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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) 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/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
  28. 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
  29. 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
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. 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
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@47.6.0/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +3 -0
  47. 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
  48. 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
  49. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@47.6.0/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +1 -0
  50. 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
  51. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@47.6.0/node_modules/@ckeditor/ckeditor5-link/dist/index.js +1 -0
  52. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@47.6.0/node_modules/@ckeditor/ckeditor5-list/dist/index.js +1 -0
  53. 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
  54. 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
  55. 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
  56. 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
  57. 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
  58. 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
  59. 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
  60. 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
  61. 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
  62. 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
  63. 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
  64. 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
  65. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@47.6.0/node_modules/@ckeditor/ckeditor5-table/dist/index.js +1 -0
  66. 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
  67. 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
  68. 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
  69. 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
  70. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +8 -0
  71. 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
  72. package/dist/node_modules/.pnpm/es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/pick.js +1 -0
  73. package/dist/node_modules/.pnpm/es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isNil.js +1 -0
  74. package/dist/packages/web-components/src/components/popover/gator/popover.gator.scss.js +1 -1
  75. package/dist/packages/web-components/src/components/table/gator/table.gator.scss.js +1 -1
  76. package/dist/types/components/icon/gator/templates/arrows-down-up.d.ts +1 -0
  77. package/dist/types/components/icon/gator/templates/index.d.ts +1 -0
  78. package/dist/types/components/popover/popover.d.ts +2 -0
  79. package/dist/types/components/table/gator/table.gator.d.ts +27 -0
  80. package/dist/types/components/table/table-column-definition.d.ts +8 -0
  81. package/package.json +5 -5
  82. package/web-types.json +35 -5
  83. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@47.5.0/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +0 -3
  84. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@47.5.0/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +0 -1
  85. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@47.5.0/node_modules/@ckeditor/ckeditor5-link/dist/index.js +0 -1
  86. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@47.5.0/node_modules/@ckeditor/ckeditor5-list/dist/index.js +0 -1
  87. 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
  88. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@47.5.0/node_modules/@ckeditor/ckeditor5-table/dist/index.js +0 -1
  89. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +0 -8
  90. /package/dist/assets/node_modules/.pnpm/{ckeditor5@47.5.0 → ckeditor5@47.6.0}/node_modules/ckeditor5/dist/ckeditor5.css +0 -0
  91. /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
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@ncino/web-components",
4
- "version": "9.2.0-preview.3",
4
+ "version": "9.2.1-preview.1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -6438,7 +6438,7 @@
6438
6438
  },
6439
6439
  {
6440
6440
  "name": "ngc-popover",
6441
- "description": "\n---\n\n\n### **Methods:**\n ",
6441
+ "description": "\n---\n\n\n### **Events:**\n - **closed**\n\n### **Methods:**\n ",
6442
6442
  "doc-url": "",
6443
6443
  "attributes": [
6444
6444
  {
@@ -6482,7 +6482,7 @@
6482
6482
  "value": { "type": "string | undefined", "default": "undefined" }
6483
6483
  }
6484
6484
  ],
6485
- "events": [],
6485
+ "events": [{ "name": "closed", "type": "CustomEvent" }],
6486
6486
  "js": {
6487
6487
  "properties": [
6488
6488
  { "name": "referenceId", "type": "string" },
@@ -6497,6 +6497,7 @@
6497
6497
  { "name": "_popoverRef", "type": "Ref<HTMLElement>" },
6498
6498
  { "name": "_cleanup", "type": "(() => void) | undefined" },
6499
6499
  { "name": "popoverId" },
6500
+ { "name": "isOpen" },
6500
6501
  { "name": "referenceElement" },
6501
6502
  { "name": "elementListeners" },
6502
6503
  { "name": "dataTestid", "type": "string | undefined" },
@@ -6504,7 +6505,7 @@
6504
6505
  { "name": "helpTextDataTestid" },
6505
6506
  { "name": "errorMessageDataTestid" }
6506
6507
  ],
6507
- "events": []
6508
+ "events": [{ "name": "closed", "type": "CustomEvent" }]
6508
6509
  }
6509
6510
  },
6510
6511
  {
@@ -7897,7 +7898,7 @@
7897
7898
  },
