@ncino/web-components 9.2.0-preview.4 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/components/accordion/gator/base/accordion.gator.js +1 -1
  2. package/dist/components/accordion/gator/group/accordion-group.gator.js +1 -1
  3. package/dist/components/alert/gator/base/alert.gator.js +1 -1
  4. package/dist/components/banner/gator/banner.gator.js +1 -1
  5. package/dist/components/button/gator/button.gator.js +1 -1
  6. package/dist/components/display-card/gator/display-card.gator.js +1 -1
  7. package/dist/components/headline-card/gator/headline-card.gator.js +1 -1
  8. package/dist/components/icon/gator/icon.gator.js +2 -2
  9. package/dist/components/icon/gator/index.js +1 -1
  10. package/dist/components/icon/gator/templates/arrows-down-up.js +8 -0
  11. package/dist/components/icon/gator/templates/index.js +1 -1
  12. package/dist/components/image-card/gator/image-card.gator.js +1 -1
  13. package/dist/components/input/base/input-base.gator.js +1 -1
  14. package/dist/components/input/gator/dropdown/input-dropdown.gator.js +1 -1
  15. package/dist/components/input/gator/help-text/help-text.gator.js +1 -1
  16. package/dist/components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.js +1 -1
  17. package/dist/components/input/gator/input-file/input-file.gator.js +1 -1
  18. package/dist/components/input/gator/input-textarea/input-textarea.gator.js +1 -1
  19. package/dist/components/input/gator/input-time/input-time.gator.js +1 -1
  20. package/dist/components/input-rich-text/ckeditor-config.js +1 -1
  21. package/dist/components/input-rich-text/input-rich-text.slds.js +2 -2
  22. package/dist/components/list/gator/list-item/list-item.gator.js +1 -1
  23. package/dist/components/popover/popover.js +1 -1
  24. package/dist/components/selection-box/selection-box.gator.js +1 -1
  25. package/dist/components/table/gator/table-pagination/table-pagination.gator.js +1 -1
  26. package/dist/components/table/gator/table.gator.js +135 -45
  27. package/dist/design-tokens.source.json +1 -0
  28. package/dist/generated/locale-codes.js +1 -0
  29. package/dist/generated/locales/es-419.js +10 -0
  30. package/dist/generated/locales/fr-CA.js +10 -0
  31. package/dist/generated/locales/zh-Hans.js +11 -0
  32. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-alignment@47.5.0 → @ckeditor_ckeditor5-alignment@47.6.0}/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +1 -1
  33. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autoformat@47.5.0 → @ckeditor_ckeditor5-autoformat@47.6.0}/node_modules/@ckeditor/ckeditor5-autoformat/dist/index.js +1 -1
  34. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autosave@47.5.0 → @ckeditor_ckeditor5-autosave@47.6.0}/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +1 -1
  35. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-basic-styles@47.5.0 → @ckeditor_ckeditor5-basic-styles@47.6.0}/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +1 -1
  36. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-block-quote@47.5.0 → @ckeditor_ckeditor5-block-quote@47.6.0}/node_modules/@ckeditor/ckeditor5-block-quote/dist/index.js +1 -1
  37. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-clipboard@47.5.0 → @ckeditor_ckeditor5-clipboard@47.6.0}/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +1 -1
  38. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-cloud-services@47.5.0 → @ckeditor_ckeditor5-cloud-services@47.6.0}/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +1 -1
  39. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-code-block@47.5.0 → @ckeditor_ckeditor5-code-block@47.6.0}/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +1 -1
  40. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-core@47.5.0 → @ckeditor_ckeditor5-core@47.6.0}/node_modules/@ckeditor/ckeditor5-core/dist/index.js +1 -1
  41. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-editor-classic@47.5.0 → @ckeditor_ckeditor5-editor-classic@47.6.0}/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +1 -1
  42. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-engine@47.5.0 → @ckeditor_ckeditor5-engine@47.6.0}/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +1 -1
  43. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-enter@47.5.0 → @ckeditor_ckeditor5-enter@47.6.0}/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +1 -1
  44. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-essentials@47.5.0 → @ckeditor_ckeditor5-essentials@47.6.0}/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +1 -1
  45. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-find-and-replace@47.5.0 → @ckeditor_ckeditor5-find-and-replace@47.6.0}/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +1 -1
  46. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-font@47.5.0 → @ckeditor_ckeditor5-font@47.6.0}/node_modules/@ckeditor/ckeditor5-font/dist/index.js +1 -1
  47. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-heading@47.5.0 → @ckeditor_ckeditor5-heading@47.6.0}/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +1 -1
  48. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-highlight@47.5.0 → @ckeditor_ckeditor5-highlight@47.6.0}/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +1 -1
  49. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-horizontal-line@47.5.0 → @ckeditor_ckeditor5-horizontal-line@47.6.0}/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +1 -1
  50. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-html-embed@47.5.0 → @ckeditor_ckeditor5-html-embed@47.6.0}/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +1 -1
  51. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@47.6.0/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +3 -0
  52. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-icons@47.5.0 → @ckeditor_ckeditor5-icons@47.6.0}/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +3 -3
  53. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-image@47.5.0 → @ckeditor_ckeditor5-image@47.6.0}/node_modules/@ckeditor/ckeditor5-image/dist/index.js +1 -1
  54. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@47.6.0/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +1 -0
  55. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-language@47.5.0 → @ckeditor_ckeditor5-language@47.6.0}/node_modules/@ckeditor/ckeditor5-language/dist/index.js +1 -1
  56. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@47.6.0/node_modules/@ckeditor/ckeditor5-link/dist/index.js +1 -0
  57. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@47.6.0/node_modules/@ckeditor/ckeditor5-list/dist/index.js +1 -0
  58. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-markdown-gfm@47.5.0 → @ckeditor_ckeditor5-markdown-gfm@47.6.0}/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +1 -1
  59. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-media-embed@47.5.0 → @ckeditor_ckeditor5-media-embed@47.6.0}/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +1 -1
  60. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-mention@47.5.0 → @ckeditor_ckeditor5-mention@47.6.0}/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -1
  61. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-page-break@47.5.0 → @ckeditor_ckeditor5-page-break@47.6.0}/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +1 -1
  62. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paragraph@47.5.0 → @ckeditor_ckeditor5-paragraph@47.6.0}/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -1
  63. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@47.6.0/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +1 -0
  64. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-remove-format@47.5.0 → @ckeditor_ckeditor5-remove-format@47.6.0}/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +1 -1
  65. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-select-all@47.5.0 → @ckeditor_ckeditor5-select-all@47.6.0}/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +1 -1
  66. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-show-blocks@47.5.0 → @ckeditor_ckeditor5-show-blocks@47.6.0}/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +1 -1
  67. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-source-editing@47.5.0 → @ckeditor_ckeditor5-source-editing@47.6.0}/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +1 -1
  68. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-special-characters@47.5.0 → @ckeditor_ckeditor5-special-characters@47.6.0}/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +1 -1
  69. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-style@47.5.0 → @ckeditor_ckeditor5-style@47.6.0}/node_modules/@ckeditor/ckeditor5-style/dist/index.js +1 -1
  70. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@47.6.0/node_modules/@ckeditor/ckeditor5-table/dist/index.js +1 -0
  71. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-typing@47.5.0 → @ckeditor_ckeditor5-typing@47.6.0}/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +1 -1
  72. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-ui@47.5.0 → @ckeditor_ckeditor5-ui@47.6.0}/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -1
  73. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-undo@47.5.0 → @ckeditor_ckeditor5-undo@47.6.0}/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +1 -1
  74. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-upload@47.5.0 → @ckeditor_ckeditor5-upload@47.6.0}/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +1 -1
  75. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +8 -0
  76. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-widget@47.5.0 → @ckeditor_ckeditor5-widget@47.6.0}/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1 -1
  77. package/dist/node_modules/.pnpm/es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/pick.js +1 -0
  78. package/dist/node_modules/.pnpm/es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isNil.js +1 -0
  79. package/dist/packages/web-components/src/components/popover/gator/popover.gator.scss.js +1 -1
  80. package/dist/packages/web-components/src/components/table/gator/table.gator.scss.js +1 -1
  81. package/dist/types/components/icon/gator/templates/arrows-down-up.d.ts +1 -0
  82. package/dist/types/components/icon/gator/templates/index.d.ts +1 -0
  83. package/dist/types/components/popover/popover.d.ts +2 -0
  84. package/dist/types/components/table/gator/table.gator.d.ts +27 -0
  85. package/dist/types/components/table/table-column-definition.d.ts +8 -0
  86. package/dist/types/generated/locale-codes.d.ts +13 -0
  87. package/dist/types/generated/locales/es-419.d.ts +65 -0
  88. package/dist/types/generated/locales/fr-CA.d.ts +65 -0
  89. package/dist/types/generated/locales/zh-Hans.d.ts +65 -0
  90. package/package.json +5 -5
  91. package/web-types.json +4 -413
  92. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@47.5.0/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +0 -3
  93. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@47.5.0/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +0 -1
  94. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@47.5.0/node_modules/@ckeditor/ckeditor5-link/dist/index.js +0 -1
  95. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@47.5.0/node_modules/@ckeditor/ckeditor5-list/dist/index.js +0 -1
  96. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@47.5.0/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +0 -1
  97. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@47.5.0/node_modules/@ckeditor/ckeditor5-table/dist/index.js +0 -1
  98. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +0 -8
  99. /package/dist/assets/node_modules/.pnpm/{ckeditor5@47.5.0 → ckeditor5@47.6.0}/node_modules/ckeditor5/dist/ckeditor5.css +0 -0
  100. /package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-watchdog@47.5.0 → @ckeditor_ckeditor5-watchdog@47.6.0}/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +0 -0