7898
7899
  {
7899
7900
  "name": "ngc-table",
7900
- "description": "\n---\n\n\n### **Events:**\n - **selectall**\n- **rowselected**\n- **cellchange**\n- **cellclick**",
7901
+ "description": "\n---\n\n\n### **Events:**\n - **selectall**\n- **sort**\n- **filter**\n- **rowselected**\n- **cellchange**\n- **cellclick**",
7901
7902
  "doc-url": "",
7902
7903
  "attributes": [
7903
7904
  {
@@ -7912,6 +7913,14 @@
7912
7913
  "name": "skeleton",
7913
7914
  "value": { "type": "boolean", "default": "false" }
7914
7915
  },
7916
+ {
7917
+ "name": "sort-field",
7918
+ "value": { "type": "string | null", "default": "null" }
7919
+ },
7920
+ {
7921
+ "name": "sort-direction",
7922
+ "value": { "type": "'asc' | 'desc' | null", "default": "null" }
7923
+ },
7915
7924
  {
7916
7925
  "name": "columns",
7917
7926
  "value": { "type": "ColumnDefinition[]", "default": "[]" }
@@ -7947,6 +7956,8 @@
7947
7956
  ],
7948
7957
  "events": [
7949
7958
  { "name": "selectall", "type": "CustomEvent" },
7959
+ { "name": "sort", "type": "CustomEvent" },
7960
+ { "name": "filter", "type": "CustomEvent" },
7950
7961
  { "name": "rowselected", "type": "CustomEvent" },
7951
7962
  { "name": "cellchange", "type": "CustomEvent" },
7952
7963
  { "name": "cellclick", "type": "CustomEvent" }
@@ -7956,8 +7967,25 @@
7956
7967
  { "name": "elevated", "type": "boolean" },
7957
7968
  { "name": "includePagination", "type": "boolean" },
7958
7969
  { "name": "skeleton", "type": "boolean" },
7970
+ { "name": "sortField", "type": "string | null" },
7971
+ { "name": "sortDirection", "type": "'asc' | 'desc' | null" },
7972
+ {
7973
+ "name": "filterValues",
7974
+ "type": "Record<string, string | string[]>"
7975
+ },
7959
7976
  { "name": "selectedRows", "type": "RowData[]" },
7960
7977
  { "name": "_currentPage", "type": "number" },
7978
+ { "name": "_sortField", "type": "string | null" },
7979
+ { "name": "_sortDirection", "type": "'asc' | 'desc' | null" },
7980
+ { "name": "_hoveredHeaderColumnField", "type": "string | null" },
7981
+ {
7982
+ "name": "_pendingFilterValues",
7983
+ "type": "Record<string, string | string[]>"
7984
+ },
7985
+ {
7986
+ "name": "_filterSearchQuery",
7987
+ "type": "Record<string, string>"
7988
+ },
7961
7989
  { "name": "tableElevatedClass" },
7962
7990
  { "name": "showBulkControls" },
7963
7991
  { "name": "displayedRowData" },
@@ -7975,6 +8003,8 @@
7975
8003
  ],
7976
8004
  "events": [
7977
8005
  { "name": "selectall", "type": "CustomEvent" },
8006
+ { "name": "sort", "type": "CustomEvent" },
8007
+ { "name": "filter", "type": "CustomEvent" },
7978
8008
  { "name": "rowselected", "type": "CustomEvent" },
7979
8009
  { "name": "cellchange", "type": "CustomEvent" },
7980
8010
  { "name": "cellclick", "type": "CustomEvent" }
@@ -1,3 +0,0 @@
1
- import{Plugin as f}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{logWarning as X,global as R,uid as x,priorities as S,CKEditorError as Q,toArray as k,isValidAttributeName as Y}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{UpcastWriter as B,HtmlDataProcessor as J,Matcher as M,StylesMap as Z}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Widget as ee,toWidget as K}from"../../../../../@ckeditor_ckeditor5-widget@47.5.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{Enter as te}from"../../../../../@ckeditor_ckeditor5-enter@47.5.0/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{isEqual as N}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/predicate/isEqual.js";import{mergeWith as re}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/mergeWith.js";import{startCase as ie}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/string/startCase.js";import{isPlainObject as oe}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js";import{cloneDeep as le}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/cloneDeep.js";function p(s,e,r,i){e&&ne(s,e,i),r&&w(s,r,i)}function w(s,e,r){if(e.attributes)for(const[i,t]of Object.entries(e.attributes))s.setAttribute(i,t,r);e.styles&&s.setStyle(e.styles,r),e.classes&&s.addClass(e.classes,r)}function ne(s,e,r){if(e.attributes)for(const[i]of Object.entries(e.attributes))s.removeAttribute(i,r);if(e.styles)for(const i of Object.keys(e.styles))s.removeStyle(i,r);e.classes&&s.removeClass(e.classes,r)}function se(s,e){const r=le(s);let i="attributes";for(i in e)i=="classes"?r[i]=Array.from(new Set([...s[i]||[],...e[i]])):r[i]={...s[i],...e[i]};return r}function v(s,e,r,i,t){const o=e.getAttribute(r),l={};for(const n of["attributes","styles","classes"]){if(n!=i){o&&o[n]&&(l[n]=o[n]);continue}if(i=="classes"){const a=new Set(o&&o.classes||[]);t(a),a.size&&(l[n]=Array.from(a));continue}const m=new Map(Object.entries(o&&o[n]||{}));t(m),m.size&&(l[n]=Object.fromEntries(m))}Object.keys(l).length?e.is("documentSelection")?s.setSelectionAttribute(r,l):s.setAttribute(r,l,e):o&&(e.is("documentSelection")?s.removeSelectionAttribute(r):s.removeAttribute(r,e))}function me(s,e,r){for(const i of e.getItems({shallow:!0})){const t=i.getAttribute(s);t&&t.attributes&&Object.keys(t.attributes).length?Object.keys(t).length>1&&r.setAttribute(s,{attributes:t.attributes},i):r.removeAttribute(s,i)}}function ae(s){return ie(s).replace(/ /g,"")}function b(s){return`html${ae(s)}Attributes`}function V({model:s}){return(e,r)=>r.writer.createElement(s,{htmlContent:e.getCustomProperty("$rawContent")})}function ue(s,{view:e,isInline:r}){const i=s.t;return(t,{writer:o})=>{const l=i("HTML object"),n=P(e,t,o),m=t.getAttribute(b(e));o.addClass("html-object-embed__content",n),m&&w(o,m,n);const a=o.createContainerElement(r?"span":"div",{class:"html-object-embed","data-html-object-embed-label":l},n);return K(a,o,{label:l})}}function P(s,e,r){return r.createRawElement(s,null,(i,t)=>{t.setContentOf(i,e.getAttribute("htmlContent"))})}function ce({view:s,model:e,allowEmpty:r},i){return o=>{o.on(`element:${s}`,(l,n,m)=>{let a=i.processViewAttributes(n.viewItem,m);if(!(!a&&!m.consumable.test(n.viewItem,{name:!0}))){if(a=a||{},m.consumable.consume(n.viewItem,{name:!0}),n.modelRange||(n=Object.assign(n,m.convertChildren(n.viewItem,n.modelCursor))),r&&n.modelRange.isCollapsed&&Object.keys(a).length){const u=m.writer.createElement("htmlEmptyElement");if(!m.safeInsert(u,n.modelCursor))return;const c=m.getSplitParts(u);n.modelRange=m.writer.createRange(n.modelRange.start,m.writer.createPositionAfter(c[c.length-1])),m.updateConversionResult(u,n),t(u,a,m);return}for(const u of n.modelRange.getItems())t(u,a,m)}},{priority:"low"})};function t(o,l,n){if(n.schema.checkAttribute(o,e)){const m=o.getAttribute(e),a=se(l,m||{});n.writer.setAttribute(e,a,o)}}}function j({model:s,view:e},r){return(i,{writer:t,consumable:o})=>{if(!i.hasAttribute(s))return null;const l=t.createContainerElement(e),n=i.getAttribute(s);return o.consume(i,`attribute:${s}`),w(t,n,l),l.getFillerOffset=()=>null,r?K(l,t):l}}function de({priority:s,view:e}){return(r,i)=>{if(!r)return;const{writer:t}=i,o=t.createAttributeElement(e,null,{priority:s});return w(t,r,o),o}}function E({view:s},e){return r=>{r.on(`element:${s}`,(i,t,o)=>{if(!t.modelRange||t.modelRange.isCollapsed)return;const l=e.processViewAttributes(t.viewItem,o);l&&o.writer.setAttribute(b(t.viewItem.name),l,t.modelRange)},{priority:"low"})}}function F({view:s,model:e}){return r=>{r.on(`attribute:${b(s)}:${e}`,(i,t,o)=>{if(!o.consumable.consume(t.item,i.name))return;const{attributeOldValue:l,attributeNewValue:n}=t,m=o.writer,a=o.mapper.toViewElement(t.item);p(m,l,n,a)})}}const L={block:[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"horizontalLine",view:"hr"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6","$text"],allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowIn:["$root","$container"],allowChildren:["paragraph","htmlP","htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDiv"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",allowIn:"htmlDiv",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",allowIn:"htmlDiv",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlHr",view:"hr",isEmpty:!0,modelSchema:{inheritAllFrom:"$blockObject"}}],inline:[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{isFormatting:!0}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}]};class C extends f{_definitions=[];static get pluginName(){return"DataSchema"}static get isOfficialPlugin(){return!0}init(){for(const e of L.block)this.registerBlockElement(e);for(const e of L.inline)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push({...e,isBlock:!0})}registerInlineElement(e){this._definitions.push({...e,isInline:!0})}extendBlockElement(e){this._extendDefinition({...e,isBlock:!0})}extendInlineElement(e){this._extendDefinition({...e,isInline:!0})}getDefinitionsForView(e,r=!1){const i=new Set;for(const t of this._getMatchingViewDefinitions(e)){if(r)for(const o of this._getReferences(t.model))i.add(o);i.add(t)}return i}getDefinitionsForModel(e){return this._definitions.filter(r=>r.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(r=>r.view&&he(e,r.view))}*_getReferences(e){const r=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],i=this._definitions.filter(t=>t.model==e);for(const{modelSchema:t}of i)if(t)for(const o of r)for(const l of k(t[o]||[])){const n=this._definitions.filter(m=>m.model==l);for(const m of n)l!==e&&(yield*this._getReferences(m.model),yield m)}}_extendDefinition(e){const r=Array.from(this._definitions.entries()).filter(([,i])=>i.model==e.model);if(r.length==0){this._definitions.push(e);return}for(const[i,t]of r)this._definitions[i]=re({},t,e,(o,l)=>Array.isArray(o)?o.concat(l):void 0)}}function he(s,e){return typeof s=="string"?s===e:s instanceof RegExp?s.test(e):!1}class h extends f{_dataSchema;_allowedAttributes;_disallowedAttributes;_allowedElements;_disallowedElements;_dataInitialized;_coupledAttributes;constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new M,this._disallowedAttributes=new M,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return"DataFilter"}static get isOfficialPlugin(){return!0}static get requires(){return[C,ee]}loadAllowedConfig(e){for(const r of e){const i=r.name||/[\s\S]+/,t=U(r);this.allowElement(i),t.forEach(o=>this.allowAttributes(o))}}loadDisallowedConfig(e){for(const r of e){const i=r.name||/[\s\S]+/,t=U(r);t.length==0?this.disallowElement(i):t.forEach(o=>this.disallowAttributes(o))}}loadAllowedEmptyElementsConfig(e){for(const r of e)this.allowEmptyElement(r)}allowElement(e){for(const r of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(r),this._coupledAttributes=null}disallowElement(e){for(const r of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(r.view)}allowEmptyElement(e){for(const r of this._dataSchema.getDefinitionsForView(e,!0))r.isInline&&this._dataSchema.extendInlineElement({...r,allowEmpty:!0})}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,r){const{consumable:i}=r;return W(e,this._disallowedAttributes,i),fe(e,W(e,this._allowedAttributes,i))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(const r of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))r.isBlock&&this._addAllowedElement(r);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:S.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:S.highest+1})}_registerElementHandlers(){this.on("register",(e,r)=>{const i=this.editor.model.schema;if(r.isObject&&!i.isRegistered(r.model))this._registerObjectElement(r);else if(r.isBlock)this._registerBlockElement(r);else if(r.isInline)this._registerInlineElement(r);else throw new Q("data-filter-invalid-definition",null,r);e.stop()},{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const e=this.editor.model,r=e.document.selection;e.document.registerPostFixer(i=>{const t=e.document.differ.getChanges();let o=!1;const l=this._getCoupledAttributesMap();for(const n of t){if(n.type!="attribute"||n.attributeNewValue!==null)continue;const m=l.get(n.attributeKey);if(m)for(const{item:a}of n.range.getWalker())for(const u of m)a.hasAttribute(u)&&(i.removeAttribute(u,a),o=!0)}return o}),this.listenTo(r,"change:attribute",(i,{attributeKeys:t})=>{const o=new Set,l=this._getCoupledAttributesMap();for(const n of t){if(r.hasAttribute(n))continue;const m=l.get(n);if(m)for(const a of m)r.hasAttribute(a)&&o.add(a)}o.size!=0&&e.change(n=>{for(const m of o)n.removeSelectionAttribute(m)})})}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer(r=>{const i=e.document.differ.getChanges();let t=!1;for(const o of i)if(!(o.type!=="insert"||o.name==="$text"))for(const l of o.attributes.keys())!l.startsWith("html")||!l.endsWith("Attributes")||e.schema.checkAttribute(o.name,l)||(r.removeAttribute(l,o.position.nodeAfter),t=!0);return t})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const r=this._coupledAttributes.get(e.coupledAttribute);r?r.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const r=this.editor,i=r.model.schema,t=r.conversion,{view:o,model:l}=e;i.register(l,e.modelSchema);o&&(i.extend(e.model,{allowAttributes:[b(o),"htmlContent"]}),r.data.registerRawContentMatcher({name:o}),t.for("upcast").elementToElement({view:o,model:V(e),converterPriority:S.low+2}),t.for("upcast").add(E(e,this)),t.for("editingDowncast").elementToStructure({model:{name:l,attributes:[b(o)]},view:ue(r,e)}),t.for("dataDowncast").elementToElement({model:l,view:(n,{writer:m})=>P(o,n,m)}),t.for("dataDowncast").add(F(e)))}_registerBlockElement(e){const r=this.editor,i=r.model.schema,t=r.conversion,{view:o,model:l}=e;if(!i.isRegistered(e.model)){if(!e.modelSchema||(i.register(e.model,e.modelSchema),!o))return;t.for("upcast").elementToElement({model:l,view:o,converterPriority:S.low+2}),t.for("downcast").elementToElement({model:l,view:(n,{writer:m})=>e.isEmpty?m.createEmptyElement(o):m.createContainerElement(o)})}o&&(i.extend(e.model,{allowAttributes:b(o)}),t.for("upcast").add(E(e,this)),t.for("downcast").add(F(e)))}_registerInlineElement(e){const r=this.editor,i=r.model.schema,t=r.conversion,o=e.model;if(!e.appliesToBlock&&(i.extend("$text",{allowAttributes:o}),e.attributeProperties&&i.setAttributeProperties(o,e.attributeProperties),t.for("upcast").add(ce(e,this)),t.for("downcast").attributeToElement({model:o,view:de(e)}),!!e.allowEmpty)){if(i.setAttributeProperties(o,{copyFromObject:!1}),!i.isRegistered("htmlEmptyElement")){i.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"});const l=n=>Array.from(n.getAttributeKeys()).some(m=>m.startsWith("html"));r.model.document.registerPostFixer(n=>{const m=r.model.document.differ.getChanges(),a=new Set;for(const u of m)if(u.type!=="remove"){if(u.type==="attribute"&&u.attributeNewValue===null)for(const{item:c}of u.range)c.is("element","htmlEmptyElement")&&!l(c)&&a.add(c);if(u.type==="insert"&&u.position.nodeAfter){const c=u.position.nodeAfter;for(const{item:d}of n.createRangeOn(c))d.is("element","htmlEmptyElement")&&!l(d)&&a.add(d)}}for(const u of a)n.remove(u);return a.size>0})}r.data.htmlProcessor.domConverter.registerInlineObjectMatcher(l=>l.name==e.view&&l.isEmpty&&Array.from(l.getAttributeKeys()).length?{name:!0}:null),t.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:j(e,!0)}),t.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:j(e)})}}}function W(s,e,r){const i=e.matchAll(s)||[],t=s.document.stylesProcessor;return i.reduce((o,{match:l})=>{for(const[n,m]of l.attributes||[])if(n=="style"){const a=m,u=t.getRelatedStyles(a).filter(c=>c.split("-").length>a.split("-").length).sort((c,d)=>d.split("-").length-c.split("-").length);for(const c of u)r.consume(s,{styles:[c]})&&o.styles.push(c);r.consume(s,{styles:[a]})&&o.styles.push(a)}else if(n=="class"){const a=m;r.consume(s,{classes:[a]})&&o.classes.push(a)}else r.consume(s,{attributes:[n]})&&o.attributes.push(n);return o},{attributes:[],classes:[],styles:[]})}function fe(s,{attributes:e,classes:r,styles:i}){return!e.length&&!r.length&&!i.length?null:{...e.length&&{attributes:ge(s,e)},...i.length&&{styles:be(s,i)},...r.length&&{classes:r}}}function ge(s,e){const r={};for(const i of e){const t=s.getAttribute(i);t!==void 0&&Y(i)&&(r[i]=t)}return r}function be(s,e){const r=new Z(s.document.stylesProcessor);for(const i of e){const t=s.getStyle(i);t!==void 0&&r.set(i,t)}return Object.fromEntries(r.getStylesEntries())}function H(s,e){const{name:r}=s,i=s[e];return oe(i)?Object.entries(i).map(([t,o])=>({name:r,[e]:{[t]:o}})):Array.isArray(i)?i.map(t=>({name:r,[e]:[t]})):[s]}function U(s){const{name:e,attributes:r,classes:i,styles:t}=s,o=[];return r&&o.push(...H({name:e,attributes:r},"attributes")),i&&o.push(...H({name:e,classes:i},"classes")),t&&o.push(...H({name:e,styles:t},"styles")),o}class pe extends f{static get requires(){return[h]}static get pluginName(){return"CodeBlockElementSupport"}static get isOfficialPlugin(){return!0}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(h);e.on("register:pre",(r,i)=>{if(i.model!=="codeBlock")return;const t=this.editor,o=t.model.schema,l=t.conversion;o.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),l.for("upcast").add(we(e)),l.for("downcast").add(Ae()),r.stop()})}}function we(s){return e=>{e.on("element:code",(r,i,t)=>{const o=i.viewItem,l=o.parent;if(!l||!l.is("element","pre"))return;n(l,"htmlPreAttributes"),n(o,"htmlContentAttributes");function n(m,a){const u=s.processViewAttributes(m,t);u&&t.writer.setAttribute(a,u,i.modelRange)}},{priority:"low"})}}function Ae(){return s=>{s.on("attribute:htmlPreAttributes:codeBlock",(e,r,i)=>{if(!i.consumable.consume(r.item,e.name))return;const{attributeOldValue:t,attributeNewValue:o}=r,n=i.mapper.toViewElement(r.item).parent;p(i.writer,t,o,n)}),s.on("attribute:htmlContentAttributes:codeBlock",(e,r,i)=>{if(!i.consumable.consume(r.item,e.name))return;const{attributeOldValue:t,attributeNewValue:o}=r,l=i.mapper.toViewElement(r.item);p(i.writer,t,o,l)})}}class ve extends f{static get requires(){return[h]}static get pluginName(){return"DualContentModelElementSupport"}static get isOfficialPlugin(){return!0}init(){this.editor.plugins.get(h).on("register",(r,i)=>{const t=i,o=this.editor,l=o.model.schema,n=o.conversion;if(!t.paragraphLikeModel||l.isRegistered(t.model)||l.isRegistered(t.paragraphLikeModel))return;const m={model:t.paragraphLikeModel,view:t.view};l.register(t.model,t.modelSchema),l.register(m.model,{inheritAllFrom:"$block"}),n.for("upcast").elementToElement({view:t.view,model:(a,{writer:u})=>this._hasBlockContent(a)?u.createElement(t.model):u.createElement(m.model),converterPriority:S.low+.5}),n.for("downcast").elementToElement({view:t.view,model:t.model}),this._addAttributeConversion(t),n.for("downcast").elementToElement({view:m.view,model:m.model}),this._addAttributeConversion(m),r.stop()})}_hasBlockContent(e){const r=this.editor.editing.view,i=r.domConverter.blockElements;for(const t of r.createRangeIn(e).getItems())if(t.is("element")&&i.includes(t.name))return!0;return!1}_addAttributeConversion(e){const r=this.editor,i=r.conversion,t=r.plugins.get(h);r.model.schema.extend(e.model,{allowAttributes:b(e.view)}),i.for("upcast").add(E(e,t)),i.for("downcast").add(F(e))}}class ye extends f{static get requires(){return[C,te]}static get pluginName(){return"HeadingElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const r=e.config.get("heading.options");this.registerHeadingElements(e,r)}registerHeadingElements(e,r){const i=e.plugins.get(C),t=[];for(const o of r)"model"in o&&"view"in o&&(i.registerBlockElement({view:o.view,model:o.model}),t.push(o.model));i.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:t}}),i.extendBlockElement({model:"htmlSummary",modelSchema:{allowChildren:t}})}}function O(s,e,r){const i=s.createRangeOn(e);for(const{item:t}of i.getWalker())if(t.is("element",r))return t}class Ee extends f{static get requires(){return[h]}static get pluginName(){return"ImageElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const r=e.model.schema,i=e.conversion,t=e.plugins.get(h);t.on("register:figure",()=>{i.for("upcast").add(ke(t))}),t.on("register:img",(o,l)=>{l.model!=="imageBlock"&&l.model!=="imageInline"||(r.isRegistered("imageBlock")&&r.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),r.isRegistered("imageInline")&&r.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),i.for("upcast").add(Ce(t)),i.for("downcast").add(Fe()),e.plugins.has("LinkImage")&&i.for("upcast").add(Se(t,e)),o.stop())})}}function Ce(s){return e=>{e.on("element:img",(r,i,t)=>{if(!i.modelRange)return;const o=i.viewItem,l=s.processViewAttributes(o,t);l&&t.writer.setAttribute("htmlImgAttributes",l,i.modelRange)},{priority:"low"})}}function Se(s,e){const r=e.plugins.get("ImageUtils");return i=>{i.on("element:a",(t,o,l)=>{const n=o.viewItem;if(!r.findViewImgElement(n))return;const a=o.modelCursor.parent;if(!a.is("element","imageBlock"))return;const u=s.processViewAttributes(n,l);u&&l.writer.setAttribute("htmlLinkAttributes",u,a)},{priority:"low"})}}function ke(s){return e=>{e.on("element:figure",(r,i,t)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("image"))return;const l=s.processViewAttributes(o,t);l&&t.writer.setAttribute("htmlFigureAttributes",l,i.modelRange)},{priority:"low"})}}function Fe(){return s=>{e("htmlImgAttributes"),r("img","htmlImgAttributes"),r("figure","htmlFigureAttributes"),r("a","htmlLinkAttributes");function e(i){s.on(`attribute:${i}:imageInline`,(t,o,l)=>{if(!l.consumable.consume(o.item,t.name))return;const{attributeOldValue:n,attributeNewValue:m}=o,a=l.mapper.toViewElement(o.item);p(l.writer,n,m,a)},{priority:"low"})}function r(i,t){s.on(`attribute:${t}:imageBlock`,(o,l,n)=>{if(!n.consumable.test(l.item,o.name))return;const{attributeOldValue:m,attributeNewValue:a}=l,u=n.mapper.toViewElement(l.item),c=O(n.writer,u,i);c&&(p(n.writer,m,a,c),n.consumable.consume(l.item,o.name))},{priority:"low"}),i==="a"&&s.on("attribute:linkHref:imageBlock",(o,l,n)=>{if(!n.consumable.consume(l.item,"attribute:htmlLinkAttributes:imageBlock"))return;const m=n.mapper.toViewElement(l.item),a=O(n.writer,m,"a");w(n.writer,l.item.getAttribute("htmlLinkAttributes"),a)},{priority:"low"})}}}class Oe extends f{static get requires(){return[h]}static get pluginName(){return"MediaEmbedElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const r=e.model.schema,i=e.conversion,t=this.editor.plugins.get(h),o=this.editor.plugins.get(C),l=e.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:l}),t.on("register:figure",()=>{i.for("upcast").add(Pe(t))}),t.on(`register:${l}`,(n,m)=>{m.model==="media"&&(r.extend("media",{allowAttributes:[b(l),"htmlFigureAttributes"]}),i.for("upcast").add(Te(t,l)),i.for("dataDowncast").add(Ie(l)),n.stop())})}}function Te(s,e){const r=(i,t,o)=>{const l=t.viewItem;n(l,b(e));function n(m,a){const u=s.processViewAttributes(m,o);u&&o.writer.setAttribute(a,u,t.modelRange)}};return i=>{i.on(`element:${e}`,r,{priority:"low"})}}function Pe(s){return e=>{e.on("element:figure",(r,i,t)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("media"))return;const l=s.processViewAttributes(o,t);l&&t.writer.setAttribute("htmlFigureAttributes",l,i.modelRange)},{priority:"low"})}}function Ie(s){return e=>{r(s,b(s)),r("figure","htmlFigureAttributes");function r(i,t){e.on(`attribute:${t}:media`,(o,l,n)=>{if(!n.consumable.consume(l.item,o.name))return;const{attributeOldValue:m,attributeNewValue:a}=l,u=n.mapper.toViewElement(l.item),c=O(n.writer,u,i);p(n.writer,m,a,c)})}}}class $e extends f{static get requires(){return[h]}static get pluginName(){return"ScriptElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(h);e.on("register:script",(r,i)=>{const t=this.editor,o=t.model.schema,l=t.conversion;o.register("htmlScript",i.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),t.data.registerRawContentMatcher({name:"script"}),l.for("upcast").elementToElement({view:"script",model:V(i)}),l.for("upcast").add(E(i,e)),l.for("downcast").elementToElement({model:"htmlScript",view:(n,{writer:m})=>P("script",n,m)}),l.for("downcast").add(F(i)),r.stop()})}}const _e=["width","max-width","min-width","height","min-height","max-height"];class He extends f{static get requires(){return[h]}static get pluginName(){return"TableElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const r=e.model.schema,i=e.conversion,t=e.plugins.get(h),o=e.plugins.get("TableUtils");t.on("register:figure",()=>{i.for("upcast").add(Ve(t))}),t.on("register:table",(l,n)=>{n.model==="table"&&(r.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),i.for("upcast").add(Be(t)),i.for("downcast").add(Re()),e.model.document.registerPostFixer(De(e.model,o)),l.stop())})}}function De(s,e){return r=>{const i=s.document.differ.getChanges();let t=!1;for(const o of i){if(o.type!="attribute"||o.attributeKey!="headingRows")continue;const l=o.range.start.nodeAfter,n=l.getAttribute("htmlTheadAttributes"),m=l.getAttribute("htmlTbodyAttributes");n&&!o.attributeNewValue?(r.removeAttribute("htmlTheadAttributes",l),t=!0):m&&o.attributeNewValue==e.getRows(l)&&(r.removeAttribute("htmlTbodyAttributes",l),t=!0)}return t}}function Be(s){return e=>{e.on("element:table",(r,i,t)=>{if(!i.modelRange)return;const o=i.viewItem;t.consumable.consume(o,{classes:"table"}),l(o,"htmlTableAttributes");for(const n of o.getChildren())n.is("element","thead")&&l(n,"htmlTheadAttributes"),n.is("element","tbody")&&l(n,"htmlTbodyAttributes");function l(n,m){const a=s.processViewAttributes(n,t);a&&t.writer.setAttribute(m,a,i.modelRange)}},{priority:"low"})}}function Ve(s){return e=>{e.on("element:figure",(r,i,t)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("table"))return;const l=s.processViewAttributes(o,t);l&&t.writer.setAttribute("htmlFigureAttributes",l,i.modelRange)},{priority:"low"})}}function Re(){return s=>{e("table","htmlTableAttributes"),e("figure","htmlFigureAttributes"),e("thead","htmlTheadAttributes"),e("tbody","htmlTbodyAttributes");function e(r,i){s.on(`attribute:${i}:table`,(t,o,l)=>{if(!l.consumable.test(o.item,t.name))return;const n=l.mapper.toViewElement(o.item),m=O(l.writer,n,r);if(m)if(l.consumable.consume(o.item,t.name),i==="htmlTableAttributes"&&n!==m){const a=q(o.attributeOldValue),u=q(o.attributeNewValue);p(l.writer,a.tableAttributes,u.tableAttributes,m),p(l.writer,a.figureAttributes,u.figureAttributes,n)}else p(l.writer,o.attributeOldValue,o.attributeNewValue,m)})}}}function q(s){const e={},r={...s};if(!s||!("styles"in s))return{figureAttributes:e,tableAttributes:r};r.styles={};for(const[i,t]of Object.entries(s.styles))_e.includes(i)?e.styles={...e.styles,[i]:t}:r.styles={...r.styles,[i]:t};return{figureAttributes:e,tableAttributes:r}}class xe extends f{static get requires(){return[h]}static get pluginName(){return"StyleElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(h);e.on("register:style",(r,i)=>{const t=this.editor,o=t.model.schema,l=t.conversion;o.register("htmlStyle",i.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),t.data.registerRawContentMatcher({name:"style"}),l.for("upcast").elementToElement({view:"style",model:V(i)}),l.for("upcast").add(E(i,e)),l.for("downcast").elementToElement({model:"htmlStyle",view:(n,{writer:m})=>P("style",n,m)}),l.for("downcast").add(F(i)),r.stop()})}}class Me extends f{static get requires(){return[h]}static get pluginName(){return"ListElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const r=e.model.schema,i=e.conversion,t=e.plugins.get(h),o=e.plugins.get("ListEditing"),l=e.plugins.get("ListUtils"),n=["ul","ol","li"];o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:w}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:w}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:w}),t.on("register",(m,a)=>{if(!n.includes(a.view)||(m.stop(),r.checkAttribute("$block","htmlLiAttributes")))return;const u=n.map(c=>b(c));r.extend("$listItem",{allowAttributes:u}),i.for("upcast").add(c=>{c.on("element:ul",D("htmlUlAttributes",t),{priority:"low"}),c.on("element:ol",D("htmlOlAttributes",t),{priority:"low"}),c.on("element:li",D("htmlLiAttributes",t),{priority:"low"})})}),o.on("postFixer",(m,{listNodes:a,writer:u})=>{for(const{node:c,previousNodeInList:d}of a)if(d){if(d.getAttribute("listType")==c.getAttribute("listType")){const g=z(d.getAttribute("listType")),A=d.getAttribute(g);!N(c.getAttribute(g),A)&&u.model.schema.checkAttribute(c,g)&&(u.setAttribute(g,A,c),m.return=!0)}if(d.getAttribute("listItemId")==c.getAttribute("listItemId")){const g=d.getAttribute("htmlLiAttributes");!N(c.getAttribute("htmlLiAttributes"),g)&&u.model.schema.checkAttribute(c,"htmlLiAttributes")&&(u.setAttribute("htmlLiAttributes",g,c),m.return=!0)}}}),o.on("postFixer",(m,{listNodes:a,writer:u})=>{for(const{node:c}of a){const d=c.getAttribute("listType");!l.isNumberedListType(d)&&c.getAttribute("htmlOlAttributes")&&(u.removeAttribute("htmlOlAttributes",c),m.return=!0),l.isNumberedListType(d)&&c.getAttribute("htmlUlAttributes")&&(u.removeAttribute("htmlUlAttributes",c),m.return=!0)}})}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const r=e.commands.get("indentList");this.listenTo(r,"afterExecute",(i,t)=>{e.model.change(o=>{for(const l of t){const n=z(l.getAttribute("listType"));e.model.schema.checkAttribute(l,n)&&o.setAttribute(n,{},l)}})})}}function D(s,e){return(r,i,t)=>{const o=i.viewItem;i.modelRange||Object.assign(i,t.convertChildren(i.viewItem,i.modelCursor));const l=e.processViewAttributes(o,t);for(const n of i.modelRange.getItems({shallow:!0}))n.hasAttribute("listItemId")&&(n.hasAttribute("htmlUlAttributes")||n.hasAttribute("htmlOlAttributes")||t.writer.model.schema.checkAttribute(n,s)&&t.writer.setAttribute(s,l||{},n))}}function z(s){return s==="numbered"||s=="customNumbered"?"htmlOlAttributes":"htmlUlAttributes"}class Ne extends f{static get requires(){return[h]}static get pluginName(){return"HorizontalLineElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("HorizontalLineEditing"))return;const r=e.model.schema,i=e.conversion,t=e.plugins.get(h);t.on("register:hr",(o,l)=>{l.model==="horizontalLine"&&(r.extend("horizontalLine",{allowAttributes:["htmlHrAttributes"]}),i.for("upcast").add(E(l,t)),i.for("downcast").add(je()),o.stop())})}}function je(){return s=>{s.on("attribute:htmlHrAttributes:horizontalLine",(e,r,i)=>{if(!i.consumable.test(r.item,e.name))return;const{attributeOldValue:t,attributeNewValue:o}=r,l=i.mapper.toViewElement(r.item),n=O(i.writer,l,"hr");n&&(p(i.writer,t,o,n),i.consumable.consume(r.item,e.name))},{priority:"low"})}}class Le extends f{static get requires(){return[h,C]}static get pluginName(){return"CustomElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(h),r=this.editor.plugins.get(C);e.on("register:$customElement",(i,t)=>{i.stop();const o=this.editor,l=o.model.schema,n=o.conversion,m=o.editing.view.domConverter.unsafeElements,a=o.data.htmlProcessor.domConverter.preElements;l.register(t.model,t.modelSchema),l.extend(t.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),o.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),n.for("upcast").elementToElement({view:/.*/,model:(u,c)=>{if(u.name=="$comment")return null;if(!We(u.name)||r.getDefinitionsForView(u.name).size)return null;m.includes(u.name)||m.push(u.name),a.includes(u.name)||a.push(u.name);const d=c.writer.createElement(t.model,{htmlElementName:u.name}),g=e.processViewAttributes(u,c);g&&c.writer.setAttribute("htmlCustomElementAttributes",g,d);let A;if(u.is("element","template")&&u.getCustomProperty("$rawContent"))A=u.getCustomProperty("$rawContent");else{const I=new B(u.document).createDocumentFragment(u),$=o.data.htmlProcessor.domConverter.viewToDom(I),_=$.firstChild;for(;_.firstChild;)$.appendChild(_.firstChild);_.remove(),A=o.data.htmlProcessor.htmlWriter.getHtml($)}c.writer.setAttribute("htmlContent",A,d);for(const{item:T}of o.editing.view.createRangeIn(u))c.consumable.consume(T,{name:!0});return d},converterPriority:"low"}),n.for("editingDowncast").elementToElement({model:{name:t.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:c})=>{const d=u.getAttribute("htmlElementName"),g=c.createRawElement(d);return u.hasAttribute("htmlCustomElementAttributes")&&w(c,u.getAttribute("htmlCustomElementAttributes"),g),g}}),n.for("dataDowncast").elementToElement({model:{name:t.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:c})=>{const d=u.getAttribute("htmlElementName"),g=u.getAttribute("htmlContent"),A=c.createRawElement(d,null,(T,I)=>{I.setContentOf(T,g)});return u.hasAttribute("htmlCustomElementAttributes")&&w(c,u.getAttribute("htmlCustomElementAttributes"),A),A}})})}}function We(s){try{document.createElement(s)}catch{return!1}return!0}class rt extends f{static get pluginName(){return"GeneralHtmlSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[h,pe,ve,ye,Ee,Oe,$e,He,xe,Me,Ne,Le]}init(){const e=this.editor,r=e.plugins.get(h);r.loadAllowedEmptyElementsConfig(e.config.get("htmlSupport.allowEmpty")||[]),r.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),r.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[])}afterInit(){this.editor.commands.get("removeFormat")?.registerCustomAttribute(r=>r.startsWith("html")&&r.endsWith("Attributes"),me)}getGhsAttributeNameForElement(e){const r=this.editor.plugins.get("DataSchema"),i=Array.from(r.getDefinitionsForView(e,!1)),t=i.find(o=>o.isInline&&!i[0].isObject);return t?t.model:b(e)}addModelHtmlClass(e,r,i){const t=this.editor.model,o=this.getGhsAttributeNameForElement(e);t.change(l=>{for(const n of y(t,i,o))v(l,n,o,"classes",m=>{for(const a of k(r))m.add(a)})})}removeModelHtmlClass(e,r,i){const t=this.editor.model,o=this.getGhsAttributeNameForElement(e);t.change(l=>{for(const n of y(t,i,o))v(l,n,o,"classes",m=>{for(const a of k(r))m.delete(a)})})}setModelHtmlAttributes(e,r,i){const t=this.editor.model,o=this.getGhsAttributeNameForElement(e);t.change(l=>{for(const n of y(t,i,o))v(l,n,o,"attributes",m=>{for(const[a,u]of Object.entries(r))m.set(a,u)})})}removeModelHtmlAttributes(e,r,i){const t=this.editor.model,o=this.getGhsAttributeNameForElement(e);t.change(l=>{for(const n of y(t,i,o))v(l,n,o,"attributes",m=>{for(const a of k(r))m.delete(a)})})}setModelHtmlStyles(e,r,i){const t=this.editor.model,o=this.getGhsAttributeNameForElement(e);t.change(l=>{for(const n of y(t,i,o))v(l,n,o,"styles",m=>{for(const[a,u]of Object.entries(r))m.set(a,u)})})}removeModelHtmlStyles(e,r,i){const t=this.editor.model,o=this.getGhsAttributeNameForElement(e);t.change(l=>{for(const n of y(t,i,o))v(l,n,o,"styles",m=>{for(const a of k(r))m.delete(a)})})}}function*y(s,e,r){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)s.schema.checkAttributeInSelection(e,r)&&(yield e);else for(const i of Ue(s,e,r))yield*i.getItems({shallow:!0})}function Ue(s,e,r){return!(Symbol.iterator in e)&&(e.is("node")||e.is("$text")||e.is("$textProxy"))?s.schema.checkAttribute(e,r)?[s.createRangeOn(e)]:[]:s.schema.getValidRanges(s.createSelection(e).getRanges(),r)}class it extends f{static get pluginName(){return"HtmlComment"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,r=new Map;e.data.processor.skipComments=!1,e.model.schema.addAttributeCheck((i,t)=>{if(i.endsWith("$root")&&t.startsWith("$comment"))return!0}),e.conversion.for("upcast").elementToMarker({view:"$comment",model:i=>{const o=`$comment:${x()}`,l=i.getCustomProperty("$rawContent");return r.set(o,l),o}}),e.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(i,{writer:t})=>{let o;for(const a of this.editor.model.document.getRootNames())if(o=this.editor.model.document.getRoot(a),o.hasAttribute(i.markerName))break;const l=i.markerName,n=o.getAttribute(l),m=t.createUIElement("$comment");return t.setCustomProperty("$rawContent",n,m),m}}),e.model.document.registerPostFixer(i=>{let t=!1;const o=e.model.document.differ.getChangedMarkers().filter(l=>l.name.startsWith("$comment:"));for(const l of o){const{oldRange:n,newRange:m}=l.data;if(!(n&&m&&n.root==m.root)){if(n){const a=n.root;a.hasAttribute(l.name)&&(i.removeAttribute(l.name,a),t=!0)}if(m){const a=m.root;a.rootName=="$graveyard"?(i.removeMarker(l.name),t=!0):a.hasAttribute(l.name)||(i.setAttribute(l.name,r.get(l.name)||"",a),t=!0)}}}return t}),e.data.on("set",()=>{for(const i of e.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(i.name)},{priority:"high"}),e.model.on("deleteContent",(i,[t])=>{for(const o of t.getRanges()){const l=e.model.schema.getLimitElement(o),n=e.model.createPositionAt(l,0),m=e.model.createPositionAt(l,"end");let a;n.isTouching(o.start)&&m.isTouching(o.end)?a=this.getHtmlCommentsInRange(e.model.createRange(n,m)):a=this.getHtmlCommentsInRange(o,{skipBoundaries:!0});for(const u of a)this.removeHtmlComment(u)}},{priority:"high"})}createHtmlComment(e,r){const i=x(),o=this.editor.model,l=o.document.getRoot(e.root.rootName),n=`$comment:${i}`;return o.change(m=>{const a=m.createRange(e);return m.addMarker(n,{usingOperation:!0,affectsData:!0,range:a}),m.setAttribute(n,r,l),n})}removeHtmlComment(e){const r=this.editor,i=r.model.markers.get(e);return i?(r.model.change(t=>{t.removeMarker(i)}),!0):!1}getHtmlCommentData(e){const i=this.editor.model.markers.get(e);if(!i)return null;let t="";for(const o of this.editor.model.document.getRoots())if(o.hasAttribute(e)){t=o.getAttribute(e);break}return{content:t,position:i.getStart()}}getHtmlCommentsInRange(e,{skipBoundaries:r=!1}={}){const i=!r;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter(o=>t(o,e)).map(o=>o.name);function t(o,l){const n=o.getRange().start;return(n.isAfter(l.start)||i&&n.isEqual(l.start))&&(n.isBefore(l.end)||i&&n.isEqual(l.end))}}}class qe extends J{toView(e){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4)))return super.toView(e);let r="",i="";e=e.trim().replace(/<\?xml\s[^?]*\?>/i,m=>(i=m,"")),e=e.trim().replace(/^<!DOCTYPE\s[^>]*?>/i,m=>(r=m,""));const t=this._toDom(e),o=this.domConverter.domToView(t,{skipComments:this.skipComments}),l=new B(o.document);l.setCustomProperty("$fullPageDocument",t.ownerDocument.documentElement.outerHTML,o);const n=Array.from(t.ownerDocument.querySelectorAll("head style"));return l.setCustomProperty("$fullPageHeadStyles",n,o),r&&l.setCustomProperty("$fullPageDocType",r,o),i&&l.setCustomProperty("$fullPageXmlDeclaration",i,o),o}toData(e){let r=super.toData(e);const i=e.getCustomProperty("$fullPageDocument"),t=e.getCustomProperty("$fullPageDocType"),o=e.getCustomProperty("$fullPageXmlDeclaration");return i&&(r=i.replace(/<\/body\s*>/,r+"$&"),t&&(r=t+`
2
- `+r),o&&(r=o+`
3
- `+r)),r}}class ot extends f{static get pluginName(){return"FullPage"}static get licenseFeatureCode(){return"FPH"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define("htmlSupport.fullPage",{allowRenderStylesFromHead:!1,sanitizeCss:r=>(X("css-full-page-provide-sanitize-function"),{css:r,hasChanged:!1})}),e.data.processor=new qe(e.data.viewDocument)}init(){const e=this.editor,r=["$fullPageDocument","$fullPageDocType","$fullPageXmlDeclaration","$fullPageHeadStyles"];e.model.schema.extend("$root",{allowAttributes:r}),e.data.on("toModel",(i,[t])=>{const o=e.model.document.getRoot();e.model.change(l=>{for(const n of r){const m=t.getCustomProperty(n);m&&l.setAttribute(n,m,o)}}),G(e)&&this._renderStylesFromHead(o)},{priority:"low"}),e.data.on("toView",(i,[t])=>{if(!t.is("rootElement"))return;const o=t,l=i.return;if(!o.hasAttribute("$fullPageDocument"))return;const n=new B(l.document);for(const m of r){const a=o.getAttribute(m);a&&n.setCustomProperty(m,a,l)}},{priority:"low"}),e.data.on("set",()=>{const i=e.model.document.getRoot();e.model.change(t=>{for(const o of r)i.hasAttribute(o)&&t.removeAttribute(o,i)})},{priority:"high"}),e.data.on("get",(i,t)=>{t[0]||(t[0]={}),t[0].trim=!1},{priority:"high"})}destroy(){super.destroy(),G(this.editor)&&this._removeStyleElementsFromDom()}_removeStyleElementsFromDom(){const e=Array.from(R.document.querySelectorAll(`[data-full-page-style-id="${this.editor.id}"]`));for(const r of e)r.remove()}_renderStyleElementsInDom(e){const r=this.editor,i=e.getAttribute("$fullPageHeadStyles");if(!i)return;const t=r.config.get("htmlSupport.fullPage.sanitizeCss");for(const o of i){o.setAttribute("data-full-page-style-id",r.id);const l=t(o.innerText);l.hasChanged&&(o.innerText=l.css),R.document.head.append(o)}}_renderStylesFromHead(e){this._removeStyleElementsFromDom(),this._renderStyleElementsInDom(e)}}function G(s){return s.config.get("htmlSupport.fullPage.allowRenderStylesFromHead")}export{pe as CodeBlockElementSupport,Le as CustomElementSupport,h as DataFilter,C as DataSchema,ve as DualContentModelElementSupport,ot as FullPage,rt as GeneralHtmlSupport,ye as HeadingElementSupport,Ne as HorizontalLineElementSupport,it as HtmlComment,qe as HtmlPageDataProcessor,Ee as ImageElementSupport,Me as ListElementSupport,Oe as MediaEmbedElementSupport,$e as ScriptElementSupport,xe as StyleElementSupport,He as TableElementSupport,L as _HTML_SUPPORT_SCHEMA_DEFINITIONS,de as _attributeToInlineHtmlSupportConverter,P as _createObjectHtmlSupportView,j as _emptyInlineModelElementToViewHtmlSupportConverter,b as _getHtmlSupportAttributeName,O as _getHtmlSupportDescendantElement,se as _mergeHtmlSupportViewElementAttributes,F as _modelToViewBlockAttributeHtmlSupportConverter,v as _modifyHtmlSupportGhsAttribute,ne as _removeHtmlSupportViewAttributes,w as _setHtmlSupportViewAttributes,ae as _toHtmlSupportPascalCase,ue as _toObjectWidgetHtmlSupportConverter,p as _updateHtmlSupportViewAttributes,ce as _viewToAttributeInlineHtmlSupportConverter,E as _viewToModelBlockAttributeHtmlSupportConverter,V as _viewToModelObjectContentHtmlSupportConverter};
@@ -1 +0,0 @@
1
- import{Plugin as l,MultiCommand as u,Command as I}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{ButtonView as k,MenuBarMenuListItemButtonView as w}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconIndent as f,IconOutdent as h}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{addMarginStylesRules as b}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{first as p}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";class B extends l{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.commands.add("indent",new u(t)),t.commands.add("outdent",new u(t))}}class v extends l{static get pluginName(){return"IndentUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale,n=t.t,s=e.uiLanguageDirection=="ltr"?f:h,i=e.uiLanguageDirection=="ltr"?h:f;this._defineButton("indent",n("Increase indent"),s),this._defineButton("outdent",n("Decrease indent"),i)}_defineButton(t,e,n){const s=this.editor;s.ui.componentFactory.add(t,()=>{const i=this._createButton(k,t,e,n);return i.set({tooltip:!0}),i}),s.ui.componentFactory.add("menuBar:"+t,()=>this._createButton(w,t,e,n))}_createButton(t,e,n,s){const i=this.editor,r=i.commands.get(e),d=new t(i.locale);return d.set({label:n,icon:s}),d.bind("isEnabled").to(r,"isEnabled"),this.listenTo(d,"execute",()=>{i.execute(e),i.editing.view.focus()}),d}}class O extends l{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[B,v]}}class a extends I{_indentBehavior;constructor(t,e){super(t),this._indentBehavior=e}refresh(){const e=this.editor.model,n=p(e.document.selection.getSelectedBlocks());if(!n||!this._isIndentationChangeAllowed(n)){this.isEnabled=!1;return}this.isEnabled=this._indentBehavior.checkEnabled(n.getAttribute("blockIndent"))}execute(){const t=this.editor.model,e=this._getBlocksToChange();t.change(n=>{for(const s of e){const i=s.getAttribute("blockIndent"),r=this._indentBehavior.getNextIndent(i);r?n.setAttribute("blockIndent",r,s):n.removeAttribute("blockIndent",s)}})}_getBlocksToChange(){const e=this.editor.model.document.selection;return Array.from(e.getSelectedBlocks()).filter(s=>this._isIndentationChangeAllowed(s))}_isIndentationChangeAllowed(t){const e=this.editor;return e.model.schema.checkAttribute(t,"blockIndent")?!e.plugins.has("ListUtils")||!this._indentBehavior.isForward?!0:!e.plugins.get("ListUtils").isListItemBlock(t):!1}}class g{isForward;offset;unit;constructor(t){this.isForward=t.direction==="forward",this.offset=t.offset,this.unit=t.unit}checkEnabled(t){const e=parseFloat(t||"0");return this.isForward||e>0}getNextIndent(t){const e=parseFloat(t||"0");if(!(!t||t.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const s=this.isForward?this.offset:-this.offset,i=e+s;return i>0?i+this.unit:void 0}}class m{isForward;classes;constructor(t){this.isForward=t.direction==="forward",this.classes=t.classes}checkEnabled(t){const e=this.classes.indexOf(t);return this.isForward?e<this.classes.length-1:e>=0}getNextIndent(t){const e=this.classes.indexOf(t),n=this.isForward?1:-1;return this.classes[e+n]}}const C=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class y extends l{constructor(t){super(t),t.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClasses(e.classes),t.commands.add("indentBlock",new a(t,new m({direction:"forward",classes:e.classes}))),t.commands.add("outdentBlock",new a(t,new m({direction:"backward",classes:e.classes})))):(t.data.addStyleProcessorRules(b),this._setupConversionUsingOffset(),t.commands.add("indentBlock",new a(t,new g({direction:"forward",offset:e.offset,unit:e.unit}))),t.commands.add("outdentBlock",new a(t,new g({direction:"backward",offset:e.offset,unit:e.unit}))))}afterInit(){const t=this.editor,e=t.model.schema,n=t.commands.get("indent"),s=t.commands.get("outdent"),i=t.config.get("heading.options");(i&&i.map(c=>c.model)||C).forEach(c=>{e.isRegistered(c)&&e.extend(c,{allowAttributes:"blockIndent"})}),e.setAttributeProperties("blockIndent",{isFormatting:!0}),n.registerChildCommand(t.commands.get("indentBlock")),s.registerChildCommand(t.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const t=this.editor.conversion,n=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";t.for("upcast").attributeToAttribute({view:{styles:{[n]:/[\s\S]+/}},model:{key:"blockIndent",value:s=>{if(!s.is("element","li"))return s.getStyle(n)}}}),t.for("downcast").attributeToAttribute({model:"blockIndent",view:s=>({key:"style",value:{[n]:s}})})}_setupConversionUsingClasses(t){const e={model:{key:"blockIndent",values:[]},view:{}};for(const n of t)e.model.values.push(n),e.view[n]={key:"class",value:[n]};this.editor.conversion.attributeToAttribute(e)}}export{O as Indent,y as IndentBlock,a as IndentBlockCommand,B as IndentEditing,v as IndentUI,m as _IndentUsingClasses,g as _IndentUsingOffset};
@@ -1 +0,0 @@
1
- import{Plugin as p,Command as ie}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as me,findAttributeRange as S,TextWatcher as fe,getLastTextLine as ke,TwoStepCaretMovement as G,Input as ge,inlineHighlight as we}from"../../../../../@ckeditor_ckeditor5-typing@47.5.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{ClipboardPipeline as be}from"../../../../../@ckeditor_ckeditor5-clipboard@47.5.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{env as pe,keyCodes as _e,Collection as se,first as ne,toMap as B,ObservableMixin as Ve,FocusTracker as F,KeystrokeHandler as H,diff as ve}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ClickObserver as Le,ModelLivePosition as W,Matcher as Ie}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{IconUnlink as ye,IconPencil as Te,IconSettings as Pe,IconLink as oe,IconPreviousArrow as D,IconNextArrow as Ee}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ContextualBalloon as X,ToolbarView as Ce,CssTransitionDisablerMixin as j,ButtonView as w,SwitchButtonView as xe,MenuBarMenuListItemButtonView as Ae,clickOutsideHandler as Se,View as T,ViewCollection as R,FocusCycler as U,ListView as O,ListItemView as N,FormHeaderView as M,IconView as Be,submitHandler as Fe,LabeledFieldView as J,createLabeledInputText as Y,FormRowView as Q}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{isWidget as He}from"../../../../../@ckeditor_ckeditor5-widget@47.5.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{upperFirst as De}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/string/upperFirst.js";class Re{_definitions=new Set;get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,i,s)=>{if(!s.consumable.test(i.item,"attribute:linkHref")||!(i.item.is("selection")||s.schema.isInline(i.item)))return;const n=s.writer,o=n.document.selection;for(const a of this._definitions){const r=n.createAttributeElement("a",a.attributes,{priority:5});a.classes&&n.addClass(a.classes,r);for(const c in a.styles)n.setStyle(c,a.styles[c],r);n.setCustomProperty("link",!0,r),a.callback(i.attributeNewValue)?i.item.is("selection")?n.wrap(o.getFirstRange(),r):n.wrap(s.mapper.toViewRange(i.range),r):n.unwrap(s.mapper.toViewRange(i.range),r)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,i,{writer:s,mapper:n})=>{const o=n.toViewElement(i.item),a=Array.from(o.getChildren()).find(r=>r.is("element","a"));if(a)for(const r of this._definitions){const c=B(r.attributes);if(r.callback(i.attributeNewValue)){for(const[d,h]of c)d==="class"?s.addClass(h,a):s.setAttribute(d,h,a);r.classes&&s.addClass(r.classes,a);for(const d in r.styles)s.setStyle(d,r.styles[d],a)}else{for(const[d,h]of c)d==="class"?s.removeClass(h,a):s.removeAttribute(d,a);r.classes&&s.removeClass(r.classes,a);for(const d in r.styles)s.removeStyle(d,a)}}})}}}const Ue=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Oe="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",Ne=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,Me=/^((\w+:(\/{2,})?)|(\W))/i,qe=["https?","ftps?","mailto"],L="Ctrl+K";function ze(l){return l.is("attributeElement")&&!!l.getCustomProperty("link")}function Z(l,{writer:e}){const t=e.createAttributeElement("a",{href:l},{priority:5});return e.setCustomProperty("link",!0,t),t}function re(l,e=qe){const t=String(l),i=e.join("|"),s=new RegExp(`${Oe.replace("<protocols>",i)}`,"i");return Ke(t,s)?t:"#"}function Ke(l,e){return!!l.replace(Ue,"").match(e)}function $e(l,e){const t={"Open in a new tab":l("Open in a new tab"),Downloadable:l("Downloadable")};return e.forEach(i=>("label"in i&&t[i.label]&&(i.label=t[i.label]),i)),e}function Ge(l){const e=[];if(l)for(const[t,i]of Object.entries(l)){const s=Object.assign({},i,{id:`link${De(t)}`});e.push(s)}return e}function x(l,e){return l?e.checkAttribute(l.name,"linkHref"):!1}function We(l){return Ne.test(l)}function q(l,e){const t=We(l)?"mailto:":e,i=!!t&&!le(l);return l&&i?t+l:l}function le(l){return Me.test(l)}function Xe(l){window.open(l,"_blank","noopener")}function A(l){let e="";for(const t of l.getItems()){if(!t.is("$text")&&!t.is("$textProxy"))return;e+=t.data}return e}class je extends ie{manualDecorators=new se;automaticDecorators=new Re;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()||ne(t.getSelectedBlocks());x(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 s of this.manualDecorators)s.value=this._getDecoratorStateFromModel(s.id)}execute(e,t={},i){const s=this.editor.model,n=s.document.selection,o=[],a=[];for(const r in t)t[r]?o.push(r):a.push(r);s.change(r=>{const c=u=>{r.setAttribute("linkHref",e,u),o.forEach(m=>r.setAttribute(m,!0,u)),a.forEach(m=>r.removeAttribute(m,u))},d=(u,m)=>{const k=A(u);if(!k)return u;let g=i;if(g||(g=m&&m==k?e:k),g!=k){const V=r.createDocumentFragment();for(const P of u.getItems()){const y=P;r.append(r.createText(y.data,y.getAttributes()),V)}const f=r.createRangeIn(V),v=Je(k,g);let I=0;for(const{offset:P,actual:y,expected:z}of v){const K=P+I,E=r.createRange(f.start.getShiftedBy(K),f.start.getShiftedBy(K+y.length)),de=Ye(E,f).getAttributes(),ue=Array.from(de).filter(([he])=>s.schema.getAttributeProperties(he).isFormatting),$=r.createText(z,ue);c($),r.remove(E),r.insert($,E.start),I+=z.length}return s.insertContent(V,u),r.createRange(u.start,u.start.getShiftedBy(g.length))}},h=u=>{const{plugins:m}=this.editor;if(r.setSelection(u.end),m.has("TwoStepCaretMovement"))m.get("TwoStepCaretMovement")._handleForwardMovement();else for(const k of["linkHref",...o,...a])r.removeSelectionAttribute(k)};if(n.isCollapsed){const u=n.getFirstPosition();if(n.hasAttribute("linkHref")){const m=n.getAttribute("linkHref"),k=S(u,"linkHref",m,s),g=d(k,m);c(g||k),g&&h(g)}else if(e!==""){const m=B(n.getAttributes());m.set("linkHref",e),o.forEach(g=>{m.set(g,!0)});const k=s.insertContent(r.createText(i||e,m),u);h(k)}}else{const u=Array.from(n.getRanges()),m=s.schema.getValidRanges(u,"linkHref"),k=[];for(const f of n.getSelectedBlocks())s.schema.checkAttribute(f,"linkHref")&&k.push(r.createRangeOn(f));const g=k.slice();for(const f of m)this._isRangeToUpdate(f,k)&&g.push(f);const V=u.map(f=>({start:W.fromPosition(f.start,"toPrevious"),end:W.fromPosition(f.end,"toNext")}));for(let f of g){const v=(f.start.textNode||f.start.nodeAfter).getAttribute("linkHref");f=d(f,v)||f,c(f)}r.setSelection(V.map(f=>{const v=f.start.toPosition(),I=f.end.toPosition();return f.start.detach(),f.end.detach(),s.createRange(v,I)}))}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,s=i.getSelectedElement();return x(s,t.schema)?s.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}}function Je(l,e){const t=ve(l,e),i={equal:0,insert:0,delete:0},s=[];let n="",o="";for(const a of[...t,null])a=="insert"?o+=e[i.equal+i.insert]:a=="delete"?n+=l[i.equal+i.delete]:(n.length||o.length)&&(s.push({offset:i.equal,actual:n,expected:o}),n="",o=""),a&&i[a]++;return s}function Ye(l,e){if(!l.isCollapsed)return ne(l.getItems());const t=l.start;return t.textNode?t.textNode:!t.nodeBefore||t.isEqual(e.start)?t.nodeAfter:t.nodeBefore}class Qe extends ie{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();x(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,s=e.commands.get("link");t.change(n=>{const o=i.isCollapsed?[S(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const a of o)if(n.removeAttribute("linkHref",a),s)for(const r of s.manualDecorators)n.removeAttribute(r.id,a)})}}class Ze extends Ve(){id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:i,classes:s,styles:n,defaultValue:o}){super(),this.id=e,this.set("value",void 0),this.defaultValue=o,this.label=t,this.attributes=i,this.classes=s,this.styles=n}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const et="ck-link_selected",ee="automatic",tt="manual",it=/^(https?:)?\/\//;class _ extends p{_linkOpeners=[];static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[G,ge,be]}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:Z}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(n,o)=>Z(re(n,t),o)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:n=>n.getAttribute("href")}}),e.commands.add("link",new je(e)),e.commands.add("unlink",new Qe(e));const i=$e(e.t,Ge(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(n=>n.mode===ee)),this._enableManualDecorators(i.filter(n=>n.mode===tt)),e.plugins.get(G).registerAttribute("linkHref"),we(e,"linkHref","a",et),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_registerLinkOpener(e){this._linkOpeners.push(e)}_enableAutomaticDecorators(e){const t=this.editor,s=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&s.add({id:"linkIsExternal",mode:ee,callback:n=>!!n&&it.test(n),attributes:{target:"_blank",rel:"noopener noreferrer"}}),s.add(e),s.length&&t.conversion.for("downcast").add(s.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,s=t.commands.get("link").manualDecorators;e.forEach(n=>{t.model.schema.extend("$text",{allowAttributes:n.id});const o=new Ze(n);s.add(o),t.conversion.for("downcast").attributeToElement({model:o.id,view:(a,{writer:r,schema:c},{item:d})=>{if((d.is("selection")||c.isInline(d))&&a){const h=r.createAttributeElement("a",o.attributes,{priority:5});o.classes&&r.addClass(o.classes,h);for(const u in o.styles)r.setStyle(u,o.styles[u],h);return r.setCustomProperty("link",!0,h),h}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...o._createPattern()},model:{key:o.id}})})}_enableLinkOpen(){const e=this.editor,i=e.editing.view.document,s=n=>{this._linkOpeners.some(o=>o(n))||Xe(n)};this.listenTo(i,"click",(n,o)=>{if(!(pe.isMac?o.domEvent.metaKey:o.domEvent.ctrlKey))return;let r=o.domTarget;if(r.tagName.toLowerCase()!="a"&&(r=r.closest("a")),!r)return;const c=r.getAttribute("href");c&&(n.stop(),o.preventDefault(),s(c))},{context:"$capture"}),this.listenTo(i,"keydown",(n,o)=>{const r=e.commands.get("link").value;r&&o.keyCode===_e.enter&&o.altKey&&(n.stop(),s(r))})}_enableSelectionAttributesFixer(){const t=this.editor.model,i=t.document.selection;this.listenTo(i,"change:attribute",(s,{attributeKeys:n})=>{!n.includes("linkHref")||i.hasAttribute("linkHref")||t.change(o=>{st(o,nt(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",(s,n)=>{t.change(o=>{const a=o.createRangeIn(n.content);for(const r of a.getItems())if(r.hasAttribute("linkHref")){const c=q(r.getAttribute("linkHref"),i);o.setAttribute("linkHref",c,r)}})})}}function st(l,e){l.removeSelectionAttribute("linkHref");for(const t of e)l.removeSelectionAttribute(t)}function nt(l){return l.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}class ot extends w{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 s=()=>i.preventDefault();this.fire("navigate",this.href,s)}})}}),this.template.tag="a"}}class rt extends T{focusTracker=new F;keystrokes=new H;backButtonView;saveButtonView;displayedTextInputView;urlInputView;children;providersListChildren;_validators;_focusables=new R;_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 U({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(),Fe({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 w(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:D,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new w(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 M(this.locale,{label:e("Link")});return t.children.add(this.backButtonView,0),t}_createProvidersListView(){const e=new O(this.locale);return e.extendTemplate({attributes:{class:["ck-link-form__providers-list"]}}),e.items.bindTo(this.providersListChildren).using(t=>{const i=new N(this.locale);return i.children.add(t),i}),e}_createDisplayedTextInput(){const e=this.locale.t,t=new J(this.locale,Y);return t.label=e("Displayed text"),t.class="ck-labeled-field-view_full-width",t}_createUrlInput(){const e=this.locale.t,t=new J(this.locale,Y);return t.fieldView.inputMode="url",t.label=e("Link URL"),t.class="ck-labeled-field-view_full-width",t}_createFormChildren(){this.children.add(new Q(this.locale,{children:[this.displayedTextInputView],class:["ck-form__row_large-top-padding"]})),this.children.add(new Q(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 lt extends T{focusTracker=new F;keystrokes=new H;backButtonView;listView;listChildren;emptyListInformation;children;_focusables=new R;_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,s)=>{s?(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 U({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 O(this.locale);return e.extendTemplate({attributes:{class:["ck-link-providers__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new N(this.locale);return i.children.add(t),i}),e}_createBackButton(){const e=this.locale.t,t=new w(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:D,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){const e=new M(this.locale);return e.bind("label").to(this,"title"),e.children.add(this.backButtonView,0),e}_createEmptyLinksListItemView(){const e=new T(this.locale);return e.setTemplate({tag:"p",attributes:{class:["ck","ck-link__empty-list-info"]},children:[{text:this.bindTemplate.to("emptyListPlaceholder")}]}),e}}class at extends T{focusTracker=new F;keystrokes=new H;backButtonView;children;listChildren;_focusables=new R;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new U({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 w(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:D,tooltip:!0}),t.delegate("execute").to(this,"back"),t}_createHeaderView(){const e=this.locale.t,t=new M(this.locale,{label:e("Link properties")});return t.children.add(this.backButtonView,0),t}_createListView(){const e=new O(this.locale);return e.extendTemplate({attributes:{class:["ck-link__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new N(this.locale);return i.children.add(t),i}),e}}class ct extends w{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 Be;return e.content=Ee,e}}const b="link-ui";class ae extends p{toolbarView=null;formView=null;linkProviderItemsView=null;propertiesView=null;_balloon;_linksProviders=new se;static get requires(){return[X,_]}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(Le),this._balloon=e.plugins.get(X),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:b,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:b,view:(i,{writer:s})=>{if(!i.markerRange.isCollapsed)return null;const n=s.createUIElement("span");return s.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],n),n}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:L},{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 Ce(e.locale),i=e.commands.get("link");t.class="ck-link-toolbar";let s=e.config.get("link.toolbar");return i.manualDecorators.length||(s=s.filter(n=>n!=="linkProperties")),t.fillFromConfig(s,e.ui.componentFactory),t.keystrokes.set("Esc",(n,o)=>{this._hideUI(),o()}),t.keystrokes.set(L,(n,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"),s=e.config.get("link.defaultProtocol"),n=new(j(rt))(e.locale,dt(e));return n.displayedTextInputView.bind("isEnabled").to(this,"selectedLinkableText",o=>o!==void 0),n.urlInputView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("label").to(i,"value",o=>t(o?"Update":"Insert")),this.listenTo(n,"submit",()=>{if(n.isValid()){const o=n.urlInputView.fieldView.element.value,a=q(o,s),r=n.displayedTextInputView.fieldView.element.value;e.execute("link",a,this._getDecoratorSwitchesState(),r!==this.selectedLinkableText?r:void 0),this._closeFormView()}}),this.listenTo(n.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(n,"cancel",()=>{this._closeFormView()}),n.keystrokes.set("Esc",(o,a)=>{this._closeFormView(),a()}),n.providersListChildren.bindTo(this._linksProviders).using(o=>this._createLinksListProviderButton(o)),n}_createLinkProviderListView(e){return e.getListItems().map(({href:t,label:i,icon:s})=>{const n=new w;return n.set({label:i,icon:s,tooltip:!1,withText:!0}),n.on("execute",()=>{this.formView.resetFormStatus(),this.formView.urlInputView.fieldView.value=t,this.editor.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),n})}_createLinkProviderItemsView(e){const t=this.editor,i=t.locale.t,s=new lt(t.locale),{emptyListPlaceholder:n,label:o}=e;return s.emptyListPlaceholder=n||i("No links available"),s.title=o,this.listenTo(s,"cancel",()=>{t.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),s}_createPropertiesView(){const e=this.editor,t=this.editor.commands.get("link"),i=new(j(at))(e.locale);return this.listenTo(i,"back",()=>{e.editing.view.focus(),this._removePropertiesView()}),i.listChildren.bindTo(t.manualDecorators).using(s=>{const n=new xe(e.locale);return n.set({label:s.label,withText:!0}),n.bind("isOn").toMany([s,t],"value",(o,a)=>a===void 0&&o===void 0?!!s.defaultValue:!!o),n.on("execute",()=>{s.set("value",!n.isOn),e.execute("link",t.value,this._getDecoratorSwitchesState())}),n}),i}_getDecoratorSwitchesState(){const e=this.editor.commands.get("link");return Array.from(e.manualDecorators).reduce((t,i)=>{const s=e.value===void 0&&i.value===void 0?i.defaultValue:i.value;return{...t,[i.id]:!!s}},{})}_registerEditingOpeners(){this.editor.plugins.get(_)._registerLinkOpener(t=>{const i=this._getLinkProviderLinkByHref(t);if(!i)return!1;const{item:s,provider:n}=i;return n.navigate?n.navigate(s):!1})}_registerComponents(){const e=this.editor;e.ui.componentFactory.add("link",()=>{const t=this._createButton(w);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:link",()=>{const t=this._createButton(Ae);return t.set({role:"menuitemcheckbox"}),t}),e.ui.componentFactory.add("linkPreview",t=>{const i=new ot(t),s=e.config.get("link.allowedProtocols"),n=e.commands.get("link"),o=t.t;i.bind("isEnabled").to(n,"value",r=>!!r),i.bind("href").to(n,"value",r=>r&&re(r,s));const a=r=>{if(!r){i.label=void 0,i.icon=void 0,i.tooltip=o("Open link in new tab");return}const c=this._getLinkProviderLinkByHref(r);if(c){const{label:d,tooltip:h,icon:u}=c.item;i.label=d,i.tooltip=h||!1,i.icon=u}else i.label=r,i.icon=void 0,i.tooltip=o("Open link in new tab")};return a(n.value),this.listenTo(n,"change:value",(r,c,d)=>{a(d)}),this.listenTo(i,"navigate",(r,c,d)=>{const h=this._getLinkProviderLinkByHref(c);if(!h)return;const{provider:u,item:m}=h,{navigate:k}=u;k&&k(m)&&(r.stop(),d())}),i}),e.ui.componentFactory.add("unlink",t=>{const i=e.commands.get("unlink"),s=new w(t),n=t.t;return s.set({label:n("Unlink"),icon:ye,tooltip:!0}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",()=>{e.execute("unlink"),this._hideUI()}),s}),e.ui.componentFactory.add("editLink",t=>{const i=e.commands.get("link"),s=new w(t),n=t.t;return s.set({label:n("Edit link"),icon:Te,tooltip:!0}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",()=>{this._addFormView()}),s}),e.ui.componentFactory.add("linkProperties",t=>{const i=e.commands.get("link"),s=new w(t),n=t.t;return s.set({label:n("Link properties"),icon:Pe,tooltip:!0}),s.bind("isEnabled").to(i,"isEnabled",i,"value",i,"manualDecorators",(o,a,r)=>o&&!!a&&r.length>0),this.listenTo(s,"execute",()=>{this._addPropertiesView()}),s})}_createLinksListProviderButton(e){const t=this.editor.locale,i=new ct(t);return i.set({label:e.label}),this.listenTo(i,"execute",()=>{this._showLinksProviderView(e)}),i}_createButton(e){const t=this.editor,i=t.locale,s=t.commands.get("link"),n=new e(t.locale),o=i.t;return n.set({label:o("Link"),icon:oe,keystroke:L,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",a=>!!a),this.listenTo(n,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showUI(!0),this._getSelectedLinkElement()&&this._addFormView()}),n}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(L,(i,s)=>{s(),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())}),Se({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(),s=o();const n=()=>{const a=this._getSelectedLinkElement(),r=o();i&&!a||!i&&r!==s?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=a,s=r};function o(){return t.selection.focus.getAncestors().reverse().find(a=>a.is("element"))}this.listenTo(e.ui,"update",n),this.listenTo(this._balloon,"change:visibleView",n)}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(b)){const s=this.editor.editing.mapper.markerNameToElements(b);if(s){const n=Array.from(s),o=e.createRange(e.createPositionBefore(n[0]),e.createPositionAfter(n[n.length-1]));return{target:e.domConverter.viewRangeToDom(o)}}}return{target:()=>{const s=this._getSelectedLinkElement();return s?e.domConverter.mapViewToDom(s):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&He(i))return C(t.getFirstPosition());{const s=t.getFirstRange().getTrimmed(),n=C(s.start),o=C(s.end);return!n||n!=o?null:e.createRangeIn(n).getTrimmed().isEqual(s)?n:null}}_getSelectedLinkableText(){const e=this.editor.model,t=this.editor.editing,i=this._getSelectedLinkElement();if(!i)return A(e.document.selection.getFirstRange());const s=t.view.createRangeOn(i),n=t.mapper.toModelRange(s);return A(n)}_getLinkProviderLinkByHref(e){if(!e)return null;for(const t of this._linksProviders){const i=t.getItem?t.getItem(e):t.getListItems().find(s=>s.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(b))t.updateMarker(b,{range:i});else if(i.start.isAtEnd){const s=i.start.getLastMatchingPosition(({item:n})=>!e.schema.isContent(n),{boundaries:i});t.addMarker(b,{usingOperation:!1,affectsData:!1,range:t.createRange(s,i.end)})}else t.addMarker(b,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(b)&&e.change(t=>{t.removeMarker(b)})}}function C(l){return l.getAncestors().find(e=>ze(e))||null}function dt(l){const e=l.t,t=l.config.get("link.allowCreatingEmptyLinks");return[i=>{if(!t&&!i.url.length)return e("Link URL must not be empty.")}]}const ut=4,ce=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"),ht=2;class mt extends p{static get requires(){return[me,_]}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")?S(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const s=this.editor.model,n=s.document.selection,o=n.getFirstPosition(),a=n.getLastPosition();let r=t.getJoined(this._expandLinkRange(s,o)||t);r&&(r=r.getJoined(this._expandLinkRange(s,a)||t)),r&&(r.start.isBefore(o)||r.end.isAfter(a))&&e.setSelection(r)}_enablePasteLinking(){const e=this.editor,t=e.model,i=t.document.selection,s=e.plugins.get("ClipboardPipeline"),n=e.commands.get("link");s.on("inputTransformation",(o,a)=>{if(!this.isEnabled||!n.isEnabled||i.isCollapsed||a.method!=="paste"||i.rangeCount>1)return;const r=i.getFirstRange(),c=a.dataTransfer.getData("text/plain");if(!c)return;const d=c.match(ce);d&&d[2]===c&&(t.change(h=>{this._selectEntireLinks(h,r),n.execute(c)}),o.stop())},{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new fe(e.model,i=>{let s=i;if(!ft(s))return;s=s.slice(0,-1),"!.:,;?".includes(s[s.length-1])&&(s=s.slice(0,-1));const n=te(s);if(n)return{url:n,removedTrailingCharacters:i.length-s.length}});t.on("matched:data",(i,s)=>{const{batch:n,range:o,url:a,removedTrailingCharacters:r}=s;if(!n.isTyping)return;const c=o.end.getShiftedBy(-r),d=c.getShiftedBy(-a.length),h=e.model.createRange(d,c);this._applyAutoLink(a,h)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition();let n;s.parent.previousSibling?.is("element")?n=t.createRangeIn(s.parent.previousSibling):n=t.createRange(t.createPositionAt(s.parent,0),s),this._checkAndApplyAutoLinkOnRange(n)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition(),n=t.createRange(t.createPositionAt(s.parent,0),s.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:s}=ke(e,t),n=te(i);if(n){const o=t.createRange(s.end.getShiftedBy(-n.length),s.end);this._applyAutoLink(n,o)}}_applyAutoLink(e,t){const i=this.editor.model,s=this.editor.config.get("link.defaultProtocol"),n=q(e,s);!this.isEnabled||!kt(t,i)||!le(n)||gt(t)||this._persistAutoLink(n,t)}_persistAutoLink(e,t){const i=this.editor.model,s=this.editor.plugins.get("Delete");i.enqueueChange(n=>{n.setAttribute("linkHref",e,t),i.enqueueChange(()=>{s.requestUndoOnBackspace()})})}}function ft(l){return l.length>ut&&l[l.length-1]===" "&&l[l.length-2]!==" "}function te(l){const e=ce.exec(l);return e?e[ht]:null}function kt(l,e){return e.schema.checkAttributeInSelection(e.createSelection(l),"linkHref")}function gt(l){const e=l.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}class Bt extends p{static get requires(){return[_,ae,mt]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}}class wt extends p{static get requires(){return["ImageEditing","ImageUtils",_]}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(bt(e)),e.conversion.for("downcast").add(pt(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(_t(i)),e.conversion.for("upcast").add(Vt(e,i))}}function bt(l){const e=l.plugins.has("ImageInlineEditing"),t=l.plugins.get("ImageUtils");return i=>{i.on("element:a",(s,n,o)=>{const a=n.viewItem,r=t.findViewImgElement(a);if(!r)return;const c=r.findAncestor(m=>t.isBlockImageView(m));if(e&&!c)return;const d={attributes:["href"]};if(!o.consumable.test(a,d))return;const h=a.getAttribute("href"),u=n.modelCursor.parent;u.is("element","imageBlock")&&(o.writer.setAttribute("linkHref",h,u),o.consumable.consume(a,d))},{priority:"high"})}}function pt(l){const e=l.plugins.get("ImageUtils");return t=>{t.on("attribute:linkHref:imageBlock",(i,s,n)=>{if(!n.consumable.consume(s.item,i.name))return;const o=n.mapper.toViewElement(s.item),a=n.writer,r=Array.from(o.getChildren()).find(h=>h.is("element","a")),c=e.findViewImgElement(o),d=c.parent.is("element","picture")?c.parent:c;if(r)s.attributeNewValue?a.setAttribute("href",s.attributeNewValue,r):(a.move(a.createRangeOn(d),a.createPositionAt(o,0)),a.remove(r));else{const h=a.createContainerElement("a",{href:s.attributeNewValue});a.insert(a.createPositionAt(o,0),h),a.move(a.createRangeOn(d),a.createPositionAt(h,0))}},{priority:"high"})}}function _t(l){return e=>{e.on(`attribute:${l.id}:imageBlock`,(t,i,s)=>{const n=s.mapper.toViewElement(i.item),o=Array.from(n.getChildren()).find(a=>a.is("element","a"));if(o){if(i.attributeOldValue){for(const a in l.attributes)s.writer.removeAttribute(a,o);l.classes&&s.writer.removeClass(l.classes,o);for(const a in l.styles)s.writer.removeStyle(a,o)}if(i.attributeNewValue){for(const[a,r]of B(l.attributes))s.writer.setAttribute(a,r,o);l.classes&&s.writer.addClass(l.classes,o);for(const a in l.styles)s.writer.setStyle(a,l.styles[a],o)}}})}}function Vt(l,e){const t=l.plugins.has("ImageInlineEditing"),i=l.plugins.get("ImageUtils");return s=>{s.on("element:a",(n,o,a)=>{const r=o.viewItem,c=i.findViewImgElement(r);if(!c)return;const d=c.findAncestor(k=>i.isBlockImageView(k));if(t&&!d)return;const u=new Ie(e._createPattern()).match(r);if(!u||!a.consumable.test(r,u.match))return;const m=o.modelCursor.parent;m?.is("element","imageBlock")&&(a.writer.setAttribute(e.id,!0,m),a.consumable.consume(r,u.match))},{priority:"high"})}}class vt extends p{static get requires(){return[_,ae,"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,s)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(s.preventDefault(),i.stop())},{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",i=>{const s=new w(i),n=e.plugins.get("LinkUI"),o=e.commands.get("link");return s.set({isEnabled:!0,label:t("Link image"),icon:oe,keystroke:L,tooltip:!0,isToggleable:!0}),s.bind("isEnabled").to(o,"isEnabled"),s.bind("isOn").to(o,"value",a=>!!a),this.listenTo(s,"execute",()=>{this._isSelectedLinkedImage(e.model.document.selection)?n._addToolbarView():n._showUI(!0)}),s})}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}class Ft extends p{static get requires(){return[wt,vt]}static get pluginName(){return"LinkImage"}static get isOfficialPlugin(){return!0}}export{mt as AutoLink,Re as AutomaticLinkDecorators,Bt as Link,je as LinkCommand,_ as LinkEditing,rt as LinkFormView,Ft as LinkImage,wt as LinkImageEditing,vt as LinkImageUI,Ze as LinkManualDecorator,at as LinkPropertiesView,lt as LinkProviderItemsView,ae as LinkUI,Qe as UnlinkCommand,L as _LINK_KEYSTROKE,ct as _LinkButtonView,ot as _LinkPreviewButtonView,Z as _createLinkElement,re as _ensureSafeLinkUrl,A as _extractTextFromLinkRange,$e as _getLocalizedLinkDecorators,le as _hasLinkProtocol,We as _isEmailLink,Ge as _normalizeLinkDecorators,Xe as _openLink,q as addLinkProtocolIfApplicable,re as ensureSafeUrl,ze as isLinkElement,x as isLinkableElement};
@@ -1 +0,0 @@
1
- import{Plugin as h,Command as v}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as Rt}from"../../../../../@ckeditor_ckeditor5-typing@47.5.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Enter as Mt}from"../../../../../@ckeditor_ckeditor5-enter@47.5.0/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{CKEditorError as Dt,getCode as $t,toArray as S,first as D,parseKeystroke as zt,getLocalizedArrowKeyCodeDirection as Ut,env as G,uid as jt,FocusTracker as et,KeystrokeHandler as it,global as Wt}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{_normalizeFontSizeOptions as st}from"../../../../../@ckeditor_ckeditor5-font@47.5.0/node_modules/@ckeditor/ckeditor5-font/dist/index.js";import{ClipboardPipeline as qt}from"../../../../../@ckeditor_ckeditor5-clipboard@47.5.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{createDropdown as Kt,SplitButtonView as Ht,MenuBarMenuView as Yt,ButtonView as Z,MenuBarMenuListItemButtonView as Gt,focusChildOnDropdownOpen as Zt,View as nt,ViewCollection as Jt,FocusCycler as Qt,addKeyboardHandlingForGrid as Xt,CollapsibleView as te,LabeledFieldView as ee,createLabeledInputNumber as ie,SwitchButtonView as se}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconListStyleDisc as ne,IconListStyleCircle as re,IconListStyleSquare as oe,IconListStyleDecimal as le,IconListStyleDecimalLeadingZero as ae,IconListStyleLowerRoman as ce,IconListStyleUpperRoman as ue,IconListStyleLowerLatin as de,IconListStyleUpperLatin as me,IconBulletedList as J,IconNumberedList as Q,IconTodoList as fe}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{DomEventObserver as pe,Matcher as kt}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";class y{_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 ge{_listHead;constructor(t){this._listHead=t}[Symbol.iterator](){return new V(this._listHead)}}class x{static next(){return jt()}}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 y(n,{...t,includeSelf:e,sameIndent:!0,sameAttributes:"listItemId"}));return e?i:i.reverse()}function he(n){return Array.from(new y(n,{direction:"forward",higherIndent:!0}))}function At(n,t){const e=new y(n,{sameIndent:!0,sameAttributes:"listType",...t}),i=new y(n,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...t});return[...Array.from(e).reverse(),...i]}function L(n){return!y.first(n,{sameIndent:!0,sameAttributes:"listItemId"})}function rt(n){return!y.first(n,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function O(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 $(n){n=S(n);const t=new Set;for(const e of n)for(const i of At(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}={}){n=S(n);const s=e?O(n):n;for(const r of s){const o=r.getAttribute("listIndent")+i;o<0?z(r,t):t.setAttribute("listIndent",o,r)}return s}function be(n,t){n=S(n);const e=O(n),i=new Set,s=Math.min(...e.map(o=>o.getAttribute("listIndent"))),r=new Map;for(const o of e)r.set(o,y.first(o,{lowerIndent:!0}));for(const o of e){if(i.has(o))continue;i.add(o);const l=o.getAttribute("listIndent")-1;if(l<0){z(o,t);continue}if(o.getAttribute("listIndent")==s){const a=ye(o,r.get(o),t);for(const c of a)i.add(c);if(a.length)continue}t.setAttribute("listIndent",l,o)}return C(i)}function z(n,t){n=S(n);for(const e of n)e.is("element","listItem")&&t.rename(e,"paragraph");for(const e of n)for(const i of e.getAttributeKeys())i.startsWith("list")&&t.removeAttribute(i,e);return n}function E(n){if(!n.length)return!1;const t=n[0].getAttribute("listItemId");return t?!n.some(e=>e.getAttribute("listItemId")!=t):!1}function Ie(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 ye(n,t,e){return _(t,{direction:"forward"}).pop().index>n.index?W(n,t,e):[]}class ot extends v{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=lt(t.document.selection);t.change(i=>{const s=[];E(e)&&!L(e[0])?(this._direction=="forward"&&s.push(...q(e,i)),s.push(...X(e[0],i))):this._direction=="forward"?s.push(...q(e,i,{expand:!0})):s.push(...be(e,i));for(const r of s){if(!r.hasAttribute("listType"))continue;const o=y.first(r,{sameIndent:!0});o&&i.setAttribute("listType",o.getAttribute("listType"),r)}this._fireAfterExecute(s)})}_fireAfterExecute(t){this.fire("afterExecute",C(new Set(t)))}_checkEnabled(){let t=lt(this.editor.model.document.selection),e=t[0];if(!e)return!1;if(this._direction=="backward"||E(t)&&!L(t[0]))return!0;t=O(t),e=t[0];const i=y.first(e,{sameIndent:!0});return i?i.getAttribute("listType")==e.getAttribute("listType"):!1}}function lt(n){const t=Array.from(n.getSelectedBlocks()),e=t.findIndex(i=>!p(i));return e!=-1&&(t.length=e),t}class F 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],c=_(a,{direction:"forward"}),u=[];c.length>1&&u.push(...X(c[1],l)),u.push(...z(r,l)),u.push(...Ie(a,l)),this._fireAfterExecute(u)}else if((s||i.selection.isCollapsed)&&p(r[0])){const a=At(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 O(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 at extends v{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:t=!1}={}){const e=this.editor.model,i=e.document.selection,s=[];e.change(r=>{const{firstElement:o,lastElement:l}=this._getMergeSubjectElements(i,t),a=o.getAttribute("listIndent")||0,c=l.getAttribute("listIndent"),u=l.getAttribute("listItemId");if(a!=c){const d=he(l);s.push(...q([l,...d],r,{indentBy:a-c,expand:a<c}))}if(t){let d=i;i.isCollapsed&&(d=r.createSelection(r.createRange(r.createPositionAt(o,"end"),r.createPositionAt(l,0)))),e.deleteContent(d,{doNotResetEntireContent:i.isCollapsed});const f=d.getLastPosition().parent,m=f.nextSibling;s.push(f),m&&m!==l&&m.getAttribute("listItemId")==u&&s.push(...W(m,f,r))}else s.push(...W(l,o,r));this._fireAfterExecute(s)})}_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||E([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=L(l);this._direction=="backward"?(o=l,a&&!e?r=y.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 ct 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)&&!L(e)}_getStartBlock(){const e=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?e:e.nextSibling}}class ke extends h{static get pluginName(){return"ListItemBoldIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!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 Ae extends h{static get pluginName(){return"ListItemItalicIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!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 Le extends h{static get pluginName(){return"ListItemFontSizeIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);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 we extends h{static get pluginName(){return"ListItemFontColorIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!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 Te extends h{static get pluginName(){return"ListItemFontFamilyIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!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 Se extends h{_loadedFormatting={};static get pluginName(){return"ListFormatting"}static get isOfficialPlugin(){return!0}static get requires(){return[ke,Ae,Le,we,Te]}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=_e(t,o,Object.keys(this._loadedFormatting));for(const[a,c]of Object.entries(l)){const u=this._loadedFormatting[a];(c&&ve(e,o,u,c)||!c&&Ce(e,o,u))&&(r=!0)}}return r})}registerFormatAttribute(t,e){this._loadedFormatting[t]=e}_isInlineOrSelectionFormatting(t){return t.replace(/^selection:/,"")in this._loadedFormatting}}function _e(n,t,e){if(L(t))return ut(n,t,e);const i=T(t);return ut(n,i[0],e)}function ut(n,t,e){if(!xe(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 ve(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 Ce(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 xe(n){return["numbered","bulleted","customNumbered","customBulleted"].includes(n.getAttribute("listType"))}class Be extends h{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(t){return $(t)}isFirstBlockOfListItem(t){return L(t)}isListItemBlock(t){return p(t)}expandListBlocksToCompleteItems(t,e={}){return O(t,e)}isNumberedListType(t){return M(t)}}function Fe(n){return n.is("element","ol")||n.is("element","ul")}function K(n){return n.is("element","li")}function Ee(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 Pe(n,t,e,i=wt(e,t)){return n.createAttributeElement(Lt(e),null,{priority:2*t/100-100,id:i})}function Ve(n,t,e){return n.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:e})}function Lt(n){return n=="numbered"||n=="customNumbered"?"ol":"ul"}function wt(n,t){return`list-${n}-${t}`}function A(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 Oe(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 Ne(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 Re(){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=Ee(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 Me(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")A(m.position,u,f),m.attributes.has("listItemId")?d.add(m.position.nodeAfter):A(m.position.getShiftedBy(m.length),u,f);else if(m.type=="remove"&&m.attributes.has("listItemId"))A(m.position,u,f);else if(m.type=="attribute"){const g=m.range.start.nodeAfter;e.includes(m.attributeKey)?(A(m.range.start,u,f),m.attributeNewValue===null?(A(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 k=m.getAttribute("listIndent");g&&k<g.getAttribute("listIndent")&&(f.length=k+1),f[k]={modelAttributes:Object.fromEntries(Array.from(m.getAttributes()).filter(([I])=>e.includes(I))),modelElement:m};const w=_(m,{direction:"forward"});for(const I of w)d.add(I),(r(I,w)||l(I,f,c))&&u.push(I)}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=St(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),k=Fe(m);if(!k&&!g)continue;const w=`checkAttributes:${g?"item":"list"}`;if(i.fire(w,{viewElement:m,modelAttributes:c[f].modelAttributes,modelReferenceElement:c[f].modelElement}))break;if(k&&(f--,f<0))return!1}return!0}}function dt(n,t,e,{dataPipeline:i}={}){const s=qe(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=$e(d,c,e,a);Tt(m,a,c),je(m,a);const g=Ue(d,m,t,a,f);We(d,g,t,a,f)}}function De(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&&Tt(d,s,r)}}function mt(n,{dataPipeline:t}={}){return(e,{writer:i})=>{if(!St(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 $e(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 ze(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 Tt(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 Ue(n,t,e,i,{dataPipeline:s}){let r=i.createRangeOn(t);if(!L(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 je(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 We(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=Ve(i,l,o.getAttribute("listItemId")),c=Pe(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=y.first(o,{lowerIndent:!0}),!o))break}}function qe(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 St(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 b extends h{_downcastStrategies=[];static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Mt,Rt,Be,qt,Se]}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 Dt("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 F(t,"numbered")),t.commands.add("bulletedList",new F(t,"bulleted")),t.commands.add("customNumberedList",new F(t,"customNumbered",{multiLevel:!0})),t.commands.add("customBulletedList",new F(t,"customBulleted",{multiLevel:!0})),t.commands.add("indentList",new ot(t,"forward")),t.commands.add("outdentList",new ot(t,"backward")),t.commands.add("splitListItemBefore",new ct(t,"before")),t.commands.add("splitListItemAfter",new ct(t,"after")),i&&(t.commands.add("mergeListItemBackward",new at(t,"backward")),t.commands.add("mergeListItemForward",new at(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(!y.first(a,{sameAttributes:"listType",sameIndent:!0})&&a.getAttribute("listIndent")===0)rt(a)||t.execute("splitListItemAfter"),t.execute("outdentList");else{if(!e||!e.isEnabled)return;e.execute({shouldMergeOnBlocksContentLevel:ft(t.model,"backward")})}r.preventDefault(),s.stop()}else{if(o.isCollapsed&&!o.getLastPosition().isAtEnd||!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:ft(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=L(a),u=rt(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",Re())}),s||t.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),t.conversion.for("editingDowncast").elementToElement({model:r,view:mt(i),converterPriority:"high"}).add(l=>{l.on("attribute",dt(i,this._downcastStrategies,e)),l.on("remove",De(e.schema))}),t.conversion.for("dataDowncast").elementToElement({model:r,view:mt(i,{dataPipeline:!0}),converterPriority:"high"}).add(l=>{l.on("attribute",dt(i,this._downcastStrategies,e,{dataPipeline:!0}))});const o=ze(this._downcastStrategies,t.editing.view);t.editing.mapper.on("modelToViewPosition",o),t.data.mapper.on("modelToViewPosition",o),this.listenTo(e.document,"change:data",Me(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!=Lt(c.listType)||a.id!=wt(c.listType,c.listIndent))&&(l.return=!0,l.stop())})}_setupModelPostFixing(){const t=this.editor.model,e=this.getListAttributeNames();t.document.registerPostFixer(i=>Ke(t,i,e,this)),this.on("postFixer",(i,{listNodes:s,writer:r})=>{i.return=Oe(s,r)||i.return},{priority:"high"}),this.on("postFixer",(i,{listNodes:s,writer:r,seenIds:o})=>{i.return=Ne(s,o,r)||i.return},{priority:"high"})}_setupClipboardIntegration(){const t=this.editor.model,e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(t,"insertContent",He(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());E(a)&&z(a,r)}})})}_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 Ke(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);A(u.position,o,r),u.attributes.has("listItemId")||A(u.position.getShiftedBy(u.length),o,r);for(const{item:f,previousPosition:m}of n.createRangeIn(d))p(f)&&A(m,o,r)}else u.type=="remove"?A(u.position,o,r):u.type=="attribute"&&e.includes(u.attributeKey)&&(A(u.range.start,o,r),u.attributeNewValue===null&&A(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 ge(u),listHead:u,writer:t,seenIds:c})||a;return a}function He(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 ft(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:E([s,r])}function H(n,t,e,i){n.ui.componentFactory.add(t,()=>{const s=pt(Z,n,t,e,i);return s.set({tooltip:!0,isToggleable:!0}),s}),n.ui.componentFactory.add(`menuBar:${t}`,()=>{const s=pt(Gt,n,t,e,i);return s.set({role:"menuitemcheckbox",isToggleable:!0}),s})}function pt(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 Ye 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 Ti extends h{static get requires(){return[b,Ye]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}}class Ge 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=$(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 _t={},vt={},Ct={},xt=[{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"}];for(const{listStyle:n,typeAttribute:t,listType:e}of xt)_t[n]=e,vt[n]=t,t&&(Ct[t]=n);function Bt(){return xt.map(n=>n.listStyle)}function tt(n){return _t[n]||null}function Ft(n){return Ct[n]||null}function Y(n){return vt[n]||null}function Ze(n){switch(n){case"lower-alpha":return"lower-latin";case"upper-alpha":return"upper-latin";default:return n}}class Je 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=$(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 Qe 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=$(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 gt(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 Xe 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 Et(n){const{startIndex:t,reversed:e,styles:i}=n;return{styles:ti(i),startIndex:t||!1,reversed:e||!1}}function ti(n){const t={listTypes:["bulleted","numbered"],useAttribute:!1};return n===!0||(n?Array.isArray(n)||typeof n=="string"?t.listTypes=S(n):(t.listTypes=n.listTypes?S(n.listTypes):t.listTypes,t.useAttribute=!!n.useAttribute,n.listStyleTypes&&(t.listStyleTypes=n.listStyleTypes)):t.listTypes=[]),t}const B="default";class ei extends h{static get requires(){return[b,Xe]}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(b),s=t.config.get("list.properties"),r=ii(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",gt(l)),o.on("element:ul",gt(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 ii(n){const t=[],e=Et(n);if(n.styles){const i=e.styles.useAttribute;t.push({attributeName:"listStyle",defaultValue:B,viewConsumables:{styles:"list-style-type"},addCommand(s){let r=Bt();i&&(r=r.filter(o=>!!Y(o))),s.commands.add("listStyle",new Je(s,B,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==B?!0:tt(r)==s.getAttribute("listType")},setAttributeOnDowncast(s,r,o){if(r&&r!==B)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 Ze(r);const o=s.getAttribute("type");return o?Ft(o):B}})}return n.reversed&&t.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(i){i.commands.add("listReversed",new Qe(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 Ge(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 Pt extends nt{children;stylesView=null;additionalPropertiesCollapsibleView=null;startIndexFieldView=null;reversedSwitchButtonView=null;focusTracker=new et;keystrokes=new it;focusables=new Jt;focusCycler;constructor(t,{enabledProperties:e,styleButtonViews:i,styleGridAriaLabel:s}){super(t);const r=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new Qt({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);Xt({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>Wt.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 te(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 ee(this.locale,ie);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 se(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 si 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=Et(i),r=s.styles.listTypes;if(r.includes("bulleted")){const o=[{label:e("Toggle the disc list style"),tooltip:e("Disc"),type:"disc",icon:ne},{label:e("Toggle the circle list style"),tooltip:e("Circle"),type:"circle",icon:re},{label:e("Toggle the square list style"),tooltip:e("Square"),type:"square",icon:oe}],l=e("Bulleted List"),a=e("Bulleted list styles toolbar"),c="bulletedList";t.ui.componentFactory.add(c,ht({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,buttonIcon:J,styleGridAriaLabel:a,styleDefinitions:o})),t.ui.componentFactory.add(`menuBar:${c}`,bt({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:le},{label:e("Toggle the decimal with leading zero list style"),tooltip:e("Decimal with leading zero"),type:"decimal-leading-zero",icon:ae},{label:e("Toggle the lower–roman list style"),tooltip:e("Lower–roman"),type:"lower-roman",icon:ce},{label:e("Toggle the upper–roman list style"),tooltip:e("Upper-roman"),type:"upper-roman",icon:ue},{label:e("Toggle the lower–latin list style"),tooltip:e("Lower-latin"),type:"lower-latin",icon:de},{label:e("Toggle the upper–latin list style"),tooltip:e("Upper-latin"),type:"upper-latin",icon:me}],l=e("Numbered List"),a=e("Numbered list styles toolbar"),c="numberedList";t.ui.componentFactory.add(c,ht({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,buttonIcon:Q,styleGridAriaLabel:a,styleDefinitions:o})),r.includes("numbered")&&t.ui.componentFactory.add(`menuBar:${c}`,bt({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,styleGridAriaLabel:a,styleDefinitions:o}))}}}function ht({editor:n,normalizedConfig:t,parentCommandName:e,buttonLabel:i,buttonIcon:s,styleGridAriaLabel:r,styleDefinitions:o}){const l=n.commands.get(e);return a=>{const c=Kt(a,Ht),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=ni({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 Vt({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 ni({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=Vt({editor:n,parentCommandName:i,listStyleCommand:d}),m=t.styles.listStyleTypes;let g=s;if(m){const w=m[a];w&&(g=s.filter(I=>w.includes(I.type)))}const k=Ot(d);c=g.filter(k).map(f)}const u=new Pt(o,{styleGridAriaLabel:r,enabledProperties:l,styleButtonViews:c});if(t.styles.listTypes.includes(a)&&Zt(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 bt({editor:n,normalizedConfig:t,parentCommandName:e,buttonLabel:i,styleGridAriaLabel:s,styleDefinitions:r}){return o=>{const l=new Yt(o),a=n.commands.get(e),c=n.commands.get("listStyle"),u=Ot(c),d=Vt({editor:n,parentCommandName:e,listStyleCommand:c}),f=t.styles.listStyleTypes;let m=r;if(f){const w=a.type,I=f[w];I&&(m=r.filter(Nt=>I.includes(Nt.type)))}const g=m.filter(u).map(d),k=new Pt(o,{styleGridAriaLabel:s,enabledProperties:{...t,startIndex:!1,reversed:!1},styleButtonViews:g});return k.delegate("execute").to(l),l.buttonView.set({label:i,icon:e==="bulletedList"?J:Q}),l.panelView.children.add(k),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 Si extends h{static get requires(){return[ei,si]}static get pluginName(){return"ListProperties"}static get isOfficialPlugin(){return!0}}class ri 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 oi extends pe{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 li=zt("Ctrl+Enter");class ai extends h{static get pluginName(){return"TodoListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.model,i=t.editing,s=t.plugins.get(b),o=t.config.get("list.multiBlock")?"paragraph":"listItem";t.commands.add("todoList",new F(t,"todo")),t.commands.add("checkTodoList",new ri(t)),i.view.addObserver(oi),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",ui()),l.on("element:li",ci(),{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",di({name:"ul",classes:"todo-list"}))}),t.conversion.for("downcast").elementToElement({model:o,view:(l,{writer:a})=>{if(N(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 N(l,s.getListAttributeNames())},createWrapperElement(l,a,{dataPipeline:c}){const u=["todo-list__label"];return N(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=N(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"&&L(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)===li&&(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",fi(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=It(c)&&a.viewPosition.offset<=1,f=c.is("element","span")&&c.getAttribute("contenteditable")=="false"&&It(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=yt(s),l=yt(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 ci(){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 ui(){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 kt(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 di(n){const t=new kt(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 N(n,t){return(n.is("element","paragraph")||n.is("element","listItem"))&&n.getAttribute("listType")=="todo"&&L(n)&&mi(n,t)}function mi(n,t){for(const e of n.getAttributeKeys())if(!e.startsWith("selection:")&&!t.includes(e))return!1;return!0}function fi(n,t){return(e,i)=>{const s=Ut(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 It(n){return!!n&&n.is("attributeElement")&&n.hasClass("todo-list__label")}function yt(n){return!n||!n.is("element","paragraph")&&!n.is("element","listItem")?!1:n.getAttribute("listType")=="todo"}class pi 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"),fe)}}class _i extends h{static get requires(){return[ai,pi]}static get pluginName(){return"TodoList"}static get isOfficialPlugin(){return!0}}export{ri as CheckTodoListCommand,Ti as List,F as ListCommand,b as ListEditing,Se as ListFormatting,ot as ListIndentCommand,ke as ListItemBoldIntegration,we as ListItemFontColorIntegration,Te as ListItemFontFamilyIntegration,Le as ListItemFontSizeIntegration,Ae as ListItemItalicIntegration,at as ListMergeCommand,Si as ListProperties,ei as ListPropertiesEditing,si as ListPropertiesUI,Xe as ListPropertiesUtils,Qe as ListReversedCommand,ct as ListSplitCommand,Ge as ListStartCommand,Je as ListStyleCommand,Ye as ListUI,Be as ListUtils,_i as TodoList,ai as TodoListEditing,pi as TodoListUI,ge as _ListBlocksIterable,Pt as _ListPropertiesView,y as _ListWalker,V as _SiblingListBlocksIterator,oi as _TodoCheckboxChangeObserver,U as _canBecomeSimpleListItem,Pe as _createListElement,Ve as _createListItemElement,H as _createListUIComponents,ze as _createModelToViewListPositionMapper,O as _expandListBlocksToCompleteItems,$ as _expandListBlocksToCompleteList,A as _findAndAddListHeadToMap,$e as _findMappedListItemViewElement,Oe as _fixListIndents,Ne as _fixListItemIds,T as _getAllListItemBlocks,Bt as _getAllSupportedListStyleTypes,Ee as _getListIndent,_ as _getListItemBlocks,At as _getListItems,Ft as _getListStyleTypeFromTypeAttribute,tt as _getListTypeFromListStyleType,he as _getNestedListBlocks,Et as _getNormalizedListConfig,P as _getSelectedBlockObject,Y as _getTypeAttributeFromListStyleType,wt as _getViewElementIdForListType,Lt as _getViewElementNameForListType,q as _indentListBlocks,L as _isFirstBlockOfListItem,rt as _isLastBlockOfListItem,p as _isListItemBlock,K as _isListItemView,Fe as _isListView,M as _isNumberedListType,E as _isSingleListItem,mt as _listItemBogusParagraphCreator,dt as _listItemDowncastConverter,De as _listItemDowncastRemoveConverter,Re as _listItemUpcastConverter,gt as _listPropertiesUpcastConverter,W as _mergeListItemBefore,Ze as _normalizeListStyle,Ie as _outdentFollowingListItems,be as _outdentListBlocksWithMerge,Me as _reconvertListItemsOnDataChange,z as _removeListAttributes,C as _sortListBlocks,X as _splitListItemBefore};