@@ -0,0 +1 @@
1
+ import{Plugin as V,Command as oe}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as ge,findAttributeRange as H,TextWatcher as we,getLastTextLine as be,TwoStepCaretMovement as X,Input as pe,inlineHighlight as _e}from"../../../../../@ckeditor_ckeditor5-typing@47.6.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{ClipboardPipeline as Ve}from"../../../../../@ckeditor_ckeditor5-clipboard@47.6.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{priorities as _,env as ve,keyCodes as Le,Collection as re,first as le,toMap as E,ObservableMixin as Ie,FocusTracker as R,KeystrokeHandler as U,diff as ye}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ClickObserver as Te,ModelLivePosition as J,Matcher as Pe}from"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{IconUnlink as Ee,IconPencil as Ce,IconSettings as xe,IconLink as ae,IconPreviousArrow as O,IconNextArrow as Ae}from"../../../../../@ckeditor_ckeditor5-icons@47.6.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ContextualBalloon as Y,ToolbarView as Se,CssTransitionDisablerMixin as Q,ButtonView as b,SwitchButtonView as Be,MenuBarMenuListItemButtonView as De,clickOutsideHandler as Fe,View as C,ViewCollection as M,FocusCycler as N,ListView as K,ListItemView as q,FormHeaderView as z,IconView as He,submitHandler as Re,LabeledFieldView as Z,createLabeledInputText as ee,FormRowView as te}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{isWidget as Ue}from"../../../../../@ckeditor_ckeditor5-widget@47.6.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{upperFirst as Oe}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/string/upperFirst.js";class Me{_definitions=new Set;_conflictChecker;get length(){return this._definitions.size}setConflictChecker(e){this._conflictChecker=e}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{const t=(n,s)=>{const o=s.createAttributeElement("a",n.attributes,{priority:5});n.classes&&s.addClass(n.classes,o);for(const l in n.styles)s.setStyle(l,n.styles[l],o);return s.setCustomProperty("link",!0,o),o},i=n=>(s,o,l)=>{if(o.attributeKey.startsWith("link")&&!(o.attributeKey=="linkHref"&&!l.consumable.test(o.item,"attribute:linkHref"))&&!(!o.item.is("selection")&&!l.schema.isInline(o.item)))for(const c of this._definitions)c.callback(o.item.getAttribute("linkHref"))&&!this._conflictChecker?.(c,o.item)&&n?o.item.is("selection")?l.writer.wrap(l.writer.document.selection.getFirstRange(),t(c,l.writer)):l.writer.wrap(l.mapper.toViewRange(o.range),t(c,l.writer)):l.writer.unwrap(l.mapper.toViewRange(o.range),t(c,l.writer))};e.on("attribute",i(!1),{priority:_.high-1}),e.on("attribute",i(!0),{priority:_.high-2})}}getDispatcherForLinkedImage(){return e=>{const t=i=>(n,s,{writer:o,mapper:l})=>{if(!s.item.is("element","imageBlock")||!s.attributeKey.startsWith("link"))return;const c=l.toViewElement(s.item),a=Array.from(c.getChildren()).find(d=>d.is("element","a"));if(a)for(const d of this._definitions){const m=E(d.attributes);if(d.callback(s.item.getAttribute("linkHref"))&&!this._conflictChecker?.(d,s.item)&&i){for(const[h,u]of m)h==="class"?o.addClass(u,a):o.setAttribute(h,u,!1,a);d.classes&&o.addClass(d.classes,a);for(const h in d.styles)o.setStyle(h,d.styles[h],a)}else{for(const[h,u]of m)h==="class"?o.removeClass(u,a):o.removeAttribute(h,u,a);d.classes&&o.removeClass(d.classes,a);for(const h in d.styles)o.removeStyle(h,a)}}};e.on("attribute",t(!1),{priority:_.high-1}),e.on("attribute",t(!0),{priority:_.high-2})}}}const Ne=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Ke="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",qe=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,ze=/^((\w+:(\/{2,})?)|(\W))/i,$e=["https?","ftps?","mailto"],y="Ctrl+K";function Ge(r){return r.is("attributeElement")&&!!r.getCustomProperty("link")}function ie(r,{writer:e}){const t=e.createAttributeElement("a",{href:r},{priority:5});return e.setCustomProperty("link",!0,t),t}function ce(r,e=$e){const t=String(r),i=e.join("|"),n=new RegExp(`${Ke.replace("<protocols>",i)}`,"i");return je(t,n)?t:"#"}function je(r,e){return!!r.replace(Ne,"").match(e)}function We(r,e){const t={"Open in a new tab":r("Open in a new tab"),Downloadable:r("Downloadable")};return e.forEach(i=>("label"in i&&t[i.label]&&(i.label=t[i.label]),i)),e}function Xe(r){const e=[];if(r)for(const[t,i]of Object.entries(r)){const n=Object.assign({},i,{id:`link${Oe(t)}`});e.push(n)}return e}function B(r,e){return r?e.checkAttribute(r.name,"linkHref"):!1}function Je(r){return qe.test(r)}function $(r,e){const t=Je(r)?"mailto:":e,i=!!t&&!de(r);return r&&i?t+r:r}function de(r){return ze.test(r)}function Ye(r){window.open(r,"_blank","noopener")}function D(r){let e="";for(const t of r.getItems()){if(!t.is("$text")&&!t.is("$textProxy"))return;e+=t.data}return e}function F(r,e){if(r.attributes&&e.attributes&&Object.keys(r.attributes).some(n=>!t(n)&&n in e.attributes)||r.styles&&e.styles&&Object.keys(r.styles).some(n=>n in e.styles))return!0;return!1;function t(i){return i==="class"||i==="style"||i==="rel"}}function Qe({decoratorStates:r,allDecorators:e}){const t={...r};for(const n in r)if(r[n]&&i(n)){const s=Ze(n,e);for(const o of s)t[o]=!1}function i(n){return e.some(s=>s.id===n&&!s.value)}return t}function Ze(r,e){const t=e.find(i=>i.id===r);return t?e.filter(i=>i.id!==r&&F(t,i)).map(i=>i.id):[]}class et extends oe{manualDecorators=new re;automaticDecorators=new Me;restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||le(t.getSelectedBlocks());B(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const n of this.manualDecorators)n.value=this._getDecoratorStateFromModel(n.id)}execute(e,t={},i){const n=this.editor.model,s=n.document.selection,o=Qe({allDecorators:Array.from(this.manualDecorators),decoratorStates:t}),l=[],c=[];for(const a in o)o[a]?l.push(a):c.push(a);n.change(a=>{const d=u=>{a.setAttribute("linkHref",e,u),l.forEach(k=>a.setAttribute(k,!0,u)),c.forEach(k=>a.removeAttribute(k,u))},m=(u,k)=>{const g=D(u);if(!g)return u;let w=i;if(w||(w=k&&k==g?e:g),w!=g){const L=a.createDocumentFragment();for(const x of u.getItems()){const P=x;a.append(a.createText(P.data,P.getAttributes()),L)}const f=a.createRangeIn(L),I=tt(g,w);let T=0;for(const{offset:x,actual:P,expected:G}of I){const j=x+T,A=a.createRange(f.start.getShiftedBy(j),f.start.getShiftedBy(j+P.length)),me=it(A,f).getAttributes(),fe=Array.from(me).filter(([ke])=>n.schema.getAttributeProperties(ke).isFormatting),W=a.createText(G,fe);d(W),a.remove(A),a.insert(W,A.start),T+=G.length}return n.insertContent(L,u),a.createRange(u.start,u.start.getShiftedBy(w.length))}},h=u=>{const{plugins:k}=this.editor;if(a.setSelection(u.end),k.has("TwoStepCaretMovement"))k.get("TwoStepCaretMovement")._handleForwardMovement();else for(const g of["linkHref",...l,...c])a.removeSelectionAttribute(g)};if(s.isCollapsed){const u=s.getFirstPosition();if(s.hasAttribute("linkHref")){const k=s.getAttribute("linkHref"),g=H(u,"linkHref",k,n),w=m(g,k);d(w||g),w&&h(w)}else if(e!==""){const k=E(s.getAttributes());k.set("linkHref",e),l.forEach(w=>{k.set(w,!0)});const g=n.insertContent(a.createText(i||e,k),u);h(g)}}else{const u=Array.from(s.getRanges()),k=n.schema.getValidRanges(u,"linkHref"),g=[];for(const f of s.getSelectedBlocks())n.schema.checkAttribute(f,"linkHref")&&g.push(a.createRangeOn(f));const w=g.slice();for(const f of k)this._isRangeToUpdate(f,g)&&w.push(f);const L=u.map(f=>({start:J.fromPosition(f.start,"toPrevious"),end:J.fromPosition(f.end,"toNext")}));for(let f of w){const I=(f.start.textNode||f.start.nodeAfter).getAttribute("linkHref");f=m(f,I)||f,d(f)}a.setSelection(L.map(f=>{const I=f.start.toPosition(),T=f.end.toPosition();return f.start.detach(),f.end.detach(),n.createRange(I,T)}))}}),this.restoreManualDecoratorStates()}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,n=i.getSelectedElement();return B(n,t.schema)?n.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}}function tt(r,e){const t=ye(r,e),i={equal:0,insert:0,delete:0},n=[];let s="",o="";for(const l of[...t,null])l=="insert"?o+=e[i.equal+i.insert]:l=="delete"?s+=r[i.equal+i.delete]:(s.length||o.length)&&(n.push({offset:i.equal,actual:s,expected:o}),s="",o=""),l&&i[l]++;return n}function it(r,e){if(!r.isCollapsed)return le(r.getItems());const t=r.start;return t.textNode?t.textNode:!t.nodeBefore||t.isEqual(e.start)?t.nodeAfter:t.nodeBefore}class nt extends oe{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();B(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,n=e.commands.get("link");t.change(s=>{const o=i.isCollapsed?[H(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const l of o)if(s.removeAttribute("linkHref",l),n)for(const c of n.manualDecorators)s.removeAttribute(c.id,l)})}}class st extends Ie(){id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:i,classes:n,styles:s,defaultValue:o}){super(),this.id=e,this.set("value",void 0),this.defaultValue=o,this.label=t,this.attributes=i,this.classes=n,this.styles=s}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const ot="ck-link_selected",ne="automatic",rt="manual",lt=/^(https?:)?\/\//;class v extends V{_linkOpeners=[];static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[X,pe,Ve]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1,toolbar:["linkPreview","|","editLink","linkProperties","unlink"]})}init(){const e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:ie}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(s,o)=>ie(ce(s,t),o)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:s=>s.getAttribute("href")}}),e.commands.add("link",new et(e)),e.commands.add("unlink",new nt(e));const i=We(e.t,Xe(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(s=>s.mode===ne)),this._enableManualDecorators(i.filter(s=>s.mode===rt)),e.plugins.get(X).registerAttribute("linkHref"),_e(e,"linkHref","a",ot),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration(),this._enableDecoratorConflictPostfixer()}_registerLinkOpener(e){this._linkOpeners.push(e)}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link"),n=i.automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:ne,callback:s=>!!s&&lt.test(s),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(e),n.setConflictChecker((s,o)=>{for(const l of i.manualDecorators)if(o.hasAttribute(l.id)&&F(s,l))return!0}),n.length&&t.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,n=t.commands.get("link").manualDecorators;e.forEach(s=>{t.model.schema.extend("$text",{allowAttributes:s.id});const o=new st(s);n.add(o),t.conversion.for("downcast").add(l=>{const c=d=>{const m=d.createAttributeElement("a",o.attributes,{priority:5});o.classes&&d.addClass(o.classes,m);for(const h in o.styles)d.setStyle(h,o.styles[h],m);return d.setCustomProperty("link",!0,m),m},a=d=>(m,h,u)=>{if(!(!h.item.is("selection")&&!u.schema.isInline(h.item))){if(!d&&h.attributeOldValue){if(!u.consumable.test(h.item,m.name))return;u.writer.unwrap(u.mapper.toViewRange(h.range),c(u.writer))}if(d&&h.attributeNewValue){if(!u.consumable.consume(h.item,m.name))return;h.item.is("selection")?u.writer.wrap(u.writer.document.selection.getFirstRange(),c(u.writer)):u.writer.wrap(u.mapper.toViewRange(h.range),c(u.writer))}}};l.on(`attribute:${o.id}`,a(!1),{priority:_.high-1}),l.on(`attribute:${o.id}`,a(!0),{priority:_.high-2})}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...o._createPattern()},model:{key:o.id}})})}_enableLinkOpen(){const e=this.editor,i=e.editing.view.document,n=s=>{this._linkOpeners.some(o=>o(s))||Ye(s)};this.listenTo(i,"click",(s,o)=>{if(!(ve.isMac?o.domEvent.metaKey:o.domEvent.ctrlKey))return;let c=o.domTarget;if(c.tagName.toLowerCase()!="a"&&(c=c.closest("a")),!c)return;const a=c.getAttribute("href");a&&(s.stop(),o.preventDefault(),n(a))},{context:"$capture"}),this.listenTo(i,"keydown",(s,o)=>{const c=e.commands.get("link").value;c&&o.keyCode===Le.enter&&o.altKey&&(s.stop(),n(c))})}_enableSelectionAttributesFixer(){const t=this.editor.model,i=t.document.selection;this.listenTo(i,"change:attribute",(n,{attributeKeys:s})=>{!s.includes("linkHref")||i.hasAttribute("linkHref")||t.change(o=>{at(o,ct(t.schema))})})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(n,s)=>{t.change(o=>{const l=o.createRangeIn(s.content);for(const c of l.getItems())if(c.hasAttribute("linkHref")){const a=$(c.getAttribute("linkHref"),i);o.setAttribute("linkHref",a,c)}})})}_enableDecoratorConflictPostfixer(){const e=this.editor,t=e.model,i=e.commands.get("link");t.document.registerPostFixer(n=>{let s=!1;const o=t.document.differ.getChanges(),l=new Set,c=new Set(i.manualDecorators.map(a=>a.id));for(const a of o){if(a.type==="attribute"){if(a.attributeKey!=="linkHref"&&!c.has(a.attributeKey))continue;for(const d of a.range.getItems())d.hasAttribute("linkHref")&&l.add(d)}a.type==="insert"&&a.attributes.has("linkHref")&&a.position.nodeAfter&&l.add(a.position.nodeAfter)}for(const a of l){const d=[];for(const m of i.manualDecorators)if(a.hasAttribute(m.id)){for(let h=d.length-1;h>=0;h--){const u=d[h];F(u,m)&&(n.removeAttribute(u.id,a),d.splice(h,1),s=!0)}d.push(m)}}return s})}}function at(r,e){r.removeSelectionAttribute("linkHref");for(const t of e)r.removeSelectionAttribute(t)}function ct(r){return r.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}class dt extends b{constructor(e){super(e);const t=this.bindTemplate;this.set({href:void 0,withText:!0}),this.extendTemplate({attributes:{class:["ck-link-toolbar__preview"],href:t.to("href"),target:"_blank",rel:"noopener noreferrer"},on:{click:t.to(i=>{if(this.href){const n=()=>i.preventDefault();this.fire("navigate",this.href,n)}})}}),this.template.tag="a"}}class ut extends C{focusTracker=new R;keystrokes=new U;backButtonView;saveButtonView;displayedTextInputView;urlInputView;children;providersListChildren;_validators;_focusables=new M;_focusCycler;constructor(e,t){super(e),this._validators=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.displayedTextInputView=this._createDisplayedTextInput(),this.urlInputView=this._createUrlInput(),this.providersListChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView()]),this._createFormChildren(),this.listenTo(this.providersListChildren,"add",()=>{this.stopListening(this.providersListChildren,"add"),this.children.add(this._createProvidersListView())}),this._focusCycler=new N({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-link-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Re({view:this}),[this.urlInputView,this.saveButtonView,...this.providersListChildren,this.backButtonView,this.displayedTextInputView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createBackButton(){const e=this.locale.t,t=new b(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:O,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new b(this.locale);return t.set({label:e("Insert"),tooltip:!1,withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new z(this.locale,{label:e("Link")});return t.children.add(this.backButtonView,0),t}_createProvidersListView(){const e=new K(this.locale);return e.extendTemplate({attributes:{class:["ck-link-form__providers-list"]}}),e.items.bindTo(this.providersListChildren).using(t=>{const i=new q(this.locale);return i.children.add(t),i}),e}_createDisplayedTextInput(){const e=this.locale.t,t=new Z(this.locale,ee);return t.label=e("Displayed text"),t.class="ck-labeled-field-view_full-width",t}_createUrlInput(){const e=this.locale.t,t=new Z(this.locale,ee);return t.fieldView.inputMode="url",t.label=e("Link URL"),t.class="ck-labeled-field-view_full-width",t}_createFormChildren(){this.children.add(new te(this.locale,{children:[this.displayedTextInputView],class:["ck-form__row_large-top-padding"]})),this.children.add(new te(this.locale,{children:[this.urlInputView,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding","ck-form__row_large-bottom-padding"]}))}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}class ht extends C{focusTracker=new R;keystrokes=new U;backButtonView;listView;listChildren;emptyListInformation;children;_focusables=new M;_focusCycler;constructor(e){super(e),this.listChildren=this.createCollection(),this.backButtonView=this._createBackButton(),this.listView=this._createListView(),this.emptyListInformation=this._createEmptyLinksListItemView(),this.children=this.createCollection([this._createHeaderView(),this.emptyListInformation]),this.set("title",""),this.set("emptyListPlaceholder",""),this.set("hasItems",!1),this.listenTo(this.listChildren,"change",()=>{this.hasItems=this.listChildren.length>0}),this.on("change:hasItems",(t,i,n)=>{n?(this.children.remove(this.emptyListInformation),this.children.add(this.listView)):(this.children.remove(this.listView),this.children.add(this.emptyListInformation))}),this.keystrokes.set("Esc",(t,i)=>{this.fire("cancel"),i()}),this._focusCycler=new N({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-providers"],tabindex:"-1"},children:this.children})}render(){super.render(),[this.listView,this.backButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createListView(){const e=new K(this.locale);return e.extendTemplate({attributes:{class:["ck-link-providers__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new q(this.locale);return i.children.add(t),i}),e}_createBackButton(){const e=this.locale.t,t=new b(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:O,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){const e=new z(this.locale);return e.bind("label").to(this,"title"),e.children.add(this.backButtonView,0),e}_createEmptyLinksListItemView(){const e=new C(this.locale);return e.setTemplate({tag:"p",attributes:{class:["ck","ck-link__empty-list-info"]},children:[{text:this.bindTemplate.to("emptyListPlaceholder")}]}),e}}class mt extends C{focusTracker=new R;keystrokes=new U;backButtonView;children;listChildren;_focusables=new M;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new N({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-properties"],tabindex:"-1"},children:this.children}),this.keystrokes.set("Esc",(t,i)=>{this.fire("back"),i()})}render(){super.render(),[...this.listChildren,this.backButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBackButton(){const e=this.locale.t,t=new b(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:O,tooltip:!0}),t.delegate("execute").to(this,"back"),t}_createHeaderView(){const e=this.locale.t,t=new z(this.locale,{label:e("Link properties")});return t.children.add(this.backButtonView,0),t}_createListView(){const e=new K(this.locale);return e.extendTemplate({attributes:{class:["ck-link__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new q(this.locale);return i.children.add(t),i}),e}}class ft extends b{arrowView;constructor(e){super(e),this.set({withText:!0}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-link__button"]}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new He;return e.content=Ae,e}}const p="link-ui";class ue extends V{toolbarView=null;formView=null;linkProviderItemsView=null;propertiesView=null;_balloon;_linksProviders=new re;static get requires(){return[Y,v]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;this.set("selectedLinkableText",void 0),e.editing.view.addObserver(Te),this._balloon=e.plugins.get(Y),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:p,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:p,view:(i,{writer:n})=>{if(!i.markerRange.isCollapsed)return null;const s=n.createUIElement("span");return n.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],s),s}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:y},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.propertiesView&&this.propertiesView.destroy(),this.formView&&this.formView.destroy(),this.toolbarView&&this.toolbarView.destroy(),this.linkProviderItemsView&&this.linkProviderItemsView.destroy()}registerLinksListProvider(e){const t=this._linksProviders.filter(i=>(i.order||0)<=(e.order||0)).length;this._linksProviders.add(e,t)}_createViews(){const e=this.editor.commands.get("link");this.toolbarView=this._createToolbarView(),this.formView=this._createFormView(),e.manualDecorators.length&&(this.propertiesView=this._createPropertiesView()),this._enableUserBalloonInteractions()}_createToolbarView(){const e=this.editor,t=new Se(e.locale),i=e.commands.get("link");t.class="ck-link-toolbar";let n=e.config.get("link.toolbar");return i.manualDecorators.length||(n=n.filter(s=>s!=="linkProperties")),t.fillFromConfig(n,e.ui.componentFactory),t.keystrokes.set("Esc",(s,o)=>{this._hideUI(),o()}),t.keystrokes.set(y,(s,o)=>{this._addFormView(),o()}),e.ui.addToolbar(t,{isContextual:!0,beforeFocus:()=>{this._getSelectedLinkElement()&&!this._isToolbarVisible&&this._showUI(!0)},afterBlur:()=>{this._hideUI(!1)}}),t}_createFormView(){const e=this.editor,t=e.locale.t,i=e.commands.get("link"),n=e.config.get("link.defaultProtocol"),s=new(Q(ut))(e.locale,kt(e));return s.displayedTextInputView.bind("isEnabled").to(this,"selectedLinkableText",o=>o!==void 0),s.urlInputView.bind("isEnabled").to(i,"isEnabled"),s.saveButtonView.bind("isEnabled").to(i,"isEnabled"),s.saveButtonView.bind("label").to(i,"value",o=>t(o?"Update":"Insert")),this.listenTo(s,"submit",()=>{if(s.isValid()){const o=s.urlInputView.fieldView.element.value,l=$(o,n),c=s.displayedTextInputView.fieldView.element.value;e.execute("link",l,this._getDecoratorSwitchesState(),c!==this.selectedLinkableText?c:void 0),this._closeFormView()}}),this.listenTo(s.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(s,"cancel",()=>{this._closeFormView()}),s.keystrokes.set("Esc",(o,l)=>{this._closeFormView(),l()}),s.providersListChildren.bindTo(this._linksProviders).using(o=>this._createLinksListProviderButton(o)),s}_createLinkProviderListView(e){return e.getListItems().map(({href:t,label:i,icon:n})=>{const s=new b;return s.set({label:i,icon:n,tooltip:!1,withText:!0}),s.on("execute",()=>{this.formView.resetFormStatus(),this.formView.urlInputView.fieldView.value=t,this.editor.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),s})}_createLinkProviderItemsView(e){const t=this.editor,i=t.locale.t,n=new ht(t.locale),{emptyListPlaceholder:s,label:o}=e;return n.emptyListPlaceholder=s||i("No links available"),n.title=o,this.listenTo(n,"cancel",()=>{t.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),n}_createPropertiesView(){const e=this.editor,t=this.editor.commands.get("link"),i=new(Q(mt))(e.locale);return this.listenTo(i,"back",()=>{e.editing.view.focus(),this._removePropertiesView()}),i.listChildren.bindTo(t.manualDecorators).using(n=>{const s=new Be(e.locale);return s.set({label:n.label,withText:!0}),s.bind("isOn").toMany([n,t],"value",(o,l)=>l===void 0&&o===void 0?!!n.defaultValue:!!o),s.on("execute",()=>{e.execute("link",t.value,{...this._getDecoratorSwitchesState(),[n.id]:!s.isOn})}),s}),i}_getDecoratorSwitchesState(){const e=this.editor.commands.get("link");return Array.from(e.manualDecorators).reduce((t,i)=>{const n=e.value===void 0&&i.value===void 0?i.defaultValue:i.value;return{...t,[i.id]:!!n}},{})}_registerEditingOpeners(){this.editor.plugins.get(v)._registerLinkOpener(t=>{const i=this._getLinkProviderLinkByHref(t);if(!i)return!1;const{item:n,provider:s}=i;return s.navigate?s.navigate(n):!1})}_registerComponents(){const e=this.editor;e.ui.componentFactory.add("link",()=>{const t=this._createButton(b);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:link",()=>{const t=this._createButton(De);return t.set({role:"menuitemcheckbox"}),t}),e.ui.componentFactory.add("linkPreview",t=>{const i=new dt(t),n=e.config.get("link.allowedProtocols"),s=e.commands.get("link"),o=t.t;i.bind("isEnabled").to(s,"value",c=>!!c),i.bind("href").to(s,"value",c=>c&&ce(c,n));const l=c=>{if(!c){i.label=void 0,i.icon=void 0,i.tooltip=o("Open link in new tab");return}const a=this._getLinkProviderLinkByHref(c);if(a){const{label:d,tooltip:m,icon:h}=a.item;i.label=d,i.tooltip=m||!1,i.icon=h}else i.label=c,i.icon=void 0,i.tooltip=o("Open link in new tab")};return l(s.value),this.listenTo(s,"change:value",(c,a,d)=>{l(d)}),this.listenTo(i,"navigate",(c,a,d)=>{const m=this._getLinkProviderLinkByHref(a);if(!m)return;const{provider:h,item:u}=m,{navigate:k}=h;k&&k(u)&&(c.stop(),d())}),i}),e.ui.componentFactory.add("unlink",t=>{const i=e.commands.get("unlink"),n=new b(t),s=t.t;return n.set({label:s("Unlink"),icon:Ee,tooltip:!0}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{e.execute("unlink"),this._hideUI()}),n}),e.ui.componentFactory.add("editLink",t=>{const i=e.commands.get("link"),n=new b(t),s=t.t;return n.set({label:s("Edit link"),icon:Ce,tooltip:!0}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{this._addFormView()}),n}),e.ui.componentFactory.add("linkProperties",t=>{const i=e.commands.get("link"),n=new b(t),s=t.t;return n.set({label:s("Link properties"),icon:xe,tooltip:!0}),n.bind("isEnabled").to(i,"isEnabled",i,"value",i,"manualDecorators",(o,l,c)=>o&&!!l&&c.length>0),this.listenTo(n,"execute",()=>{this._addPropertiesView()}),n})}_createLinksListProviderButton(e){const t=this.editor.locale,i=new ft(t);return i.set({label:e.label}),this.listenTo(i,"execute",()=>{this._showLinksProviderView(e)}),i}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("link"),s=new e(t.locale),o=i.t;return s.set({label:o("Link"),icon:ae,keystroke:y,isToggleable:!0}),s.bind("isEnabled").to(n,"isEnabled"),s.bind("isOn").to(n,"value",l=>!!l),this.listenTo(s,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showUI(!0),this._getSelectedLinkElement()&&this._addFormView()}),s}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(y,(i,n)=>{n(),e.commands.get("link").isEnabled&&(e.editing.view.scrollToTheSelection(),this._showUI(!0))})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._isToolbarVisible&&!this.toolbarView.focusTracker.isFocused&&(this.toolbarView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Fe({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideUI(!1)}})}_addToolbarView(){this.toolbarView||this._createViews(),!this._isToolbarInPanel&&this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this.formView.backButtonView.isVisible=e.isEnabled&&!!e.value,this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.selectedLinkableText=this._getSelectedLinkableText(),this.formView.displayedTextInputView.fieldView.value=this.selectedLinkableText||"",this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_addPropertiesView(){this.propertiesView||this._createViews(),!this._arePropertiesInPanel&&(this.propertiesView.disableCssTransitions(),this._balloon.add({view:this.propertiesView,position:this._getBalloonPositionData()}),this.propertiesView.enableCssTransitions(),this.propertiesView.focus())}_showLinksProviderView(e){this.linkProviderItemsView&&this._removeLinksProviderView(),this.linkProviderItemsView=this._createLinkProviderItemsView(e),this._addLinkProviderItemsView(e)}_addLinkProviderItemsView(e){this.linkProviderItemsView.listChildren.clear(),this.linkProviderItemsView.listChildren.addMany(this._createLinkProviderListView(e)),this._balloon.add({view:this.linkProviderItemsView,position:this._getBalloonPositionData()}),this.linkProviderItemsView.focus()}_closeFormView(){const e=this.editor.commands.get("link");this.selectedLinkableText=void 0,e.value!==void 0?this._removeFormView():this._hideUI()}_removePropertiesView(){this._arePropertiesInPanel&&this._balloon.remove(this.propertiesView)}_removeLinksProviderView(){this._isLinksListInPanel&&this._balloon.remove(this.linkProviderItemsView)}_removeFormView(e=!0){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.displayedTextInputView.fieldView.reset(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._isToolbarVisible?this._addFormView():this._addToolbarView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addToolbarView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(e=!0){const t=this.editor;this._isUIInPanel&&(this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeLinksProviderView(),this._removePropertiesView(),this._removeFormView(e),this._isToolbarInPanel&&this._balloon.remove(this.toolbarView),this._hideFakeVisualSelection())}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),n=o();const s=()=>{const l=this._getSelectedLinkElement(),c=o();i&&!l||!i&&c!==n?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=l,n=c};function o(){return t.selection.focus.getAncestors().reverse().find(l=>l.is("element"))}this.listenTo(e.ui,"update",s),this.listenTo(this._balloon,"change:visibleView",s)}get _arePropertiesInPanel(){return!!this.propertiesView&&this._balloon.hasView(this.propertiesView)}get _isLinksListInPanel(){return!!this.linkProviderItemsView&&this._balloon.hasView(this.linkProviderItemsView)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _isToolbarInPanel(){return!!this.toolbarView&&this._balloon.hasView(this.toolbarView)}get _isPropertiesVisible(){return!!this.propertiesView&&this._balloon.visibleView===this.propertiesView}get _isFormVisible(){return!!this.formView&&this._balloon.visibleView==this.formView}get _isToolbarVisible(){return!!this.toolbarView&&this._balloon.visibleView===this.toolbarView}get _isUIInPanel(){return this._arePropertiesInPanel||this._isLinksListInPanel||this._isFormInPanel||this._isToolbarInPanel}get _isUIVisible(){return this._isPropertiesVisible||this._isLinksListInPanel||this._isFormVisible||this._isToolbarVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document;if(this.editor.model.markers.has(p)){const n=this.editor.editing.mapper.markerNameToElements(p);if(n){const s=Array.from(n),o=e.createRange(e.createPositionBefore(s[0]),e.createPositionAfter(s[s.length-1]));return{target:e.domConverter.viewRangeToDom(o)}}}return{target:()=>{const n=this._getSelectedLinkElement();return n?e.domConverter.mapViewToDom(n):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&Ue(i))return S(t.getFirstPosition());{const n=t.getFirstRange().getTrimmed(),s=S(n.start),o=S(n.end);return!s||s!=o?null:e.createRangeIn(s).getTrimmed().isEqual(n)?s:null}}_getSelectedLinkableText(){const e=this.editor.model,t=this.editor.editing,i=this._getSelectedLinkElement();if(!i)return D(e.document.selection.getFirstRange());const n=t.view.createRangeOn(i),s=t.mapper.toModelRange(n);return D(s)}_getLinkProviderLinkByHref(e){if(!e)return null;for(const t of this._linksProviders){const i=t.getItem?t.getItem(e):t.getListItems().find(n=>n.href===e);if(i)return{provider:t,item:i}}return null}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(p))t.updateMarker(p,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition(({item:s})=>!e.schema.isContent(s),{boundaries:i});t.addMarker(p,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker(p,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(p)&&e.change(t=>{t.removeMarker(p)})}}function S(r){return r.getAncestors().find(e=>Ge(e))||null}function kt(r){const e=r.t,t=r.config.get("link.allowCreatingEmptyLinks");return[i=>{if(!t&&!i.url.length)return e("Link URL must not be empty.")}]}const gt=4,he=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63}))|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),wt=2;class bt extends V{static get requires(){return[ge,v]}static get pluginName(){return"AutoLink"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?H(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const n=this.editor.model,s=n.document.selection,o=s.getFirstPosition(),l=s.getLastPosition();let c=t.getJoined(this._expandLinkRange(n,o)||t);c&&(c=c.getJoined(this._expandLinkRange(n,l)||t)),c&&(c.start.isBefore(o)||c.end.isAfter(l))&&e.setSelection(c)}_enablePasteLinking(){const e=this.editor,t=e.model,i=t.document.selection,n=e.plugins.get("ClipboardPipeline"),s=e.commands.get("link");n.on("inputTransformation",(o,l)=>{if(!this.isEnabled||!s.isEnabled||i.isCollapsed||l.method!=="paste"||i.rangeCount>1)return;const c=i.getFirstRange(),a=l.dataTransfer.getData("text/plain");if(!a)return;const d=a.match(he);d&&d[2]===a&&(t.change(m=>{this._selectEntireLinks(m,c),s.execute(a)}),o.stop())},{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new we(e.model,i=>{let n=i;if(!pt(n))return;n=n.slice(0,-1),"!.:,;?".includes(n[n.length-1])&&(n=n.slice(0,-1));const s=se(n);if(s)return{url:s,removedTrailingCharacters:i.length-n.length}});t.on("matched:data",(i,n)=>{const{batch:s,range:o,url:l,removedTrailingCharacters:c}=n;if(!s.isTyping)return;const a=o.end.getShiftedBy(-c),d=a.getShiftedBy(-l.length),m=e.model.createRange(d,a);this._applyAutoLink(l,m)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const n=t.document.selection.getFirstPosition();let s;n.parent.previousSibling?.is("element")?s=t.createRangeIn(n.parent.previousSibling):s=t.createRange(t.createPositionAt(n.parent,0),n),this._checkAndApplyAutoLinkOnRange(s)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const n=t.document.selection.getFirstPosition(),s=t.createRange(t.createPositionAt(n.parent,0),n.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(s)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:n}=be(e,t),s=se(i);if(s){const o=t.createRange(n.end.getShiftedBy(-s.length),n.end);this._applyAutoLink(s,o)}}_applyAutoLink(e,t){const i=this.editor.model,n=this.editor.config.get("link.defaultProtocol"),s=$(e,n);!this.isEnabled||!_t(t,i)||!de(s)||Vt(t)||this._persistAutoLink(s,t)}_persistAutoLink(e,t){const i=this.editor.model,n=this.editor.plugins.get("Delete");i.enqueueChange(s=>{s.setAttribute("linkHref",e,t),i.enqueueChange(()=>{n.requestUndoOnBackspace()})})}}function pt(r){return r.length>gt&&r[r.length-1]===" "&&r[r.length-2]!==" "}function se(r){const e=he.exec(r);return e?e[wt]:null}function _t(r,e){return e.schema.checkAttributeInSelection(e.createSelection(r),"linkHref")}function Vt(r){const e=r.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}class Ut extends V{static get requires(){return[v,ue,bt]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}}class vt extends V{static get requires(){return["ImageEditing","ImageUtils",v]}static get pluginName(){return"LinkImageEditing"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(Lt(e)),e.conversion.for("downcast").add(It(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,i=e.commands.get("link").automaticDecorators;i.length&&e.conversion.for("downcast").add(i.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(yt(i)),e.conversion.for("upcast").add(Tt(e,i))}}function Lt(r){const e=r.plugins.has("ImageInlineEditing"),t=r.plugins.get("ImageUtils");return i=>{i.on("element:a",(n,s,o)=>{const l=s.viewItem,c=t.findViewImgElement(l);if(!c)return;const a=c.findAncestor(u=>t.isBlockImageView(u));if(e&&!a)return;const d={attributes:["href"]};if(!o.consumable.test(l,d))return;const m=l.getAttribute("href"),h=s.modelCursor.parent;h.is("element","imageBlock")&&(o.writer.setAttribute("linkHref",m,h),o.consumable.consume(l,d))},{priority:"high"})}}function It(r){const e=r.plugins.get("ImageUtils");return t=>{t.on("attribute:linkHref:imageBlock",(i,n,s)=>{if(!s.consumable.consume(n.item,i.name))return;const o=s.mapper.toViewElement(n.item),l=s.writer,c=Array.from(o.getChildren()).find(m=>m.is("element","a")),a=e.findViewImgElement(o),d=a.parent.is("element","picture")?a.parent:a;if(c)n.attributeNewValue?l.setAttribute("href",n.attributeNewValue,c):(l.move(l.createRangeOn(d),l.createPositionAt(o,0)),l.remove(c));else{const m=l.createContainerElement("a",{href:n.attributeNewValue});l.insert(l.createPositionAt(o,0),m),l.move(l.createRangeOn(d),l.createPositionAt(m,0))}},{priority:"high"})}}function yt(r){return e=>{const t=i=>(n,s,o)=>{const l=o.mapper.toViewElement(s.item),c=Array.from(l.getChildren()).find(a=>a.is("element","a"));if(c){if(!i&&s.attributeOldValue){for(const[a,d]of E(r.attributes))o.writer.removeAttribute(a,d,c);r.classes&&o.writer.removeClass(r.classes,c);for(const a in r.styles)o.writer.removeStyle(a,c)}if(i&&s.attributeNewValue){for(const[a,d]of E(r.attributes))o.writer.setAttribute(a,d,!1,c);r.classes&&o.writer.addClass(r.classes,c);for(const a in r.styles)o.writer.setStyle(a,r.styles[a],c)}}};e.on(`attribute:${r.id}:imageBlock`,t(!1),{priority:_.high-1}),e.on(`attribute:${r.id}:imageBlock`,t(!0),{priority:_.high-2})}}function Tt(r,e){const t=r.plugins.has("ImageInlineEditing"),i=r.plugins.get("ImageUtils");return n=>{n.on("element:a",(s,o,l)=>{const c=o.viewItem,a=i.findViewImgElement(c);if(!a)return;const d=a.findAncestor(k=>i.isBlockImageView(k));if(t&&!d)return;const h=new Pe(e._createPattern()).match(c);if(!h||!l.consumable.test(c,h.match))return;const u=o.modelCursor.parent;u?.is("element","imageBlock")&&(l.writer.setAttribute(e.id,!0,u),l.consumable.consume(c,h.match))},{priority:"high"})}}class Pt extends V{static get requires(){return[v,ue,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(i,n)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(n.preventDefault(),i.stop())},{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",i=>{const n=new b(i),s=e.plugins.get("LinkUI"),o=e.commands.get("link");return n.set({isEnabled:!0,label:t("Link image"),icon:ae,keystroke:y,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(o,"isEnabled"),n.bind("isOn").to(o,"value",l=>!!l),this.listenTo(n,"execute",()=>{this._isSelectedLinkedImage(e.model.document.selection)?s._addToolbarView():s._showUI(!0)}),n})}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}class Ot extends V{static get requires(){return[vt,Pt]}static get pluginName(){return"LinkImage"}static get isOfficialPlugin(){return!0}}export{bt as AutoLink,Me as AutomaticLinkDecorators,Ut as Link,et as LinkCommand,v as LinkEditing,ut as LinkFormView,Ot as LinkImage,vt as LinkImageEditing,Pt as LinkImageUI,st as LinkManualDecorator,mt as LinkPropertiesView,ht as LinkProviderItemsView,ue as LinkUI,nt as UnlinkCommand,y as _LINK_KEYSTROKE,ft as _LinkButtonView,dt as _LinkPreviewButtonView,ie as _createLinkElement,ce as _ensureSafeLinkUrl,D as _extractTextFromLinkRange,We as _getLocalizedLinkDecorators,de as _hasLinkProtocol,Je as _isEmailLink,Xe as _normalizeLinkDecorators,Ye as _openLink,$ as addLinkProtocolIfApplicable,ce as ensureSafeUrl,Ge as isLinkElement,B as isLinkableElement};
@@ -0,0 +1 @@
1
+ import{Plugin as h,Command as v}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as Mt}from"../../../../../@ckeditor_ckeditor5-typing@47.6.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Enter as Dt}from"../../../../../@ckeditor_ckeditor5-enter@47.6.0/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{CKEditorError as zt,getCode as $t,toArray as S,first as D,parseKeystroke as Ut,getLocalizedArrowKeyCodeDirection as jt,env as G,uid as Wt,FocusTracker as et,KeystrokeHandler as it,global as qt}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{_normalizeFontSizeOptions as st}from"../../../../../@ckeditor_ckeditor5-font@47.6.0/node_modules/@ckeditor/ckeditor5-font/dist/index.js";import{ClipboardPipeline as Kt}from"../../../../../@ckeditor_ckeditor5-clipboard@47.6.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{createDropdown as Ht,SplitButtonView as Yt,MenuBarMenuView as Gt,ButtonView as Z,MenuBarMenuListItemButtonView as Zt,focusChildOnDropdownOpen as Jt,View as nt,ViewCollection as Qt,FocusCycler as Xt,addKeyboardHandlingForGrid as te,CollapsibleView as ee,LabeledFieldView as ie,createLabeledInputNumber as se,SwitchButtonView as ne}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconListStyleDisc as re,IconListStyleCircle as oe,IconListStyleSquare as le,IconListStyleDecimal as ae,IconListStyleDecimalLeadingZero as ce,IconListStyleLowerRoman as ue,IconListStyleUpperRoman as de,IconListStyleLowerLatin as me,IconListStyleUpperLatin as fe,IconListStyleArabicIndic as pe,IconBulletedList as J,IconNumberedList as Q,IconTodoList as ge}from"../../../../../@ckeditor_ckeditor5-icons@47.6.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{DomEventObserver as he,Matcher as At}from"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{pick as rt}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/pick.js";class A{_startElement;_referenceIndent;_isForward;_includeSelf;_sameAttributes;_sameIndent;_lowerIndent;_higherIndent;constructor(t,e){this._startElement=t,this._referenceIndent=t.getAttribute("listIndent"),this._isForward=e.direction=="forward",this._includeSelf=!!e.includeSelf,this._sameAttributes=S(e.sameAttributes||[]),this._sameIndent=!!e.sameIndent,this._lowerIndent=!!e.lowerIndent,this._higherIndent=!!e.higherIndent}static first(t,e){const s=new this(t,e)[Symbol.iterator]();return D(s)}*[Symbol.iterator](){const t=[];for(const{node:e}of new V(this._getStartNode(),this._isForward?"forward":"backward")){const i=e.getAttribute("listIndent");if(i<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=i}else if(i>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){t.push(e);continue}}else{if(!this._sameIndent){if(this._higherIndent){t.length&&(yield*t,t.length=0);break}continue}if(this._sameAttributes.some(s=>e.getAttribute(s)!==this._startElement.getAttribute(s)))break}t.length&&(yield*t,t.length=0),yield e}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}class V{_node;_isForward;_previousNodesByIndent=[];_previous=null;_previousNodeIndent=null;constructor(t,e="forward"){this._node=t,this._isForward=e==="forward"}[Symbol.iterator](){return this}next(){if(!p(this._node))return{done:!0,value:void 0};const t=this._node.getAttribute("listIndent");let e=null;if(this._previous){const s=this._previousNodeIndent;t>s?this._previousNodesByIndent[s]=this._previous:t<s?(e=this._previousNodesByIndent[t]||null,this._previousNodesByIndent.length=t):e=this._previous}const i={node:this._node,previous:this._previous,previousNodeInList:e};return this._previous=this._node,this._previousNodeIndent=t,this._node=this._isForward?this._node.nextSibling:this._node.previousSibling,{value:i,done:!1}}}class be{_listHead;constructor(t){this._listHead=t}[Symbol.iterator](){return new V(this._listHead)}}class x{static next(){return Wt()}}function p(n){return!!n&&n.is("element")&&n.hasAttribute("listItemId")}function T(n,t={}){return[..._(n,{...t,direction:"backward"}),..._(n,{...t,direction:"forward"})]}function _(n,t={}){const e=t.direction=="forward",i=Array.from(new A(n,{...t,includeSelf:e,sameIndent:!0,sameAttributes:"listItemId"}));return e?i:i.reverse()}function Ie(n){return Array.from(new A(n,{direction:"forward",higherIndent:!0}))}function Lt(n,t){const e=new A(n,{sameIndent:!0,sameAttributes:"listType",...t}),i=new A(n,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...t});return[...Array.from(e).reverse(),...i]}function w(n){return!A.first(n,{sameIndent:!0,sameAttributes:"listItemId"})}function ot(n){return!A.first(n,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function N(n,t={}){n=S(n);const e=t.withNested!==!1,i=new Set;for(const s of n)for(const r of T(s,{higherIndent:e}))i.add(r);return C(i)}function z(n){n=S(n);const t=new Set;for(const e of n)for(const i of Lt(e))t.add(i);return C(t)}function X(n,t){const e=_(n,{direction:"forward"}),i=x.next();for(const s of e)t.setAttribute("listItemId",i,s);return e}function W(n,t,e){const i={};for(const[r,o]of t.getAttributes())r.startsWith("list")&&(i[r]=o);const s=_(n,{direction:"forward"});for(const r of s)e.setAttributes(i,r);return s}function q(n,t,{expand:e,indentBy:i=1,attributeNames:s}){n=S(n);const r=e?N(n):n;for(const o of r){const l=o.getAttribute("listIndent")+i;l<0?$(o,t,s):t.setAttribute("listIndent",l,o)}return r}function ye(n,t,{attributeNames:e}){n=S(n);const i=N(n),s=new Set,r=Math.min(...i.map(l=>l.getAttribute("listIndent"))),o=new Map;for(const l of i)o.set(l,A.first(l,{lowerIndent:!0}));for(const l of i){if(s.has(l))continue;s.add(l);const a=l.getAttribute("listIndent")-1;if(a<0){$(l,t,e);continue}if(l.getAttribute("listIndent")==r){const c=Le(l,o.get(l),t);for(const u of c)s.add(u);if(c.length)continue}t.setAttribute("listIndent",a,l)}return C(s)}function $(n,t,e){n=S(n);for(const i of n)i.is("element","listItem")&&t.rename(i,"paragraph");for(const i of n)for(const s of i.getAttributeKeys())e.includes(s)&&t.removeAttribute(s,i);return n}function F(n){if(!n.length)return!1;const t=n[0].getAttribute("listItemId");return t?!n.some(e=>e.getAttribute("listItemId")!=t):!1}function ke(n,t){const e=[];let i=Number.POSITIVE_INFINITY;for(const{node:s}of new V(n.nextSibling)){const r=s.getAttribute("listIndent");if(r==0)break;r<i&&(i=r);const o=r-i;t.setAttribute("listIndent",o,s),e.push(s)}return e}function C(n){return Array.from(n).filter(t=>t.root.rootName!=="$graveyard").sort((t,e)=>t.index-e.index)}function P(n){const t=n.document.selection.getSelectedElement();return t&&n.schema.isObject(t)&&n.schema.isBlock(t)?t:null}function U(n,t){return t.checkChild(n.parent,"listItem")&&t.checkChild(n,"$text")&&!t.isObject(n)}function M(n){return n=="numbered"||n=="customNumbered"}function Ae(n){return!A.first(n,{sameIndent:!0,sameAttributes:"listType"})}function Le(n,t,e){return _(t,{direction:"forward"}).pop().index>n.index?W(n,t,e):[]}class lt extends v{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor,e=t.model,i=at(e.document.selection),r=t.plugins.get("ListEditing").getListAttributeNames();e.change(o=>{const l=[];F(i)&&!w(i[0])?(this._direction=="forward"&&l.push(...q(i,o,{attributeNames:r})),l.push(...X(i[0],o))):this._direction=="forward"?l.push(...q(i,o,{expand:!0,attributeNames:r})):l.push(...ye(i,o,{attributeNames:r}));for(const a of l){if(!a.hasAttribute("listType"))continue;const c=A.first(a,{sameIndent:!0});c&&o.setAttribute("listType",c.getAttribute("listType"),a)}this._fireAfterExecute(l)})}_fireAfterExecute(t){this.fire("afterExecute",C(new Set(t)))}_checkEnabled(){let t=at(this.editor.model.document.selection),e=t[0];if(!e)return!1;if(this._direction=="backward"||F(t)&&!w(t[0]))return!0;t=N(t),e=t[0];const i=A.first(e,{sameIndent:!0});return i?i.getAttribute("listType")==e.getAttribute("listType"):!1}}function at(n){const t=Array.from(n.getSelectedBlocks()),e=t.findIndex(i=>!p(i));return e!=-1&&(t.length=e),t}class B extends v{type;_listWalkerOptions;constructor(t,e,i={}){super(t),this.type=e,this._listWalkerOptions=i.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,i=e.document,s=P(e),r=Array.from(i.selection.getSelectedBlocks()).filter(l=>e.schema.checkAttribute(l,"listType")||U(l,e.schema)),o=t.forceValue!==void 0?!t.forceValue:this.value;e.change(l=>{if(o){const a=r[r.length-1],u=this.editor.plugins.get("ListEditing").getListAttributeNames(),d=_(a,{direction:"forward"}),f=[];d.length>1&&f.push(...X(d[1],l)),f.push(...$(r,l,u)),f.push(...ke(a,l)),this._fireAfterExecute(f)}else if((s||i.selection.isCollapsed)&&p(r[0])){const a=Lt(s||r[0],this._listWalkerOptions);for(const c of a)l.setAttributes({...t.additionalAttributes,listType:this.type},c);this._fireAfterExecute(a)}else{const a=[];for(const c of r)if(!c.hasAttribute("listType"))!c.is("element","listItem")&&U(c,e.schema)&&l.rename(c,"listItem"),l.setAttributes({...t.additionalAttributes,listIndent:0,listItemId:x.next(),listType:this.type},c),a.push(c);else for(const u of N(c,{withNested:!1}))u.getAttribute("listType")!=this.type&&(l.setAttributes({...t.additionalAttributes,listType:this.type},u),a.push(u));this._fireAfterExecute(a)}})}_fireAfterExecute(t){this.fire("afterExecute",C(new Set(t)))}_getValue(){const t=this.editor.model.document.selection,e=Array.from(t.getSelectedBlocks());if(!e.length)return!1;for(const i of e)if(i.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const t=this.editor.model,e=t.schema,i=t.document.selection,s=Array.from(i.getSelectedBlocks());if(!s.length)return!1;if(this.value)return!0;for(const r of s)if(e.checkAttribute(r,"listType")||U(r,e))return!0;return!1}}class ct extends v{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:t=!1}={}){const e=this.editor,i=e.model,s=i.document.selection,r=[],l=e.plugins.get("ListEditing").getListAttributeNames();i.change(a=>{const{firstElement:c,lastElement:u}=this._getMergeSubjectElements(s,t),d=c.getAttribute("listIndent")||0,f=u.getAttribute("listIndent"),m=u.getAttribute("listItemId");if(d!=f){const g=Ie(u);r.push(...q([u,...g],a,{indentBy:d-f,expand:d<f,attributeNames:l}))}if(t){let g=s;s.isCollapsed&&(g=a.createSelection(a.createRange(a.createPositionAt(c,"end"),a.createPositionAt(u,0)))),i.deleteContent(g,{doNotResetEntireContent:s.isCollapsed});const b=g.getLastPosition().parent,y=b.nextSibling;r.push(b),y&&y!==u&&y.getAttribute("listItemId")==m&&r.push(...W(y,b,a))}else r.push(...W(u,c,a));this._fireAfterExecute(r)})}_fireAfterExecute(t){this.fire("afterExecute",C(new Set(t)))}_checkEnabled(){const t=this.editor.model,e=t.document.selection,i=P(t);if(e.isCollapsed||i){const s=i||e.getFirstPosition().parent;if(!p(s))return!1;const r=this._direction=="backward"?s.previousSibling:s.nextSibling;if(!r||F([s,r]))return!1}else{const s=e.getLastPosition(),r=e.getFirstPosition();if(s.parent===r.parent||!p(s.parent))return!1}return!0}_getMergeSubjectElements(t,e){const i=this.editor.model,s=P(i);let r,o;if(t.isCollapsed||s){const l=s||t.getFirstPosition().parent,a=w(l);this._direction=="backward"?(o=l,a&&!e?r=A.first(l,{sameIndent:!0,lowerIndent:!0}):r=l.previousSibling):(r=l,o=l.nextSibling)}else r=t.getFirstPosition().parent,o=t.getLastPosition().parent;return{firstElement:r,lastElement:o}}}class ut extends v{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(e=>{const i=X(this._getStartBlock(),e);this._fireAfterExecute(i)})}_fireAfterExecute(t){this.fire("afterExecute",C(new Set(t)))}_checkEnabled(){const t=this.editor.model.document.selection,e=this._getStartBlock();return t.isCollapsed&&p(e)&&!w(e)}_getStartBlock(){const e=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?e:e.nextSibling}}class we extends h{static get pluginName(){return"ListItemBoldIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[I]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(I);!t.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("bold","listItemBold"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemBold",setAttributeOnDowncast(s,r,o,l){r&&(s.addClass("ck-list-marker-bold",o),G.isSafari&&!(l&&l.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-bold","0",o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemBold"}),e.schema.setAttributeProperties("listItemBold",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemBold"),t.conversion.for("upcast").attributeToAttribute({model:"listItemBold",view:{name:"li",classes:"ck-list-marker-bold"}}))}}class Te extends h{static get pluginName(){return"ListItemItalicIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[I]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(I);!t.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("italic","listItemItalic"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemItalic",setAttributeOnDowncast(s,r,o,l){r&&(s.addClass("ck-list-marker-italic",o),G.isSafari&&!(l&&l.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-italic","0",o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemItalic"}),e.schema.setAttributeProperties("listItemItalic",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemItalic"),t.conversion.for("upcast").attributeToAttribute({model:"listItemItalic",view:{name:"li",classes:"ck-list-marker-italic"}}))}}class Se extends h{static get pluginName(){return"ListItemFontSizeIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[I]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(I);if(!t.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;const s=st(t.config.get("fontSize.options"));e.registerFormatAttribute("fontSize","listItemFontSize"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontSize",setAttributeOnDowncast(r,o,l,a){if(o){const c=s.find(u=>u.model==o);c&&c.view&&typeof c.view!="string"?c.view.styles?(r.addClass("ck-list-marker-font-size",l),r.setStyle("--ck-content-list-marker-font-size",c.view.styles["font-size"],l)):c.view.classes&&(r.addClass(`ck-list-marker-font-size-${o}`,l),G.isSafari&&!(a&&a.dataPipeline)&&r.setStyle("--ck-content-list-marker-dummy-font-size","0",l)):(r.addClass("ck-list-marker-font-size",l),r.setStyle("--ck-content-list-marker-font-size",o,l))}}})}afterInit(){const t=this.editor,e=t.model;if(!t.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;e.schema.extend("$listItem",{allowAttributes:"listItemFontSize"}),e.schema.setAttributeProperties("listItemFontSize",{isFormatting:!0}),e.schema.addAttributeCheck(s=>{if(!s.last.getAttribute("listItemId"))return!1},"listItemFontSize"),t.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s=>s.getStyle("--ck-content-list-marker-font-size")},view:{name:"li",classes:"ck-list-marker-font-size",styles:{"--ck-content-list-marker-font-size":/.*/}}});const i=st(t.config.get("fontSize.options"));for(const s of i)s.model&&s.view&&t.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s.model},view:{name:"li",classes:`ck-list-marker-font-size-${s.model}`}})}}class _e extends h{static get pluginName(){return"ListItemFontColorIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[I]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(I);!t.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("fontColor","listItemFontColor"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontColor",setAttributeOnDowncast(s,r,o){r&&(s.addClass("ck-list-marker-color",o),s.setStyle("--ck-content-list-marker-color",r,o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemFontColor"}),e.schema.setAttributeProperties("listItemFontColor",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontColor"),t.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontColor",value:i=>i.getStyle("--ck-content-list-marker-color")},view:{name:"li",classes:"ck-list-marker-color",styles:{"--ck-content-list-marker-color":/.*/}}}))}}class ve extends h{static get pluginName(){return"ListItemFontFamilyIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[I]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(I);!t.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("fontFamily","listItemFontFamily"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontFamily",setAttributeOnDowncast(s,r,o){r&&(s.addClass("ck-list-marker-font-family",o),s.setStyle("--ck-content-list-marker-font-family",r,o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemFontFamily"}),e.schema.setAttributeProperties("listItemFontFamily",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontFamily"),t.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontFamily",value:i=>i.getStyle("--ck-content-list-marker-font-family")},view:{name:"li",classes:"ck-list-marker-font-family",styles:{"--ck-content-list-marker-font-family":/.*/}}}))}}class Ce extends h{_loadedFormatting={};static get pluginName(){return"ListFormatting"}static get isOfficialPlugin(){return!0}static get requires(){return[we,Te,Se,_e,ve]}constructor(t){super(t),t.config.define("list.enableListItemMarkerFormatting",!0)}afterInit(){this.editor.config.get("list.enableListItemMarkerFormatting")&&this._registerPostfixerForListItemFormatting()}_registerPostfixerForListItemFormatting(){const t=this.editor.model;t.document.registerPostFixer(e=>{const i=t.document.differ.getChanges(),s=new Set;let r=!1;for(const o of i)if(o.type==="attribute")(o.attributeKey=="listItemId"||o.attributeKey=="listType"||this._isInlineOrSelectionFormatting(o.attributeKey)||Object.values(this._loadedFormatting).includes(o.attributeKey))&&(p(o.range.start.nodeAfter)?s.add(o.range.start.nodeAfter):p(o.range.start.parent)&&s.add(o.range.start.parent));else if(p(o.position.nodeAfter)&&s.add(o.position.nodeAfter),p(o.position.nodeBefore)&&s.add(o.position.nodeBefore),p(o.position.parent)&&s.add(o.position.parent),o.type=="insert"&&o.name!="$text"){const l=e.createRangeIn(o.position.nodeAfter);for(const a of l.getItems())p(a)&&s.add(a)}for(const o of s){const l=xe(t,o,Object.keys(this._loadedFormatting));for(const[a,c]of Object.entries(l)){const u=this._loadedFormatting[a];(c&&Ee(e,o,u,c)||!c&&Be(e,o,u))&&(r=!0)}}return r})}registerFormatAttribute(t,e){this._loadedFormatting[t]=e}_isInlineOrSelectionFormatting(t){return t.replace(/^selection:/,"")in this._loadedFormatting}}function xe(n,t,e){if(w(t))return dt(n,t,e);const i=T(t);return dt(n,i[0],e)}function dt(n,t,e){if(!Fe(t)||n.schema.isLimit(t))return Object.fromEntries(e.map(l=>[l]));if(t.isEmpty)return Object.fromEntries(e.map(l=>[l,t.getAttribute(`selection:${l}`)]));const i=new Set(e),s={},o=n.createRangeIn(t).getWalker({ignoreElementEnd:!0});for(const{item:l}of o){for(const a of i)if(n.schema.checkAttribute(l,a)){const c=l.getAttribute(a);c===void 0?(i.delete(a),s[a]=void 0):s[a]===void 0?s[a]=c:s[a]!==c&&(i.delete(a),s[a]=void 0)}else a in s||(s[a]=void 0);if(!i.size)break;n.schema.isLimit(l)&&o.jumpTo(n.createPositionAfter(l))}return s}function Ee(n,t,e,i){const s=T(t);let r=!1;for(const o of s)(!o.hasAttribute(e)||o.getAttribute(e)!==i)&&(n.setAttribute(e,i,o),r=!0);return r}function Be(n,t,e){const i=T(t);let s=!1;for(const r of i)r.hasAttribute(e)&&(n.removeAttribute(e,r),s=!0);return s}function Fe(n){return["numbered","bulleted","customNumbered","customBulleted"].includes(n.getAttribute("listType"))}class Pe extends h{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(t){return z(t)}isFirstBlockOfListItem(t){return w(t)}isListItemBlock(t){return p(t)}expandListBlocksToCompleteItems(t,e={}){return N(t,e)}isNumberedListType(t){return M(t)}isFirstListItemInList(t){return Ae(t)}}function Ve(n){return n.is("element","ol")||n.is("element","ul")}function K(n){return n.is("element","li")}function Ne(n){let t=0,e=n.parent;for(;e;){if(K(e))t++;else{const i=e.previousSibling;i&&K(i)&&t++}e=e.parent}return t}function Oe(n,t,e,i=Tt(e,t)){return n.createAttributeElement(wt(e),null,{priority:2*t/100-100,id:i})}function Re(n,t,e){return n.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:e})}function wt(n){return n=="numbered"||n=="customNumbered"?"ol":"ul"}function Tt(n,t){return`list-${n}-${t}`}function L(n,t,e){const i=n.nodeBefore;if(p(i)){let s=i;for(const{node:r}of new V(s,"backward"))if(s=r,e.has(s)||(e.add(s),t.has(i)))return;t.add(s)}else{const s=n.nodeAfter;p(s)&&t.add(s)}}function Me(n,t){let e=0,i=-1,s=null,r=!1;for(const{node:o}of n){const l=o.getAttribute("listIndent");if(l>e){let a;s===null?(s=l-e,a=e):(s>l&&(s=l),a=l-s),a>i+1&&(a=i+1),t.setAttribute("listIndent",a,o),r=!0,i=a}else s=null,e=l+1,i=l}return r}function De(n,t,e){const i=new Set;let s=!1;for(const{node:r}of n){if(i.has(r))continue;let o=r.getAttribute("listType"),l=r.getAttribute("listItemId");if(t.has(l)&&(l=x.next()),t.add(l),r.is("element","listItem")){r.getAttribute("listItemId")!=l&&(e.setAttribute("listItemId",l,r),s=!0);continue}for(const a of _(r,{direction:"forward"}))i.add(a),a.getAttribute("listType")!=o&&(l=x.next(),o=a.getAttribute("listType")),a.getAttribute("listItemId")!=l&&(e.setAttribute("listItemId",l,a),s=!0)}return s}function ze(){return(n,t,e)=>{const{writer:i,schema:s}=e;if(!t.modelRange)return;const r=Array.from(t.modelRange.getItems({shallow:!0})).filter(d=>s.checkAttribute(d,"listItemId"));if(!r.length)return;const o=t.viewItem.getAttribute("data-list-item-id")||x.next();e.consumable.consume(t.viewItem,{attributes:"data-list-item-id"});const l=Ne(t.viewItem);let a=t.viewItem.parent&&t.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=r[0].getAttribute("listType");c&&(a=c);const u={listItemId:o,listIndent:l,listType:a};for(const d of r)d.hasAttribute("listItemId")||i.setAttributes(u,d);r.length>1&&r[1].getAttribute("listItemId")!=u.listItemId&&e.keepEmptyElement(r[0])}}function $e(n,t,e,i){return()=>{const a=n.document.differ.getChanges(),c=[],u=new Set,d=new Set,f=new Set;for(const m of a)if(m.type=="insert"&&m.name!="$text")L(m.position,u,f),m.attributes.has("listItemId")?d.add(m.position.nodeAfter):L(m.position.getShiftedBy(m.length),u,f);else if(m.type=="remove"&&m.attributes.has("listItemId"))L(m.position,u,f);else if(m.type=="attribute"){const g=m.range.start.nodeAfter;e.includes(m.attributeKey)?(L(m.range.start,u,f),m.attributeNewValue===null?(L(m.range.start.getShiftedBy(1),u,f),r(g)&&c.push(g)):d.add(g)):p(g)&&r(g)&&c.push(g)}for(const m of u.values())c.push(...s(m,d));for(const m of new Set(c))t.reconvertItem(m)};function s(a,c){const u=[],d=new Set,f=[];for(const{node:m,previous:g}of new V(a)){if(d.has(m))continue;const b=m.getAttribute("listIndent");g&&b<g.getAttribute("listIndent")&&(f.length=b+1),f[b]={modelAttributes:Object.fromEntries(Array.from(m.getAttributes()).filter(([k])=>e.includes(k))),modelElement:m};const y=_(m,{direction:"forward"});for(const k of y)d.add(k),(r(k,y)||l(k,f,c))&&u.push(k)}return u}function r(a,c){const u=t.mapper.toViewElement(a);if(!u)return!1;if(o(u)||i.fire("checkElement",{modelElement:a,viewElement:u}))return!0;if(!a.is("element","paragraph")&&!a.is("element","listItem"))return!1;const f=_t(a,e,c);return f&&u.is("element","p")?!0:!!(!f&&u.is("element","span"))}function o(a){for(a=a.parent;a.is("attributeElement")&&["ol","ul","li"].includes(a.name);)a=a.parent;return!!(a.getCustomProperty("$structureSlotParent")&&!t.mapper.toModelElement(a))}function l(a,c,u){if(u.has(a))return!1;const d=t.mapper.toViewElement(a);let f=c.length-1;for(let m=d.parent;!m.is("editableElement");m=m.parent){const g=K(m),b=Ve(m);if(!b&&!g)continue;const y=`checkAttributes:${g?"item":"list"}`;if(i.fire(y,{viewElement:m,modelAttributes:c[f].modelAttributes,modelReferenceElement:c[f].modelElement}))break;if(b&&(f--,f<0))return!1}return!0}}function mt(n,t,e,{dataPipeline:i}={}){const s=Ye(n,t);return(r,o,l)=>{const{writer:a,mapper:c,consumable:u}=l,d=o.item;if(!n.includes(o.attributeKey)||!s(d,u))return;const f={...l.options,dataPipeline:i},m=je(d,c,e,a);St(m,a,c),Ke(m,a);const g=qe(d,m,t,a,f);He(d,g,t,a,f)}}function Ue(n){return(t,e,i)=>{const{writer:s,mapper:r}=i,o=t.name.split(":")[1];if(!n.checkAttribute(o,"listItemId"))return;const l=r.toViewPosition(e.position),a=e.position.getShiftedBy(e.length),c=r.toViewPosition(a,{isPhantom:!0}),d=s.createRange(l,c).getTrimmed().end.nodeBefore;d&&St(d,s,r)}}function ft(n,{dataPipeline:t}={}){return(e,{writer:i})=>{if(!_t(e,n))return null;if(!t)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const s=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,s),s}}function je(n,t,e,i){const s=e.createRangeOn(n),o=t.toViewRange(s).getTrimmed().getWalker();for(const{item:l}of o)if(l.is("element")&&l.getCustomProperty("listItemMarker"))o.jumpTo(i.createPositionAfter(l));else if(l.is("element")&&!l.getCustomProperty("listItemWrapper"))return l}function We(n,t){return(e,i)=>{if(i.modelPosition.offset>0)return;const s=i.modelPosition.parent;if(!p(s)||!n.some(c=>c.scope=="itemMarker"&&c.canInjectMarkerIntoElement&&c.canInjectMarkerIntoElement(s)))return;const r=i.mapper.toViewElement(s),o=t.createRangeIn(r),l=o.getWalker();let a=o.start;for(const{item:c}of l){if(c.is("element")&&i.mapper.toModelElement(c)||c.is("$textProxy"))break;c.is("element")&&c.getCustomProperty("listItemMarker")&&(a=t.createPositionAfter(c),l.skip(({previousPosition:u})=>!u.isEqual(a)))}i.viewPosition=a}}function St(n,t,e){for(;n.parent.is("attributeElement")&&n.parent.getCustomProperty("listItemWrapper");)t.unwrap(t.createRangeOn(n),n.parent);const i=[];s(t.createPositionBefore(n).getWalker({direction:"backward"})),s(t.createRangeIn(n).getWalker());for(const r of i)t.remove(r);function s(r){for(const{item:o}of r){if(o.is("element")&&e.toModelElement(o))break;o.is("element")&&o.getCustomProperty("listItemMarker")&&i.push(o)}}}function qe(n,t,e,i,{dataPipeline:s}){let r=i.createRangeOn(t);if(!w(n))return r;for(const o of e){if(o.scope!="itemMarker")continue;const l=o.createElement(i,n,{dataPipeline:s});if(!l||(i.setCustomProperty("listItemMarker",!0,l),o.canInjectMarkerIntoElement&&o.canInjectMarkerIntoElement(n)?i.insert(i.createPositionAt(t,0),l):(i.insert(r.start,l),r=i.createRange(i.createPositionBefore(l),i.createPositionAfter(t))),!o.createWrapperElement||!o.canWrapElement))continue;const a=o.createWrapperElement(i,n,{dataPipeline:s});i.setCustomProperty("listItemWrapper",!0,a),o.canWrapElement(n)?r=i.wrap(r,a):(r=i.wrap(i.createRangeOn(l),a),r=i.createRange(r.start,i.createPositionAfter(t)))}return r}function Ke(n,t){let e=n.parent;for(;e.is("attributeElement")&&["ul","ol","li"].includes(e.name);){const i=e.parent;t.unwrap(t.createRangeOn(n),e),e=i}}function He(n,t,e,i,s){if(!n.hasAttribute("listIndent"))return;const r=n.getAttribute("listIndent");let o=n;for(let l=r;l>=0;l--){const a=Re(i,l,o.getAttribute("listItemId")),c=Oe(i,l,o.getAttribute("listType"));for(const u of e)(u.scope=="list"||u.scope=="item")&&o.hasAttribute(u.attributeName)&&u.setAttributeOnDowncast(i,o.getAttribute(u.attributeName),u.scope=="list"?c:a,s,o);if(t=i.wrap(t,a),t=i.wrap(t,c),l==0||(o=A.first(o,{lowerIndent:!0}),!o))break}}function Ye(n,t){const e=t.filter(i=>i.consume===!1).map(i=>i.attributeName);return(i,s)=>{const r=[];for(const o of n)i.hasAttribute(o)&&!e.includes(o)&&r.push(`attribute:${o}`);return r.every(o=>s.test(i,o)!==!1)?(r.forEach(o=>s.consume(i,o)),!0):!1}}function _t(n,t,e=T(n)){if(!p(n))return!1;for(const i of n.getAttributeKeys())if(!(i.startsWith("selection:")||i=="htmlEmptyBlock")&&!t.includes(i))return!1;return e.length<2}const R=["listType","listIndent","listItemId"];class I extends h{_downcastStrategies=[];static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Dt,Mt,Pe,Kt,Ce]}constructor(t){super(t),t.config.define("list.multiBlock",!0)}init(){const t=this.editor,e=t.model,i=t.config.get("list.multiBlock");if(t.plugins.has("LegacyListEditing"))throw new zt("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});e.schema.register("$listItem",{allowAttributes:R}),i?(e.schema.extend("$container",{allowAttributesOf:"$listItem"}),e.schema.extend("$block",{allowAttributesOf:"$listItem"}),e.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):e.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const s of R)e.schema.setAttributeProperties(s,{copyOnReplace:!0});t.commands.add("numberedList",new B(t,"numbered")),t.commands.add("bulletedList",new B(t,"bulleted")),t.commands.add("customNumberedList",new B(t,"customNumbered",{multiLevel:!0})),t.commands.add("customBulletedList",new B(t,"customBulleted",{multiLevel:!0})),t.commands.add("indentList",new lt(t,"forward")),t.commands.add("outdentList",new lt(t,"backward")),t.commands.add("splitListItemBefore",new ut(t,"before")),t.commands.add("splitListItemAfter",new ut(t,"after")),i&&(t.commands.add("mergeListItemBackward",new ct(t,"backward")),t.commands.add("mergeListItemForward",new ct(t,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration(),this._setupListItemIdConversionStrategy()}afterInit(){const e=this.editor.commands,i=e.get("indent"),s=e.get("outdent");i&&i.registerChildCommand(e.get("indentList"),{priority:"high"}),s&&s.registerChildCommand(e.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(t){this._downcastStrategies.push(t)}getListAttributeNames(){return[...R,...this._downcastStrategies.map(t=>t.attributeName)]}_setupDeleteIntegration(){const t=this.editor,e=t.commands.get("mergeListItemBackward"),i=t.commands.get("mergeListItemForward");this.listenTo(t.editing.view.document,"delete",(s,r)=>{const o=t.model.document.selection;P(t.model)||t.model.change(()=>{const l=o.getFirstPosition();if(o.isCollapsed&&r.direction=="backward"){if(!l.isAtStart)return;const a=l.parent;if(!p(a))return;if(!A.first(a,{sameAttributes:"listType",sameIndent:!0})&&a.getAttribute("listIndent")===0)ot(a)||t.execute("splitListItemAfter"),t.execute("outdentList");else{if(!e||!e.isEnabled)return;e.execute({shouldMergeOnBlocksContentLevel:pt(t.model,"backward")})}r.preventDefault(),s.stop()}else{if(o.isCollapsed&&!o.getLastPosition().isAtEnd||!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:pt(t.model,"forward")}),r.preventDefault(),s.stop()}})},{context:"li"})}_setupEnterIntegration(){const t=this.editor,e=t.model,i=t.commands,s=i.get("enter");this.listenTo(t.editing.view.document,"enter",(r,o)=>{const l=e.document,a=l.selection.getFirstPosition().parent;if(l.selection.isCollapsed&&p(a)&&a.isEmpty&&!o.isSoft){const c=w(a),u=ot(a);c&&u?(t.execute("outdentList"),o.preventDefault(),r.stop()):c&&!u?(t.execute("splitListItemAfter"),o.preventDefault(),r.stop()):u&&(t.execute("splitListItemBefore"),o.preventDefault(),r.stop())}},{context:"li"}),this.listenTo(s,"afterExecute",()=>{const r=i.get("splitListItemBefore");if(r.refresh(),!r.isEnabled)return;const l=t.model.document.selection.getLastPosition().parent;T(l).length===2&&r.execute()})}_setupTabIntegration(){const t=this.editor;this.listenTo(t.editing.view.document,"tab",(e,i)=>{const s=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(s).isEnabled&&(t.execute(s),i.stopPropagation(),i.preventDefault(),e.stop())},{context:"li"})}_setupConversion(){const t=this.editor,e=t.model,i=this.getListAttributeNames(),s=t.config.get("list.multiBlock"),r=s?"paragraph":"listItem";t.conversion.for("upcast").elementToElement({view:"li",model:(l,{writer:a})=>a.createElement(r,{listType:""})}).elementToElement({view:"p",model:(l,{writer:a})=>l.parent&&l.parent.is("element","li")?a.createElement(r,{listType:""}):null,converterPriority:"high"}).add(l=>{l.on("element:li",ze())}),s||t.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),t.conversion.for("editingDowncast").elementToElement({model:r,view:ft(i),converterPriority:"high"}).add(l=>{l.on("attribute",mt(i,this._downcastStrategies,e)),l.on("remove",Ue(e.schema))}),t.conversion.for("dataDowncast").elementToElement({model:r,view:ft(i,{dataPipeline:!0}),converterPriority:"high"}).add(l=>{l.on("attribute",mt(i,this._downcastStrategies,e,{dataPipeline:!0}))});const o=We(this._downcastStrategies,t.editing.view);t.editing.mapper.on("modelToViewPosition",o),t.data.mapper.on("modelToViewPosition",o),this.listenTo(e.document,"change:data",$e(e,t.editing,i,this),{priority:"high"}),this.on("checkAttributes:item",(l,{viewElement:a,modelAttributes:c})=>{a.id!=c.listItemId&&(l.return=!0,l.stop())}),this.on("checkAttributes:list",(l,{viewElement:a,modelAttributes:c})=>{(a.name!=wt(c.listType)||a.id!=Tt(c.listType,c.listIndent))&&(l.return=!0,l.stop())})}_setupModelPostFixing(){const t=this.editor.model,e=this.getListAttributeNames();t.document.registerPostFixer(i=>Ge(t,i,e,this)),this.on("postFixer",(i,{listNodes:s,writer:r})=>{i.return=Me(s,r)||i.return},{priority:"high"}),this.on("postFixer",(i,{listNodes:s,writer:r,seenIds:o})=>{i.return=De(s,o,r)||i.return},{priority:"high"})}_setupClipboardIntegration(){const t=this.editor.model,e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(t,"insertContent",Ze(t),{priority:"high"}),this.listenTo(e,"outputTransformation",(i,s)=>{t.change(r=>{const o=Array.from(s.content.getChildren()),l=o[o.length-1];if(o.length>1&&l.is("element")&&l.isEmpty&&o.slice(0,-1).every(p)&&r.remove(l),s.method=="copy"||s.method=="cut"){const a=Array.from(s.content.getChildren());F(a)&&$(a,r,this.getListAttributeNames())}})})}_setupAccessibilityIntegration(){const t=this.editor,e=t.t;t.accessibility.addKeystrokeInfoGroup({id:"list",label:e("Keystrokes that can be used in a list"),keystrokes:[{label:e("Increase list item indent"),keystroke:"Tab"},{label:e("Decrease list item indent"),keystroke:"Shift+Tab"}]})}_setupListItemIdConversionStrategy(){this.registerDowncastStrategy({scope:"item",attributeName:"listItemId",setAttributeOnDowncast(t,e,i,s){s&&(s.skipListItemIds||s.isClipboardPipeline)||t.setAttribute("data-list-item-id",e,i)}})}}function Ge(n,t,e,i){const s=n.document.differ.getChanges(),r=new Set,o=new Set,l=i.editor.config.get("list.multiBlock");let a=!1;for(const u of s){if(u.type=="insert"&&u.name!="$text"){const d=u.position.nodeAfter;if(!n.schema.checkAttribute(d,"listItemId"))for(const f of Array.from(d.getAttributeKeys()))e.includes(f)&&(t.removeAttribute(f,d),a=!0);L(u.position,o,r),u.attributes.has("listItemId")||L(u.position.getShiftedBy(u.length),o,r);for(const{item:f,previousPosition:m}of n.createRangeIn(d))p(f)&&L(m,o,r)}else u.type=="remove"?L(u.position,o,r):u.type=="attribute"&&e.includes(u.attributeKey)&&(L(u.range.start,o,r),u.attributeNewValue===null&&L(u.range.start.getShiftedBy(1),o,r));if(!l&&u.type=="attribute"&&R.includes(u.attributeKey)){const d=u.range.start.nodeAfter;u.attributeNewValue===null&&d&&d.is("element","listItem")?(t.rename(d,"paragraph"),a=!0):u.attributeOldValue===null&&d&&d.is("element")&&d.name!="listItem"&&(t.rename(d,"listItem"),a=!0)}}const c=new Set;for(const u of o.values())a=i.fire("postFixer",{listNodes:new be(u),listHead:u,writer:t,seenIds:c})||a;return a}function Ze(n){return(t,[e,i])=>{const s=e.is("documentFragment")?Array.from(e.getChildren()):[e];if(!s.length)return;const o=(i?n.createSelection(i):n.document.selection).getFirstPosition();let l;if(p(o.parent))l=o.parent;else if(p(o.nodeBefore)&&p(o.nodeAfter))l=o.nodeBefore;else return;n.change(a=>{const c=l.getAttribute("listType"),u=l.getAttribute("listIndent"),d=s[0].getAttribute("listIndent")||0,f=Math.max(u-d,0);for(const m of s){const g=p(m);l.is("element","listItem")&&m.is("element","paragraph")&&a.rename(m,"listItem"),a.setAttributes({listIndent:(g?m.getAttribute("listIndent"):0)+f,listItemId:g?m.getAttribute("listItemId"):x.next(),listType:c},m)}})}}function pt(n,t){const e=n.document.selection;if(!e.isCollapsed)return!P(n);if(t==="forward")return!0;const s=e.getFirstPosition().parent,r=s.previousSibling;return n.schema.isObject(r)?!1:r.isEmpty?!0:F([s,r])}function H(n,t,e,i){n.ui.componentFactory.add(t,()=>{const s=gt(Z,n,t,e,i);return s.set({tooltip:!0,isToggleable:!0}),s}),n.ui.componentFactory.add(`menuBar:${t}`,()=>{const s=gt(Zt,n,t,e,i);return s.set({role:"menuitemcheckbox",isToggleable:!0}),s})}function gt(n,t,e,i,s){const r=t.commands.get(e),o=new n(t.locale);return o.set({label:i,icon:s}),o.bind("isOn","isEnabled").to(r,"value","isEnabled"),o.on("execute",()=>{t.execute(e),t.editing.view.focus()}),o}class Je extends h{static get pluginName(){return"ListUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||H(this.editor,"numberedList",t("Numbered List"),Q),this.editor.ui.componentFactory.has("bulletedList")||H(this.editor,"bulletedList",t("Bulleted List"),J)}}class Ci extends h{static get requires(){return[I,Je]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}}class Qe extends v{refresh(){const t=this._getValue();this.value=t,this.isEnabled=t!=null}execute({startIndex:t=1}={}){const e=this.editor.model,i=e.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(r=>p(r)&&M(r.getAttribute("listType")));s=z(s),e.change(r=>{for(const o of s)r.setAttribute("listStart",t>=0?t:1,o)})}_getValue(){const e=this.editor.model.document,i=D(e.selection.getSelectedBlocks());return i&&p(i)&&M(i.getAttribute("listType"))?i.getAttribute("listStart"):null}}const vt={},Ct={},xt={},Et=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"},{listStyle:"arabic-indic",typeAttribute:null,listType:"numbered"}];for(const{listStyle:n,typeAttribute:t,listType:e}of Et)vt[n]=e,Ct[n]=t,t&&(xt[t]=n);function Bt(){return Et.map(n=>n.listStyle)}function tt(n){return vt[n]||null}function Ft(n){return xt[n]||null}function Y(n){return Ct[n]||null}function Xe(n){switch(n){case"lower-alpha":return"lower-latin";case"upper-alpha":return"upper-latin";default:return n}}class ti extends v{defaultType;_supportedTypes;constructor(t,e,i){super(t),this.defaultType=e,this._supportedTypes=i}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,i=e.document;e.change(s=>{this._tryToConvertItemsToList(t);let r=Array.from(i.selection.getSelectedBlocks()).filter(o=>o.hasAttribute("listType"));if(r.length){r=z(r);for(const o of r)s.setAttribute("listStyle",t.type||this.defaultType,o)}})}isStyleTypeSupported(t){return this._supportedTypes?this._supportedTypes.includes(t):!0}_getValue(){const t=D(this.editor.model.document.selection.getSelectedBlocks());return p(t)?t.getAttribute("listStyle"):null}_checkEnabled(){const t=this.editor,e=t.commands.get("numberedList"),i=t.commands.get("bulletedList");return e.isEnabled||i.isEnabled}_tryToConvertItemsToList(t){if(!t.type)return;const e=tt(t.type);if(!e)return;const i=this.editor,s=`${e}List`;i.commands.get(s).value||i.execute(s)}}class ei extends v{refresh(){const t=this._getValue();this.value=t,this.isEnabled=t!=null}execute(t={}){const e=this.editor.model,i=e.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(r=>p(r)&&r.getAttribute("listType")=="numbered");s=z(s),e.change(r=>{for(const o of s)r.setAttribute("listReversed",!!t.reversed,o)})}_getValue(){const e=this.editor.model.document,i=D(e.selection.getSelectedBlocks());return p(i)&&i.getAttribute("listType")=="numbered"?i.getAttribute("listReversed"):null}}function ht(n){return(t,e,i)=>{const{writer:s,schema:r,consumable:o}=i;if(o.test(e.viewItem,n.viewConsumables)===!1)return;e.modelRange||Object.assign(e,i.convertChildren(e.viewItem,e.modelCursor));let l=!1;for(const a of e.modelRange.getItems({shallow:!0}))r.checkAttribute(a,n.attributeName)&&n.appliesToListItem(a)&&(a.hasAttribute(n.attributeName)||(s.setAttribute(n.attributeName,n.getAttributeOnUpcast(e.viewItem),a),l=!0));l&&o.consume(e.viewItem,n.viewConsumables)}}class ii extends h{static get pluginName(){return"ListPropertiesUtils"}static get isOfficialPlugin(){return!0}getAllSupportedStyleTypes(){return Bt()}getListTypeFromListStyleType(t){return tt(t)}getListStyleTypeFromTypeAttribute(t){return Ft(t)}getTypeAttributeFromListStyleType(t){return Y(t)}}function Pt(n){const{startIndex:t,reversed:e,styles:i}=n;return{styles:si(i),startIndex:t||!1,reversed:e||!1}}function si(n){const t={listTypes:["bulleted","numbered"],useAttribute:!1,listStyleTypes:{numbered:["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"],bulleted:["disc","circle","square"]}};return n===!0||(n?Array.isArray(n)||typeof n=="string"?(t.listTypes=S(n),t.listStyleTypes=rt(t.listStyleTypes,t.listTypes)):(t.listTypes=n.listTypes?S(n.listTypes):t.listTypes,t.useAttribute=!!n.useAttribute,n.listStyleTypes?t.listStyleTypes=n.listStyleTypes:t.listStyleTypes=rt(t.listStyleTypes,t.listTypes)):(t.listTypes=[],t.listStyleTypes={})),t}const E="default";class ni extends h{static get requires(){return[I,ii]}static get pluginName(){return"ListPropertiesEditing"}static get licenseFeatureCode(){return"LP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(t){super(t),t.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){const t=this.editor,e=t.model,i=t.plugins.get(I),s=t.config.get("list.properties"),r=ri(s);for(const o of r)o.addCommand(t),e.schema.extend("$listItem",{allowAttributes:o.attributeName}),i.registerDowncastStrategy({scope:"list",attributeName:o.attributeName,setAttributeOnDowncast(l,a,c){o.setAttributeOnDowncast(l,a,c)}});t.conversion.for("upcast").add(o=>{for(const l of r)o.on("element:ol",ht(l)),o.on("element:ul",ht(l))}),i.on("checkAttributes:list",(o,{viewElement:l,modelAttributes:a,modelReferenceElement:c})=>{for(const u of r)u.appliesToListItem(c)&&u.getAttributeOnUpcast(l)!=a[u.attributeName]&&(o.return=!0,o.stop())}),this.listenTo(t.commands.get("indentList"),"afterExecute",(o,l)=>{e.change(a=>{for(const c of l)for(const u of r)u.appliesToListItem(c)&&a.setAttribute(u.attributeName,u.defaultValue,c)})}),i.on("postFixer",(o,{listNodes:l,writer:a})=>{for(const{node:c}of l)for(const u of r)u.hasValidAttribute(c)||(u.appliesToListItem(c)?a.setAttribute(u.attributeName,u.defaultValue,c):a.removeAttribute(u.attributeName,c),o.return=!0)}),i.on("postFixer",(o,{listNodes:l,writer:a})=>{for(const{node:c,previousNodeInList:u}of l)if(u&&u.getAttribute("listType")==c.getAttribute("listType"))for(const d of r){const{attributeName:f}=d;if(!d.appliesToListItem(c))continue;const m=u.getAttribute(f);c.getAttribute(f)!=m&&(a.setAttribute(f,m,c),o.return=!0)}})}}function ri(n){const t=[],e=Pt(n);if(n.styles){const i=e.styles.useAttribute;t.push({attributeName:"listStyle",defaultValue:E,viewConsumables:{styles:"list-style-type"},addCommand(s){let r=Bt();i&&(r=r.filter(o=>!!Y(o))),s.commands.add("listStyle",new ti(s,E,r))},appliesToListItem(s){return s.getAttribute("listType")=="numbered"||s.getAttribute("listType")=="bulleted"},hasValidAttribute(s){if(!this.appliesToListItem(s))return!s.hasAttribute("listStyle");if(!s.hasAttribute("listStyle"))return!1;const r=s.getAttribute("listStyle");return r==E?!0:tt(r)==s.getAttribute("listType")},setAttributeOnDowncast(s,r,o){if(r&&r!==E)if(i){const l=Y(r);if(l){s.setAttribute("type",l,o);return}}else{s.setStyle("list-style-type",r,o);return}s.removeStyle("list-style-type",o),s.removeAttribute("type",o)},getAttributeOnUpcast(s){const r=s.getStyle("list-style-type");if(r)return Xe(r);const o=s.getAttribute("type");return o?Ft(o):E}})}return n.reversed&&t.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(i){i.commands.add("listReversed",new ei(i))},appliesToListItem(i){return i.getAttribute("listType")=="numbered"},hasValidAttribute(i){return this.appliesToListItem(i)==i.hasAttribute("listReversed")},setAttributeOnDowncast(i,s,r){s?i.setAttribute("reversed","reversed",r):i.removeAttribute("reversed",r)},getAttributeOnUpcast(i){return i.hasAttribute("reversed")}}),n.startIndex&&t.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(i){i.commands.add("listStart",new Qe(i))},appliesToListItem(i){return M(i.getAttribute("listType"))},hasValidAttribute(i){return this.appliesToListItem(i)==i.hasAttribute("listStart")},setAttributeOnDowncast(i,s,r){s==0||s>1?i.setAttribute("start",s,r):i.removeAttribute("start",r)},getAttributeOnUpcast(i){const s=i.getAttribute("start");return s>=0?s:1}}),t}class Vt extends nt{children;stylesView=null;additionalPropertiesCollapsibleView=null;startIndexFieldView=null;reversedSwitchButtonView=null;focusTracker=new et;keystrokes=new it;focusables=new Qt;focusCycler;constructor(t,{enabledProperties:e,styleButtonViews:i,styleGridAriaLabel:s}){super(t);const r=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new Xt({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),i&&i.length?(this.stylesView=this._createStylesView(i,s),this.children.add(this.stylesView)):r.push("ck-list-properties_without-styles"),(e.startIndex||e.reversed)&&(this._addNumberedListPropertyViews(e),r.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:r},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const t of this.stylesView.children)this.stylesView.focusTracker.add(t.element);te({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>qt.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);const t=e=>e.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(t,e){const i=new nt(this.locale);return i.children=i.createCollection(),i.children.addMany(t),i.setTemplate({tag:"div",attributes:{"aria-label":e,class:["ck","ck-list-styles-list"]},children:i.children}),i.children.delegate("execute").to(this),i.focus=function(){for(const s of this.children)if(s instanceof Z&&s.isOn){s.focus();return}this.children.first.focus()},i.focusTracker=new et,i.keystrokes=new it,i.render(),i.keystrokes.listenTo(i.element),i}_addNumberedListPropertyViews(t){const e=this.locale.t,i=[];t.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),i.push(this.startIndexFieldView)),t.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),i.push(this.reversedSwitchButtonView)),this.stylesView?(this.additionalPropertiesCollapsibleView=new ee(this.locale,i),this.additionalPropertiesCollapsibleView.set({label:e("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(i,"isEnabled",(...s)=>s.some(r=>r)),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",(s,r,o)=>{o||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)}),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(i)}_createStartIndexField(){const t=this.locale.t,e=new ie(this.locale,se);return e.set({label:t("Start at"),class:"ck-numbered-list-properties__start-index"}),e.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),e.fieldView.on("input",()=>{const i=e.fieldView.element,s=i.valueAsNumber;if(Number.isNaN(s)){e.errorText=t("Invalid start index value.");return}i.checkValidity()?this.fire("listStart",{startIndex:s}):e.errorText=t("Start index must be greater than 0.")}),e}_createReversedSwitchButton(){const t=this.locale.t,e=new ne(this.locale);return e.set({withText:!0,label:t("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),e.delegate("execute").to(this,"listReversed"),e}}class oi extends h{static get pluginName(){return"ListPropertiesUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=t.config.get("list.properties"),s=Pt(i),r=s.styles.listTypes;if(r.includes("bulleted")){const o=[{label:e("Toggle the disc list style"),tooltip:e("Disc"),type:"disc",icon:re},{label:e("Toggle the circle list style"),tooltip:e("Circle"),type:"circle",icon:oe},{label:e("Toggle the square list style"),tooltip:e("Square"),type:"square",icon:le}],l=e("Bulleted List"),a=e("Bulleted list styles toolbar"),c="bulletedList";t.ui.componentFactory.add(c,bt({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,buttonIcon:J,styleGridAriaLabel:a,styleDefinitions:o})),t.ui.componentFactory.add(`menuBar:${c}`,It({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,styleGridAriaLabel:a,styleDefinitions:o}))}if(r.includes("numbered")||i.startIndex||i.reversed){const o=[{label:e("Toggle the decimal list style"),tooltip:e("Decimal"),type:"decimal",icon:ae},{label:e("Toggle the decimal with leading zero list style"),tooltip:e("Decimal with leading zero"),type:"decimal-leading-zero",icon:ce},{label:e("Toggle the lower–roman list style"),tooltip:e("Lower–roman"),type:"lower-roman",icon:ue},{label:e("Toggle the upper–roman list style"),tooltip:e("Upper-roman"),type:"upper-roman",icon:de},{label:e("Toggle the lower–latin list style"),tooltip:e("Lower-latin"),type:"lower-latin",icon:me},{label:e("Toggle the upper–latin list style"),tooltip:e("Upper-latin"),type:"upper-latin",icon:fe},{label:e("Toggle the arabic-indic list style"),tooltip:e("Arabic-indic"),type:"arabic-indic",icon:pe}],l=e("Numbered List"),a=e("Numbered list styles toolbar"),c="numberedList";t.ui.componentFactory.add(c,bt({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,buttonIcon:Q,styleGridAriaLabel:a,styleDefinitions:o})),r.includes("numbered")&&t.ui.componentFactory.add(`menuBar:${c}`,It({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,styleGridAriaLabel:a,styleDefinitions:o}))}}}function bt({editor:n,normalizedConfig:t,parentCommandName:e,buttonLabel:i,buttonIcon:s,styleGridAriaLabel:r,styleDefinitions:o}){const l=n.commands.get(e);return a=>{const c=Ht(a,Yt),u=c.buttonView;return c.bind("isEnabled").to(l),c.class="ck-list-styles-dropdown",u.on("execute",()=>{n.execute(e),n.editing.view.focus()}),u.set({label:i,icon:s,tooltip:!0,isToggleable:!0}),u.bind("isOn").to(l,"value",d=>!!d),c.once("change:isOpen",()=>{const d=li({editor:n,normalizedConfig:t,dropdownView:c,parentCommandName:e,styleGridAriaLabel:r,styleDefinitions:o});c.panelView.children.add(d)}),c.on("execute",()=>{n.editing.view.focus()}),c}}function Nt({editor:n,listStyleCommand:t,parentCommandName:e}){const i=n.locale,s=n.commands.get(e);return({label:r,type:o,icon:l,tooltip:a})=>{const c=new Z(i);return c.set({label:r,icon:l,tooltip:a}),c.bind("isOn").to(t,"value",u=>u===o),c.on("execute",()=>{s.value?t.value===o?n.execute(e):t.value!==o&&n.execute("listStyle",{type:o}):n.model.change(()=>{n.execute("listStyle",{type:o})})}),c}}function li({editor:n,normalizedConfig:t,dropdownView:e,parentCommandName:i,styleDefinitions:s,styleGridAriaLabel:r}){const o=n.locale,l={...t,...i!="numberedList"?{startIndex:!1,reversed:!1}:null},a=i.replace("List","");let c=null;if(t.styles.listTypes.includes(a)){const d=n.commands.get("listStyle"),f=Nt({editor:n,parentCommandName:i,listStyleCommand:d}),m=t.styles.listStyleTypes;let g=s;if(m){const y=m[a];y&&(g=s.filter(k=>y.includes(k.type)))}const b=Ot(d);c=g.filter(b).map(f)}const u=new Vt(o,{styleGridAriaLabel:r,enabledProperties:l,styleButtonViews:c});if(t.styles.listTypes.includes(a)&&Jt(e,()=>u.stylesView.children.find(d=>d.isOn)),l.startIndex){const d=n.commands.get("listStart");u.startIndexFieldView.bind("isEnabled").to(d),u.startIndexFieldView.fieldView.bind("value").to(d),u.on("listStart",(f,m)=>n.execute("listStart",m))}if(l.reversed){const d=n.commands.get("listReversed");u.reversedSwitchButtonView.bind("isEnabled").to(d),u.reversedSwitchButtonView.bind("isOn").to(d,"value",f=>!!f),u.on("listReversed",()=>{const f=d.value;n.execute("listReversed",{reversed:!f})})}return u.delegate("execute").to(e),u}function It({editor:n,normalizedConfig:t,parentCommandName:e,buttonLabel:i,styleGridAriaLabel:s,styleDefinitions:r}){return o=>{const l=new Gt(o),a=n.commands.get(e),c=n.commands.get("listStyle"),u=Ot(c),d=Nt({editor:n,parentCommandName:e,listStyleCommand:c}),f=t.styles.listStyleTypes;let m=r;if(f){const y=a.type,k=f[y];k&&(m=r.filter(Rt=>k.includes(Rt.type)))}const g=m.filter(u).map(d),b=new Vt(o,{styleGridAriaLabel:s,enabledProperties:{...t,startIndex:!1,reversed:!1},styleButtonViews:g});return b.delegate("execute").to(l),l.buttonView.set({label:i,icon:e==="bulletedList"?J:Q}),l.panelView.children.add(b),l.bind("isEnabled").to(a,"isEnabled"),l.on("execute",()=>{n.editing.view.focus()}),l}}function Ot(n){return typeof n.isStyleTypeSupported=="function"?t=>n.isStyleTypeSupported(t.type):()=>!0}class xi extends h{static get requires(){return[ni,oi]}static get pluginName(){return"ListProperties"}static get isOfficialPlugin(){return!0}}class ai extends v{constructor(t){super(t),this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){const t=this._getSelectedItems();this.value=this._getValue(t),this.isEnabled=!!t.length}execute(t={}){this.editor.model.change(e=>{const i=this._getSelectedItems(),s=t.forceValue===void 0?!this._getValue(i):t.forceValue;for(const r of i)s?e.setAttribute("todoListChecked",!0,r):e.removeAttribute("todoListChecked",r)})}_getValue(t){return t.every(e=>e.getAttribute("todoListChecked"))}_getSelectedItems(){const t=this.editor.model,e=t.schema,i=t.document.selection.getFirstRange(),s=i.start.parent,r=[];e.checkAttribute(s,"todoListChecked")&&r.push(...T(s));for(const o of i.getItems({shallow:!0}))e.checkAttribute(o,"todoListChecked")&&!r.includes(o)&&r.push(...T(o));return r}}class ci extends he{domEventType=["change"];onDomEvent(t){if(t.target){const e=this.view.domConverter.mapDomToView(t.target);e&&e.is("element","input")&&e.getAttribute("type")=="checkbox"&&e.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",t)}}}const ui=Ut("Ctrl+Enter");class di extends h{static get pluginName(){return"TodoListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[I]}init(){const t=this.editor,e=t.model,i=t.editing,s=t.plugins.get(I),o=t.config.get("list.multiBlock")?"paragraph":"listItem";t.commands.add("todoList",new B(t,"todo")),t.commands.add("checkTodoList",new ai(t)),i.view.addObserver(ci),e.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),e.schema.addAttributeCheck(l=>{const a=l.last;if(!a.getAttribute("listItemId")||a.getAttribute("listType")!="todo")return!1},"todoListChecked"),t.conversion.for("upcast").add(l=>{l.on("element:input",fi()),l.on("element:li",mi(),{priority:"low"}),l.on("element:label",j({name:"label",classes:"todo-list__label"})),l.on("element:label",j({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),l.on("element:span",j({name:"span",classes:"todo-list__label__description"})),l.on("element:ul",pi({name:"ul",classes:"todo-list"}))}),t.conversion.for("downcast").elementToElement({model:o,view:(l,{writer:a})=>{if(O(l,s.getListAttributeNames()))return a.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),s.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(l,a,c){a=="todo"?l.addClass("todo-list",c):l.removeClass("todo-list",c)}}),s.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(l,a,{dataPipeline:c}){if(a.getAttribute("listType")!="todo")return null;const u=l.createUIElement("input",{type:"checkbox",...a.getAttribute("todoListChecked")?{checked:"checked"}:null,...c?{disabled:"disabled"}:{tabindex:"-1"}});if(c)return u;const d=l.createContainerElement("span",{contenteditable:"false"},u);return d.getFillerOffset=()=>null,d},canWrapElement(l){return O(l,s.getListAttributeNames())},createWrapperElement(l,a,{dataPipeline:c}){const u=["todo-list__label"];return O(a,s.getListAttributeNames())||u.push("todo-list__label_without-description"),l.createAttributeElement(c?"label":"span",{class:u.join(" ")})}}),s.on("checkElement",(l,{modelElement:a,viewElement:c})=>{const u=O(a,s.getListAttributeNames());c.hasClass("todo-list__label__description")!=u&&(l.return=!0,l.stop())}),s.on("checkElement",(l,{modelElement:a,viewElement:c})=>{const u=a.getAttribute("listType")=="todo"&&w(a);let d=!1;const f=t.editing.view.createPositionBefore(c).getWalker({direction:"backward"});for(const{item:m}of f){if(m.is("element")&&t.editing.mapper.toModelElement(m))break;m.is("element","input")&&m.getAttribute("type")=="checkbox"&&(d=!0)}d!=u&&(l.return=!0,l.stop())}),s.on("postFixer",(l,{listNodes:a,writer:c})=>{for(const{node:u,previousNodeInList:d}of a){if(!d||d.getAttribute("listItemId")!=u.getAttribute("listItemId"))continue;const f=d.hasAttribute("todoListChecked"),m=u.hasAttribute("todoListChecked");m&&!f?(c.removeAttribute("todoListChecked",u),l.return=!0):!m&&f&&(c.setAttribute("todoListChecked",!0,u),l.return=!0)}}),e.document.registerPostFixer(l=>{const a=e.document.differ.getChanges();let c=!1;for(const u of a)if(u.type=="attribute"&&u.attributeKey=="listType"){const d=u.range.start.nodeAfter;u.attributeOldValue=="todo"&&d.hasAttribute("todoListChecked")&&(l.removeAttribute("todoListChecked",d),c=!0)}else if(u.type=="insert"&&u.name!="$text")for(const{item:d}of l.createRangeOn(u.position.nodeAfter))d.is("element")&&d.getAttribute("listType")!="todo"&&d.hasAttribute("todoListChecked")&&(l.removeAttribute("todoListChecked",d),c=!0);return c}),this.listenTo(i.view.document,"keydown",(l,a)=>{$t(a)===ui&&(t.execute("checkTodoList"),l.stop())},{priority:"high"}),this.listenTo(i.view.document,"todoCheckboxChange",(l,a)=>{const c=a.target;if(!c||!c.is("element","input"))return;const u=i.view.createPositionAfter(c),f=i.mapper.toModelPosition(u).parent;f&&p(f)&&f.getAttribute("listType")=="todo"&&this._handleCheckmarkChange(f)}),this.listenTo(i.view.document,"arrowKey",hi(e,t.locale),{context:"$text"}),this.listenTo(i.mapper,"viewToModelPosition",(l,a)=>{const c=a.viewPosition.parent,u=c.is("attributeElement","li")&&a.viewPosition.offset==0,d=yt(c)&&a.viewPosition.offset<=1,f=c.is("element","span")&&c.getAttribute("contenteditable")=="false"&&yt(c.parent);if(!u&&!d&&!f)return;const m=a.modelPosition.nodeAfter;m&&m.getAttribute("listType")=="todo"&&(a.modelPosition=e.createPositionAt(m,0))},{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(t){const e=this.editor,i=e.model,s=Array.from(i.document.selection.getRanges());i.change(r=>{r.setSelection(t,"end"),e.execute("checkTodoList"),r.setSelection(s)})}_initAriaAnnouncements(){const{model:t,ui:e,t:i}=this.editor;let s=null;e&&t.document.selection.on("change:range",()=>{const r=t.document.selection.focus.parent,o=kt(s),l=kt(r);o&&!l?e.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!o&&l&&e.ariaLiveAnnouncer.announce(i("Entering a to-do list")),s=r})}}function mi(){return(n,t,e)=>{const{writer:i,schema:s}=e;if(!t.modelRange)return;const r=Array.from(t.modelRange.getItems({shallow:!0})).filter(o=>o.getAttribute("listType")==="todo"&&s.checkAttribute(o,"listItemId")).reduce((o,l)=>{const a=l.getAttribute("listItemId");return o.has(a)||o.set(a,T(l)),o},new Map);for(const[,o]of r.entries())if(o.some(l=>l.getAttribute("todoListChecked")))for(const l of o)i.setAttribute("todoListChecked",!0,l)}}function fi(){return(n,t,e)=>{const i=t.modelCursor,s=i.parent,r=t.viewItem;if(!e.consumable.test(r,{name:!0})||r.getAttribute("type")!="checkbox"||!i.isAtStart||!s.hasAttribute("listType"))return;e.consumable.consume(r,{name:!0});const o=e.writer;o.setAttribute("listType","todo",s),t.viewItem.hasAttribute("checked")&&o.setAttribute("todoListChecked",!0,s),t.modelRange=o.createRange(i)}}function j(n){const t=new At(n);return(e,i,s)=>{const r=t.match(i.viewItem);r&&s.consumable.consume(i.viewItem,r.match)&&Object.assign(i,s.convertChildren(i.viewItem,i.modelCursor))}}function pi(n){const t=new At(n);return(e,i,s)=>{const r=t.match(i.viewItem);if(!r)return;const o=r.match;o.name=!1,s.consumable.consume(i.viewItem,o)}}function O(n,t){return(n.is("element","paragraph")||n.is("element","listItem"))&&n.getAttribute("listType")=="todo"&&w(n)&&gi(n,t)}function gi(n,t){for(const e of n.getAttributeKeys())if(!e.startsWith("selection:")&&!t.includes(e))return!1;return!0}function hi(n,t){return(e,i)=>{const s=jt(i.keyCode,t.contentLanguageDirection),r=n.schema,o=n.document.selection;if(!o.isCollapsed)return;const l=o.getFirstPosition(),a=l.parent;if(s=="right"&&l.isAtEnd){const c=r.getNearestSelectionRange(n.createPositionAfter(a),"forward");if(!c)return;const u=c.start.parent;u&&p(u)&&u.getAttribute("listType")=="todo"&&(n.change(d=>d.setSelection(c)),i.preventDefault(),i.stopPropagation(),e.stop())}else if(s=="left"&&l.isAtStart&&p(a)&&a.getAttribute("listType")=="todo"){const c=r.getNearestSelectionRange(n.createPositionBefore(a),"backward");if(!c)return;n.change(u=>u.setSelection(c)),i.preventDefault(),i.stopPropagation(),e.stop()}}}function yt(n){return!!n&&n.is("attributeElement")&&n.hasClass("todo-list__label")}function kt(n){return!n||!n.is("element","paragraph")&&!n.is("element","listItem")?!1:n.getAttribute("listType")=="todo"}class bi extends h{static get pluginName(){return"TodoListUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.t;H(this.editor,"todoList",t("To-do List"),ge)}}class Ei extends h{static get requires(){return[di,bi]}static get pluginName(){return"TodoList"}static get isOfficialPlugin(){return!0}}export{ai as CheckTodoListCommand,Ci as List,B as ListCommand,I as ListEditing,Ce as ListFormatting,lt as ListIndentCommand,we as ListItemBoldIntegration,_e as ListItemFontColorIntegration,ve as ListItemFontFamilyIntegration,Se as ListItemFontSizeIntegration,Te as ListItemItalicIntegration,ct as ListMergeCommand,xi as ListProperties,ni as ListPropertiesEditing,oi as ListPropertiesUI,ii as ListPropertiesUtils,ei as ListReversedCommand,ut as ListSplitCommand,Qe as ListStartCommand,ti as ListStyleCommand,Je as ListUI,Pe as ListUtils,Ei as TodoList,di as TodoListEditing,bi as TodoListUI,be as _ListBlocksIterable,Vt as _ListPropertiesView,A as _ListWalker,V as _SiblingListBlocksIterator,ci as _TodoCheckboxChangeObserver,U as _canBecomeSimpleListItem,Oe as _createListElement,Re as _createListItemElement,H as _createListUIComponents,We as _createModelToViewListPositionMapper,N as _expandListBlocksToCompleteItems,z as _expandListBlocksToCompleteList,L as _findAndAddListHeadToMap,je as _findMappedListItemViewElement,Me as _fixListIndents,De as _fixListItemIds,T as _getAllListItemBlocks,Bt as _getAllSupportedListStyleTypes,Ne as _getListIndent,_ as _getListItemBlocks,Lt as _getListItems,Ft as _getListStyleTypeFromTypeAttribute,tt as _getListTypeFromListStyleType,Ie as _getNestedListBlocks,Pt as _getNormalizedListConfig,P as _getSelectedBlockObject,Y as _getTypeAttributeFromListStyleType,Tt as _getViewElementIdForListType,wt as _getViewElementNameForListType,q as _indentListBlocks,w as _isFirstBlockOfListItem,ot as _isLastBlockOfListItem,p as _isListItemBlock,K as _isListItemView,Ve as _isListView,M as _isNumberedListType,F as _isSingleListItem,ft as _listItemBogusParagraphCreator,mt as _listItemDowncastConverter,Ue as _listItemDowncastRemoveConverter,ze as _listItemUpcastConverter,ht as _listPropertiesUpcastConverter,W as _mergeListItemBefore,Xe as _normalizeListStyle,ke as _outdentFollowingListItems,ye as _outdentListBlocksWithMerge,$e as _reconvertListItemsOnDataChange,$ as _removeListAttributes,C as _sortListBlocks,X as _splitListItemBefore};
@@ -1,4 +1,4 @@
1
- import{Plugin as p}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{HtmlDataProcessor as _}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{ClipboardPipeline as T}from"../../../../../@ckeditor_ckeditor5-clipboard@47.5.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{unified as u}from"../../../../../unified@11.0.5/node_modules/unified/lib/index.js";import k from"../../../../../remark-parse@11.0.0/node_modules/remark-parse/lib/index.js";import h from"../../../../../remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js";import g from"../../../../../remark-breaks@4.0.0/node_modules/remark-breaks/lib/index.js";import y from"../../../../../remark-rehype@11.1.2/node_modules/remark-rehype/lib/index.js";import D from"../../../../../rehype-dom-stringify@4.0.2/node_modules/rehype-dom-stringify/lib/index.js";import{toHtml as f}from"../../../../../hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/index.js";import{h as P}from"../../../../../hastscript@9.0.1/node_modules/hastscript/lib/index.js";import v from"../../../../../rehype-dom-parse@5.0.2/node_modules/rehype-dom-parse/lib/index.js";import H from"../../../../../rehype-remark@10.0.1/node_modules/rehype-remark/lib/index.js";import M from"../../../../../remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.js";import{visit as m}from"../../../../../unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js";import{fromDom as b}from"../../../../../hast-util-from-dom@5.0.1/node_modules/hast-util-from-dom/lib/index.js";class R{_processor;constructor(){this._processor=u().use(k).use(h,{singleTilde:!0}).use(g).use(y,{allowDangerousHtml:!0}).use(A).use(N).use(D)}parse(e){return this._processor.processSync(e).toString().replaceAll(`
1
+ import{Plugin as p}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{HtmlDataProcessor as _}from"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{ClipboardPipeline as T}from"../../../../../@ckeditor_ckeditor5-clipboard@47.6.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{unified as u}from"../../../../../unified@11.0.5/node_modules/unified/lib/index.js";import k from"../../../../../remark-parse@11.0.0/node_modules/remark-parse/lib/index.js";import h from"../../../../../remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js";import g from"../../../../../remark-breaks@4.0.0/node_modules/remark-breaks/lib/index.js";import y from"../../../../../remark-rehype@11.1.2/node_modules/remark-rehype/lib/index.js";import D from"../../../../../rehype-dom-stringify@4.0.2/node_modules/rehype-dom-stringify/lib/index.js";import{toHtml as f}from"../../../../../hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/index.js";import{h as P}from"../../../../../hastscript@9.0.1/node_modules/hastscript/lib/index.js";import v from"../../../../../rehype-dom-parse@5.0.2/node_modules/rehype-dom-parse/lib/index.js";import H from"../../../../../rehype-remark@10.0.1/node_modules/rehype-remark/lib/index.js";import M from"../../../../../remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.js";import{visit as m}from"../../../../../unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js";import{fromDom as b}from"../../../../../hast-util-from-dom@5.0.1/node_modules/hast-util-from-dom/lib/index.js";class R{_processor;constructor(){this._processor=u().use(k).use(h,{singleTilde:!0}).use(g).use(y,{allowDangerousHtml:!0}).use(A).use(N).use(D)}parse(e){return this._processor.processSync(e).toString().replaceAll(`
2
2
  </code>`,"</code>")}}function N(){return s=>{m(s,"element",e=>{(e.tagName==="ul"||e.tagName==="ol"||e.tagName==="li")&&(e.children=e.children.filter(t=>t.type!=="text"||!!t.value.trim()),delete e.properties.className)})}}function A(){return s=>{m(s,["root","element"],e=>{if(!F(e)||!e.children.some(r=>r.type==="raw"))return;const t=document.createElement("template");t.innerHTML=f({type:"root",children:e.children},{allowDangerousHtml:!0}),e.children=Array.from(t.content.childNodes).map(r=>b(r))})}}function F(s){return(s.type==="root"||s.type==="element")&&s.children}class S{_processor;_keepRawTags=[];constructor(){this._buildProcessor()}keep(e){this._keepRawTags.push(e.toLowerCase()),this._buildProcessor()}parse(e){return this._processor.processSync(e).toString().trim()}_getRawTagsHandlers(){return this._keepRawTags.reduce((e,t)=>(e[t]=(r,n)=>{const o=f(P(n.tagName,n.properties),{allowDangerousHtml:!0,closeSelfClosing:!0}),i=o.indexOf(">"),a=o.slice(0,i+1),l=o.slice(i+1);return[{type:"html",value:a},...r.all(n),{type:"html",value:l}]},e),{})}_buildProcessor(){this._processor=u().use(v).use(E).use(H,{handlers:this._getRawTagsHandlers()}).use(h,{singleTilde:!0}).use(g).use(M,{resourceLink:!0,emphasis:"_",rule:"-",handlers:{break:()=>`
3
3
  `},unsafe:[{character:"<"}]})}}function E(){return function(s){m(s,"element",(e,t,r)=>{t!==null&&e.tagName==="label"&&r.type==="element"&&r.tagName==="li"&&r.children.splice(t,1,...e.children)})}}class d{_htmlDP;_markdown2html;_html2markdown;constructor(e){this._htmlDP=new _(e),this._markdown2html=new R,this._html2markdown=new S}keepHtml(e){this._html2markdown.keep(e)}toView(e){const t=this._markdown2html.parse(e);return this._htmlDP.toView(t)}toData(e){const t=this._htmlDP.toData(e);return this._html2markdown.parse(t)}registerRawContentMatcher(e){this._htmlDP.registerRawContentMatcher(e)}useFillerType(){}}class X extends p{constructor(e){super(e),e.data.processor=new d(e.data.viewDocument)}static get pluginName(){return"Markdown"}static get isOfficialPlugin(){return!0}}const O=["SPAN","BR","PRE","CODE"];class Y extends p{_gfmDataProcessor;constructor(e){super(e),this._gfmDataProcessor=new d(e.data.viewDocument)}static get pluginName(){return"PasteFromMarkdownExperimental"}static get isOfficialPlugin(){return!0}static get requires(){return[T]}init(){const e=this.editor,r=e.editing.view.document,n=e.plugins.get("ClipboardPipeline");let o=!1;this.listenTo(r,"keydown",(i,a)=>{o=a.shiftKey}),this.listenTo(n,"inputTransformation",(i,a)=>{if(o)return;const l=a.dataTransfer.getData("text/html");if(!l){const w=a.dataTransfer.getData("text/plain");a.content=this._gfmDataProcessor.toView(w);return}const c=this._parseMarkdownFromHtml(l);c&&(a.content=this._gfmDataProcessor.toView(c))})}_parseMarkdownFromHtml(e){const t=this._removeOsSpecificTags(e);if(!this._containsOnlyAllowedFirstLevelTags(t))return null;const r=this._removeFirstLevelWrapperTagsAndBrs(t);return this._containsAnyRemainingHtmlTags(r)?null:this._replaceHtmlReservedEntitiesWithCharacters(r)}_removeOsSpecificTags(e){return e.replace(/^<meta\b[^>]*>/,"").trim().replace(/^<html>/,"").replace(/<\/html>$/,"").trim().replace(/^<body>/,"").replace(/<\/body>$/,"").trim().replace(/^<!--StartFragment-->/,"").replace(/<!--EndFragment-->$/,"").trim()}_containsOnlyAllowedFirstLevelTags(e){const t=new DOMParser,{body:r}=t.parseFromString(e,"text/html");return Array.from(r.children).map(o=>o.tagName).every(o=>O.includes(o))}_removeFirstLevelWrapperTagsAndBrs(e){const t=new DOMParser,{body:r}=t.parseFromString(e,"text/html"),n=r.querySelectorAll("br");for(const i of n)i.replaceWith(`
4
4
  `);const o=r.querySelectorAll(":scope > *");for(const i of o){const a=i.cloneNode(!0);i.replaceWith(...a.childNodes)}return r.innerHTML}_containsAnyRemainingHtmlTags(e){return e.includes("<")}_replaceHtmlReservedEntitiesWithCharacters(e){return e.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&nbsp;/g," ")}}export{X as Markdown,d as MarkdownGfmDataProcessor,S as MarkdownGfmHtmlToMd,R as MarkdownGfmMdToHtml,Y as PasteFromMarkdownExperimental};
@@ -1 +1 @@
1
- import{Plugin as h,Command as M}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as T,toWidget as P,findOptimalInsertionRange as k}from"../../../../../@ckeditor_ckeditor5-widget@47.5.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{global as w,first as x,logWarning as R,toArray as D,FocusTracker as C,KeystrokeHandler as F}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{Dialog as U,ButtonView as S,MenuBarMenuListItemButtonView as L,CssTransitionDisablerMixin as B,IconView as A,Template as N,View as O,submitHandler as $,LabeledFieldView as W,createLabeledInputText as H}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconMedia as q,IconMediaPlaceholder as j}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ModelLivePosition as f,ModelLiveRange as z}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Clipboard as G}from"../../../../../@ckeditor_ckeditor5-clipboard@47.5.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Delete as b}from"../../../../../@ckeditor_ckeditor5-typing@47.5.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Undo as K}from"../../../../../@ckeditor_ckeditor5-undo@47.5.0/node_modules/@ckeditor/ckeditor5-undo/dist/index.js";function _(n,e){const t=(i,r,o)=>{if(!o.consumable.consume(r.item,i.name))return;const a=r.attributeNewValue,s=o.writer,l=o.mapper.toViewElement(r.item),d=[...l.getChildren()].find(u=>u.getCustomProperty("media-content"));s.remove(d);const m=n.getMediaViewElement(s,a,e);s.insert(s.createPositionAt(l,0),m)};return i=>{i.on("attribute:url:media",t)}}function X(n,e,t){return e.setCustomProperty("media",!0,n),P(n,e,{label:t})}function v(n,e,t,i){return n.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(n,t,i),n.createSlot()])}function E(n){const e=n.getSelectedElement();return e&&e.is("element","media")?e:null}function V(n,e,t,i){n.change(r=>{const o=r.createElement("media",{url:e});n.insertObject(o,t,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})})}class J extends M{refresh(){const e=this.editor.model,t=e.document.selection,i=E(t);this.value=i?i.getAttribute("url"):void 0,this.isEnabled=Y(t)||Q(t,e)}execute(e){const t=this.editor.model,i=t.document.selection,r=E(i);r?t.change(o=>{o.setAttribute("url",e,r)}):V(t,e,i,!0)}}function Q(n,e){let i=k(n,e).start.parent;return i.isEmpty&&!e.schema.isLimit(i)&&(i=i.parent),e.schema.checkChild(i,"media")}function Y(n){const e=n.getSelectedElement();return!!e&&e.name==="media"}const Z="0 0 64 42";class ee{locale;providerDefinitions;constructor(e,t){const i=t.providers,r=t.extraProviders||[],o=new Set(t.removeProviders),a=i.concat(r).filter(s=>{const l=s.name;return l?!o.has(l):(R("media-embed-no-provider-name",{provider:s}),!1)});this.locale=e,this.providerDefinitions=a}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new I(this.locale);e=e.trim();for(const t of this.providerDefinitions){const i=t.html,r=D(t.url);for(const o of r){const a=this._getUrlMatches(e,o);if(a)return new I(this.locale,e,a,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let r=e.replace(/^https?:\/\//,"");return i=r.match(t),i||(r=r.replace(/^www\./,""),i=r.match(t),i)?i:null}}class I{url;_locale;_match;_previewRenderer;constructor(e,t,i,r){this.url=this._getValidUrl(t),this._locale=e,this._match=i,this._previewRenderer=r}getViewElement(e,t){const i={};let r;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");const o=this._getPreviewHtml(t);r=e.createRawElement("div",i,(a,s)=>{s.setContentOf(a,o)})}else this.url&&(i.url=this.url),r=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",!0,r),r}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new A,t=this._locale.t;return e.content=j,e.viewBox=Z,new N({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}class c extends h{static get pluginName(){return"MediaEmbedEditing"}static get isOfficialPlugin(){return!0}registry;constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:[/^dailymotion\.com\/video\/(\w+)/,/^dai.ly\/(\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/shorts\/([\w-]+)(?:\?t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{const i=t[1],r=t[2];return`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${i}${r?`?start=${r}`:""}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>`}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{name:"instagram",url:[/^instagram\.com\/p\/(\w+)/,/^instagram\.com\/reel\/(\w+)/]},{name:"twitter",url:[/^twitter\.com/,/^x\.com/]},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new ee(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,i=e.t,r=e.conversion,o=e.config.get("mediaEmbed.previewsInData"),a=e.config.get("mediaEmbed.elementName"),s=this.registry;e.commands.add("mediaEmbed",new J(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),r.for("dataDowncast").elementToStructure({model:"media",view:(l,{writer:d})=>{const m=l.getAttribute("url");return v(d,s,m,{elementName:a,renderMediaPreview:!!m&&o})}}),r.for("dataDowncast").add(_(s,{elementName:a,renderMediaPreview:o})),r.for("editingDowncast").elementToStructure({model:"media",view:(l,{writer:d})=>{const m=l.getAttribute("url"),u=v(d,s,m,{elementName:a,renderForEditingView:!0});return X(u,d,i("media widget"))}}),r.for("editingDowncast").add(_(s,{elementName:a,renderForEditingView:!0})),r.for("upcast").elementToElement({view:l=>["oembed",a].includes(l.name)&&l.getAttribute("url")?{name:!0}:null,model:(l,{writer:d})=>{const m=l.getAttribute("url");return s.hasMedia(m)?d.createElement("media",{url:m}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(l,{writer:d})=>{const m=l.getAttribute("data-oembed-url");return s.hasMedia(m)?d.createElement("media",{url:m}):null}}).add(l=>{const d=(m,u,g)=>{if(!g.consumable.consume(u.viewItem,{name:!0,classes:"media"}))return;const{modelRange:p,modelCursor:y}=g.convertChildren(u.viewItem,u.modelCursor);u.modelRange=p,u.modelCursor=y,x(p.getItems())||g.consumable.revert(u.viewItem,{name:!0,classes:"media"})};l.on("element:figure",d)})}}const te=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class ie extends h{static get requires(){return[G,b,K]}static get pluginName(){return"AutoMediaEmbed"}static get isOfficialPlugin(){return!0}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{const o=t.selection.getFirstRange(),a=f.fromPosition(o.start);a.stickiness="toPrevious";const s=f.fromPosition(o.end);s.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(a,s),a.detach(),s.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(w.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const i=this.editor,r=i.plugins.get(c).registry,o=new z(e,t),a=o.getWalker({ignoreElementEnd:!0});let s="";for(const d of a)d.item.is("$textProxy")&&(s+=d.item.data);if(s=s.trim(),!s.match(te)){o.detach();return}if(!r.hasMedia(s)){o.detach();return}if(!i.commands.get("mediaEmbed").isEnabled){o.detach();return}this._positionToInsert=f.fromPosition(e),this._timeoutId=w.window.setTimeout(()=>{i.model.change(d=>{this._timeoutId=null,d.remove(o),o.detach();let m=null;this._positionToInsert.root.rootName!=="$graveyard"&&(m=this._positionToInsert),V(i.model,s,m,!1),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get(b).requestUndoOnBackspace()},100)}}class re extends O{focusTracker;keystrokes;urlInputView;_validators;_urlInputViewInfoDefault;_urlInputViewInfoTip;constructor(e,t){super(t),this.focusTracker=new C,this.keystrokes=new F,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView]})}render(){super.render(),$({view:this}),this.focusTracker.add(this.urlInputView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.urlInputView.focus()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,t=new W(this.locale,H),i=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,i.inputMode="url",i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim()}),t}}class oe extends h{static get requires(){return[c,U]}static get pluginName(){return"MediaEmbedUI"}static get isOfficialPlugin(){return!0}_formView;init(){const e=this.editor;e.ui.componentFactory.add("mediaEmbed",()=>{const t=this.editor.locale.t,i=this._createDialogButton(S);return i.tooltip=!0,i.label=t("Insert media"),i}),e.ui.componentFactory.add("menuBar:mediaEmbed",()=>{const t=this.editor.locale.t,i=this._createDialogButton(L);return i.label=t("Media"),i})}_createDialogButton(e){const t=this.editor,i=new e(t.locale),r=t.commands.get("mediaEmbed"),o=this.editor.plugins.get("Dialog");return i.icon=q,i.bind("isEnabled").to(r,"isEnabled"),i.on("execute",()=>{o.id==="mediaEmbed"?o.hide():this._showDialog()}),i}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.commands.get("mediaEmbed"),r=e.locale.t,o=i.value!==void 0;if(!this._formView){const a=e.plugins.get(c).registry;this._formView=new(B(re))(ne(e.t,a),e.locale),this._formView.on("submit",()=>this._handleSubmitForm())}t.show({id:"mediaEmbed",title:r("Media embed"),content:this._formView,isModal:!0,onShow:()=>{this._formView.url=i.value||"",this._formView.resetFormStatus(),this._formView.urlInputView.fieldView.select()},actionButtons:[{label:r("Cancel"),withText:!0,onExecute:()=>t.hide()},{label:r(o?"Save":"Insert"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSubmitForm()}]})}_handleSubmitForm(){const e=this.editor,t=e.plugins.get("Dialog");this._formView.isValid()&&(e.execute("mediaEmbed",this._formView.url),t.hide(),e.editing.view.focus())}}function ne(n,e){return[t=>{if(!t.url.length)return n("The URL must not be empty.")},t=>{if(!e.hasMedia(t.url))return n("This media URL is not supported.")}]}class pe extends h{static get requires(){return[c,oe,ie,T]}static get pluginName(){return"MediaEmbed"}static get isOfficialPlugin(){return!0}}export{ie as AutoMediaEmbed,pe as MediaEmbed,J as MediaEmbedCommand,c as MediaEmbedEditing,oe as MediaEmbedUI,ee as MediaRegistry,re as _MediaFormView,v as _createMediaFigureElement,E as _getSelectedMediaModelWidget,V as _insertMedia,_ as _modelToViewUrlAttributeMediaConverter,X as _toMediaWidget};
1
+ import{Plugin as h,Command as M}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as T,toWidget as P,findOptimalInsertionRange as k}from"../../../../../@ckeditor_ckeditor5-widget@47.6.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{global as w,first as x,logWarning as R,toArray as D,FocusTracker as C,KeystrokeHandler as F}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{Dialog as U,ButtonView as S,MenuBarMenuListItemButtonView as L,CssTransitionDisablerMixin as B,IconView as A,Template as N,View as O,submitHandler as $,LabeledFieldView as W,createLabeledInputText as H}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconMedia as q,IconMediaPlaceholder as j}from"../../../../../@ckeditor_ckeditor5-icons@47.6.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ModelLivePosition as f,ModelLiveRange as z}from"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Clipboard as G}from"../../../../../@ckeditor_ckeditor5-clipboard@47.6.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Delete as b}from"../../../../../@ckeditor_ckeditor5-typing@47.6.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Undo as K}from"../../../../../@ckeditor_ckeditor5-undo@47.6.0/node_modules/@ckeditor/ckeditor5-undo/dist/index.js";function _(n,e){const t=(i,r,o)=>{if(!o.consumable.consume(r.item,i.name))return;const a=r.attributeNewValue,s=o.writer,l=o.mapper.toViewElement(r.item),d=[...l.getChildren()].find(u=>u.getCustomProperty("media-content"));s.remove(d);const m=n.getMediaViewElement(s,a,e);s.insert(s.createPositionAt(l,0),m)};return i=>{i.on("attribute:url:media",t)}}function X(n,e,t){return e.setCustomProperty("media",!0,n),P(n,e,{label:t})}function v(n,e,t,i){return n.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(n,t,i),n.createSlot()])}function E(n){const e=n.getSelectedElement();return e&&e.is("element","media")?e:null}function V(n,e,t,i){n.change(r=>{const o=r.createElement("media",{url:e});n.insertObject(o,t,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})})}class J extends M{refresh(){const e=this.editor.model,t=e.document.selection,i=E(t);this.value=i?i.getAttribute("url"):void 0,this.isEnabled=Y(t)||Q(t,e)}execute(e){const t=this.editor.model,i=t.document.selection,r=E(i);r?t.change(o=>{o.setAttribute("url",e,r)}):V(t,e,i,!0)}}function Q(n,e){let i=k(n,e).start.parent;return i.isEmpty&&!e.schema.isLimit(i)&&(i=i.parent),e.schema.checkChild(i,"media")}function Y(n){const e=n.getSelectedElement();return!!e&&e.name==="media"}const Z="0 0 64 42";class ee{locale;providerDefinitions;constructor(e,t){const i=t.providers,r=t.extraProviders||[],o=new Set(t.removeProviders),a=i.concat(r).filter(s=>{const l=s.name;return l?!o.has(l):(R("media-embed-no-provider-name",{provider:s}),!1)});this.locale=e,this.providerDefinitions=a}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new I(this.locale);e=e.trim();for(const t of this.providerDefinitions){const i=t.html,r=D(t.url);for(const o of r){const a=this._getUrlMatches(e,o);if(a)return new I(this.locale,e,a,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let r=e.replace(/^https?:\/\//,"");return i=r.match(t),i||(r=r.replace(/^www\./,""),i=r.match(t),i)?i:null}}class I{url;_locale;_match;_previewRenderer;constructor(e,t,i,r){this.url=this._getValidUrl(t),this._locale=e,this._match=i,this._previewRenderer=r}getViewElement(e,t){const i={};let r;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");const o=this._getPreviewHtml(t);r=e.createRawElement("div",i,(a,s)=>{s.setContentOf(a,o)})}else this.url&&(i.url=this.url),r=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",!0,r),r}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new A,t=this._locale.t;return e.content=j,e.viewBox=Z,new N({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}class c extends h{static get pluginName(){return"MediaEmbedEditing"}static get isOfficialPlugin(){return!0}registry;constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:[/^dailymotion\.com\/video\/(\w+)/,/^dai.ly\/(\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/shorts\/([\w-]+)(?:\?t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{const i=t[1],r=t[2];return`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${i}${r?`?start=${r}`:""}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>`}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{name:"instagram",url:[/^instagram\.com\/p\/(\w+)/,/^instagram\.com\/reel\/(\w+)/]},{name:"twitter",url:[/^twitter\.com/,/^x\.com/]},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new ee(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,i=e.t,r=e.conversion,o=e.config.get("mediaEmbed.previewsInData"),a=e.config.get("mediaEmbed.elementName"),s=this.registry;e.commands.add("mediaEmbed",new J(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),r.for("dataDowncast").elementToStructure({model:"media",view:(l,{writer:d})=>{const m=l.getAttribute("url");return v(d,s,m,{elementName:a,renderMediaPreview:!!m&&o})}}),r.for("dataDowncast").add(_(s,{elementName:a,renderMediaPreview:o})),r.for("editingDowncast").elementToStructure({model:"media",view:(l,{writer:d})=>{const m=l.getAttribute("url"),u=v(d,s,m,{elementName:a,renderForEditingView:!0});return X(u,d,i("media widget"))}}),r.for("editingDowncast").add(_(s,{elementName:a,renderForEditingView:!0})),r.for("upcast").elementToElement({view:l=>["oembed",a].includes(l.name)&&l.getAttribute("url")?{name:!0}:null,model:(l,{writer:d})=>{const m=l.getAttribute("url");return s.hasMedia(m)?d.createElement("media",{url:m}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(l,{writer:d})=>{const m=l.getAttribute("data-oembed-url");return s.hasMedia(m)?d.createElement("media",{url:m}):null}}).add(l=>{const d=(m,u,g)=>{if(!g.consumable.consume(u.viewItem,{name:!0,classes:"media"}))return;const{modelRange:p,modelCursor:y}=g.convertChildren(u.viewItem,u.modelCursor);u.modelRange=p,u.modelCursor=y,x(p.getItems())||g.consumable.revert(u.viewItem,{name:!0,classes:"media"})};l.on("element:figure",d)})}}const te=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class ie extends h{static get requires(){return[G,b,K]}static get pluginName(){return"AutoMediaEmbed"}static get isOfficialPlugin(){return!0}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{const o=t.selection.getFirstRange(),a=f.fromPosition(o.start);a.stickiness="toPrevious";const s=f.fromPosition(o.end);s.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(a,s),a.detach(),s.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(w.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const i=this.editor,r=i.plugins.get(c).registry,o=new z(e,t),a=o.getWalker({ignoreElementEnd:!0});let s="";for(const d of a)d.item.is("$textProxy")&&(s+=d.item.data);if(s=s.trim(),!s.match(te)){o.detach();return}if(!r.hasMedia(s)){o.detach();return}if(!i.commands.get("mediaEmbed").isEnabled){o.detach();return}this._positionToInsert=f.fromPosition(e),this._timeoutId=w.window.setTimeout(()=>{i.model.change(d=>{this._timeoutId=null,d.remove(o),o.detach();let m=null;this._positionToInsert.root.rootName!=="$graveyard"&&(m=this._positionToInsert),V(i.model,s,m,!1),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get(b).requestUndoOnBackspace()},100)}}class re extends O{focusTracker;keystrokes;urlInputView;_validators;_urlInputViewInfoDefault;_urlInputViewInfoTip;constructor(e,t){super(t),this.focusTracker=new C,this.keystrokes=new F,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView]})}render(){super.render(),$({view:this}),this.focusTracker.add(this.urlInputView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.urlInputView.focus()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,t=new W(this.locale,H),i=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,i.inputMode="url",i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim()}),t}}class oe extends h{static get requires(){return[c,U]}static get pluginName(){return"MediaEmbedUI"}static get isOfficialPlugin(){return!0}_formView;init(){const e=this.editor;e.ui.componentFactory.add("mediaEmbed",()=>{const t=this.editor.locale.t,i=this._createDialogButton(S);return i.tooltip=!0,i.label=t("Insert media"),i}),e.ui.componentFactory.add("menuBar:mediaEmbed",()=>{const t=this.editor.locale.t,i=this._createDialogButton(L);return i.label=t("Media"),i})}_createDialogButton(e){const t=this.editor,i=new e(t.locale),r=t.commands.get("mediaEmbed"),o=this.editor.plugins.get("Dialog");return i.icon=q,i.bind("isEnabled").to(r,"isEnabled"),i.on("execute",()=>{o.id==="mediaEmbed"?o.hide():this._showDialog()}),i}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.commands.get("mediaEmbed"),r=e.locale.t,o=i.value!==void 0;if(!this._formView){const a=e.plugins.get(c).registry;this._formView=new(B(re))(ne(e.t,a),e.locale),this._formView.on("submit",()=>this._handleSubmitForm())}t.show({id:"mediaEmbed",title:r("Media embed"),content:this._formView,isModal:!0,onShow:()=>{this._formView.url=i.value||"",this._formView.resetFormStatus(),this._formView.urlInputView.fieldView.select()},actionButtons:[{label:r("Cancel"),withText:!0,onExecute:()=>t.hide()},{label:r(o?"Save":"Insert"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSubmitForm()}]})}_handleSubmitForm(){const e=this.editor,t=e.plugins.get("Dialog");this._formView.isValid()&&(e.execute("mediaEmbed",this._formView.url),t.hide(),e.editing.view.focus())}}function ne(n,e){return[t=>{if(!t.url.length)return n("The URL must not be empty.")},t=>{if(!e.hasMedia(t.url))return n("This media URL is not supported.")}]}class pe extends h{static get requires(){return[c,oe,ie,T]}static get pluginName(){return"MediaEmbed"}static get isOfficialPlugin(){return!0}}export{ie as AutoMediaEmbed,pe as MediaEmbed,J as MediaEmbedCommand,c as MediaEmbedEditing,oe as MediaEmbedUI,ee as MediaRegistry,re as _MediaFormView,v as _createMediaFigureElement,E as _getSelectedMediaModelWidget,V as _insertMedia,_ as _modelToViewUrlAttributeMediaConverter,X as _toMediaWidget};
@@ -1 +1 @@
1
- import{keyCodes as r}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";r.arrowup,r.arrowdown,r.esc;r.enter,r.tab;
1
+ import{keyCodes as r}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";r.arrowup,r.arrowdown,r.esc;r.enter,r.tab;
@@ -1 +1 @@
1
- import{Plugin as l,Command as d}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as m,toWidget as p,findOptimalInsertionRange as k}from"../../../../../@ckeditor_ckeditor5-widget@47.5.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{IconPageBreak as B}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as f,MenuBarMenuListItemButtonView as P}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class b extends d{refresh(){const e=this.editor.model,t=e.schema,a=e.document.selection;this.isEnabled=h(a,t,e)}execute(){const e=this.editor.model;e.change(t=>{const a=t.createElement("pageBreak");e.insertObject(a,null,null,{setSelection:"after"})})}}function h(i,e,t){const a=E(i,t);return e.checkChild(a,"pageBreak")}function E(i,e){const a=k(i,e).start.parent;return a.isEmpty&&!a.is("element","$root")?a.parent:a}class y extends l{static get pluginName(){return"PageBreakEditing"}static get licenseFeatureCode(){return"PB"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,a=e.t,o=e.conversion;t.register("pageBreak",{inheritAllFrom:"$blockObject"}),o.for("dataDowncast").elementToStructure({model:"pageBreak",view:(r,{writer:n})=>n.createContainerElement("div",{class:"page-break",style:"page-break-after: always"},n.createContainerElement("span",{style:"display: none"}))}),o.for("editingDowncast").elementToStructure({model:"pageBreak",view:(r,{writer:n})=>{const c=a("Page break"),s=n.createContainerElement("div"),g=n.createRawElement("span",{class:"page-break__label"},function(u){u.innerText=a("Page break")});return n.addClass("page-break",s),n.insert(n.createPositionAt(s,0),g),v(s,n,c)}}),o.for("upcast").elementToElement({view:r=>{const n=r.getStyle("page-break-before")=="always",c=r.getStyle("page-break-after")=="always";if(!n&&!c)return null;if(r.childCount==1){const s=r.getChild(0);if(!s.is("element","span")||s.getStyle("display")!="none")return null}else if(r.childCount>1)return null;return{name:!0,styles:[...n?["page-break-before"]:[],...c?["page-break-after"]:[]],...r.hasClass("page-break")&&{classes:["page-break"]}}},model:"pageBreak",converterPriority:"high"}),e.commands.add("pageBreak",new b(e))}}function v(i,e,t){return e.setCustomProperty("pageBreak",!0,i),p(i,e,{label:t})}class C extends l{static get pluginName(){return"PageBreakUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("pageBreak",()=>{const t=this._createButton(f);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:pageBreak",()=>this._createButton(P))}_createButton(e){const t=this.editor,a=t.locale,o=t.commands.get("pageBreak"),r=new e(t.locale),n=a.t;return r.set({label:n("Page break"),icon:B}),r.bind("isEnabled").to(o,"isEnabled"),this.listenTo(r,"execute",()=>{t.execute("pageBreak"),t.editing.view.focus()}),r}}class O extends l{static get requires(){return[y,C,m]}static get pluginName(){return"PageBreak"}static get isOfficialPlugin(){return!0}}export{O as PageBreak,b as PageBreakCommand,y as PageBreakEditing,C as PageBreakUI};
1
+ import{Plugin as l,Command as d}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as m,toWidget as p,findOptimalInsertionRange as k}from"../../../../../@ckeditor_ckeditor5-widget@47.6.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{IconPageBreak as B}from"../../../../../@ckeditor_ckeditor5-icons@47.6.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as f,MenuBarMenuListItemButtonView as P}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class b extends d{refresh(){const e=this.editor.model,t=e.schema,a=e.document.selection;this.isEnabled=h(a,t,e)}execute(){const e=this.editor.model;e.change(t=>{const a=t.createElement("pageBreak");e.insertObject(a,null,null,{setSelection:"after"})})}}function h(i,e,t){const a=E(i,t);return e.checkChild(a,"pageBreak")}function E(i,e){const a=k(i,e).start.parent;return a.isEmpty&&!a.is("element","$root")?a.parent:a}class y extends l{static get pluginName(){return"PageBreakEditing"}static get licenseFeatureCode(){return"PB"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,a=e.t,o=e.conversion;t.register("pageBreak",{inheritAllFrom:"$blockObject"}),o.for("dataDowncast").elementToStructure({model:"pageBreak",view:(r,{writer:n})=>n.createContainerElement("div",{class:"page-break",style:"page-break-after: always"},n.createContainerElement("span",{style:"display: none"}))}),o.for("editingDowncast").elementToStructure({model:"pageBreak",view:(r,{writer:n})=>{const c=a("Page break"),s=n.createContainerElement("div"),g=n.createRawElement("span",{class:"page-break__label"},function(u){u.innerText=a("Page break")});return n.addClass("page-break",s),n.insert(n.createPositionAt(s,0),g),v(s,n,c)}}),o.for("upcast").elementToElement({view:r=>{const n=r.getStyle("page-break-before")=="always",c=r.getStyle("page-break-after")=="always";if(!n&&!c)return null;if(r.childCount==1){const s=r.getChild(0);if(!s.is("element","span")||s.getStyle("display")!="none")return null}else if(r.childCount>1)return null;return{name:!0,styles:[...n?["page-break-before"]:[],...c?["page-break-after"]:[]],...r.hasClass("page-break")&&{classes:["page-break"]}}},model:"pageBreak",converterPriority:"high"}),e.commands.add("pageBreak",new b(e))}}function v(i,e,t){return e.setCustomProperty("pageBreak",!0,i),p(i,e,{label:t})}class C extends l{static get pluginName(){return"PageBreakUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("pageBreak",()=>{const t=this._createButton(f);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:pageBreak",()=>this._createButton(P))}_createButton(e){const t=this.editor,a=t.locale,o=t.commands.get("pageBreak"),r=new e(t.locale),n=a.t;return r.set({label:n("Page break"),icon:B}),r.bind("isEnabled").to(o,"isEnabled"),this.listenTo(r,"execute",()=>{t.execute("pageBreak"),t.editing.view.focus()}),r}}class O extends l{static get requires(){return[y,C,m]}static get pluginName(){return"PageBreak"}static get isOfficialPlugin(){return!0}}export{O as PageBreak,b as PageBreakCommand,y as PageBreakEditing,C as PageBreakUI};
@@ -1 +1 @@
1
- import{Plugin as h,Command as l}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{first as m}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";class p extends l{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,r=e.document,t=m(r.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&c(t,e.schema)}execute(e={}){const r=this.editor.model,t=r.document,a=e.selection||t.selection;r.canEditAt(a)&&r.change(n=>{const s=a.getSelectedBlocks();for(const i of s)!i.is("element","paragraph")&&c(i,r.schema)&&n.rename(i,"paragraph")})}}function c(o,e){return e.checkChild(o.parent,"paragraph")&&!e.isObject(o)}class u extends l{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const r=this.editor.model,t=e.attributes;let a=e.position;return r.canEditAt(a)?r.change(n=>{if(a=this._findPositionToInsertParagraph(a,n),!a)return null;const s=n.createElement("paragraph");return t&&r.schema.setAllowedAttributes(s,t,n),r.insertContent(s,a),n.setSelection(s,"in"),n.createPositionAt(s,0)}):null}_findPositionToInsertParagraph(e,r){const t=this.editor.model;if(t.schema.checkChild(e,"paragraph"))return e;const a=t.schema.findAllowedParent(e,"paragraph");if(!a)return null;const n=e.parent,s=t.schema.checkChild(n,"$text");return n.isEmpty||s&&e.isAtEnd?t.createPositionAfter(n):!n.isEmpty&&s&&e.isAtStart?t.createPositionBefore(n):r.split(e,a).position}}class d extends h{static get pluginName(){return"Paragraph"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,r=e.model;e.commands.add("paragraph",new p(e)),e.commands.add("insertParagraph",new u(e)),r.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(t,{writer:a})=>!d.paragraphLikeElements.has(t.name)||t.isEmpty?null:a.createElement("paragraph"),view:/.+/,converterPriority:"low"})}static paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"])}export{u as InsertParagraphCommand,d as Paragraph,p as ParagraphCommand};
1
+ import{Plugin as h,Command as l}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{first as m}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";class p extends l{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,r=e.document,t=m(r.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&c(t,e.schema)}execute(e={}){const r=this.editor.model,t=r.document,a=e.selection||t.selection;r.canEditAt(a)&&r.change(n=>{const s=a.getSelectedBlocks();for(const i of s)!i.is("element","paragraph")&&c(i,r.schema)&&n.rename(i,"paragraph")})}}function c(o,e){return e.checkChild(o.parent,"paragraph")&&!e.isObject(o)}class u extends l{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const r=this.editor.model,t=e.attributes;let a=e.position;return r.canEditAt(a)?r.change(n=>{if(a=this._findPositionToInsertParagraph(a,n),!a)return null;const s=n.createElement("paragraph");return t&&r.schema.setAllowedAttributes(s,t,n),r.insertContent(s,a),n.setSelection(s,"in"),n.createPositionAt(s,0)}):null}_findPositionToInsertParagraph(e,r){const t=this.editor.model;if(t.schema.checkChild(e,"paragraph"))return e;const a=t.schema.findAllowedParent(e,"paragraph");if(!a)return null;const n=e.parent,s=t.schema.checkChild(n,"$text");return n.isEmpty||s&&e.isAtEnd?t.createPositionAfter(n):!n.isEmpty&&s&&e.isAtStart?t.createPositionBefore(n):r.split(e,a).position}}class d extends h{static get pluginName(){return"Paragraph"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,r=e.model;e.commands.add("paragraph",new p(e)),e.commands.add("insertParagraph",new u(e)),r.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(t,{writer:a})=>!d.paragraphLikeElements.has(t.name)||t.isEmpty?null:a.createElement("paragraph"),view:/.+/,converterPriority:"low"})}static paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"])}export{u as InsertParagraphCommand,d as Paragraph,p as ParagraphCommand};
@@ -0,0 +1 @@
1
+ import{Plugin as M}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{ClipboardPipeline as O}from"../../../../../@ckeditor_ckeditor5-clipboard@47.6.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{UpcastWriter as y,ViewDocument as C,ViewDomConverter as L,Matcher as b}from"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";function R(t,e){const n=[];for(const s of e.createRangeIn(t)){const i=s.item;i.is("element","a")&&!i.hasAttribute("href")&&(i.hasAttribute("id")||i.hasAttribute("name"))&&n.push(i)}for(const s of n){const i=s.parent.getChildIndex(s)+1,l=s.getChildren();e.insertChild(i,l,s.parent)}}function E(t){const e=parseFloat(t);return t.endsWith("pt")?h(e*96/72):t.endsWith("pc")?h(e*12*96/72):t.endsWith("in")?h(e*96):t.endsWith("cm")?h(e*96/2.54):t.endsWith("mm")?h(e/10*96/2.54):t}function h(t){return Math.round(t)+"px"}function k(t,e,n){if(!t.childCount)return;const s=new y(t.document),i=W(t,s);if(!i.length)return;const l={},o=[];let r=x();for(const a of i)if(a.indent!==void 0){N(a)||(v(s,o,r),r=x(),o.length=0);const c=`${a.id}:${a.indent}`,f=Math.min(a.indent-1,o.length);if(f<o.length&&o[f].id!==a.id&&(o.length=f),f<o.length-1)o.length=f+1;else{const u=w(a,e);if(f>o.length-1||o[f].listElement.name!=u.type){f==0&&u.type=="ol"&&a.id!==void 0&&l[c]&&(u.startIndex=l[c]);const g=z(u,s,n);if(o.length==0){const d=a.element.parent,p=d.getChildIndex(a.element)+1;s.insertChild(p,g,d)}else{const d=o[f-1].listItemElements;s.appendChild(g,d[d.length-1])}o[f]={...a,listElement:g,listItemElements:[]},f==0&&a.id!==void 0&&(l[c]=u.startIndex||1)}}const m=a.element.name=="li"?a.element:s.createElement("li");B(s,o,r,a,m,f),s.appendChild(m,o[f].listElement),o[f].listItemElements.push(m),f==0&&a.id!==void 0&&l[c]++,a.element!=m&&s.appendChild(a.element,m),j(a.element,s),s.removeStyle("text-indent",a.element),s.removeStyle("margin-left",a.element)}else{const c=o.find(f=>f.marginLeft==a.marginLeft);if(c){const f=c.listItemElements;s.appendChild(a.element,f[f.length-1]),s.removeStyle("margin-left",a.element)}else o.length=0}v(s,o,r)}function B(t,e,n,s,i,l){if(s.marginLeft===void 0){l==0&&(n.canApplyMarginOnList=!1);return}const o=parseFloat(s.marginLeft);let r=0;if(e.length>1){const f=e[e.length-2].listItemElements;if(f.length>0){const m=f[f.length-1].getStyle("margin-left");m!==void 0&&(r+=parseFloat(m))}}r+=e.length*40;const a=o-r,c=a!==0?h(a):void 0;c&&(t.setStyle("margin-left",c,i),l==0&&n.canApplyMarginOnList&&(n.marginLeft===void 0&&(n.marginLeft=c),c!==n.marginLeft&&(n.canApplyMarginOnList=!1),n.topLevelListItemElements.push(i)))}function x(){return{marginLeft:void 0,canApplyMarginOnList:!0,topLevelListItemElements:[]}}function v(t,e,n){if(n.canApplyMarginOnList&&n.marginLeft&&n.topLevelListItemElements.length>0){t.setStyle("margin-left",n.marginLeft,e[0].listElement);for(const s of n.topLevelListItemElements)t.removeStyle("margin-left",s)}}function D(t,e){for(const n of e.createRangeIn(t)){const s=n.item;if(s.is("element","li")){const i=s.getChild(0);i&&i.is("element","p")&&e.unwrapElement(i)}}}function W(t,e){const n=e.createRangeIn(t),s=[],i=new Set;for(const l of n.getItems()){if(!l.is("element")||!l.name.match(/^(p|h\d+|li|div)$/))continue;let o=G(l);if(o!==void 0&&parseFloat(o)==0&&!Array.from(l.getClassNames()).find(r=>r.startsWith("MsoList"))&&(o=void 0),l.hasStyle("mso-list")&&l.getStyle("mso-list")!=="none"||o!==void 0&&i.has(o)){const r=V(l);s.push({element:l,id:r.id,order:r.order,indent:r.indent,marginLeft:o}),o!==void 0&&i.add(o)}else i.clear()}return s}function N(t){const e=t.element.previousSibling;if(!e){const n=t.element.parent;return S(n)&&(!n.previousSibling||S(n.previousSibling))}return S(e)}function S(t){return t.is("element","ol")||t.is("element","ul")}function w(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),s=/mso-level-number-format:([^;]{0,100});/gi,i=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,l=new RegExp(`@list\\s+l${t.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),o=new RegExp(`@list l${t.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),r=l.exec(e),a=o.exec(e),c=r&&!a,f=n.exec(e);let m="decimal",u="ol",g=null;if(f&&f[1]){const d=s.exec(f[1]);if(d&&d[1]&&(m=d[1].trim(),u=m!=="bullet"&&m!=="image"?"ol":"ul"),m==="bullet"){const p=F(t.element);p&&(m=p)}else{const p=i.exec(f[1]);p&&p[1]&&(g=parseInt(p[1]))}c&&(u="ol")}return{type:u,startIndex:g,style:$(m),isLegalStyleList:c}}function F(t){if(t.name=="li"&&t.parent.name=="ul"&&t.parent.hasAttribute("type"))return t.parent.getAttribute("type");const e=_(t);if(!e)return null;const n=e._data;return n==="o"?"circle":n==="·"?"disc":n==="§"?"square":null}function _(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const n=e.getChild(0);if(n)return n.is("$text")?n:n.getChild(0)}return null}function $(t){if(t.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(t){case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return t;default:return null}}function z(t,e,n){const s=e.createElement(t.type);return t.style&&e.setStyle("list-style-type",t.style,s),t.startIndex&&t.startIndex>1&&e.setAttribute("start",t.startIndex,s),t.isLegalStyleList&&n&&e.addClass("legal-list",s),s}function V(t){const e=t.getStyle("mso-list");if(e===void 0)return{};const n=e.match(/(^|\s{1,100})l(\d+)/i),s=e.match(/\s{0,100}lfo(\d+)/i),i=e.match(/\s{0,100}level(\d+)/i);return n&&s&&i?{id:n[2],order:s[1],indent:parseInt(i[1])}:{indent:1}}function j(t,e){const n=new b({name:"span",styles:{"mso-list":"Ignore"}}),s=e.createRangeIn(t);for(const i of s)i.type==="elementStart"&&n.match(i.item)&&e.remove(i.item)}function G(t){const e=t.getStyle("margin-left");return e===void 0||e.endsWith("px")?e:E(e)}function H(t,e){if(!t.childCount)return;const n=new y(t.document),s=U(t,n);X(s,t,n),K(s,t,n),J(t,n);const i=Q(t,n);i.length&&Z(i,Y(e),n)}function q(t){return btoa(t.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(""))}function U(t,e){const n=e.createRangeIn(t),s=new b({name:/v:(.+)/}),i=[];for(const l of n){if(l.type!="elementStart")continue;const o=l.item,r=o.previousSibling,a=r&&r.is("element")?r.name:null,c=["Chart"],f=s.match(o),m=o.getAttribute("o:gfxdata"),u=a==="v:shapetype",g=m&&c.some(d=>o.getAttribute("id").includes(d));f&&m&&!u&&!g&&i.push(l.item.getAttribute("id"))}return i}function X(t,e,n){const s=n.createRangeIn(e),i=new b({name:"img"}),l=[];for(const o of s)if(o.item.is("element")&&i.match(o.item)){const r=o.item,a=r.getAttribute("v:shapes")?r.getAttribute("v:shapes").split(" "):[];a.length&&a.every(c=>t.indexOf(c)>-1)?l.push(r):r.getAttribute("src")||l.push(r)}for(const o of l)n.remove(o)}function J(t,e){const n=e.createRangeIn(t),s=new b({name:/v:(.+)/}),i=[];for(const l of n)l.type=="elementStart"&&s.match(l.item)&&i.push(l.item);for(const l of i)e.remove(l)}function K(t,e,n){const s=n.createRangeIn(e),i=[];for(const r of s)if(r.type=="elementStart"&&r.item.is("element","v:shape")){const a=r.item.getAttribute("id");if(t.includes(a))continue;l(r.item.parent.getChildren(),a)||i.push(r.item)}for(const r of i){const a={src:o(r)};r.hasAttribute("alt")&&(a.alt=r.getAttribute("alt"));const c=n.createElement("img",a);n.insertChild(r.index+1,c,r.parent)}function l(r,a){for(const c of r){if(c.is("element")&&(c.name=="img"&&c.getAttribute("v:shapes")==a||l(c.getChildren(),a)))return!0}return!1}function o(r){for(const a of r.getChildren()){if(a.is("element")&&a.getAttribute("src"))return a.getAttribute("src")}}}function Q(t,e){const n=e.createRangeIn(t),s=new b({name:"img"}),i=[];let l=0;for(const o of n)o.item.is("element")&&s.match(o.item)&&(o.item.getAttribute("src").startsWith("file://")&&i.push({element:o.item,imageIndex:l}),l++);return i}function Y(t){if(!t)return[];const e=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,n=new RegExp("(?:("+e.source+"))([\\da-fA-F\\s]+)\\}","g"),s=t.match(n),i=[];if(s)for(const l of s){let o=!1;l.includes("\\pngblip")?o="image/png":l.includes("\\jpegblip")&&(o="image/jpeg"),o&&i.push({hex:l.replace(e,"").replace(/[^\da-fA-F]/g,""),type:o})}return i}function Z(t,e,n){for(let s=0;s<t.length;s++){const{element:i,imageIndex:l}=t[s],o=e[l];if(o){const r=`data:${o.type};base64,${q(o.hex)}`;n.setAttribute("src",r,i)}}}function ee(t){const e=[],n=new y(t.document);for(const{item:s}of n.createRangeIn(t))if(s.is("element")){for(const i of s.getClassNames())/\bmso/gi.exec(i)&&n.removeClass(i,s);for(const i of s.getStyleNames())/\bmso/gi.exec(i)&&n.removeStyle(i,s);(s.is("element","w:sdt")||s.is("element","w:sdtpr")&&s.isEmpty||s.is("element","o:p")&&s.isEmpty)&&e.push(s)}for(const s of e){const i=s.parent,l=i.getChildIndex(s);n.insertChild(l,s.getChildren(),i),n.remove(s)}}function te(t,e,n=!1,s=!1){for(const i of e.createRangeIn(t).getItems()){if(!i.is("element","table")&&!i.is("element","td")&&!i.is("element","th"))continue;if(n&&s&&i.is("element","table")){const r=i.parent?.is("element","div")?i.parent:null,a=i.parent?.parent?.is("element","div")?i.parent.parent:null,c=r??a;c&&c.getAttribute("align")==="center"&&!i.getAttribute("align")?(e.setStyle("margin-left","auto",i),e.setStyle("margin-right","auto",i)):c&&c.getAttribute("align")==="right"&&!i.getAttribute("align")?(e.setStyle("margin-left","auto",i),e.setStyle("margin-right","0",i)):!c&&!i.getAttribute("align")&&(e.setStyle("margin-left","0",i),e.setStyle("margin-right","auto",i))}const l=["left","top","right","bottom"];if(l.every(r=>!i.hasStyle(`border-${r}-style`)))e.setStyle("border-style","none",i);else for(const r of l)i.hasStyle(`border-${r}-style`)||e.setStyle(`border-${r}-style`,"none",i);const o=["width","height",...l.map(r=>`border-${r}-width`),...l.map(r=>`padding-${r}`)];for(const r of o)i.hasStyle(r)&&e.setStyle(r,E(i.getStyle(r)),i)}}function T(t,e){for(const n of e.createRangeIn(t).getItems())n.is("element","table")&&(n.getStyle("width")==="0px"&&e.removeStyle("width",n),n.getAttribute("width")==="0"&&e.removeAttribute("width",n))}function ne(t,e){const n=new Map,s=new Map;let i=null;for(const{item:o}of e.createRangeIn(t))if(o.is("element")){if(o.getStyle("mso-element")==="footnote-list"){i=o;continue}if(o.hasStyle("mso-footnote-id")){const r=o.findAncestor("element",a=>a.getStyle("mso-element")==="footnote");if(r){const a=r.getAttribute("id");s.set(a,r)}else{const a=o.getStyle("mso-footnote-id");n.set(a,o)}continue}}if(!n.size||!i)return;const l=ie(e);e.replace(i,l);for(const[o,r]of n){const a=s.get(o);if(!a)continue;e.replace(r,oe(e,o));const c=le(e,o);se(e,a);for(const f of a.getChildren()){let m=f;f.is("element")&&(m=e.clone(f,!0)),e.appendChild(m,c.content)}e.appendChild(c.listItem,l)}}function se(t,e){const n=[],s=[];for(const{item:i}of t.createRangeIn(e))if(i.is("element")&&i.getStyle("mso-footnote-id")){n.unshift(i);const{nextSibling:l}=i;l?.is("$text")&&l.data.startsWith(" ")&&s.unshift(l)}for(const i of n)t.remove(i);for(const i of s){const l=i.data.substring(1);if(l.length>0){const o=i.parent,r=o.getChildIndex(i),a=t.createText(l);t.remove(i),t.insertChild(r,a,o)}else t.remove(i)}return e}function ie(t){return t.createElement("ol",{class:"footnotes"})}function oe(t,e){const n=t.createElement("sup",{class:"footnote"}),s=t.createElement("a",{id:`ref-${e}`,href:`#${e}`});return t.appendChild(s,n),n}function le(t,e){const n=t.createElement("li",{id:e,class:"footnote-definition"}),s=t.createElement("a",{href:`#ref-${e}`,class:"footnote-backlink"}),i=t.createElement("div",{class:"footnote-content"});return t.appendChild(t.createText("^"),s),t.appendChild(s,n),t.appendChild(i,n),{listItem:n,content:i}}const re=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,ae=/xmlns:o="urn:schemas-microsoft-com/i;class ce{document;hasMultiLevelListPlugin;hasTablePropertiesPlugin;hasExtendedTableBlockAlignment;constructor(e,n=!1,s=!1,i=!1){this.document=e,this.hasMultiLevelListPlugin=n,this.hasTablePropertiesPlugin=s,this.hasExtendedTableBlockAlignment=i}isActive(e){return re.test(e)||ae.test(e)}execute(e){const n=new y(this.document),{body:s,stylesString:i}=e._parsedData;R(s,n),k(s,i,this.hasMultiLevelListPlugin),H(s,e.dataTransfer.getData("text/rtf")),te(s,n,this.hasTablePropertiesPlugin,this.hasExtendedTableBlockAlignment),T(s,n),ne(s,n),ee(s),e.content=s}}function fe(t,e){for(const n of t.getChildren())if(n.is("element","b")&&n.getStyle("font-weight")==="normal"){const s=t.getChildIndex(n);e.remove(n),e.insertChild(s,n.getChildren(),t)}}function me(t,e){const n=new C(e.document.stylesProcessor),s=new L(n,{renderingMode:"data"}),i=s.blockElements,l=s.inlineObjectElements,o=[];for(const r of e.createRangeIn(t)){const a=r.item;if(a.is("element","br")){const c=I(a,"forward",e,{blockElements:i,inlineObjectElements:l}),f=I(a,"backward",e,{blockElements:i,inlineObjectElements:l}),m=A(c,i);(A(f,i)||m)&&o.push(a)}}for(const r of o)r.hasClass("Apple-interchange-newline")?e.remove(r):e.replace(r,e.createElement("p"))}function I(t,e,n,{blockElements:s,inlineObjectElements:i}){let l=n.createPositionAt(t,e=="forward"?"after":"before");return l=l.getLastMatchingPosition(({item:o})=>o.is("element")&&!s.includes(o.name)&&!i.includes(o.name),{direction:e}),e=="forward"?l.nodeAfter:l.nodeBefore}function A(t,e){return!!t&&t.is("element")&&e.includes(t.name)}function ue(t,e,n){const s=new Set;for(const i of e.createRangeIn(t).getItems())!i.is("view:$textProxy")||!i.data.includes(" ")||de(i.parent)&&s.add(i.textNode);for(const i of s)ge(i,e,n)}function de(t){let e=t;for(;e;){if(e.is("element")&&e.getStyle?.("white-space")==="pre-wrap")return!0;e=e.parent}return!1}function ge(t,e,n){const{parent:s,data:i}=t,l=i.replaceAll(" "," ".repeat(n)),o=s.getChildIndex(t);e.remove(t),e.insertChild(o,e.createText(l),s)}const pe=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class he{document;constructor(e){this.document=e}isActive(e){return pe.test(e)}execute(e){const n=new y(this.document),{body:s}=e._parsedData;fe(s,n),D(s,n),me(s,n),ue(s,n,8),e.content=s}}function ye(t,e){for(const n of t.getChildren())n.is("element","table")&&n.hasAttribute("xmlns")&&e.removeAttribute("xmlns",n)}function be(t,e){for(const n of t.getChildren())if(n.is("element","google-sheets-html-origin")){const s=t.getChildIndex(n);e.remove(n),e.insertChild(s,n.getChildren(),t)}}function Se(t,e){for(const n of Array.from(t.getChildren()))n.is("element","style")&&e.remove(n)}const xe=/<google-sheets-html-origin/i;class ve{document;constructor(e){this.document=e}isActive(e){return xe.test(e)}execute(e){const n=new y(this.document),{body:s}=e._parsedData;be(s,n),ye(s,n),T(s,n),Se(s,n),e.content=s}}function Ie(t){return P(P(t)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/(<span\s+style=['"]letter-spacing:[^'"]+?['"]>)[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>(&nbsp;|\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)</g,"><")}function Ae(t){t.querySelectorAll("span[style*=spacerun]").forEach(e=>{const n=e,s=n.innerText.length||0;n.innerText=Array(s+1).join("  ").substr(0,s)})}function P(t){return t.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,n)=>n.length===1?" ":Array(n.length+1).join("  ").substr(0,n.length))}function Pe(t,e){const n=new DOMParser;t=t.replace(/<!--\[if gte vml 1]>/g,""),t=t.replace(/<o:SmartTagType(?:\s+[^\s>=]+(?:="[^"]*")?)*\s*\/?>/gi,"");const s=Ie(Ee(t)),i=n.parseFromString(s,"text/html");Ae(i);const l=i.body.innerHTML,o=Ce(i,e),r=Le(i);return{body:o,bodyString:l,styles:r.styles,stylesString:r.stylesString}}function Ce(t,e){const n=new C(e),s=new L(n,{renderingMode:"data"}),i=t.createDocumentFragment(),l=t.body.childNodes;for(;l.length>0;)i.appendChild(l[0]);return s.domToView(i,{skipComments:!0})}function Le(t){const e=[],n=[],s=Array.from(t.getElementsByTagName("style"));for(const i of s)i.sheet&&i.sheet.cssRules&&i.sheet.cssRules.length&&(e.push(i.sheet),n.push(i.innerHTML));return{styles:e,stylesString:n.join(" ")}}function Ee(t){const e="</body>",n="</html>",s=t.indexOf(e);if(s<0)return t;const i=t.indexOf(n,s+e.length);return t.substring(0,s+e.length)+(i>=0?t.substring(i):"")}class Re extends M{static get pluginName(){return"PasteFromOffice"}static get licenseFeatureCode(){return"PFO"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[O]}init(){const e=this.editor,n=e.plugins.get("ClipboardPipeline"),s=e.editing.view.document,i=[],l=this.editor.plugins.has("MultiLevelListEditing"),o=this.editor.plugins.has("TablePropertiesEditing"),r=!!this.editor.config.get("experimentalFlags.useExtendedTableBlockAlignment");i.push(new ce(s,l,o,r)),i.push(new he(s)),i.push(new ve(s)),n.on("inputTransformation",(a,c)=>{if(c._isTransformedWithPasteFromOffice||e.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const m=c.dataTransfer.getData("text/html"),u=i.find(g=>g.isActive(m));u&&(c._parsedData||(c._parsedData=Pe(m,s.stylesProcessor)),u.execute(c),c._isTransformedWithPasteFromOffice=!0)},{priority:"high"})}}export{Re as PasteFromOffice,he as PasteFromOfficeGoogleDocsNormalizer,ve as PasteFromOfficeGoogleSheetsNormalizer,ce as PasteFromOfficeMSWordNormalizer,q as _convertHexToBase64,E as _convertPasteOfficeCssLengthToPx,Ae as _normalizePasteOfficeSpaceRunSpans,Ie as _normalizePasteOfficeSpacing,be as _removePasteGoogleOfficeSheetsTag,ee as _removePasteMSOfficeAttributes,fe as _removePasteOfficeBoldWrapper,T as _removePasteOfficeInvalidTableWidths,Se as _removePasteOfficeStyleBlock,ye as _removePasteOfficeXmlnsAttributes,H as _replacePasteOfficeImagesSourceWithBase64,h as _toPasteOfficePxValue,me as _transformPasteOfficeBlockBrsToParagraphs,R as _transformPasteOfficeBookmarks,k as _transformPasteOfficeListItemLikeElementsIntoLists,te as _transformPasteOfficeTables,D as _unwrapPasteOfficeParagraphInListItem,Pe as parsePasteOfficeHtml};
@@ -1 +1 @@
1
- import{Plugin as a,Command as d}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconRemoveFormat as l}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as g,MenuBarMenuListItemButtonView as f}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{first as c}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";const n="removeFormat";class F extends a{static get pluginName(){return"RemoveFormatUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add(n,()=>{const e=this._createButton(g);return e.set({tooltip:!0}),e}),t.ui.componentFactory.add(`menuBar:${n}`,()=>this._createButton(f))}_createButton(t){const e=this.editor,i=e.locale,s=e.commands.get(n),o=new t(e.locale),r=i.t;return o.set({label:r("Remove Format"),icon:l}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{e.execute(n),e.editing.view.focus()}),o}}class h extends d{_customAttributesHandlers=[];refresh(){const t=this.editor.model;this.isEnabled=!!c(this._getFormattingItems(t.document.selection))}execute(){const t=this.editor.model;t.change(e=>{for(const i of this._getFormattingItems(t.document.selection))if(i.is("selection"))for(const s of this._getFormattingAttributes(i))e.removeSelectionAttribute(s);else{const s=e.createRangeOn(i);for(const o of this._getFormattingAttributes(i))this._removeFormatting(o,i,s,e)}})}registerCustomAttribute(t,e){this._customAttributesHandlers.push({isFormatting:t,removeFormatting:e})}_removeFormatting(t,e,i,s){let o=!1;for(const{isFormatting:r,removeFormatting:u}of this._customAttributesHandlers)r(t,e)&&(u(t,i,s),o=!0);o||s.removeAttribute(t,i)}*_getFormattingItems(t){const e=this.editor.model,i=e.schema,s=o=>!!c(this._getFormattingAttributes(o));for(const o of t.getRanges())for(const r of o.getItems())i.isBlock(r)&&o.end.isTouching(e.createPositionAt(r,0))||s(r)&&(yield r);for(const o of t.getSelectedBlocks())s(o)&&(yield o);s(t)&&(yield t)}*_getFormattingAttributes(t){const e=this.editor.model.schema;for(const[i]of t.getAttributes()){for(const{isFormatting:o}of this._customAttributesHandlers)o(i,t)&&(yield i);const s=e.getAttributeProperties(i);s&&s.isFormatting&&(yield i)}}}class b extends a{static get pluginName(){return"RemoveFormatEditing"}static get licenseFeatureCode(){return"RF"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){const t=this.editor;t.commands.add("removeFormat",new h(t))}}class p extends a{static get requires(){return[b,F]}static get pluginName(){return"RemoveFormat"}static get isOfficialPlugin(){return!0}}export{p as RemoveFormat,h as RemoveFormatCommand,b as RemoveFormatEditing,F as RemoveFormatUI};
1
+ import{Plugin as a,Command as d}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconRemoveFormat as l}from"../../../../../@ckeditor_ckeditor5-icons@47.6.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as g,MenuBarMenuListItemButtonView as f}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{first as c}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";const n="removeFormat";class F extends a{static get pluginName(){return"RemoveFormatUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add(n,()=>{const e=this._createButton(g);return e.set({tooltip:!0}),e}),t.ui.componentFactory.add(`menuBar:${n}`,()=>this._createButton(f))}_createButton(t){const e=this.editor,i=e.locale,s=e.commands.get(n),o=new t(e.locale),r=i.t;return o.set({label:r("Remove Format"),icon:l}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{e.execute(n),e.editing.view.focus()}),o}}class h extends d{_customAttributesHandlers=[];refresh(){const t=this.editor.model;this.isEnabled=!!c(this._getFormattingItems(t.document.selection))}execute(){const t=this.editor.model;t.change(e=>{for(const i of this._getFormattingItems(t.document.selection))if(i.is("selection"))for(const s of this._getFormattingAttributes(i))e.removeSelectionAttribute(s);else{const s=e.createRangeOn(i);for(const o of this._getFormattingAttributes(i))this._removeFormatting(o,i,s,e)}})}registerCustomAttribute(t,e){this._customAttributesHandlers.push({isFormatting:t,removeFormatting:e})}_removeFormatting(t,e,i,s){let o=!1;for(const{isFormatting:r,removeFormatting:u}of this._customAttributesHandlers)r(t,e)&&(u(t,i,s),o=!0);o||s.removeAttribute(t,i)}*_getFormattingItems(t){const e=this.editor.model,i=e.schema,s=o=>!!c(this._getFormattingAttributes(o));for(const o of t.getRanges())for(const r of o.getItems())i.isBlock(r)&&o.end.isTouching(e.createPositionAt(r,0))||s(r)&&(yield r);for(const o of t.getSelectedBlocks())s(o)&&(yield o);s(t)&&(yield t)}*_getFormattingAttributes(t){const e=this.editor.model.schema;for(const[i]of t.getAttributes()){for(const{isFormatting:o}of this._customAttributesHandlers)o(i,t)&&(yield i);const s=e.getAttributeProperties(i);s&&s.isFormatting&&(yield i)}}}class b extends a{static get pluginName(){return"RemoveFormatEditing"}static get licenseFeatureCode(){return"RF"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){const t=this.editor;t.commands.add("removeFormat",new h(t))}}class p extends a{static get requires(){return[b,F]}static get pluginName(){return"RemoveFormat"}static get isOfficialPlugin(){return!0}}export{p as RemoveFormat,h as RemoveFormatCommand,b as RemoveFormatEditing,F as RemoveFormatUI};
@@ -1 +1 @@
1
- import{Plugin as o,Command as a}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{getCode as u,parseKeystroke as d}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconSelectAll as m}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as g,MenuBarMenuListItemButtonView as f}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class A extends a{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!r(e.schema,i))do if(i=i.parent,!i)return;while(!r(e.schema,i));e.change(n=>{n.setSelection(i,"in")})}}function r(l,e){return l.isLimit(e)&&(l.checkChild(e,"$text")||l.checkChild(e,"paragraph"))}const p=d("Ctrl+A");class h extends o{static get pluginName(){return"SelectAllEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=e.editing.view.document;e.commands.add("selectAll",new A(e)),this.listenTo(n,"keydown",(c,s)=>{u(s)===p&&(e.execute("selectAll"),s.preventDefault())}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}}class S extends o{static get pluginName(){return"SelectAllUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",()=>{const t=this._createButton(g);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:selectAll",()=>this._createButton(f))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("selectAll"),c=new e(t.locale),s=i.t;return c.set({label:s("Select all"),icon:m,keystroke:"Ctrl+A"}),c.bind("isEnabled").to(n,"isEnabled"),this.listenTo(c,"execute",()=>{t.execute("selectAll"),t.editing.view.focus()}),c}}class E extends o{static get requires(){return[h,S]}static get pluginName(){return"SelectAll"}static get isOfficialPlugin(){return!0}}export{E as SelectAll,A as SelectAllCommand,h as SelectAllEditing,S as SelectAllUI};
1
+ import{Plugin as o,Command as a}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{getCode as u,parseKeystroke as d}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconSelectAll as m}from"../../../../../@ckeditor_ckeditor5-icons@47.6.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as g,MenuBarMenuListItemButtonView as f}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class A extends a{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!r(e.schema,i))do if(i=i.parent,!i)return;while(!r(e.schema,i));e.change(n=>{n.setSelection(i,"in")})}}function r(l,e){return l.isLimit(e)&&(l.checkChild(e,"$text")||l.checkChild(e,"paragraph"))}const p=d("Ctrl+A");class h extends o{static get pluginName(){return"SelectAllEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=e.editing.view.document;e.commands.add("selectAll",new A(e)),this.listenTo(n,"keydown",(c,s)=>{u(s)===p&&(e.execute("selectAll"),s.preventDefault())}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}}class S extends o{static get pluginName(){return"SelectAllUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",()=>{const t=this._createButton(g);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:selectAll",()=>this._createButton(f))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("selectAll"),c=new e(t.locale),s=i.t;return c.set({label:s("Select all"),icon:m,keystroke:"Ctrl+A"}),c.bind("isEnabled").to(n,"isEnabled"),this.listenTo(c,"execute",()=>{t.execute("selectAll"),t.editing.view.focus()}),c}}class E extends o{static get requires(){return[h,S]}static get pluginName(){return"SelectAll"}static get isOfficialPlugin(){return!0}}export{E as SelectAll,A as SelectAllCommand,h as SelectAllEditing,S as SelectAllUI};
@@ -1 +1 @@
1
- import{Plugin as c,Command as u}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconShowBlocks as d}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as h,MenuBarMenuListItemButtonView as m}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class w extends u{constructor(t){super(t),this.affectsData=!1,this.value=!1}execute(){const t="ck-show-blocks",e=this.editor.editing.view;e.change(s=>{for(const o of e.document.roots)o.hasClass(t)?(s.removeClass(t,o),this.value=!1):(s.addClass(t,o),this.value=!0)})}}class g extends c{static get pluginName(){return"ShowBlocksEditing"}static get isOfficialPlugin(){return!0}init(){const{editor:t}=this;t.commands.add("showBlocks",new w(t))}}class B extends c{static get pluginName(){return"ShowBlocksUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("showBlocks",()=>{const e=this._createButton(h);return e.set({tooltip:!0,icon:d}),e}),t.ui.componentFactory.add("menuBar:showBlocks",()=>this._createButton(m))}_createButton(t){const e=this.editor,s=e.locale,o=e.commands.get("showBlocks"),i=new t(s),a=s.t;return i.set({label:a("Show blocks"),isToggleable:!0,role:"menuitemcheckbox"}),i.bind("isEnabled").to(o),i.bind("isOn").to(o,"value",o,"isEnabled",(l,r)=>l&&r),this.listenTo(i,"execute",()=>{e.execute("showBlocks"),e.editing.view.focus()}),i}}class S extends c{static get pluginName(){return"ShowBlocks"}static get isOfficialPlugin(){return!0}static get requires(){return[g,B]}}export{S as ShowBlocks,w as ShowBlocksCommand,g as ShowBlocksEditing,B as ShowBlocksUI};
1
+ import{Plugin as c,Command as u}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconShowBlocks as d}from"../../../../../@ckeditor_ckeditor5-icons@47.6.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as h,MenuBarMenuListItemButtonView as m}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class w extends u{constructor(t){super(t),this.affectsData=!1,this.value=!1}execute(){const t="ck-show-blocks",e=this.editor.editing.view;e.change(s=>{for(const o of e.document.roots)o.hasClass(t)?(s.removeClass(t,o),this.value=!1):(s.addClass(t,o),this.value=!0)})}}class g extends c{static get pluginName(){return"ShowBlocksEditing"}static get isOfficialPlugin(){return!0}init(){const{editor:t}=this;t.commands.add("showBlocks",new w(t))}}class B extends c{static get pluginName(){return"ShowBlocksUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("showBlocks",()=>{const e=this._createButton(h);return e.set({tooltip:!0,icon:d}),e}),t.ui.componentFactory.add("menuBar:showBlocks",()=>this._createButton(m))}_createButton(t){const e=this.editor,s=e.locale,o=e.commands.get("showBlocks"),i=new t(s),a=s.t;return i.set({label:a("Show blocks"),isToggleable:!0,role:"menuitemcheckbox"}),i.bind("isEnabled").to(o),i.bind("isOn").to(o,"value",o,"isEnabled",(l,r)=>l&&r),this.listenTo(i,"execute",()=>{e.execute("showBlocks"),e.editing.view.focus()}),i}}class S extends c{static get pluginName(){return"ShowBlocks"}static get isOfficialPlugin(){return!0}static get requires(){return[g,B]}}export{S as ShowBlocks,w as ShowBlocksCommand,g as ShowBlocksEditing,B as ShowBlocksUI};