@ncino/web-components 4.3.0-preview.6 → 4.3.0-preview.8

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 (110) hide show
  1. package/dist/_virtual/external3.js +1 -0
  2. package/dist/_virtual/index10.js +1 -1
  3. package/dist/_virtual/index11.js +1 -1
  4. package/dist/_virtual/index12.js +1 -1
  5. package/dist/_virtual/index13.js +1 -0
  6. package/dist/_virtual/index4.js +1 -1
  7. package/dist/_virtual/index5.js +1 -1
  8. package/dist/_virtual/index6.js +1 -1
  9. package/dist/_virtual/index7.js +1 -1
  10. package/dist/_virtual/index8.js +1 -1
  11. package/dist/_virtual/index9.js +1 -1
  12. package/dist/_virtual/index_react.js +1 -0
  13. package/dist/_virtual/index_react2.js +1 -0
  14. package/dist/_virtual/react.production.js +1 -0
  15. package/dist/assets/node_modules/.pnpm/{ckeditor5@45.2.0 → ckeditor5@45.2.1}/node_modules/ckeditor5/dist/ckeditor5.css +1 -1
  16. package/dist/components/alert/alert.gator.figma.js +7 -0
  17. package/dist/components/avatar/gator/avatar.gator.figma.js +9 -0
  18. package/dist/components/button/gator/button.gator.figma.js +12 -4
  19. package/dist/components/button-group/gator/button-group.gator.figma.js +7 -0
  20. package/dist/components/icon/gator/icon.gator.figma.js +7 -2
  21. package/dist/components/icon/gator/icons.gator.figma.js +1 -0
  22. package/dist/components/input-rich-text/ckeditor-config.js +1 -1
  23. package/dist/components/input-rich-text/input-rich-text.slds.js +2 -2
  24. package/dist/components/panel/gator/panel.storybook-test.js +1 -1
  25. package/dist/components/table/gator/table.gator.js +70 -37
  26. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-alignment@45.2.0 → @ckeditor_ckeditor5-alignment@45.2.1}/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +1 -1
  27. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autoformat@45.2.0 → @ckeditor_ckeditor5-autoformat@45.2.1}/node_modules/@ckeditor/ckeditor5-autoformat/dist/index.js +1 -1
  28. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autosave@45.2.0 → @ckeditor_ckeditor5-autosave@45.2.1}/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +1 -1
  29. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-basic-styles@45.2.0 → @ckeditor_ckeditor5-basic-styles@45.2.1}/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +1 -1
  30. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-block-quote@45.2.0 → @ckeditor_ckeditor5-block-quote@45.2.1}/node_modules/@ckeditor/ckeditor5-block-quote/dist/index.js +1 -1
  31. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-clipboard@45.2.0 → @ckeditor_ckeditor5-clipboard@45.2.1}/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +1 -1
  32. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-cloud-services@45.2.0 → @ckeditor_ckeditor5-cloud-services@45.2.1}/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +1 -1
  33. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-code-block@45.2.0 → @ckeditor_ckeditor5-code-block@45.2.1}/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +1 -1
  34. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-core@45.2.0 → @ckeditor_ckeditor5-core@45.2.1}/node_modules/@ckeditor/ckeditor5-core/dist/index.js +1 -1
  35. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-editor-classic@45.2.0 → @ckeditor_ckeditor5-editor-classic@45.2.1}/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +1 -1
  36. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-engine@45.2.0 → @ckeditor_ckeditor5-engine@45.2.1}/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +11 -11
  37. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-enter@45.2.0 → @ckeditor_ckeditor5-enter@45.2.1}/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +1 -1
  38. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-essentials@45.2.0 → @ckeditor_ckeditor5-essentials@45.2.1}/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +1 -1
  39. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-find-and-replace@45.2.0 → @ckeditor_ckeditor5-find-and-replace@45.2.1}/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +1 -1
  40. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-font@45.2.0 → @ckeditor_ckeditor5-font@45.2.1}/node_modules/@ckeditor/ckeditor5-font/dist/index.js +1 -1
  41. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-heading@45.2.0 → @ckeditor_ckeditor5-heading@45.2.1}/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +1 -1
  42. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-highlight@45.2.0 → @ckeditor_ckeditor5-highlight@45.2.1}/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +1 -1
  43. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-horizontal-line@45.2.0 → @ckeditor_ckeditor5-horizontal-line@45.2.1}/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +1 -1
  44. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-html-embed@45.2.0 → @ckeditor_ckeditor5-html-embed@45.2.1}/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +1 -1
  45. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-html-support@45.2.0 → @ckeditor_ckeditor5-html-support@45.2.1}/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +1 -1
  46. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-image@45.2.0 → @ckeditor_ckeditor5-image@45.2.1}/node_modules/@ckeditor/ckeditor5-image/dist/index.js +1 -1
  47. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-indent@45.2.0 → @ckeditor_ckeditor5-indent@45.2.1}/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +1 -1
  48. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-language@45.2.0 → @ckeditor_ckeditor5-language@45.2.1}/node_modules/@ckeditor/ckeditor5-language/dist/index.js +1 -1
  49. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-link@45.2.0 → @ckeditor_ckeditor5-link@45.2.1}/node_modules/@ckeditor/ckeditor5-link/dist/index.js +1 -1
  50. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-list@45.2.0 → @ckeditor_ckeditor5-list@45.2.1}/node_modules/@ckeditor/ckeditor5-list/dist/index.js +1 -1
  51. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-markdown-gfm@45.2.0 → @ckeditor_ckeditor5-markdown-gfm@45.2.1}/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +1 -1
  52. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-media-embed@45.2.0 → @ckeditor_ckeditor5-media-embed@45.2.1}/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +1 -1
  53. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-mention@45.2.0 → @ckeditor_ckeditor5-mention@45.2.1}/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -1
  54. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-page-break@45.2.0 → @ckeditor_ckeditor5-page-break@45.2.1}/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +1 -1
  55. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paragraph@45.2.0 → @ckeditor_ckeditor5-paragraph@45.2.1}/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -1
  56. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paste-from-office@45.2.0 → @ckeditor_ckeditor5-paste-from-office@45.2.1}/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +1 -1
  57. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-remove-format@45.2.0 → @ckeditor_ckeditor5-remove-format@45.2.1}/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +1 -1
  58. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-select-all@45.2.0 → @ckeditor_ckeditor5-select-all@45.2.1}/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +1 -1
  59. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-show-blocks@45.2.0 → @ckeditor_ckeditor5-show-blocks@45.2.1}/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +1 -1
  60. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-source-editing@45.2.0 → @ckeditor_ckeditor5-source-editing@45.2.1}/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +1 -1
  61. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-special-characters@45.2.0 → @ckeditor_ckeditor5-special-characters@45.2.1}/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +1 -1
  62. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-style@45.2.0 → @ckeditor_ckeditor5-style@45.2.1}/node_modules/@ckeditor/ckeditor5-style/dist/index.js +1 -1
  63. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-table@45.2.0 → @ckeditor_ckeditor5-table@45.2.1}/node_modules/@ckeditor/ckeditor5-table/dist/index.js +1 -1
  64. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-typing@45.2.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +13 -0
  65. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-ui@45.2.0 → @ckeditor_ckeditor5-ui@45.2.1}/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -1
  66. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-undo@45.2.0 → @ckeditor_ckeditor5-undo@45.2.1}/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +1 -1
  67. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-upload@45.2.0 → @ckeditor_ckeditor5-upload@45.2.1}/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +1 -1
  68. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-utils@45.2.0 → @ckeditor_ckeditor5-utils@45.2.1}/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +1 -1
  69. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-widget@45.2.0 → @ckeditor_ckeditor5-widget@45.2.1}/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1 -1
  70. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/client/external.js +1 -1
  71. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/common/updates.js +1 -1
  72. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/react/external.js +1 -0
  73. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/react/index_react.js +1 -0
  74. package/dist/node_modules/.pnpm/{@storybook_instrumenter@8.6.14_storybook@8.6.14_prettier@3.6.0_ → @storybook_instrumenter@8.6.14_storybook@8.6.14_prettier@3.5.3_}/node_modules/@storybook/instrumenter/dist/index.js +1 -1
  75. package/dist/node_modules/.pnpm/{@storybook_test@8.6.14_storybook@8.6.14_prettier@3.6.0_ → @storybook_test@8.6.14_storybook@8.6.14_prettier@3.5.3_}/node_modules/@storybook/test/dist/index.js +1 -1
  76. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +1 -1
  77. package/dist/node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js +1 -1
  78. package/dist/node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js +1 -1
  79. package/dist/node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js +1 -1
  80. package/dist/node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.js +1 -1
  81. package/dist/node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js +1 -1
  82. package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.production.js +9 -0
  83. package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/index.js +1 -0
  84. package/dist/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js +1 -1
  85. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/index.js +1 -1
  86. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/index.js +1 -1
  87. package/dist/packages/web-components/src/components/table/gator/table.gator.scss.js +1 -1
  88. package/dist/types/components/alert/alert.gator.figma.d.ts +1 -0
  89. package/dist/types/components/avatar/gator/avatar.gator.figma.d.ts +1 -0
  90. package/dist/types/components/button-group/gator/button-group.gator.figma.d.ts +1 -0
  91. package/dist/types/components/icon/gator/icons.gator.figma.d.ts +1 -0
  92. package/dist/types/components/table/gator/table.gator.d.ts +3 -0
  93. package/dist/types/components/table/table.d.ts +2 -0
  94. package/dist/utils/vitest-a11y-utils.js +1 -1
  95. package/package.json +18 -18
  96. package/web-types.json +1 -1
  97. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-typing@45.2.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +0 -13
  98. /package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-icons@45.2.0 → @ckeditor_ckeditor5-icons@45.2.1}/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +0 -0
  99. /package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-watchdog@45.2.0 → @ckeditor_ckeditor5-watchdog@45.2.1}/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +0 -0
  100. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.6.0_storybook@8.6.14_prettier@3.6.0_ → @storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_}/node_modules/@storybook/core/dist/channels/index.js +0 -0
  101. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.6.0_storybook@8.6.14_prettier@3.6.0_ → @storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_}/node_modules/@storybook/core/dist/client-logger/index.js +0 -0
  102. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.6.0_storybook@8.6.14_prettier@3.6.0_ → @storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_}/node_modules/@storybook/core/dist/core-events/index.js +0 -0
  103. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.6.0_storybook@8.6.14_prettier@3.6.0_ → @storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_}/node_modules/@storybook/core/dist/csf/index.js +0 -0
  104. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.6.0_storybook@8.6.14_prettier@3.6.0_ → @storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_}/node_modules/@storybook/core/dist/preview-api/index.js +0 -0
  105. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.6.0_storybook@8.6.14_prettier@3.6.0_ → @storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_}/node_modules/@storybook/core/dist/preview-errors.js +0 -0
  106. /package/dist/node_modules/.pnpm/{@vitest_browser@3.2.4_msw@2.7.3_@types_node@24.0.3_typescript@5.8.3__playwright@1.53.1__6fcfe539b096d0d382b4f941dd125630 → @vitest_browser@3.2.4_msw@2.7.3_@types_node@24.0.1_typescript@5.8.3__playwright@1.53.1__64bf204e83d923e607f171b7f35f4f46}/node_modules/@vitest/browser/context.js +0 -0
  107. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.3_@vitest_browser@3.2.4_@vitest_ui@3._c4c70545e07c6add63948b205cccfe4e → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.1_@vitest_browser@3.2.4_@vitest_ui@3._5d5a5c8a4aa2033fceb23b072a94a45b}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +0 -0
  108. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.3_@vitest_browser@3.2.4_@vitest_ui@3._c4c70545e07c6add63948b205cccfe4e → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.1_@vitest_browser@3.2.4_@vitest_ui@3._5d5a5c8a4aa2033fceb23b072a94a45b}/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +0 -0
  109. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.3_@vitest_browser@3.2.4_@vitest_ui@3._c4c70545e07c6add63948b205cccfe4e → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.1_@vitest_browser@3.2.4_@vitest_ui@3._5d5a5c8a4aa2033fceb23b072a94a45b}/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +0 -0
  110. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.3_@vitest_browser@3.2.4_@vitest_ui@3._c4c70545e07c6add63948b205cccfe4e → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.1_@vitest_browser@3.2.4_@vitest_ui@3._5d5a5c8a4aa2033fceb23b072a94a45b}/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +0 -0
@@ -1,4 +1,4 @@
1
- import{Plugin as m,Command as E}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Observer as b,BubblingEventInfo as v,DomEventData as k}from"../../../../../@ckeditor_ckeditor5-engine@45.2.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{env as S}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";/**
1
+ import{Plugin as m,Command as E}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Observer as b,BubblingEventInfo as v,DomEventData as k}from"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{env as S}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  *//**
@@ -1,4 +1,4 @@
1
- import{Plugin as t}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Clipboard as r}from"../../../../../@ckeditor_ckeditor5-clipboard@45.2.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Enter as i,ShiftEnter as e}from"../../../../../@ckeditor_ckeditor5-enter@45.2.0/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{SelectAll as o}from"../../../../../@ckeditor_ckeditor5-select-all@45.2.0/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js";import{Typing as s}from"../../../../../@ckeditor_ckeditor5-typing@45.2.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Undo as m}from"../../../../../@ckeditor_ckeditor5-undo@45.2.0/node_modules/@ckeditor/ckeditor5-undo/dist/index.js";import{AccessibilityHelp as l}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
1
+ import{Plugin as t}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Clipboard as r}from"../../../../../@ckeditor_ckeditor5-clipboard@45.2.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Enter as i,ShiftEnter as e}from"../../../../../@ckeditor_ckeditor5-enter@45.2.1/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{SelectAll as o}from"../../../../../@ckeditor_ckeditor5-select-all@45.2.1/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js";import{Typing as s}from"../../../../../@ckeditor_ckeditor5-typing@45.2.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Undo as m}from"../../../../../@ckeditor_ckeditor5-undo@45.2.1/node_modules/@ckeditor/ckeditor5-undo/dist/index.js";import{AccessibilityHelp as l}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */class d extends t{static get requires(){return[l,r,i,o,e,s,m]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}}export{d as Essentials};
@@ -1,4 +1,4 @@
1
- var v=Object.defineProperty;var F=(c,r,t)=>r in c?v(c,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[r]=t;var u=(c,r,t)=>F(c,typeof r!="symbol"?r+"":r,t);import{Plugin as _,Command as w}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconFindReplace as b,IconPreviousArrow as V}from"../../../../../@ckeditor_ckeditor5-icons@45.2.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{Dialog as B,DropdownView as A,createDropdown as I,FormHeaderView as E,ButtonView as k,MenuBarMenuListItemButtonView as D,DialogViewPosition as O,CssTransitionDisablerMixin as S,View as p,ViewCollection as P,FocusCycler as N,submitHandler as M,CollapsibleView as H,SwitchButtonView as R,LabeledFieldView as W,createLabeledInputText as $}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{scrollViewportToShowTarget as L,Collection as x,uid as U,ObservableMixin as q,FocusTracker as G,KeystrokeHandler as K,isVisible as j,Rect as z}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{debounce as Q}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/debounce.js";import{escapeRegExp as Z}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js";/**
1
+ var v=Object.defineProperty;var F=(c,r,t)=>r in c?v(c,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[r]=t;var u=(c,r,t)=>F(c,typeof r!="symbol"?r+"":r,t);import{Plugin as _,Command as w}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconFindReplace as b,IconPreviousArrow as V}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{Dialog as B,DropdownView as A,createDropdown as I,FormHeaderView as E,ButtonView as k,MenuBarMenuListItemButtonView as D,DialogViewPosition as O,CssTransitionDisablerMixin as S,View as p,ViewCollection as P,FocusCycler as N,submitHandler as M,CollapsibleView as H,SwitchButtonView as R,LabeledFieldView as W,createLabeledInputText as $}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{scrollViewportToShowTarget as L,Collection as x,uid as U,ObservableMixin as q,FocusTracker as G,KeystrokeHandler as K,isVisible as j,Rect as z}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{debounce as Q}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/debounce.js";import{escapeRegExp as Z}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */class J extends p{constructor(t){super(t);u(this,"children");u(this,"_findInputView");u(this,"_replaceInputView");u(this,"_findButtonView");u(this,"_findPrevButtonView");u(this,"_findNextButtonView");u(this,"_advancedOptionsCollapsibleView");u(this,"_matchCaseSwitchView");u(this,"_wholeWordsOnlySwitchView");u(this,"_replaceButtonView");u(this,"_replaceAllButtonView");u(this,"_inputsDivView");u(this,"_actionButtonsDivView");u(this,"_focusTracker");u(this,"_keystrokes");u(this,"_focusables");u(this,"focusCycler");const e=t.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",(i,s)=>i>0&&!s),this._findInputView=this._createInputField(e("Find in text…")),this._findPrevButtonView=this._createButton({label:e("Previous result"),class:"ck-button-prev",icon:V,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:e("Next result"),class:"ck-button-next",icon:V,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(e("Replace with…"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:e("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:e("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:e("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new G,this._keystrokes=new K,this._focusables=new P,this.focusCycler=new N({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children})}render(){super.render(),M({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(t){t===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){const t=this.locale,e=t.t,i=new p(t);return this._findInputView.fieldView.on("input",()=>{this.isDirty=!0}),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findPrevious:s})=>s),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findNext:s})=>s),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:s},n)=>s&&n),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",(s,n)=>s||!n?"":e("Tip: Find some text first in order to replace it.")),i.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),i}_onFindButtonExecute(){if(!this._textToFind){const t=this.t;this._findInputView.errorText=t("Text to find must not be empty.");return}this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly})}_injectFindResultsCounter(){const t=this.locale,e=t.t,i=this.bindTemplate,s=new p(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",(o,a)=>e("%0 of %1",[o,a])),s.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",i.if("isDirty","ck-hidden")]},children:[{text:i.to("_resultsCounterText")}]});const n=()=>{const o=this._findInputView.fieldView.element;if(!o||!j(o))return;const a=new z(s.element).width,d=t.uiLanguageDirection==="ltr"?"paddingRight":"paddingLeft";a?o.style[d]=`calc( 2 * var(--ck-spacing-standard) + ${a}px )`:o.style[d]=""};this.on("change:_resultsCounterText",n,{priority:"low"}),this.on("change:isDirty",n,{priority:"low"}),this._findInputView.template.children[0].children.push(s)}_createAdvancedOptionsCollapsible(){const t=this.locale.t,e=new H(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return e.set({label:t("Advanced options"),isCollapsed:!0}),e}_createActionButtonsDiv(){const t=new p(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:e},i)=>e&&i),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replaceAll:e},i)=>e&&i),this._replaceButtonView.on("execute",()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})}),this._replaceAllButtonView.on("execute",()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()}),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),t.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),t}_createMatchCaseSwitch(){const t=this.locale.t,e=new R(this.locale);return e.set({label:t("Match case"),withText:!0}),e.bind("isOn").to(this,"_matchCase"),e.on("execute",()=>{this._matchCase=!this._matchCase,this.isDirty=!0}),e}_createWholeWordsOnlySwitch(){const t=this.locale.t,e=new R(this.locale);return e.set({label:t("Whole words only"),withText:!0}),e.bind("isOn").to(this,"_wholeWordsOnly"),e.on("execute",()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0}),e}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}_initKeystrokeHandling(){const t=i=>i.stopPropagation(),e=i=>{i.stopPropagation(),i.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",i=>{e(i),this._findNextButtonView.fire("execute")}),this._keystrokes.set("shift+f3",i=>{e(i),this._findPrevButtonView.fire("execute")}),this._keystrokes.set("enter",i=>{const s=i.target;s===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),e(i)):s===this._replaceInputView.fieldView.element&&!this.isDirty&&(this._replaceButtonView.fire("execute"),e(i))}),this._keystrokes.set("shift+enter",i=>{i.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),e(i))}),this._keystrokes.set("arrowright",t),this._keystrokes.set("arrowleft",t),this._keystrokes.set("arrowup",t),this._keystrokes.set("arrowdown",t)}_createButton(t){const e=new k(this.locale);return e.set(t),e}_createInputField(t,e){const i=new W(this.locale,$);return i.label=t,i.class=e,i}}class X extends _{constructor(t){super(t);u(this,"formView");t.config.define("findAndReplace.uiType","dialog"),this.formView=null}static get requires(){return[B]}static get pluginName(){return"FindAndReplaceUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.config.get("findAndReplace.uiType")==="dropdown",i=t.commands.get("find"),s=this.editor.t;t.ui.componentFactory.add("findAndReplace",()=>{let n;return e?(n=this._createDropdown(),n.bind("isEnabled").to(i)):n=this._createDialogButtonForToolbar(),t.keystrokes.set("Ctrl+F",(o,a)=>{if(i.isEnabled){if(n instanceof A){const d=n.buttonView;d.isOn||d.fire("execute")}else n.isOn?t.plugins.get("Dialog").view.focus():n.fire("execute");a()}}),n}),e||t.ui.componentFactory.add("menuBar:findAndReplace",()=>this._createDialogButtonForMenuBar()),t.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Find in the document"),keystroke:"CTRL+F"}]})}_createDropdown(){const t=this.editor,e=t.locale.t,i=I(t.locale);return i.once("change:isOpen",()=>{this.formView=this._createFormView(),this.formView.children.add(new E(t.locale,{label:e("Find and replace")}),0),i.panelView.children.add(this.formView)}),i.on("change:isOpen",(s,n,o)=>{o?this._setupFormView():this.fire("searchReseted")},{priority:"low"}),i.buttonView.set({icon:b,label:e("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),i}_createDialogButtonForToolbar(){const t=this.editor,e=this._createButton(k),i=t.plugins.get("Dialog");return e.set({tooltip:!0}),e.bind("isOn").to(i,"id",s=>s==="findAndReplace"),e.on("execute",()=>{e.isOn?i.hide():this._showDialog()}),e}_createDialogButtonForMenuBar(){const t=this._createButton(D),e=this.editor.plugins.get("Dialog"),i=this.editor.plugins.get("Dialog");return t.set({role:"menuitemcheckbox",isToggleable:!0}),t.bind("isOn").to(i,"id",s=>s==="findAndReplace"),t.on("execute",()=>{if(e.id==="findAndReplace"){e.hide();return}this._showDialog()}),t}_createButton(t){const e=this.editor,i=e.commands.get("find"),s=new t(e.locale),n=e.locale.t;return s.bind("isEnabled").to(i),s.set({icon:b,label:n("Find and replace"),keystroke:"CTRL+F"}),s}_showDialog(){const t=this.editor,e=t.plugins.get("Dialog"),i=t.locale.t;this.formView||(this.formView=this._createFormView()),e.show({id:"findAndReplace",title:i("Find and replace"),content:this.formView,position:O.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){const t=this.editor,e=new(S(J))(t.locale),i=t.commands,n=this.editor.plugins.get("FindAndReplaceEditing").state;e.bind("highlightOffset").to(n,"highlightedOffset"),e.listenTo(n.results,"change",()=>{e.matchCount=n.results.length});const o=i.get("findNext"),a=i.get("findPrevious"),d=i.get("replace"),l=i.get("replaceAll");return e.bind("_areCommandsEnabled").to(o,"isEnabled",a,"isEnabled",d,"isEnabled",l,"isEnabled",(h,g,f,m)=>({findNext:h,findPrevious:g,replace:f,replaceAll:m})),e.delegate("findNext","findPrevious","replace","replaceAll").to(this),e.on("change:isDirty",(h,g,f)=>{f&&this.fire("searchReseted")}),e}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()}}class Y extends w{constructor(t,e){super(t);u(this,"_state");this.isEnabled=!0,this.affectsData=!1,this._state=e}execute(t,{matchCase:e,wholeWords:i}={}){const{editor:s}=this,{model:n}=s,o=s.plugins.get("FindAndReplaceUtils");let a,d="";typeof t=="string"?a=(...g)=>({results:o.findByTextCallback(t,{matchCase:e,wholeWords:i})(...g),searchText:t}):a=t;const l=a;a=(...g)=>{const f=l(...g);return f&&"searchText"in f&&(d=f.searchText),f};const h=n.document.getRootNames().reduce((g,f)=>o.updateFindResultFromRange(n.createRangeIn(n.document.getRoot(f)),n,a,g),null);return this._state.clear(n),this._state.results.addMany(h),this._state.highlightedResult=h.get(0),this._state.searchText=d,a&&(this._state.lastSearchCallback=a),this._state.matchCase=!!e,this._state.matchWholeWords=!!i,{results:h,findCallback:a}}}class ee extends q(){constructor(r){super(),this.set("results",new x),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",(t,{removed:e,index:i})=>{if(Array.from(e).length){let s=!1;if(r.change(n=>{for(const o of e)this.highlightedResult===o&&(s=!0),r.markers.has(o.marker.name)&&n.removeMarker(o.marker)}),s){const n=i>=this.results.length?0:i;this.highlightedResult=this.results.get(n)}}}),this.on("change:highlightedResult",()=>{this.refreshHighlightOffset(r)})}clear(r){this.searchText="",r.change(t=>{if(this.highlightedResult){const e=this.highlightedResult.marker.name.split(":")[1],i=r.markers.get(`findResultHighlighted:${e}`);i&&t.removeMarker(i)}[...this.results].forEach(({marker:e})=>{t.removeMarker(e)})}),this.results.clear()}refreshHighlightOffset(r){const{highlightedResult:t,results:e}=this;t?this.highlightedOffset=C(r,[...e]).indexOf(t)+1:this.highlightedOffset=0}}function C(c,r){const t={before:-1,same:0,after:1,different:1};return c.document.getRootNames().flatMap(e=>r.filter(i=>i.marker.getStart().root.rootName===e).sort((i,s)=>t[i.marker.getStart().compareWith(s.marker.getStart())]))}class y extends w{constructor(t,e){super(t);u(this,"_state");this.isEnabled=!0,this._state=e,this._isEnabledBasedOnSelection=!1}_replace(t,e){const{model:i}=this.editor,s=e.marker.getRange();i.canEditAt(s)&&i.change(n=>{if(s.root.rootName==="$graveyard"){this._state.results.remove(e);return}let o={};for(const a of s.getItems())if(a.is("$text")||a.is("$textProxy")){o=a.getAttributes();break}i.insertContent(n.createText(t,o),s),this._state.results.has(e)&&this._state.results.remove(e)})}}class te extends y{execute(r,t){const e=Math.max(this._state.highlightedOffset-1,0);if(this._replace(r,t),this._state.results.length){const i=C(this.editor.model,[...this._state.results]);this._state.highlightedResult=i[e%i.length]}}}class ie extends y{execute(r,t){const{editor:e}=this,{model:i}=e,s=e.plugins.get("FindAndReplaceUtils"),n=t instanceof x?t:i.document.getRootNames().reduce((o,a)=>s.updateFindResultFromRange(i.createRangeIn(i.document.getRoot(a)),i,s.findByTextCallback(t,this._state),o),null);n.length&&i.change(()=>{[...n].forEach(o=>{this._replace(r,o)})})}}class T extends w{constructor(t,e){super(t);u(this,"_state");this.affectsData=!1,this._state=e,this.isEnabled=!1,this.listenTo(this._state.results,"change",()=>{this.isEnabled=this._state.results.length>1})}refresh(){this.isEnabled=this._state.results.length>1}execute(){const t=this._state.results,e=t.getIndex(this._state.highlightedResult),i=e+1>=t.length?0:e+1;this._state.highlightedResult=this._state.results.get(i)}}class se extends T{execute(){const t=this._state.results.getIndex(this._state.highlightedResult),e=t-1<0?this._state.results.length-1:t-1;this._state.highlightedResult=this._state.results.get(e)}}class ne extends _{static get pluginName(){return"FindAndReplaceUtils"}static get isOfficialPlugin(){return!0}updateFindResultFromRange(r,t,e,i){const s=i||new x,n=o=>s.find(a=>{const{marker:d}=a,l=d.getRange(),h=o.getRange();return l.isEqual(h)});return t.change(o=>{[...r].forEach(({type:a,item:d})=>{if(a==="elementStart"&&t.schema.checkChild(d,"$text")){let l=e({item:d,text:this.rangeToText(t.createRangeIn(d))});if(!l)return;"results"in l&&(l=l.results),l.forEach(h=>{const g=`findResult:${U()}`,f=o.addMarker(g,{usingOperation:!1,affectsData:!1,range:o.createRange(o.createPositionAt(d,h.start),o.createPositionAt(d,h.end))}),m=re(s,f);n(f)||s.add({id:g,label:h.label,marker:f},m)})}})}),s}rangeToText(r){return Array.from(r.getItems({shallow:!0})).reduce((t,e)=>e.is("$text")||e.is("$textProxy")?t+e.data:`${t}
@@ -1,4 +1,4 @@
1
- var j=Object.defineProperty;var H=(t,e,o)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var C=(t,e,o)=>H(t,typeof e!="symbol"?e+"":e,o);import{Plugin as h,Command as Y}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{createDropdown as A,addListToDropdown as L,MenuBarMenuView as V,MenuBarMenuListView as T,MenuBarMenuListItemView as E,MenuBarMenuListItemButtonView as D,normalizeColorOptions as W,getLocalizedColorOptions as Z,focusChildOnDropdownOpen as J,ColorSelectorView as I,ViewModel as _}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{CKEditorError as $,Collection as R}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconFontBackground as Q,IconFontColor as X,IconFontFamily as N,IconFontSize as z}from"../../../../../@ckeditor_ckeditor5-icons@45.2.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{addBackgroundRules as ee,isLength as te,isPercentage as oe}from"../../../../../@ckeditor_ckeditor5-engine@45.2.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";/**
1
+ var j=Object.defineProperty;var H=(t,e,o)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var C=(t,e,o)=>H(t,typeof e!="symbol"?e+"":e,o);import{Plugin as h,Command as Y}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{createDropdown as A,addListToDropdown as L,MenuBarMenuView as V,MenuBarMenuListView as T,MenuBarMenuListItemView as E,MenuBarMenuListItemButtonView as D,normalizeColorOptions as W,getLocalizedColorOptions as Z,focusChildOnDropdownOpen as J,ColorSelectorView as I,ViewModel as _}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{CKEditorError as $,Collection as R}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconFontBackground as Q,IconFontColor as X,IconFontFamily as N,IconFontSize as z}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{addBackgroundRules as ee,isLength as te,isPercentage as oe}from"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */class x extends Y{constructor(o,n){super(o);C(this,"attributeKey");this.attributeKey=n}refresh(){const o=this.editor.model,n=o.document;this.value=n.selection.getAttribute(this.attributeKey),this.isEnabled=o.schema.checkAttributeInSelection(n.selection,this.attributeKey)}execute(o={}){const n=this.editor.model,r=n.document.selection,c=o.value,u=o.batch,s=l=>{if(r.isCollapsed)c?l.setSelectionAttribute(this.attributeKey,c):l.removeSelectionAttribute(this.attributeKey);else{const p=n.schema.getValidRanges(r.getRanges(),this.attributeKey);for(const g of p)c?l.setAttribute(this.attributeKey,c,g):l.removeAttribute(this.attributeKey,g)}};u?n.enqueueChange(u,l=>{s(l)}):n.change(l=>{s(l)})}}const d="fontSize",f="fontFamily",w="fontColor",y="fontBackgroundColor";function M(t,e){const o={model:{key:t,values:[]},view:{},upcastAlso:{}};for(const n of e)o.model.values.push(n.model),o.view[n.model]=n.view,n.upcastAlso&&(o.upcastAlso[n.model]=n.upcastAlso);return o}function U(t){return e=>ie(e.getStyle(t))}function G(t){return(e,{writer:o})=>o.createAttributeElement("span",{style:`${t}:${e}`},{priority:7})}function ne({dropdownView:t,colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:r,documentColorsCount:c,colorPickerViewConfig:u}){const s=t.locale,l=new I(s,{colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:r,documentColorsCount:c,colorPickerViewConfig:u});return t.colorSelectorView=l,t.panelView.children.add(l),l}function ie(t){return t.replace(/\s/g,"")}class re extends x{constructor(e){super(e,f)}}/**
@@ -1,4 +1,4 @@
1
- var v=Object.defineProperty;var E=(r,e,t)=>e in r?v(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var w=(r,e,t)=>E(r,typeof e!="symbol"?e+"":e,t);import{Plugin as f,Command as V}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Paragraph as x}from"../../../../../@ckeditor_ckeditor5-paragraph@45.2.0/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js";import{priorities as M,Collection as C,first as k}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ViewModel as L,createDropdown as P,addListToDropdown as T,MenuBarMenuView as y,MenuBarMenuListView as B,MenuBarMenuListItemView as O,MenuBarMenuListItemButtonView as N}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import"../../../../../@ckeditor_ckeditor5-engine@45.2.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";/**
1
+ var v=Object.defineProperty;var E=(r,e,t)=>e in r?v(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var w=(r,e,t)=>E(r,typeof e!="symbol"?e+"":e,t);import{Plugin as f,Command as V}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Paragraph as x}from"../../../../../@ckeditor_ckeditor5-paragraph@45.2.1/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js";import{priorities as M,Collection as C,first as k}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ViewModel as L,createDropdown as P,addListToDropdown as T,MenuBarMenuView as y,MenuBarMenuListView as B,MenuBarMenuListItemView as O,MenuBarMenuListItemButtonView as N}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */class I extends V{constructor(t,n){super(t);w(this,"modelElements");this.modelElements=n}refresh(){const t=k(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some(n=>b(t,n,this.editor.model.schema))}execute(t){const n=this.editor.model,l=n.document,m=t.value;n.change(c=>{const s=Array.from(l.selection.getSelectedBlocks()).filter(g=>b(g,m,n.schema));for(const g of s)g.is("element",m)||c.rename(g,m)})}}function b(r,e,t){return t.checkChild(r.parent,e)&&!t.isObject(r)}const H="paragraph";class _ extends f{static get pluginName(){return"HeadingEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[x]}init(){const e=this.editor,t=e.config.get("heading.options"),n=[];for(const l of t)l.model!=="paragraph"&&(e.model.schema.register(l.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(l),n.push(l.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new I(e,n))}afterInit(){const e=this.editor,t=e.commands.get("enter"),n=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(l,m)=>{const c=e.model.document.selection.getFirstPosition().parent;n.some(g=>c.is("element",g.model))&&!c.is("element",H)&&c.childCount===0&&m.writer.rename(c,H)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:M.low+1})}}/**
@@ -1,4 +1,4 @@
1
- import{Plugin as w,Command as V}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconEraser as k,IconMarker as x,IconPen as B}from"../../../../../@ckeditor_ckeditor5-icons@45.2.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as y,createDropdown as E,addToolbarToDropdown as H,MenuBarMenuView as M,MenuBarMenuListView as A,MenuBarMenuListItemView as f,MenuBarMenuListItemButtonView as v,ListSeparatorView as T,SplitButtonView as I,ToolbarSeparatorView as P}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
1
+ import{Plugin as w,Command as V}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconEraser as k,IconMarker as x,IconPen as B}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as y,createDropdown as E,addToolbarToDropdown as H,MenuBarMenuView as M,MenuBarMenuListView as A,MenuBarMenuListItemView as f,MenuBarMenuListItemButtonView as v,ListSeparatorView as T,SplitButtonView as I,ToolbarSeparatorView as P}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */class O extends V{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,r=t.document.selection,o=e.value;t.change(i=>{if(r.isCollapsed){const s=r.getFirstPosition();if(r.hasAttribute("highlight")){const n=c=>c.item.hasAttribute("highlight")&&c.item.getAttribute("highlight")===this.value,h=s.getLastMatchingPosition(n,{direction:"backward"}),l=s.getLastMatchingPosition(n),u=i.createRange(h,l);!o||this.value===o?(s.isEqual(l)||i.removeAttribute("highlight",u),i.removeSelectionAttribute("highlight")):(s.isEqual(l)||i.setAttribute("highlight",o,u),i.setSelectionAttribute("highlight",o))}else o&&i.setSelectionAttribute("highlight",o)}else{const s=t.schema.getValidRanges(r.getRanges(),"highlight");for(const n of s)o?i.setAttribute("highlight",o,n):i.removeAttribute("highlight",n)}})}}class _ extends w{static get pluginName(){return"HighlightEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const t=e.config.get("highlight.options");e.conversion.attributeToElement(R(t)),e.commands.add("highlight",new O(e))}}function R(d){const e={model:{key:"highlight",values:[]},view:{}};for(const t of d)e.model.values.push(t.model),e.view[t.model]={name:"mark",classes:t.class};return e}class S extends w{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),k,null,g=>{g.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,b(e.type),e.model,g);function g(r){r.bind("isEnabled").to(t,"isEnabled"),r.bind("isOn").to(t,"value",o=>o===e.model),r.iconView.fillColor=e.color,r.isToggleable=!0}}_addButton(e,t,g,r,o){const i=this.editor;i.ui.componentFactory.add(e,s=>{const n=new y(s),h=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return n.set({label:h,icon:g,tooltip:!0}),n.on("execute",()=>{i.execute("highlight",{value:r}),i.editing.view.focus()}),o(n),n})}_addDropdown(e){const t=this.editor,g=t.t,r=t.ui.componentFactory,o=e[0],i=e.reduce((s,n)=>(s[n.model]=n,s),{});r.add("highlight",s=>{const n=t.commands.get("highlight"),h=E(s,I),l=h.buttonView;l.set({label:g("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),l.bind("icon").to(n,"value",a=>b(c(a,"type"))),l.bind("color").to(n,"value",a=>c(a,"color")),l.bind("commandValue").to(n,"value",a=>c(a,"model")),l.bind("isOn").to(n,"value",a=>!!a),l.delegate("execute").to(h);const u=()=>{const a=e.map(m=>{const p=r.create("highlight:"+m.model);return this.listenTo(p,"execute",()=>{h.buttonView.set({lastExecuted:m.model})}),p});return a.push(new P),a.push(r.create("removeHighlight")),a};h.bind("isEnabled").to(n,"isEnabled"),H(h,u,{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:g("Text highlight toolbar")}),C(h),l.on("execute",()=>{t.execute("highlight",{value:l.commandValue})}),this.listenTo(h,"execute",()=>{t.editing.view.focus()});function c(a,m){const p=!a||a===l.lastExecuted?l.lastExecuted:a;return i[p][m]}return h})}_addMenuBarButton(e){const t=this.editor,g=t.t,r=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",o=>{const i=new M(o);i.buttonView.set({label:g("Highlight"),icon:b("marker")}),i.bind("isEnabled").to(r),i.buttonView.iconView.fillColor="transparent";const s=new A(o);for(const l of e){const u=new f(o,i),c=new v(o);c.set({label:l.title,icon:b(l.type),role:"menuitemradio",isToggleable:!0}),c.iconView.fillColor=l.color,c.delegate("execute").to(i),c.bind("isOn").to(r,"value",a=>a===l.model),c.on("execute",()=>{t.execute("highlight",{value:l.model}),t.editing.view.focus()}),u.children.add(c),s.items.add(u)}s.items.add(new T(o));const n=new f(o,i),h=new v(o);return h.set({label:g("Remove highlight"),icon:k}),h.delegate("execute").to(i),h.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus()}),n.children.add(h),s.items.add(n),i.panelView.children.add(s),i})}}function C(d){d.buttonView.actionView.iconView.bind("fillColor").to(d.buttonView,"color")}function b(d){return d==="marker"?x:B}class G extends w{static get requires(){return[_,S]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}export{G as Highlight,_ as HighlightEditing,S as HighlightUI};
@@ -1,4 +1,4 @@
1
- import{Plugin as s,Command as m}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as u,toWidget as d,findOptimalInsertionRange as h}from"../../../../../@ckeditor_ckeditor5-widget@45.2.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{IconHorizontalLine as g}from"../../../../../@ckeditor_ckeditor5-icons@45.2.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as z,MenuBarMenuListItemButtonView as L}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
1
+ import{Plugin as s,Command as m}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as u,toWidget as d,findOptimalInsertionRange as h}from"../../../../../@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{IconHorizontalLine as g}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as z,MenuBarMenuListItemButtonView as L}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */class p extends m{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection;this.isEnabled=f(n,e,t)}execute(){const t=this.editor.model;t.change(e=>{const n=e.createElement("horizontalLine");t.insertObject(n,null,null,{setSelection:"after"})})}}function f(o,t,e){const n=E(o,e);return t.checkChild(n,"horizontalLine")}function E(o,t){const n=h(o,t).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}class H extends s{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.model.schema,n=t.t,a=t.conversion;e.register("horizontalLine",{inheritAllFrom:"$blockObject"}),a.for("dataDowncast").elementToElement({model:"horizontalLine",view:(r,{writer:i})=>i.createEmptyElement("hr")}),a.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(r,{writer:i})=>{const c=n("Horizontal line"),l=i.createContainerElement("div",null,i.createEmptyElement("hr"));return i.addClass("ck-horizontal-line",l),i.setCustomProperty("hr",!0,l),b(l,i,c)}}),a.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),t.commands.add("horizontalLine",new p(t))}}function b(o,t,e){return t.setCustomProperty("horizontalLine",!0,o),d(o,t,{label:e})}class v extends s{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("horizontalLine",()=>{const e=this._createButton(z);return e.set({tooltip:!0}),e}),t.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(L))}_createButton(t){const e=this.editor,n=e.locale,a=e.commands.get("horizontalLine"),r=new t(e.locale),i=n.t;return r.set({label:i("Horizontal line"),icon:g}),r.bind("isEnabled").to(a,"isEnabled"),this.listenTo(r,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),r}}class B extends s{static get requires(){return[H,v,u]}static get pluginName(){return"HorizontalLine"}static get isOfficialPlugin(){return!0}}export{B as HorizontalLine,H as HorizontalLineEditing,v as HorizontalLineUI};
@@ -1,4 +1,4 @@
1
- var S=Object.defineProperty;var A=(c,t,e)=>t in c?S(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var H=(c,t,e)=>A(c,typeof t!="symbol"?t+"":t,e);import{Plugin as f,Command as T}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as I,toWidget as L,findOptimalInsertionRange as D}from"../../../../../@ckeditor_ckeditor5-widget@45.2.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{ButtonView as x,MenuBarMenuListItemButtonView as M}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{logWarning as y,createElement as b}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconHtml as O,IconPencil as P,IconCheck as W,IconCancel as z}from"../../../../../@ckeditor_ckeditor5-icons@45.2.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";/**
1
+ var S=Object.defineProperty;var A=(c,t,e)=>t in c?S(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var H=(c,t,e)=>A(c,typeof t!="symbol"?t+"":t,e);import{Plugin as f,Command as T}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as I,toWidget as L,findOptimalInsertionRange as D}from"../../../../../@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{ButtonView as x,MenuBarMenuListItemButtonView as M}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{logWarning as y,createElement as b}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconHtml as O,IconPencil as P,IconCheck as W,IconCancel as z}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */class F extends T{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection,i=k(n);this.isEnabled=j(n,e,t),this.value=i?i.getAttribute("value")||"":null}execute(t){const e=this.editor.model,n=e.document.selection;e.change(i=>{let d;this.value!==null?d=k(n):(d=i.createElement("rawHtml"),e.insertObject(d,null,null,{setSelection:"on"})),i.setAttribute("value",t,d)})}}function j(c,t,e){const n=N(c,e);return t.checkChild(n,"rawHtml")}function N(c,t){const n=D(c,t).start.parent;return n.isEmpty&&!n.is("rootElement")?n.parent:n}function k(c){const t=c.getSelectedElement();return t&&t.is("element","rawHtml")?t:null}class U extends f{constructor(e){super(e);H(this,"_widgetButtonViewReferences",new Set);e.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:n=>(y("html-embed-provide-sanitize-function"),{html:n,hasChanged:!1})})}static get pluginName(){return"HtmlEmbedEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new F(e)),this._setupConversion()}_setupConversion(){const e=this.editor,n=e.t,i=e.editing.view,d=this._widgetButtonViewReferences,E=e.config.get("htmlEmbed");this.editor.editing.view.on("render",()=>{for(const o of d){if(o.element&&o.element.isConnected)return;o.destroy(),d.delete(o)}},{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(o,{writer:a})=>a.createElement("rawHtml",{value:o.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(o,{writer:a})=>a.createRawElement("div",{class:"raw-html-embed"},function(s){s.innerHTML=o.getAttribute("value")||""})}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(o,{writer:a})=>{let s,l,r;const m=a.createRawElement("div",{class:"raw-html-embed__content-wrapper"},function(w){s=w,g({editor:e,domElement:w,state:l,props:r}),s.addEventListener("mousedown",()=>{if(l.isEditable){const h=e.model;h.document.selection.getSelectedElement()!==o&&h.change(V=>V.setSelection(o,"on"))}},!0)}),p={makeEditable(){l=Object.assign({},l,{isEditable:!0}),g({domElement:s,editor:e,state:l,props:r}),i.change(w=>{w.setAttribute("data-cke-ignore-events","true",m)}),s.querySelector("textarea").focus()},save(w){w!==l.getRawHtmlValue()?(e.execute("htmlEmbed",w),e.editing.view.focus()):this.cancel()},cancel(){l=Object.assign({},l,{isEditable:!1}),g({domElement:s,editor:e,state:l,props:r}),e.editing.view.focus(),i.change(w=>{w.removeAttribute("data-cke-ignore-events",m)})}};l={showPreviews:E.showPreviews,isEditable:!1,getRawHtmlValue:()=>o.getAttribute("value")||""},r={sanitizeHtml:E.sanitizeHtml,textareaPlaceholder:n("Paste raw HTML here..."),onEditClick(){p.makeEditable()},onSaveClick(w){p.save(w)},onCancelClick(){p.cancel()}};const u=a.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":n("HTML snippet"),dir:e.locale.uiLanguageDirection},m);return a.setCustomProperty("rawHtmlApi",p,u),a.setCustomProperty("rawHtml",!0,u),L(u,a,{label:n("HTML snippet"),hasSelectionHandle:!0})}});function g({editor:o,domElement:a,state:s,props:l}){a.textContent="";const r=a.ownerDocument;let m;if(s.isEditable){const u={isDisabled:!1,placeholder:l.textareaPlaceholder};m=C({domDocument:r,state:s,props:u}),a.append(m)}else if(s.showPreviews){const u={sanitizeHtml:l.sanitizeHtml};a.append(R({domDocument:r,state:s,props:u,editor:o}))}else{const u={isDisabled:!0,placeholder:l.textareaPlaceholder};a.append(C({domDocument:r,state:s,props:u}))}const p={onEditClick:l.onEditClick,onSaveClick:()=>{l.onSaveClick(m.value)},onCancelClick:l.onCancelClick};a.prepend(_({editor:o,domDocument:r,state:s,props:p}))}function _({editor:o,domDocument:a,state:s,props:l}){const r=b(a,"div",{class:"raw-html-embed__buttons-wrapper"});if(s.isEditable){const m=v(o,"save",l.onSaveClick),p=v(o,"cancel",l.onCancelClick);r.append(m.element,p.element),d.add(m).add(p)}else{const m=v(o,"edit",l.onEditClick);r.append(m.element),d.add(m)}return r}function C({domDocument:o,state:a,props:s}){const l=b(o,"textarea",{placeholder:s.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return l.disabled=s.isDisabled,l.value=a.getRawHtmlValue(),l}function R({editor:o,domDocument:a,state:s,props:l}){const r=l.sanitizeHtml(s.getRawHtmlValue()),m=s.getRawHtmlValue().length>0?n("No preview available"):n("Empty snippet content"),p=b(a,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},m),u=b(a,"div",{class:"raw-html-embed__preview-content",dir:o.locale.contentLanguageDirection}),h=a.createRange().createContextualFragment(r.html);return u.appendChild(h),b(a,"div",{class:"raw-html-embed__preview"},[p,u])}}}function v(c,t,e){const{t:n}=c.locale,i=new x(c.locale),d=c.commands.get("htmlEmbed");return i.set({class:`raw-html-embed__${t}-button`,icon:P,tooltip:!0,tooltipPosition:c.locale.uiLanguageDirection==="rtl"?"e":"w"}),i.render(),t==="edit"?(i.set({icon:P,label:n("Edit source")}),i.bind("isEnabled").to(d)):t==="save"?(i.set({icon:W,label:n("Save changes")}),i.bind("isEnabled").to(d)):i.set({icon:z,label:n("Cancel")}),i.on("execute",e),i}class $ extends f{static get pluginName(){return"HtmlEmbedUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,n=t.locale.t;t.ui.componentFactory.add("htmlEmbed",()=>{const i=this._createButton(x);return i.set({tooltip:!0,label:n("Insert HTML")}),i}),t.ui.componentFactory.add("menuBar:htmlEmbed",()=>{const i=this._createButton(M);return i.set({label:n("HTML snippet")}),i})}_createButton(t){const e=this.editor,n=e.commands.get("htmlEmbed"),i=new t(e.locale);return i.set({icon:O}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",()=>{e.execute("htmlEmbed"),e.editing.view.focus(),e.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()}),i}}class Y extends f{static get requires(){return[U,$,I]}static get pluginName(){return"HtmlEmbed"}static get isOfficialPlugin(){return!0}}export{Y as HtmlEmbed,U as HtmlEmbedEditing,$ as HtmlEmbedUI};
@@ -1,4 +1,4 @@
1
- var Q=Object.defineProperty;var Y=(s,r,e)=>r in s?Q(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var v=(s,r,e)=>Y(s,typeof r!="symbol"?r+"":r,e);import{Plugin as g}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{logWarning as J,global as H,uid as M,priorities as k,CKEditorError as Z,toArray as F,isValidAttributeName as ee}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{UpcastWriter as x,HtmlDataProcessor as te,Matcher as N,StylesMap as re}from"../../../../../@ckeditor_ckeditor5-engine@45.2.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Widget as ie,toWidget as X}from"../../../../../@ckeditor_ckeditor5-widget@45.2.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{Enter as oe}from"../../../../../@ckeditor_ckeditor5-enter@45.2.0/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{isEqual as L}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isEqual.js";import{mergeWith as le}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/mergeWith.js";import{startCase as ne}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/startCase.js";import{isPlainObject as se}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js";import{cloneDeep as me}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeep.js";/**
1
+ var Q=Object.defineProperty;var Y=(s,r,e)=>r in s?Q(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var v=(s,r,e)=>Y(s,typeof r!="symbol"?r+"":r,e);import{Plugin as g}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{logWarning as J,global as H,uid as M,priorities as k,CKEditorError as Z,toArray as F,isValidAttributeName as ee}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{UpcastWriter as x,HtmlDataProcessor as te,Matcher as N,StylesMap as re}from"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Widget as ie,toWidget as X}from"../../../../../@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{Enter as oe}from"../../../../../@ckeditor_ckeditor5-enter@45.2.1/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{isEqual as L}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isEqual.js";import{mergeWith as le}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/mergeWith.js";import{startCase as ne}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/startCase.js";import{isPlainObject as se}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js";import{cloneDeep as me}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeep.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */function p(s,r,e,t){r&&ae(s,r,t),e&&w(s,e,t)}function w(s,r,e){if(r.attributes)for(const[t,i]of Object.entries(r.attributes))s.setAttribute(t,i,e);r.styles&&s.setStyle(r.styles,e),r.classes&&s.addClass(r.classes,e)}function ae(s,r,e){if(r.attributes)for(const[t]of Object.entries(r.attributes))s.removeAttribute(t,e);if(r.styles)for(const t of Object.keys(r.styles))s.removeStyle(t,e);r.classes&&s.removeClass(r.classes,e)}function ue(s,r){const e=me(s);let t="attributes";for(t in r)t=="classes"?e[t]=Array.from(new Set([...s[t]||[],...r[t]])):e[t]={...s[t],...r[t]};return e}function y(s,r,e,t,i){const o=r.getAttribute(e),l={};for(const n of["attributes","styles","classes"]){if(n!=t){o&&o[n]&&(l[n]=o[n]);continue}if(t=="classes"){const a=new Set(o&&o.classes||[]);i(a),a.size&&(l[n]=Array.from(a));continue}const m=new Map(Object.entries(o&&o[n]||{}));i(m),m.size&&(l[n]=Object.fromEntries(m))}Object.keys(l).length?r.is("documentSelection")?s.setSelectionAttribute(e,l):s.setAttribute(e,l,r):o&&(r.is("documentSelection")?s.removeSelectionAttribute(e):s.removeAttribute(e,r))}function ce(s){return ne(s).replace(/ /g,"")}function b(s){return`html${ce(s)}Attributes`}function V({model:s}){return(r,e)=>e.writer.createElement(s,{htmlContent:r.getCustomProperty("$rawContent")})}function de(s,{view:r,isInline:e}){const t=s.t;return(i,{writer:o})=>{const l=t("HTML object"),n=$(r,i,o),m=i.getAttribute(b(r));o.addClass("html-object-embed__content",n),m&&w(o,m,n);const a=o.createContainerElement(e?"span":"div",{class:"html-object-embed","data-html-object-embed-label":l},n);return X(a,o,{label:l})}}function $(s,r,e){return e.createRawElement(s,null,(t,i)=>{i.setContentOf(t,r.getAttribute("htmlContent"))})}function he({view:s,model:r,allowEmpty:e},t){return o=>{o.on(`element:${s}`,(l,n,m)=>{let a=t.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))),e&&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),i(u,a,m);return}for(const u of n.modelRange.getItems())i(u,a,m)}},{priority:"low"})};function i(o,l,n){if(n.schema.checkAttribute(o,r)){const m=o.getAttribute(r),a=ue(l,m||{});n.writer.setAttribute(r,a,o)}}}function j({model:s,view:r},e){return(t,{writer:i,consumable:o})=>{if(!t.hasAttribute(s))return null;const l=i.createContainerElement(r),n=t.getAttribute(s);return o.consume(t,`attribute:${s}`),w(i,n,l),l.getFillerOffset=()=>null,e?X(l,i):l}}function fe({priority:s,view:r}){return(e,t)=>{if(!e)return;const{writer:i}=t,o=i.createAttributeElement(r,null,{priority:s});return w(i,e,o),o}}function C({view:s},r){return e=>{e.on(`element:${s}`,(t,i,o)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;const l=r.processViewAttributes(i.viewItem,o);l&&o.writer.setAttribute(b(i.viewItem.name),l,i.modelRange)},{priority:"low"})}}function O({view:s,model:r}){return e=>{e.on(`attribute:${b(s)}:${r}`,(t,i,o)=>{if(!o.consumable.consume(i.item,t.name))return;const{attributeOldValue:l,attributeNewValue:n}=i,m=o.writer,a=o.mapper.toViewElement(i.item);p(m,l,n,a)})}}/**
@@ -1,4 +1,4 @@
1
- var et=Object.defineProperty;var tt=(a,i,e)=>i in a?et(a,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[i]=e;var f=(a,i,e)=>tt(a,typeof i!="symbol"?i+"":i,e);import{Plugin as p,Command as y}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Clipboard as it,ClipboardPipeline as H}from"../../../../../@ckeditor_ckeditor5-clipboard@45.2.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{LivePosition as F,LiveRange as nt,UpcastWriter as G,enablePlaceholder as st,Element as ot,Observer as at}from"../../../../../@ckeditor_ckeditor5-engine@45.2.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Undo as rt}from"../../../../../@ckeditor_ckeditor5-undo@45.2.0/node_modules/@ckeditor/ckeditor5-undo/dist/index.js";import{Delete as lt}from"../../../../../@ckeditor_ckeditor5-typing@45.2.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{global as T,DomEmitterMixin as ct,logWarning as v,CKEditorError as mt,Collection as ut,env as gt,first as K,FocusTracker as J,KeystrokeHandler as O,Rect as dt,toArray as fe}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{Widget as pe,WidgetToolbarRepository as ne,toWidget as ht,isWidget as ft,toWidgetEditable as pt,WidgetResize as L,calculateResizeHostAncestorWidth as Ie,findOptimalInsertionRange as It}from"../../../../../@ckeditor_ckeditor5-widget@45.2.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{SplitButtonView as be,createDropdown as Z,MenuBarMenuView as bt,MenuBarMenuListView as wt,MenuBarMenuListItemView as _t,ButtonView as _,Dialog as vt,MenuBarMenuListItemButtonView as yt,ContextualBalloon as we,CssTransitionDisablerMixin as _e,clickOutsideHandler as ve,ViewModel as se,addToolbarToDropdown as Ct,Notification as oe,FileDialogButtonView as ae,MenuBarMenuListItemFileDialogButtonView as Et,View as P,ViewCollection as X,FocusCycler as Y,CollapsibleView as kt,submitHandler as N,LabeledFieldView as Q,createLabeledInputText as ye,BalloonPanelView as St,DropdownButtonView as Ut,addListToDropdown as Bt,FormRowView as Ce,FormHeaderView as Ee,createLabeledInputNumber as Vt}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconImage as At,IconCaption as Tt,IconImageUrl as xt,IconObjectSizeFull as zt,IconObjectSizeCustom as Rt,IconObjectSizeLarge as Ot,IconObjectSizeMedium as Pt,IconObjectSizeSmall as Nt,IconObjectInline as ke,IconObjectInlineRight as W,IconObjectInlineLeft as Se,IconObjectCenter as j,IconObjectRight as Ue,IconObjectLeft as Be,IconObjectFullWidth as Ft,IconTextAlternative as Lt,IconImageUpload as Dt,IconPreviousArrow as Ve}from"../../../../../@ckeditor_ckeditor5-icons@45.2.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{FileRepository as E}from"../../../../../@ckeditor_ckeditor5-upload@45.2.0/node_modules/@ckeditor/ckeditor5-upload/dist/index.js";import{isObject as Ae}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isObject.js";import{identity as S}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/identity.js";/**
1
+ var et=Object.defineProperty;var tt=(a,i,e)=>i in a?et(a,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[i]=e;var f=(a,i,e)=>tt(a,typeof i!="symbol"?i+"":i,e);import{Plugin as p,Command as y}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Clipboard as it,ClipboardPipeline as H}from"../../../../../@ckeditor_ckeditor5-clipboard@45.2.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{LivePosition as F,LiveRange as nt,UpcastWriter as G,enablePlaceholder as st,Element as ot,Observer as at}from"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Undo as rt}from"../../../../../@ckeditor_ckeditor5-undo@45.2.1/node_modules/@ckeditor/ckeditor5-undo/dist/index.js";import{Delete as lt}from"../../../../../@ckeditor_ckeditor5-typing@45.2.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{global as T,DomEmitterMixin as ct,logWarning as v,CKEditorError as mt,Collection as ut,env as gt,first as K,FocusTracker as J,KeystrokeHandler as O,Rect as dt,toArray as fe}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{Widget as pe,WidgetToolbarRepository as ne,toWidget as ht,isWidget as ft,toWidgetEditable as pt,WidgetResize as L,calculateResizeHostAncestorWidth as Ie,findOptimalInsertionRange as It}from"../../../../../@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{SplitButtonView as be,createDropdown as Z,MenuBarMenuView as bt,MenuBarMenuListView as wt,MenuBarMenuListItemView as _t,ButtonView as _,Dialog as vt,MenuBarMenuListItemButtonView as yt,ContextualBalloon as we,CssTransitionDisablerMixin as _e,clickOutsideHandler as ve,ViewModel as se,addToolbarToDropdown as Ct,Notification as oe,FileDialogButtonView as ae,MenuBarMenuListItemFileDialogButtonView as Et,View as P,ViewCollection as X,FocusCycler as Y,CollapsibleView as kt,submitHandler as N,LabeledFieldView as Q,createLabeledInputText as ye,BalloonPanelView as St,DropdownButtonView as Ut,addListToDropdown as Bt,FormRowView as Ce,FormHeaderView as Ee,createLabeledInputNumber as Vt}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconImage as At,IconCaption as Tt,IconImageUrl as xt,IconObjectSizeFull as zt,IconObjectSizeCustom as Rt,IconObjectSizeLarge as Ot,IconObjectSizeMedium as Pt,IconObjectSizeSmall as Nt,IconObjectInline as ke,IconObjectInlineRight as W,IconObjectInlineLeft as Se,IconObjectCenter as j,IconObjectRight as Ue,IconObjectLeft as Be,IconObjectFullWidth as Ft,IconTextAlternative as Lt,IconImageUpload as Dt,IconPreviousArrow as Ve}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{FileRepository as E}from"../../../../../@ckeditor_ckeditor5-upload@45.2.1/node_modules/@ckeditor/ckeditor5-upload/dist/index.js";import{isObject as Ae}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isObject.js";import{identity as S}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/identity.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */function Mt(a){return a.createContainerElement("span",{class:"image-inline"},a.createEmptyElement("img"))}function re(a){return a.createContainerElement("figure",{class:"image"},[a.createEmptyElement("img"),a.createSlot("children")])}function Te(a,i){const e=a.plugins.get("ImageUtils"),t=a.plugins.has("ImageInlineEditing")&&a.plugins.has("ImageBlockEditing");return s=>e.isInlineImageView(s)?t&&(s.getStyle("display")=="block"||s.findAncestor(e.isBlockImageView)?"imageBlock":"imageInline")!==i?null:n(s):null;function n(s){const o={name:!0};return s.hasAttribute("src")&&(o.attributes=["src"]),o}}function ee(a,i){const e=K(i.getSelectedBlocks());return!e||a.isObject(e)||e.isEmpty&&e.name!="listItem"?"imageBlock":"imageInline"}function x(a){return a&&a.endsWith("px")?parseInt(a):null}function z(a){const i=x(a.getStyle("width")),e=x(a.getStyle("height"));return!!(i&&e)}const Wt=/^(image|image-inline)$/;class w extends p{constructor(){super(...arguments);f(this,"_domEmitter",new(ct()))}static get pluginName(){return"ImageUtils"}static get isOfficialPlugin(){return!0}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,n=null,s={}){const o=this.editor,r=o.model,l=r.document.selection,c=xe(o,t||l,n);e={...Object.fromEntries(l.getAttributes()),...e};for(const m in e)r.schema.checkAttribute(c,m)||delete e[m];return r.change(m=>{const{setImageSizes:u=!0}=s,g=m.createElement(c,e);return r.insertObject(g,t,null,{setSelection:"on",findOptimalPosition:!t&&c!="imageInline"?"auto":void 0}),g.parent?(u&&this.setImageNaturalSizeAttributes(g),g):null})}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change(n=>{const s=new T.window.Image;this._domEmitter.listenTo(s,"load",()=>{!e.getAttribute("width")&&!e.getAttribute("height")&&this.editor.model.enqueueChange(n.batch,o=>{o.setAttribute("width",s.naturalWidth,e),o.setAttribute("height",s.naturalHeight,e)}),this._domEmitter.stopListening(s,"load")}),s.src=t}))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const n=e.getSelectedElement();if(n&&this.isImageWidget(n))return n;let s=t.parent;for(;s;){if(s.is("element")&&this.isImageWidget(s))return s;s=s.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:Wt})}isImageAllowed(){const t=this.editor.model.document.selection;return jt(this.editor,t)&&qt(t)}toImageWidget(e,t,n){return t.setCustomProperty("image",!0,e),ht(e,t,{label:()=>{const r=this.findViewImgElement(e).getAttribute("alt");return r?`${r} ${n}`:n}})}isImageWidget(e){return!!e.getCustomProperty("image")&&ft(e)}isBlockImage(e){return!!e&&e.is("element","imageBlock")}isInlineImage(e){return!!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:n}of t.createRangeIn(e))if(this.isInlineImageView(n))return n}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function jt(a,i){if(xe(a,i,null)=="imageBlock"){const t=$t(i,a.model);if(a.model.schema.checkChild(t,"imageBlock"))return!0}else if(a.model.schema.checkChild(i.focus,"imageInline"))return!0;return!1}function qt(a){return[...a.focus.getAncestors()].every(i=>!i.is("element","imageBlock"))}function $t(a,i){const t=It(a,i).start.parent;return t.isEmpty&&!t.is("element","$root")?t.parent:t}function xe(a,i,e){const t=a.model.schema,n=a.config.get("image.insert.type");return a.plugins.has("ImageBlockEditing")?a.plugins.has("ImageInlineEditing")?e||(n==="inline"?"imageInline":n!=="auto"?"imageBlock":i.is("selection")?ee(t,i):t.checkChild(i,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}const Ht=new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));class ln extends p{constructor(e){super(e);f(this,"_timeoutId");f(this,"_positionToInsert");this._timeoutId=null,this._positionToInsert=null}static get requires(){return[it,w,rt,lt]}static get pluginName(){return"AutoImage"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.document,n=e.plugins.get("ClipboardPipeline");this.listenTo(n,"inputTransformation",()=>{const s=t.selection.getFirstRange(),o=F.fromPosition(s.start);o.stickiness="toPrevious";const r=F.fromPosition(s.end);r.stickiness="toNext",t.once("change:data",()=>{this._embedImageBetweenPositions(o,r),o.detach(),r.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(T.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedImageBetweenPositions(e,t){const n=this.editor,s=new nt(e,t),o=s.getWalker({ignoreElementEnd:!0}),r=Object.fromEntries(n.model.document.selection.getAttributes()),l=this.editor.plugins.get("ImageUtils");let c="";for(const m of o)m.item.is("$textProxy")&&(c+=m.item.data);if(c=c.trim(),!c.match(Ht)){s.detach();return}this._positionToInsert=F.fromPosition(e),this._timeoutId=setTimeout(()=>{if(!n.commands.get("insertImage").isEnabled){s.detach();return}n.model.change(g=>{this._timeoutId=null,g.remove(s),s.detach();let d;this._positionToInsert.root.rootName!=="$graveyard"&&(d=this._positionToInsert.toPosition()),l.insertImage({...r,src:c},d),this._positionToInsert.detach(),this._positionToInsert=null}),n.plugins.get("Delete").requestUndoOnBackspace()},100)}}class Gt extends y{refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled&&t.hasAttribute("alt")?this.value=t.getAttribute("alt"):this.value=!1}execute(i){const e=this.editor,t=e.plugins.get("ImageUtils"),n=e.model,s=t.getClosestSelectedImageElement(n.document.selection);n.change(o=>{o.setAttribute("alt",i.newValue,s)})}}class Kt extends p{static get requires(){return[w]}static get pluginName(){return"ImageTextAlternativeEditing"}static get isOfficialPlugin(){return!0}init(){this.editor.commands.add("imageTextAlternative",new Gt(this.editor))}}class Jt extends P{constructor(e){super(e);f(this,"focusTracker");f(this,"keystrokes");f(this,"labeledInput");f(this,"backButtonView");f(this,"saveButtonView");f(this,"children");f(this,"_focusables");f(this,"_focusCycler");this.focusTracker=new J,this.keystrokes=new O,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.labeledInput=this._createLabeledInputView(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new Ce(e,{children:[this.labeledInput,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding"]})),this._focusables=new X,this.keystrokes.set("Esc",(t,n)=>{this.fire("cancel"),n()}),this._focusCycler=new Y({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-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),N({view:this}),[this.backButtonView,this.labeledInput,this.saveButtonView].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()}_createBackButton(){const e=this.locale.t,t=new _(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Ve,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new _(this.locale);return t.set({label:e("Save"),withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new Ee(this.locale,{label:e("Text Alternative")});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){const e=this.locale.t,t=new Q(this.locale,ye);return t.label=e("Text alternative"),t.class="ck-labeled-field-view_full-width",t}}function Zt(a){const i=a.plugins.get("ContextualBalloon");if(a.plugins.get("ImageUtils").getClosestSelectedImageWidget(a.editing.view.document.selection)){const t=te(a);i.updatePosition(t)}}function te(a){const i=a.editing.view,e=St.defaultPositions,t=a.plugins.get("ImageUtils");return{target:i.domConverter.mapViewToDom(t.getClosestSelectedImageWidget(i.document.selection)),positions:[e.northArrowSouth,e.northArrowSouthWest,e.northArrowSouthEast,e.southArrowNorth,e.southArrowNorthWest,e.southArrowNorthEast,e.viewportStickyNorth]}}class Xt extends p{constructor(){super(...arguments);f(this,"_balloon");f(this,"_form")}static get requires(){return[we]}static get pluginName(){return"ImageTextAlternativeUI"}static get isOfficialPlugin(){return!0}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",n=>{const s=e.commands.get("imageTextAlternative"),o=new _(n);return o.set({label:t("Change image text alternative"),icon:Lt,tooltip:!0}),o.bind("isEnabled").to(s,"isEnabled"),o.bind("isOn").to(s,"value",r=>!!r),this.listenTo(o,"execute",()=>{this._showForm()}),o})}_createForm(){const e=this.editor,n=e.editing.view.document,s=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(_e(Jt))(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this.listenTo(e.ui,"update",()=>{s.getClosestSelectedImageWidget(n.selection)?this._isVisible&&Zt(e):this._hideForm(!0)}),ve({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:te(e)}),n.fieldView.value=n.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class ze extends p{static get requires(){return[Kt,Xt]}static get pluginName(){return"ImageTextAlternative"}static get isOfficialPlugin(){return!0}}function Yt(a){const i=(e,t,n)=>{if(!n.consumable.test(t.viewItem,{name:!0,classes:"image"}))return;const s=a.findViewImgElement(t.viewItem);if(!s||!n.consumable.test(s,{name:!0}))return;n.consumable.consume(t.viewItem,{name:!0,classes:"image"});const o=n.convertItem(s,t.modelCursor),r=K(o.modelRange.getItems());if(!r){n.consumable.revert(t.viewItem,{name:!0,classes:"image"});return}n.convertChildren(t.viewItem,r),n.updateConversionResult(r,t)};return e=>{e.on("element:figure",i)}}function Re(a,i){const e=(t,n,s)=>{if(!s.consumable.consume(n.item,t.name))return;const o=s.writer,r=s.mapper.toViewElement(n.item),l=a.findViewImgElement(r);n.attributeNewValue===null?(o.removeAttribute("srcset",l),o.removeAttribute("sizes",l)):n.attributeNewValue&&(o.setAttribute("srcset",n.attributeNewValue,l),o.setAttribute("sizes","100vw",l))};return t=>{t.on(`attribute:srcset:${i}`,e)}}function R(a,i,e){const t=(n,s,o)=>{if(!o.consumable.consume(s.item,n.name))return;const r=o.writer,l=o.mapper.toViewElement(s.item),c=a.findViewImgElement(l);r.setAttribute(s.attributeKey,s.attributeNewValue||"",c)};return n=>{n.on(`attribute:${e}:${i}`,t)}}class ie extends at{observe(i){this.listenTo(i,"load",(e,t)=>{const n=t.target;this.checkShouldIgnoreEventFromTarget(n)||n.tagName=="IMG"&&this._fireEvents(t)},{useCapture:!0})}stopObserving(i){this.stopListening(i)}_fireEvents(i){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",i))}}class Qt extends y{constructor(i){super(i);const e=i.config.get("image.insert.type");i.plugins.has("ImageBlockEditing")||e==="block"&&v("image-block-plugin-required"),i.plugins.has("ImageInlineEditing")||e==="inline"&&v("image-inline-plugin-required")}refresh(){const i=this.editor.plugins.get("ImageUtils");this.isEnabled=i.isImageAllowed()}execute(i){const e=fe(i.source),t=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),s=Object.fromEntries(t.getAttributes());e.forEach((o,r)=>{const l=t.getSelectedElement();if(typeof o=="string"&&(o={src:o}),r&&l&&n.isImage(l)){const c=this.editor.model.createPositionAfter(l);n.insertImage({...o,...s},c,i.imageType)}else i.breakBlock?n.insertImage({...o,...s},t.getFirstPosition(),i.imageType):n.insertImage({...o,...s},null,i.imageType)})}}class ei extends y{constructor(i){super(i),this.decorate("cleanupImage")}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=e.isImage(t),this.value=this.isEnabled?t.getAttribute("src"):null}execute(i){const e=this.editor.model.document.selection.getSelectedElement(),t=this.editor.plugins.get("ImageUtils");this.editor.model.change(n=>{n.setAttribute("src",i.source,e),this.cleanupImage(n,e),t.setImageNaturalSizeAttributes(e)})}cleanupImage(i,e){i.removeAttribute("srcset",e),i.removeAttribute("sizes",e),i.removeAttribute("sources",e),i.removeAttribute("width",e),i.removeAttribute("height",e),i.removeAttribute("alt",e)}}class Oe extends p{static get requires(){return[w]}static get pluginName(){return"ImageEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.conversion;i.editing.view.addObserver(ie),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const t=new Qt(i),n=new ei(i);i.commands.add("insertImage",t),i.commands.add("replaceImageSource",n),i.commands.add("imageInsert",t)}}class Pe extends p{static get requires(){return[w]}static get pluginName(){return"ImageSizeAttributes"}static get isOfficialPlugin(){return!0}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(i){const e=this.editor,t=e.plugins.get("ImageUtils"),n=i==="imageBlock"?"figure":"img";e.conversion.for("upcast").attributeToAttribute({view:{name:n,styles:{width:/.+/}},model:{key:"width",value:o=>z(o)?x(o.getStyle("width")):null}}).attributeToAttribute({view:{name:n,key:"width"},model:"width"}).attributeToAttribute({view:{name:n,styles:{height:/.+/}},model:{key:"height",value:o=>z(o)?x(o.getStyle("height")):null}}).attributeToAttribute({view:{name:n,key:"height"},model:"height"}),e.conversion.for("editingDowncast").add(o=>{s(o,"width","width",!0,!0),s(o,"height","height",!0,!0)}),e.conversion.for("dataDowncast").add(o=>{s(o,"width","width",!1),s(o,"height","height",!1)}),e.conversion.for("upcast").add(o=>{o.on("element:img",(r,l,c)=>{const m=l.viewItem.getAttribute("width"),u=l.viewItem.getAttribute("height");m&&u&&c.consumable.consume(l.viewItem,{styles:["aspect-ratio"]})})});function s(o,r,l,c,m=!1){o.on(`attribute:${r}:${i}`,(u,g,d)=>{if(!d.consumable.consume(g.item,u.name))return;const h=d.writer,I=d.mapper.toViewElement(g.item),b=t.findViewImgElement(I);g.attributeNewValue!==null?h.setAttribute(l,g.attributeNewValue,b):h.removeAttribute(l,b);const C=g.item.getAttribute("width"),k=g.item.getAttribute("height"),V=C&&k;if(V&&m&&h.setAttribute("loading","lazy",b),g.item.hasAttribute("sources"))return;const Qe=g.item.hasAttribute("resizedWidth");i==="imageInline"&&!Qe&&!c||V&&h.setStyle("aspect-ratio",`${C}/${k}`,b)})}}}class Ne extends y{constructor(e,t){super(e);f(this,"_modelElementName");this._modelElementName=t}refresh(){const t=this.editor.plugins.get("ImageUtils"),n=t.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=t.isInlineImage(n):this.isEnabled=t.isBlockImage(n)}execute(e={}){const t=this.editor,n=this.editor.model,s=t.plugins.get("ImageUtils"),o=s.getClosestSelectedImageElement(n.document.selection),r=Object.fromEntries(o.getAttributes());return!r.src&&!r.uploadId?null:n.change(l=>{const{setImageSizes:c=!0}=e,m=Array.from(n.markers).filter(d=>d.getRange().containsItem(o)),u=s.insertImage(r,n.createSelection(o,"on"),this._modelElementName,{setImageSizes:c});if(!u)return null;const g=l.createRangeOn(u);for(const d of m){const h=d.getRange(),I=h.root.rootName!="$graveyard"?h.getJoined(g,!0):g;l.updateMarker(d,{range:I})}return{oldElement:o,newElement:u}})}}class Fe extends p{static get requires(){return[w]}static get pluginName(){return"ImagePlaceholder"}static get isOfficialPlugin(){return!0}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const i=this.editor.model.schema;i.isRegistered("imageBlock")&&i.extend("imageBlock",{allowAttributes:["placeholder"]}),i.isRegistered("imageInline")&&i.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const i=this.editor,e=i.conversion,t=i.plugins.get("ImageUtils");e.for("editingDowncast").add(n=>{n.on("attribute:placeholder",(s,o,r)=>{if(!r.consumable.test(o.item,s.name)||!o.item.is("element","imageBlock")&&!o.item.is("element","imageInline"))return;r.consumable.consume(o.item,s.name);const l=r.writer,c=r.mapper.toViewElement(o.item),m=t.findViewImgElement(c);o.attributeNewValue?(l.addClass("image_placeholder",m),l.setStyle("background-image",`url(${o.attributeNewValue})`,m),l.setCustomProperty("editingPipeline:doNotReuseOnce",!0,m)):(l.removeClass("image_placeholder",m),l.removeStyle("background-image",m))})})}_setupLoadListener(){const i=this.editor,e=i.model,t=i.editing,n=t.view,s=i.plugins.get("ImageUtils");n.addObserver(ie),this.listenTo(n.document,"imageLoaded",(o,r)=>{const l=n.domConverter.mapDomToView(r.target);if(!l)return;const c=s.getImageWidgetFromImageView(l);if(!c)return;const m=t.mapper.toModelElement(c);!m||!m.hasAttribute("placeholder")||e.enqueueChange({isUndoable:!1},u=>{u.removeAttribute("placeholder",m)})})}}class Le extends p{static get requires(){return[Oe,Pe,w,Fe,H]}static get pluginName(){return"ImageBlockEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),i.plugins.has("ImageInlineEditing")&&(i.commands.add("imageTypeBlock",new Ne(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const i=this.editor,e=i.t,t=i.conversion,n=i.plugins.get("ImageUtils");t.for("dataDowncast").elementToStructure({model:"imageBlock",view:(s,{writer:o})=>re(o)}),t.for("editingDowncast").elementToStructure({model:"imageBlock",view:(s,{writer:o})=>n.toImageWidget(re(o),o,e("image widget"))}),t.for("downcast").add(R(n,"imageBlock","src")).add(R(n,"imageBlock","alt")).add(Re(n,"imageBlock")),t.for("upcast").elementToElement({view:Te(i,"imageBlock"),model:(s,{writer:o})=>o.createElement("imageBlock",s.hasAttribute("src")?{src:s.getAttribute("src")}:void 0)}).add(Yt(n))}_setupClipboardIntegration(){const i=this.editor,e=i.model,t=i.editing.view,n=i.plugins.get("ImageUtils"),s=i.plugins.get("ClipboardPipeline");this.listenTo(s,"inputTransformation",(o,r)=>{const l=Array.from(r.content.getChildren());let c;if(!l.every(n.isInlineImageView))return;r.targetRanges?c=i.editing.mapper.toModelRange(r.targetRanges[0]):c=e.document.selection.getFirstRange();const m=e.createSelection(c);if(ee(e.schema,m)==="imageBlock"){const u=new G(t.document),g=l.map(d=>u.createElement("figure",{class:"image"},d));r.content=u.createDocumentFragment(g)}}),this.listenTo(s,"contentInsertion",(o,r)=>{r.method==="paste"&&e.change(l=>{const c=l.createRangeIn(r.content);for(const m of c.getItems())m.is("element","imageBlock")&&n.setImageNaturalSizeAttributes(m)})})}}class ti extends P{constructor(e,t=[]){super(e);f(this,"focusTracker");f(this,"keystrokes");f(this,"_focusables");f(this,"_focusCycler");f(this,"children");this.focusTracker=new J,this.keystrokes=new O,this._focusables=new X,this.children=this.createCollection(),this._focusCycler=new Y({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const n of t)this.children.add(n),this._focusables.add(n),n instanceof kt&&this._focusables.addMany(n.children);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),N({view:this});for(const t of this._focusables)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element);const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}class B extends p{constructor(e){super(e);f(this,"dropdownView");f(this,"_integrations",new Map);e.config.define("image.insert.integrations",["upload","assetManager","url"])}static get pluginName(){return"ImageInsertUI"}static get isOfficialPlugin(){return!0}static get requires(){return[w]}init(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(e.model.document,"change",()=>{this.isImageSelected=n.isImage(t.getSelectedElement())});const s=r=>this._createToolbarComponent(r),o=r=>this._createMenuBarComponent(r);e.ui.componentFactory.add("insertImage",s),e.ui.componentFactory.add("imageInsert",s),e.ui.componentFactory.add("menuBar:insertImage",o)}registerIntegration({name:e,observable:t,buttonViewCreator:n,formViewCreator:s,menuBarButtonViewCreator:o,requiresForm:r=!1,override:l=!1}){this._integrations.has(e)&&!l&&v("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:n,menuBarButtonViewCreator:o,formViewCreator:s,requiresForm:r})}_createToolbarComponent(e){const t=this.editor,n=e.t,s=this._prepareIntegrations();if(!s.length)return null;let o;const r=s[0];if(s.length==1){if(!r.requiresForm)return r.buttonViewCreator(!0);o=r.buttonViewCreator(!0)}else{const m=r.buttonViewCreator(!1);o=new be(e,m),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",u=>n(u?"Replace image":"Insert image"))}const l=this.dropdownView=Z(e,o),c=s.map(({observable:m})=>typeof m=="function"?m():m);return l.bind("isEnabled").toMany(c,"isEnabled",(...m)=>m.some(u=>u)),l.once("change:isOpen",()=>{const m=s.flatMap(({formViewCreator:g})=>g(s.length==1)),u=new ti(t.locale,m);l.panelView.children.add(u)}),l}_createMenuBarComponent(e){const t=e.t,n=this._prepareIntegrations();if(!n.length)return null;const s=n.flatMap(({menuBarButtonViewCreator:l})=>l(n.length==1)),o=new bt(e),r=new wt(e);o.panelView.children.add(r),o.buttonView.set({icon:At,label:t("Image")});for(const l of s){const c=new _t(e,o);c.children.add(l),r.items.add(c),l.delegate("execute").to(o)}return o}_prepareIntegrations(){const t=this.editor.config.get("image.insert.integrations"),n=[];if(!t.length)return v("image-insert-integrations-not-specified"),n;for(const s of t){if(!this._integrations.has(s)){["upload","assetManager","url"].includes(s)||v("image-insert-unknown-integration",{item:s});continue}n.push(this._integrations.get(s))}return n.length||v("image-insert-integrations-not-registered"),n}}class cn extends p{static get requires(){return[Le,pe,ze,B]}static get pluginName(){return"ImageBlock"}static get isOfficialPlugin(){return!0}}class ii extends p{static get requires(){return[Oe,Pe,w,Fe,H]}static get pluginName(){return"ImageInlineEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.model.schema.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"],disallowIn:["caption"]}),this._setupConversion(),i.plugins.has("ImageBlockEditing")&&(i.commands.add("imageTypeInline",new Ne(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const i=this.editor,e=i.t,t=i.conversion,n=i.plugins.get("ImageUtils");t.for("dataDowncast").elementToElement({model:"imageInline",view:(s,{writer:o})=>o.createEmptyElement("img")}),t.for("editingDowncast").elementToStructure({model:"imageInline",view:(s,{writer:o})=>n.toImageWidget(Mt(o),o,e("image widget"))}),t.for("downcast").add(R(n,"imageInline","src")).add(R(n,"imageInline","alt")).add(Re(n,"imageInline")),t.for("upcast").elementToElement({view:Te(i,"imageInline"),model:(s,{writer:o})=>o.createElement("imageInline",s.hasAttribute("src")?{src:s.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const i=this.editor,e=i.model,t=i.editing.view,n=i.plugins.get("ImageUtils"),s=i.plugins.get("ClipboardPipeline");this.listenTo(s,"inputTransformation",(o,r)=>{const l=Array.from(r.content.getChildren());let c;if(!l.every(n.isBlockImageView))return;r.targetRanges?c=i.editing.mapper.toModelRange(r.targetRanges[0]):c=e.document.selection.getFirstRange();const m=e.createSelection(c);if(ee(e.schema,m)==="imageInline"){const u=new G(t.document),g=l.map(d=>d.childCount===1?(Array.from(d.getAttributes()).forEach(h=>u.setAttribute(...h,n.findViewImgElement(d))),d.getChild(0)):d);r.content=u.createDocumentFragment(g)}}),this.listenTo(s,"contentInsertion",(o,r)=>{r.method==="paste"&&e.change(l=>{const c=l.createRangeIn(r.content);for(const m of c.getItems())m.is("element","imageInline")&&n.setImageNaturalSizeAttributes(m)})})}}class mn extends p{static get requires(){return[ii,pe,ze,B]}static get pluginName(){return"ImageInline"}static get isOfficialPlugin(){return!0}}class De extends p{static get pluginName(){return"ImageCaptionUtils"}static get isOfficialPlugin(){return!0}static get requires(){return[w]}getCaptionFromImageModelElement(i){for(const e of i.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(i){const e=this.editor.plugins.get("ImageUtils"),t=i.getFirstPosition().findAncestor("caption");return t&&e.isBlockImage(t.parent)?t:null}matchImageCaptionViewElement(i){const e=this.editor.plugins.get("ImageUtils");return i.name=="figcaption"&&e.isBlockImageView(i.parent)?{name:!0}:null}}class ni extends y{refresh(){const i=this.editor,e=i.plugins.get("ImageCaptionUtils"),t=i.plugins.get("ImageUtils");if(!i.plugins.has(Le)){this.isEnabled=!1,this.value=!1;return}const n=i.model.document.selection,s=n.getSelectedElement();if(!s){const o=e.getCaptionFromModelSelection(n);this.isEnabled=!!o,this.value=!!o;return}this.isEnabled=t.isImage(s),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(s):this.value=!1}execute(i={}){const{focusCaptionOnShow:e}=i;this.editor.model.change(t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)})}_showImageCaption(i,e){const n=this.editor.model.document.selection,s=this.editor.plugins.get("ImageCaptionEditing"),o=this.editor.plugins.get("ImageUtils");let r=n.getSelectedElement();const l=s._getSavedCaption(r);o.isInlineImage(r)&&(this.editor.execute("imageTypeBlock"),r=n.getSelectedElement());const c=l||i.createElement("caption");i.append(c,r),e&&i.setSelection(c,"in")}_hideImageCaption(i){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("ImageCaptionEditing"),s=e.plugins.get("ImageCaptionUtils");let o=t.getSelectedElement(),r;o?r=s.getCaptionFromImageModelElement(o):(r=s.getCaptionFromModelSelection(t),o=r.parent),n._saveCaption(o,r),i.setSelection(o,"on"),i.remove(r)}}class si extends p{constructor(e){super(e);f(this,"_savedCaptionsMap");this._savedCaptionsMap=new WeakMap}static get requires(){return[w,De]}static get pluginName(){return"ImageCaptionEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new ni(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,n=e.plugins.get("ImageUtils"),s=e.plugins.get("ImageCaptionUtils"),o=e.t;e.conversion.for("upcast").elementToElement({view:r=>s.matchImageCaptionViewElement(r),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(r,{writer:l})=>n.isBlockImage(r.parent)?l.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(r,{writer:l})=>{if(!n.isBlockImage(r.parent))return null;const c=l.createEditableElement("figcaption");l.setCustomProperty("imageCaption",!0,c),c.placeholder=o("Enter image caption"),st({view:t,element:c,keepOnFocus:!0});const m=r.parent.getAttribute("alt"),u=m?o("Caption for image: %0",[m]):o("Caption for the image");return pt(c,l,{label:u})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils"),s=e.commands.get("imageTypeInline"),o=e.commands.get("imageTypeBlock"),r=l=>{if(!l.return)return;const{oldElement:c,newElement:m}=l.return;/* istanbul ignore if: paranoid check -- @preserve */if(!c)return;if(t.isBlockImage(c)){const g=n.getCaptionFromImageModelElement(c);if(g){this._saveCaption(m,g);return}}const u=this._getSavedCaption(c);u&&this._saveCaption(m,u)};s&&this.listenTo(s,"execute",r,{priority:"low"}),o&&this.listenTo(o,"execute",r,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?ot.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){const e=this.editor,t=e.model,n=e.plugins.get("ImageUtils"),s=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",()=>{const o=t.document.differ.getChanges();for(const r of o){if(r.attributeKey!=="alt")continue;const l=r.range.start.nodeAfter;if(n.isBlockImage(l)){const c=s.getCaptionFromImageModelElement(l);if(!c)return;e.editing.reconvertItem(c)}}})}}class oi extends p{static get requires(){return[De]}static get pluginName(){return"ImageCaptionUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.editing.view,t=i.plugins.get("ImageCaptionUtils"),n=i.t;i.ui.componentFactory.add("toggleImageCaption",s=>{const o=i.commands.get("toggleImageCaption"),r=new _(s);return r.set({icon:Tt,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.bind("label").to(o,"value",l=>n(l?"Toggle caption off":"Toggle caption on")),this.listenTo(r,"execute",()=>{i.execute("toggleImageCaption",{focusCaptionOnShow:!0});const l=t.getCaptionFromModelSelection(i.model.document.selection);if(l){const c=i.editing.mapper.toViewElement(l);e.scrollToTheSelection(),e.change(m=>{m.addClass("image__caption_highlighted",c)})}i.editing.view.focus()}),r})}}class un extends p{static get requires(){return[si,oi]}static get pluginName(){return"ImageCaption"}static get isOfficialPlugin(){return!0}}function Me(a){const i=a.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${i.join("|")})$`)}function ai(a){return new Promise((i,e)=>{const t=a.getAttribute("src");fetch(t).then(n=>n.blob()).then(n=>{const s=We(n,t),r=`image.${s.replace("image/","")}`,l=new File([n],r,{type:s});i(l)}).catch(n=>n&&n.name==="TypeError"?li(t).then(i).catch(e):e(n))})}function ri(a,i){return!a.isInlineImageView(i)||!i.getAttribute("src")?!1:!!i.getAttribute("src").match(/^data:image\/\w+;base64,/g)||!!i.getAttribute("src").match(/^blob:/g)}function We(a,i){return a.type?a.type:i.match(/data:(image\/\w+);base64/)?i.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}function li(a){return ci(a).then(i=>{const e=We(i,a),n=`image.${e.replace("image/","")}`;return new File([i],n,{type:e})})}function ci(a){return new Promise((i,e)=>{const t=T.document.createElement("img");t.addEventListener("load",()=>{const n=T.document.createElement("canvas");n.width=t.width,n.height=t.height,n.getContext("2d").drawImage(t,0,0),n.toBlob(o=>o?i(o):e())}),t.addEventListener("error",()=>e()),t.src=a})}class mi extends p{static get pluginName(){return"ImageUploadUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.ui.componentFactory.add("uploadImage",()=>this._createToolbarButton()),i.ui.componentFactory.add("imageUpload",()=>this._createToolbarButton()),i.ui.componentFactory.add("menuBar:uploadImage",()=>this._createMenuBarButton("standalone")),i.plugins.has("ImageInsertUI")&&i.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>i.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createButton(i){const e=this.editor,t=e.locale,n=e.commands.get("uploadImage"),s=e.config.get("image.upload.types"),o=Me(s),r=new i(e.locale),l=t.t;return r.set({acceptedType:s.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0,label:l("Upload from computer"),icon:Dt}),r.bind("isEnabled").to(n),r.on("done",(c,m)=>{const u=Array.from(m).filter(g=>o.test(g.type));u.length&&(e.execute("uploadImage",{file:u}),e.editing.view.focus())}),r}_createToolbarButton(){const i=this.editor.locale.t,e=this.editor.plugins.get("ImageInsertUI"),t=this.editor.commands.get("uploadImage"),n=this._createButton(ae);return n.tooltip=!0,n.bind("label").to(e,"isImageSelected",t,"isAccessAllowed",(s,o)=>i(o?s?"Replace image from computer":"Upload image from computer":"You have no image upload permissions.")),n}_createDropdownButton(){const i=this.editor.locale.t,e=this.editor.plugins.get("ImageInsertUI"),t=this._createButton(ae);return t.withText=!0,t.bind("label").to(e,"isImageSelected",n=>i(n?"Replace from computer":"Upload from computer")),t.on("execute",()=>{e.dropdownView.isOpen=!1}),t}_createMenuBarButton(i){const e=this.editor.locale.t,t=this._createButton(Et);switch(t.withText=!0,i){case"standalone":t.label=e("Image from computer");break;case"insertOnly":t.label=e("Image");break;case"insertNested":t.label=e("From computer");break}return t}}class ui extends p{constructor(e){super(e);f(this,"placeholder");f(this,"uploadStatusChange",(e,t,n)=>{const s=this.editor,o=t.item,r=o.getAttribute("uploadId");if(!n.consumable.consume(t.item,e.name))return;const l=s.plugins.get("ImageUtils"),c=s.plugins.get(E),m=r?t.attributeNewValue:null,u=this.placeholder,g=s.editing.mapper.toViewElement(o),d=n.writer;if(m=="reading"){le(g,d),ce(l,u,g,d);return}if(m=="uploading"){const h=c.loaders.get(r);le(g,d),h?(me(g,d),di(g,d,h,s.editing.view),bi(l,g,d,h)):ce(l,u,g,d);return}m=="complete"&&c.loaders.get(r)&&fi(g,d,s.editing.view),hi(g,d),me(g,d),gi(g,d)});this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}static get pluginName(){return"ImageUploadProgress"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function le(a,i){a.hasClass("ck-appear")||i.addClass("ck-appear",a)}function gi(a,i){i.removeClass("ck-appear",a)}function ce(a,i,e,t){e.hasClass("ck-image-upload-placeholder")||t.addClass("ck-image-upload-placeholder",e);const n=a.findViewImgElement(e);n.getAttribute("src")!==i&&t.setAttribute("src",i,n),je(e,"placeholder")||t.insert(t.createPositionAfter(n),Ii(t))}function me(a,i){a.hasClass("ck-image-upload-placeholder")&&i.removeClass("ck-image-upload-placeholder",a),qe(a,i,"placeholder")}function di(a,i,e,t){const n=pi(i);i.insert(i.createPositionAt(a,"end"),n),e.on("change:uploadedPercent",(s,o,r)=>{t.change(l=>{l.setStyle("width",r+"%",n)})})}function hi(a,i){qe(a,i,"progressBar")}function fi(a,i,e){const t=i.createUIElement("div",{class:"ck-image-upload-complete-icon"});i.insert(i.createPositionAt(a,"end"),t),setTimeout(()=>{e.change(n=>n.remove(n.createRangeOn(t)))},3e3)}function pi(a){const i=a.createUIElement("div",{class:"ck-progress-bar"});return a.setCustomProperty("progressBar",!0,i),i}function Ii(a){const i=a.createUIElement("div",{class:"ck-upload-placeholder-loader"});return a.setCustomProperty("placeholder",!0,i),i}function je(a,i){for(const e of a.getChildren())if(e.getCustomProperty(i))return e}function qe(a,i,e){const t=je(a,e);t&&i.remove(i.createRangeOn(t))}function bi(a,i,e,t){if(t.data){const n=a.findViewImgElement(i);e.setAttribute("src",t.data,n)}}class wi extends y{constructor(i){super(i),this.set("isAccessAllowed",!0)}refresh(){const i=this.editor,e=i.plugins.get("ImageUtils"),t=i.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(t)}execute(i){const e=fe(i.file),t=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),s=Object.fromEntries(t.getAttributes());e.forEach((o,r)=>{const l=t.getSelectedElement();if(r&&l&&n.isImage(l)){const c=this.editor.model.createPositionAfter(l);this._uploadImage(o,s,c)}else this._uploadImage(o,s)})}_uploadImage(i,e,t){const n=this.editor,o=n.plugins.get(E).createLoader(i),r=n.plugins.get("ImageUtils");o&&r.insertImage({...e,uploadId:o.id},t)}}class _i extends p{constructor(e){super(e);f(this,"_uploadImageElements");f(this,"_uploadedImages",new Map);e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}static get requires(){return[E,oe,H,w]}static get pluginName(){return"ImageUploadEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.document,n=e.conversion,s=e.plugins.get(E),o=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline"),l=Me(e.config.get("image.upload.types")),c=new wi(e);e.commands.add("uploadImage",c),e.commands.add("imageUpload",c),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}).add(m=>m.on("element:img",(u,g,d)=>{if(!d.consumable.test(g.viewItem,{attributes:["data-ck-upload-id"]}))return;const h=g.viewItem.getAttribute("data-ck-upload-id");if(!h)return;const[I]=Array.from(g.modelRange.getItems({shallow:!0})),b=s.loaders.get(h);I&&(d.writer.setAttribute("uploadId",h,I),d.consumable.consume(g.viewItem,{attributes:["data-ck-upload-id"]}),b&&b.data&&d.writer.setAttribute("uploadStatus",b.status,I))},{priority:"low"})),this.listenTo(e.editing.view.document,"clipboardInput",(m,u)=>{if(vi(u.dataTransfer))return;const g=Array.from(u.dataTransfer.files).filter(h=>h?l.test(h.type):!1);if(!g.length)return;if(m.stop(),e.model.change(h=>{u.targetRanges&&h.setSelection(u.targetRanges.map(I=>e.editing.mapper.toModelRange(I))),e.execute("uploadImage",{file:g})}),!e.commands.get("uploadImage").isAccessAllowed){const h=e.plugins.get("Notification"),I=e.locale.t;h.showWarning(I("You have no image upload permissions."),{namespace:"image"})}}),this.listenTo(r,"inputTransformation",(m,u)=>{const g=Array.from(e.editing.view.createRangeIn(u.content)).map(h=>h.item).filter(h=>ri(o,h)&&!h.getAttribute("uploadProcessed")).map(h=>({promise:ai(h),imageElement:h}));if(!g.length)return;const d=new G(e.editing.view.document);for(const h of g){d.setAttribute("uploadProcessed",!0,h.imageElement);const I=s.createLoader(h.promise);I&&(d.setAttribute("src","",h.imageElement),d.setAttribute("uploadId",I.id,h.imageElement))}}),e.editing.view.document.on("dragover",(m,u)=>{u.preventDefault()}),t.on("change",()=>{const m=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),u=new Set;for(const g of m)if(g.type=="insert"&&g.name!="$text"){const d=g.position.nodeAfter,h=g.position.root.rootName=="$graveyard";for(const I of yi(e,d)){const b=I.getAttribute("uploadId");if(!b)continue;const C=s.loaders.get(b);if(!C){!h&&this._uploadedImages.has(b)&&e.model.enqueueChange({isUndoable:!1},k=>{k.setAttribute("uploadStatus","complete",I),this.fire("uploadComplete",{data:this._uploadedImages.get(b),imageElement:I})});continue}h?u.has(b)||Array.from(this._uploadImageElements.get(b)).every(V=>V.root.rootName=="$graveyard")&&C.abort():(u.add(b),this._uploadImageElements.has(b)?this._uploadImageElements.get(b).add(I):this._uploadImageElements.set(b,new Set([I])),C.status=="idle"&&this._readAndUpload(C))}}}),this.on("uploadComplete",(m,{imageElement:u,data:g})=>{const d=g.urls?g.urls:g;this.editor.model.change(h=>{h.setAttribute("src",d.default,u),this._parseAndSetSrcsetAttributeOnImage(d,u,h),o.setImageNaturalSizeAttributes(u)})},{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageBlock")),this.editor.plugins.has("ImageInlineEditing")&&(e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageInline"))}_readAndUpload(e){const t=this.editor,n=t.model,s=t.locale.t,o=t.plugins.get(E),r=t.plugins.get(oe),l=t.plugins.get("ImageUtils"),c=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},u=>{const g=c.get(e.id);for(const d of g)u.setAttribute("uploadStatus","reading",d)}),e.read().then(()=>{const u=e.upload();t.ui&&t.ui.ariaLiveAnnouncer.announce(s("Uploading image"));for(const g of c.get(e.id)){/* istanbul ignore next -- @preserve */if(gt.isSafari){const d=t.editing.mapper.toViewElement(g),h=l.findViewImgElement(d);t.editing.view.once("render",()=>{if(!h.parent)return;const I=t.editing.view.domConverter.mapViewToDom(h.parent);if(!I)return;const b=I.style.display;I.style.display="none",I._ckHack=I.offsetHeight,I.style.display=b})}n.enqueueChange({isUndoable:!1},d=>{d.setAttribute("uploadStatus","uploading",g)})}return u}).then(u=>{n.enqueueChange({isUndoable:!1},g=>{for(const d of c.get(e.id))g.setAttribute("uploadStatus","complete",d),this.fire("uploadComplete",{data:u,imageElement:d});t.ui&&t.ui.ariaLiveAnnouncer.announce(s("Image upload complete")),this._uploadedImages.set(e.id,u)}),m()}).catch(u=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(s("Error during image upload")),e.status!=="error"&&e.status!=="aborted")throw u;e.status=="error"&&u&&r.showWarning(u,{title:s("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},g=>{for(const d of c.get(e.id))d.root.rootName!=="$graveyard"&&g.remove(d)}),m()});function m(){n.enqueueChange({isUndoable:!1},u=>{for(const g of c.get(e.id))u.removeAttribute("uploadId",g),u.removeAttribute("uploadStatus",g);c.delete(e.id)}),o.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,n){let s=0;const o=Object.keys(e).filter(r=>{const l=parseInt(r,10);if(!isNaN(l))return s=Math.max(s,l),!0}).map(r=>`${e[r]} ${r}w`).join(", ");if(o!=""){const r={srcset:o};!t.hasAttribute("width")&&!t.hasAttribute("height")&&(r.width=s),n.setAttributes(r,t)}}_registerConverters(e){const{conversion:t,plugins:n}=this.editor,s=n.get(E),o=n.get(w);t.for("dataDowncast").add(r=>{r.on(`attribute:uploadId:${e}`,(l,c,m)=>{if(!m.consumable.test(c.item,l.name))return;const u=s.loaders.get(c.attributeNewValue);if(!u||!u.data)return null;const g=m.mapper.toViewElement(c.item),d=o.findViewImgElement(g);d&&(m.consumable.consume(c.item,l.name),m.writer.setAttribute("data-ck-upload-id",u.id,d))})})}}function vi(a){return Array.from(a.types).includes("text/html")&&a.getData("text/html")!==""}function yi(a,i){const e=a.plugins.get("ImageUtils");return Array.from(a.model.createRangeOn(i)).filter(t=>e.isImage(t.item)).map(t=>t.item)}class Ci extends p{static get pluginName(){return"ImageUpload"}static get isOfficialPlugin(){return!0}static get requires(){return[_i,mi,ui]}}class Ei extends P{constructor(e){super(e);f(this,"urlInputView");f(this,"keystrokes");this.set("imageURLInputValue",""),this.set("isImageSelected",!1),this.set("isEnabled",!0),this.keystrokes=new O,this.urlInputView=this._createUrlInputView(),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-url"],tabindex:"-1"},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]}}]})}render(){super.render(),N({view:this}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}_createUrlInputView(){const e=this.locale,t=e.t,n=new Q(e,ye);return n.bind("label").to(this,"isImageSelected",s=>t(s?"Update image URL":"Insert image via URL")),n.bind("isEnabled").to(this),n.fieldView.inputMode="url",n.fieldView.placeholder="https://example.com/image.png",n.fieldView.bind("value").to(this,"imageURLInputValue",s=>s||""),n.fieldView.on("input",()=>{this.imageURLInputValue=n.fieldView.element.value.trim()}),n}focus(){this.urlInputView.focus()}}class ki extends p{constructor(){super(...arguments);f(this,"_imageInsertUI");f(this,"_formView")}static get pluginName(){return"ImageInsertViaUrlUI"}static get isOfficialPlugin(){return!0}static get requires(){return[B,vt]}init(){this.editor.ui.componentFactory.add("insertImageViaUrl",()=>this._createToolbarButton()),this.editor.ui.componentFactory.add("menuBar:insertImageViaUrl",()=>this._createMenuBarButton("standalone"))}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createInsertUrlButton(e){const t=new e(this.editor.locale);return t.icon=xt,t.on("execute",()=>{this._showModal()}),t}_createToolbarButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(_);return t.tooltip=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",n=>e(n?"Update image URL":"Insert image via URL")),t}_createDropdownButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(_);return t.withText=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",n=>e(n?"Update image URL":"Insert via URL")),t}_createMenuBarButton(e){const t=this.editor.locale.t,n=this._createInsertUrlButton(yt);switch(n.withText=!0,e){case"standalone":n.label=t("Image via URL");break;case"insertOnly":n.label=t("Image");break;case"insertNested":n.label=t("Via URL");break}return n}_createInsertUrlView(){const e=this.editor,t=e.locale,n=e.commands.get("replaceImageSource"),s=e.commands.get("insertImage"),o=new Ei(t);return o.bind("isImageSelected").to(this._imageInsertUI),o.bind("isEnabled").toMany([s,n],"isEnabled",(...r)=>r.some(l=>l)),o}_showModal(){const e=this.editor,n=e.locale.t,s=e.plugins.get("Dialog");this._formView||(this._formView=this._createInsertUrlView(),this._formView.on("submit",()=>this._handleSave()));const o=e.commands.get("replaceImageSource");this._formView.imageURLInputValue=o.value||"",s.show({id:"insertImageViaUrl",title:n("Image via URL"),isModal:!0,content:this._formView,actionButtons:[{label:n("Cancel"),withText:!0,onExecute:()=>s.hide()},{label:this._imageInsertUI.isImageSelected?n("Save"):n("Insert"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSave()}]})}_handleSave(){this.editor.commands.get("replaceImageSource").isEnabled?this.editor.execute("replaceImageSource",{source:this._formView.imageURLInputValue}):this.editor.execute("insertImage",{source:this._formView.imageURLInputValue}),this.editor.plugins.get("Dialog").hide()}}class Si extends p{static get pluginName(){return"ImageInsertViaUrl"}static get isOfficialPlugin(){return!0}static get requires(){return[ki,B]}}class gn extends p{static get pluginName(){return"ImageInsert"}static get isOfficialPlugin(){return!0}static get requires(){return[Ci,Si,B]}}class Ui extends y{refresh(){const i=this.editor,t=i.plugins.get("ImageUtils").getClosestSelectedImageElement(i.model.document.selection);this.isEnabled=!!t,!t||!t.hasAttribute("resizedWidth")?this.value=null:this.value={width:t.getAttribute("resizedWidth"),height:null}}execute(i){const e=this.editor,t=e.model,n=e.plugins.get("ImageUtils"),s=n.getClosestSelectedImageElement(t.document.selection);this.value={width:i.width,height:null},s&&t.change(o=>{o.setAttribute("resizedWidth",i.width,s),o.removeAttribute("resizedHeight",s),n.setImageNaturalSizeAttributes(s)})}}class $e extends p{static get requires(){return[w]}static get pluginName(){return"ImageResizeEditing"}static get isOfficialPlugin(){return!0}constructor(i){super(i),i.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:custom",value:"custom",icon:"custom"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const i=this.editor,e=new Ui(i);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),i.commands.add("resizeImage",e),i.commands.add("imageResize",e)}afterInit(){this._registerSchema()}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(i){const e=this.editor,t=e.plugins.get("ImageUtils");e.conversion.for("downcast").add(n=>n.on(`attribute:resizedWidth:${i}`,(s,o,r)=>{if(!r.consumable.consume(o.item,s.name))return;const l=r.writer,c=r.mapper.toViewElement(o.item);o.attributeNewValue!==null?(l.setStyle("width",o.attributeNewValue,c),l.addClass("image_resized",c)):(l.removeStyle("width",c),l.removeClass("image_resized",c))})),e.conversion.for("dataDowncast").attributeToAttribute({model:{name:i,key:"resizedHeight"},view:n=>({key:"style",value:{height:n}})}),e.conversion.for("editingDowncast").add(n=>n.on(`attribute:resizedHeight:${i}`,(s,o,r)=>{if(!r.consumable.consume(o.item,s.name))return;const l=r.writer,c=r.mapper.toViewElement(o.item),m=i==="imageInline"?t.findViewImgElement(c):c;o.attributeNewValue!==null?l.setStyle("height",o.attributeNewValue,m):l.removeStyle("height",m)})),e.conversion.for("upcast").attributeToAttribute({view:{name:i==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:n=>z(n)?null:n.getStyle("width")}}),e.conversion.for("upcast").attributeToAttribute({view:{name:i==="imageBlock"?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:n=>z(n)?null:n.getStyle("height")}}),e.conversion.for("upcast").add(n=>{n.on(`element:${i==="imageBlock"?"figure":"img"}`,(s,o,r)=>{r.consumable.consume(o.viewItem,{classes:["image_resized"]})})})}}const D={small:Nt,medium:Pt,large:Ot,custom:Rt,original:zt};class Bi extends p{constructor(e){super(e);f(this,"_resizeUnit");this._resizeUnit=e.config.get("image.resizeUnit")}static get requires(){return[$e]}static get pluginName(){return"ImageResizeButtons"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),n=e.commands.get("resizeImage");this.bind("isEnabled").to(n);for(const s of t)this._registerImageResizeButton(s);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:n,value:s,icon:o}=e;t.ui.componentFactory.add(n,r=>{const l=new _(r),c=t.commands.get("resizeImage"),m=this._getOptionLabelValue(e,!0);if(!D[o])throw new mt("imageresizebuttons-missing-icon",t,e);if(l.set({label:m,icon:D[o],tooltip:m,isToggleable:!0}),l.bind("isEnabled").to(this),t.plugins.has("ImageCustomResizeUI")&&U(e)){const u=t.plugins.get("ImageCustomResizeUI");this.listenTo(l,"execute",()=>{u._showForm(this._resizeUnit)})}else{const u=s?s+this._resizeUnit:null;l.bind("isOn").to(c,"value",c,"isEnabled",q(u)),this.listenTo(l,"execute",()=>{t.execute("resizeImage",{width:u})})}return l})}_registerImageResizeDropdown(e){const t=this.editor,n=t.t,s=e.find(r=>!r.value),o=r=>{const l=t.commands.get("resizeImage"),c=Z(r,Ut),m=c.buttonView,u=n("Resize image");return m.set({tooltip:u,commandValue:s.value,icon:D.medium,isToggleable:!0,label:this._getOptionLabelValue(s),withText:!0,class:"ck-resize-image-button",ariaLabel:u,ariaLabelledBy:void 0}),m.bind("label").to(l,"value",g=>g&&g.width?g.width:this._getOptionLabelValue(s)),c.bind("isEnabled").to(this),Bt(c,()=>this._getResizeDropdownListItemDefinitions(e,l),{ariaLabel:n("Image resize list"),role:"menu"}),this.listenTo(c,"execute",g=>{"onClick"in g.source?g.source.onClick():(t.execute(g.source.commandName,{width:g.source.commandValue}),t.editing.view.focus())}),c};t.ui.componentFactory.add("resizeImage",o),t.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(e,t=!1){const n=this.editor.t;return e.label?e.label:t?U(e)?n("Custom image size"):e.value?n("Resize image to %0",e.value+this._resizeUnit):n("Resize image to the original size"):U(e)?n("Custom"):e.value?e.value+this._resizeUnit:n("Original")}_getResizeDropdownListItemDefinitions(e,t){const{editor:n}=this,s=new ut,o=e.map(r=>U(r)?{...r,valueWithUnits:"custom"}:r.value?{...r,valueWithUnits:`${r.value}${this._resizeUnit}`}:{...r,valueWithUnits:null});for(const r of o){let l=null;if(n.plugins.has("ImageCustomResizeUI")&&U(r)){const c=n.plugins.get("ImageCustomResizeUI");l={type:"button",model:new se({label:this._getOptionLabelValue(r),role:"menuitemradio",withText:!0,icon:null,onClick:()=>{c._showForm(this._resizeUnit)}})};const m=Object.values(o).map(u=>u.valueWithUnits);l.model.bind("isOn").to(t,"value",t,"isEnabled",Vi(m))}else l={type:"button",model:new se({commandName:"resizeImage",commandValue:r.valueWithUnits,label:this._getOptionLabelValue(r),role:"menuitemradio",withText:!0,icon:null})},l.model.bind("isOn").to(t,"value",t,"isEnabled",q(r.valueWithUnits));l.model.bind("isEnabled").to(t,"isEnabled"),s.add(l)}return s}}function U(a){return a.value==="custom"}function q(a){return(i,e)=>{const t=i;return t===void 0||!e?!1:a===null&&t===a?!0:t!==null&&t.width===a}}function Vi(a){return(i,e)=>!a.some(t=>q(t)(i,e))}const Ai="figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img",M="image_resized";class Ti extends p{static get requires(){return[L,w]}static get pluginName(){return"ImageResizeHandles"}static get isOfficialPlugin(){return!0}init(){const i=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(i),this._setupResizerCreator()}_setupResizerCreator(){const i=this.editor,e=i.editing.view,t=i.plugins.get("ImageUtils");e.addObserver(ie),this.listenTo(e.document,"imageLoaded",(n,s)=>{if(!s.target.matches(Ai))return;const o=i.editing.view.domConverter,r=o.domToView(s.target),l=t.getImageWidgetFromImageView(r);let c=this.editor.plugins.get(L).getResizerByViewElement(l);if(c){c.redraw();return}const m=i.editing.mapper,u=m.toModelElement(l);c=i.plugins.get(L).attachTo({unit:i.config.get("image.resizeUnit"),modelElement:u,viewElement:l,editor:i,getHandleHost(g){return g.querySelector("img")},getResizeHost(){return o.mapViewToDom(m.toViewElement(u))},isCentered(){return u.getAttribute("imageStyle")=="alignCenter"},onCommit(g){e.change(d=>{d.removeClass(M,l)}),i.execute("resizeImage",{width:g})}}),c.on("updateSize",()=>{l.hasClass(M)||e.change(d=>{d.addClass(M,l)});const g=u.name==="imageInline"?r:l;g.getStyle("height")&&e.change(d=>{d.removeStyle("height",g)})}),c.bind("isEnabled").to(this)})}}/**
@@ -1,4 +1,4 @@
1
- var k=Object.defineProperty;var w=(o,t,e)=>t in o?k(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var d=(o,t,e)=>w(o,typeof t!="symbol"?t+"":t,e);import{Plugin as u,MultiCommand as f,Command as b}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{ButtonView as p,MenuBarMenuListItemButtonView as B}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconIndent as h,IconOutdent as g}from"../../../../../@ckeditor_ckeditor5-icons@45.2.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{addMarginRules as v}from"../../../../../@ckeditor_ckeditor5-engine@45.2.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{first as C}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";/**
1
+ var k=Object.defineProperty;var w=(o,t,e)=>t in o?k(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var d=(o,t,e)=>w(o,typeof t!="symbol"?t+"":t,e);import{Plugin as u,MultiCommand as f,Command as b}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{ButtonView as p,MenuBarMenuListItemButtonView as B}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconIndent as h,IconOutdent as g}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{addMarginRules as v}from"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{first as C}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */class x extends u{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.commands.add("indent",new f(t)),t.commands.add("outdent",new f(t))}}class _ extends u{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"?h:g,i=e.uiLanguageDirection=="ltr"?g:h;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(p,t,e,n);return i.set({tooltip:!0}),i}),s.ui.componentFactory.add("menuBar:"+t,()=>this._createButton(B,t,e,n))}_createButton(t,e,n,s){const i=this.editor,c=i.commands.get(e),r=new t(i.locale);return r.set({label:n,icon:s}),r.bind("isEnabled").to(c,"isEnabled"),this.listenTo(r,"execute",()=>{i.execute(e),i.editing.view.focus()}),r}}class L extends u{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[x,_]}}class l extends b{constructor(e,n){super(e);d(this,"_indentBehavior");this._indentBehavior=n}refresh(){const n=this.editor.model,s=C(n.document.selection.getSelectedBlocks());if(!s||!this._isIndentationChangeAllowed(s)){this.isEnabled=!1;return}this.isEnabled=this._indentBehavior.checkEnabled(s.getAttribute("blockIndent"))}execute(){const e=this.editor.model,n=this._getBlocksToChange();e.change(s=>{for(const i of n){const c=i.getAttribute("blockIndent"),r=this._indentBehavior.getNextIndent(c);r?s.setAttribute("blockIndent",r,i):s.removeAttribute("blockIndent",i)}})}_getBlocksToChange(){const n=this.editor.model.document.selection;return Array.from(n.getSelectedBlocks()).filter(i=>this._isIndentationChangeAllowed(i))}_isIndentationChangeAllowed(e){const n=this.editor;return n.model.schema.checkAttribute(e,"blockIndent")?!n.plugins.has("ListUtils")||!this._indentBehavior.isForward?!0:!n.plugins.get("ListUtils").isListItemBlock(e):!1}}/**
@@ -1,4 +1,4 @@
1
- import{Plugin as m,Command as x}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Collection as w,getLanguageDirection as p}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{createDropdown as h,addListToDropdown as L,MenuBarMenuView as C,MenuBarMenuListView as P,ListSeparatorView as A,MenuBarMenuListItemView as T,MenuBarMenuListItemButtonView as V,ViewModel as b}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
1
+ import{Plugin as m,Command as x}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Collection as w,getLanguageDirection as p}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{createDropdown as h,addListToDropdown as L,MenuBarMenuView as C,MenuBarMenuListView as P,ListSeparatorView as A,MenuBarMenuListItemView as T,MenuBarMenuListItemButtonView as V,ViewModel as b}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */function f(l,e){return e=e||p(l),`${l}:${e}`}function v(l){const[e,t]=l.split(":");return{languageCode:e,textDirection:t}}class M extends x{refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"language")}execute({languageCode:e,textDirection:t}={}){const s=this.editor.model,o=s.document.selection,u=e?f(e,t):!1;s.change(g=>{if(o.isCollapsed)u?g.setSelectionAttribute("language",u):g.removeSelectionAttribute("language");else{const n=s.schema.getValidRanges(o.getRanges(),"language");for(const a of n)u?g.setAttribute("language",u,a):g.removeAttribute("language",a)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,s=e.document.selection;if(s.isCollapsed)return s.getAttribute("language")||!1;for(const r of s.getRanges())for(const o of r.getItems())if(t.checkAttribute(o,"language"))return o.getAttribute("language")||!1;return!1}}class y extends m{static get pluginName(){return"TextPartLanguageEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"language"}),e.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),e.commands.add("textPartLanguage",new M(e))}_defineConverters(){const e=this.editor.conversion;e.for("upcast").elementToAttribute({model:{key:"language",value:t=>{const s=t.getAttribute("lang"),r=t.getAttribute("dir");return f(s,r)}},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),e.for("downcast").attributeToElement({model:"language",view:(t,{writer:s},r)=>{if(!t||!r.item.is("$textProxy")&&!r.item.is("documentSelection"))return;const{languageCode:o,textDirection:u}=v(t);return s.createAttributeElement("span",{lang:o,dir:u})}})}}class D extends m{static get pluginName(){return"TextPartLanguageUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,s=t("Choose language"),r=t("Language");e.ui.componentFactory.add("textPartLanguage",o=>{const{definitions:u,titles:g}=this._getItemMetadata(),n=e.commands.get("textPartLanguage"),a=h(o);return L(a,u,{ariaLabel:r,role:"menu"}),a.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),a.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),a.bind("isEnabled").to(n,"isEnabled"),a.buttonView.bind("label").to(n,"value",i=>i&&g[i]||s),a.buttonView.bind("ariaLabel").to(n,"value",i=>{const c=i&&g[i];return c?`${c}, ${r}`:r}),this.listenTo(a,"execute",i=>{n.execute({languageCode:i.source.languageCode,textDirection:i.source.textDirection}),e.editing.view.focus()}),a}),e.ui.componentFactory.add("menuBar:textPartLanguage",o=>{const{definitions:u}=this._getItemMetadata(),g=e.commands.get("textPartLanguage"),n=new C(o);n.buttonView.set({label:r});const a=new P(o);a.set({ariaLabel:t("Language"),role:"menu"});for(const i of u){if(i.type!="button"){a.items.add(new A(o));continue}const c=new T(o,n),d=new V(o);d.set({role:"menuitemradio",isToggleable:!0}),d.bind(...Object.keys(i.model)).to(i.model),d.delegate("execute").to(n),c.children.add(d),a.items.add(c)}return n.bind("isEnabled").to(g,"isEnabled"),n.panelView.children.add(a),n.on("execute",i=>{g.execute({languageCode:i.source.languageCode,textDirection:i.source.textDirection}),e.editing.view.focus()}),n})}_getItemMetadata(){const e=this.editor,t=new w,s={},r=e.commands.get("textPartLanguage"),o=e.config.get("language.textPartLanguage"),u=e.locale.t,g=u("Remove language");t.add({type:"button",model:new b({label:g,languageCode:!1,withText:!0})}),t.add({type:"separator"});for(const n of o){const a={type:"button",model:new b({label:n.title,languageCode:n.languageCode,role:"menuitemradio",textDirection:n.textDirection,withText:!0})},i=f(n.languageCode,n.textDirection);a.model.bind("isOn").to(r,"value",c=>c===i),t.add(a),s[i]=n.title}return{definitions:t,titles:s}}}class F extends m{static get requires(){return[y,D]}static get pluginName(){return"TextPartLanguage"}static get isOfficialPlugin(){return!0}}export{F as TextPartLanguage,y as TextPartLanguageEditing,D as TextPartLanguageUI};
@@ -1,4 +1,4 @@
1
- var me=Object.defineProperty;var fe=(l,o,e)=>o in l?me(l,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[o]=e;var d=(l,o,e)=>fe(l,typeof o!="symbol"?o+"":o,e);import{Plugin as V,Command as ie}from"../../../../../@ckeditor_ckeditor5-core@45.2.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as ke,findAttributeRange as x,TextWatcher as ge,getLastTextLine as we,TwoStepCaretMovement as G,Input as be,inlineHighlight as pe}from"../../../../../@ckeditor_ckeditor5-typing@45.2.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{ClipboardPipeline as _e}from"../../../../../@ckeditor_ckeditor5-clipboard@45.2.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{env as Ve,keyCodes as ve,Collection as se,first as ne,toMap as S,ObservableMixin as Le,FocusTracker as B,KeystrokeHandler as F,diff as Ie}from"../../../../../@ckeditor_ckeditor5-utils@45.2.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ClickObserver as ye,LivePosition as W,Matcher as Te}from"../../../../../@ckeditor_ckeditor5-engine@45.2.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{IconUnlink as Pe,IconPencil as Ee,IconSettings as Ce,IconLink as oe,IconPreviousArrow as H,IconNextArrow as Ae}from"../../../../../@ckeditor_ckeditor5-icons@45.2.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ContextualBalloon as X,ToolbarView as xe,CssTransitionDisablerMixin as j,ButtonView as p,SwitchButtonView as Se,MenuBarMenuListItemButtonView as Be,clickOutsideHandler as Fe,View as y,ViewCollection as R,FocusCycler as D,ListView as U,ListItemView as O,FormHeaderView as M,IconView as He,submitHandler as Re,LabeledFieldView as J,createLabeledInputText as Y,FormRowView as Q}from"../../../../../@ckeditor_ckeditor5-ui@45.2.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{isWidget as De}from"../../../../../@ckeditor_ckeditor5-widget@45.2.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{upperFirst as Ue}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/upperFirst.js";/**
1
+ var me=Object.defineProperty;var fe=(l,o,e)=>o in l?me(l,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[o]=e;var d=(l,o,e)=>fe(l,typeof o!="symbol"?o+"":o,e);import{Plugin as V,Command as ie}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as ke,findAttributeRange as x,TextWatcher as ge,getLastTextLine as we,TwoStepCaretMovement as G,Input as be,inlineHighlight as pe}from"../../../../../@ckeditor_ckeditor5-typing@45.2.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{ClipboardPipeline as _e}from"../../../../../@ckeditor_ckeditor5-clipboard@45.2.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{env as Ve,keyCodes as ve,Collection as se,first as ne,toMap as S,ObservableMixin as Le,FocusTracker as B,KeystrokeHandler as F,diff as Ie}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ClickObserver as ye,LivePosition as W,Matcher as Te}from"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{IconUnlink as Pe,IconPencil as Ee,IconSettings as Ce,IconLink as oe,IconPreviousArrow as H,IconNextArrow as Ae}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ContextualBalloon as X,ToolbarView as xe,CssTransitionDisablerMixin as j,ButtonView as p,SwitchButtonView as Se,MenuBarMenuListItemButtonView as Be,clickOutsideHandler as Fe,View as y,ViewCollection as R,FocusCycler as D,ListView as U,ListItemView as O,FormHeaderView as M,IconView as He,submitHandler as Re,LabeledFieldView as J,createLabeledInputText as Y,FormRowView as Q}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{isWidget as De}from"../../../../../@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{upperFirst as Ue}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/upperFirst.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */class Oe{constructor(){d(this,"_definitions",new Set)}get length(){return this._definitions.size}add(o){Array.isArray(o)?o.forEach(e=>this._definitions.add(e)):this._definitions.add(o)}getDispatcher(){return o=>{o.on("attribute:linkHref",(e,t,i)=>{if(!i.consumable.test(t.item,"attribute:linkHref")||!(t.item.is("selection")||i.schema.isInline(t.item)))return;const s=i.writer,n=s.document.selection;for(const r of this._definitions){const c=s.createAttributeElement("a",r.attributes,{priority:5});r.classes&&s.addClass(r.classes,c);for(const a in r.styles)s.setStyle(a,r.styles[a],c);s.setCustomProperty("link",!0,c),r.callback(t.attributeNewValue)?t.item.is("selection")?s.wrap(n.getFirstRange(),c):s.wrap(i.mapper.toViewRange(t.range),c):s.unwrap(i.mapper.toViewRange(t.range),c)}},{priority:"high"})}}getDispatcherForLinkedImage(){return o=>{o.on("attribute:linkHref:imageBlock",(e,t,{writer:i,mapper:s})=>{const n=s.toViewElement(t.item),r=Array.from(n.getChildren()).find(c=>c.is("element","a"));if(r)for(const c of this._definitions){const a=S(c.attributes);if(c.callback(t.attributeNewValue)){for(const[u,m]of a)u==="class"?i.addClass(m,r):i.setAttribute(u,m,r);c.classes&&i.addClass(c.classes,r);for(const u in c.styles)i.setStyle(u,c.styles[u],r)}else{for(const[u,m]of a)u==="class"?i.removeClass(m,r):i.removeAttribute(u,r);c.classes&&i.removeClass(c.classes,r);for(const u in c.styles)i.removeStyle(u,r)}}})}}}const Me=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Ne="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",qe=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,ze=/^((\w+:(\/{2,})?)|(\W))/i,Ke=["https?","ftps?","mailto"],I="Ctrl+K";function $e(l){return l.is("attributeElement")&&!!l.getCustomProperty("link")}function Z(l,{writer:o}){const e=o.createAttributeElement("a",{href:l},{priority:5});return o.setCustomProperty("link",!0,e),e}function re(l,o=Ke){const e=String(l),t=o.join("|"),i=new RegExp(`${Ne.replace("<protocols>",t)}`,"i");return Ge(e,i)?e:"#"}function Ge(l,o){return!!l.replace(Me,"").match(o)}function We(l,o){const e={"Open in a new tab":l("Open in a new tab"),Downloadable:l("Downloadable")};return o.forEach(t=>("label"in t&&e[t.label]&&(t.label=e[t.label]),t)),o}function Xe(l){const o=[];if(l)for(const[e,t]of Object.entries(l)){const i=Object.assign({},t,{id:`link${Ue(e)}`});o.push(i)}return o}function C(l,o){return l?o.checkAttribute(l.name,"linkHref"):!1}function je(l){return qe.test(l)}function N(l,o){const e=je(l)?"mailto:":o,t=!!e&&!le(l);return l&&t?e+l:l}function le(l){return ze.test(l)}function Je(l){window.open(l,"_blank","noopener")}function A(l){let o="";for(const e of l.getItems()){if(!e.is("$text")&&!e.is("$textProxy"))return;o+=e.data}return o}class Ye extends ie{constructor(){super(...arguments);d(this,"manualDecorators",new se);d(this,"automaticDecorators",new Oe)}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());C(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,r=[],c=[];for(const a in t)t[a]?r.push(a):c.push(a);s.change(a=>{const u=h=>{a.setAttribute("linkHref",e,h),r.forEach(k=>a.setAttribute(k,!0,h)),c.forEach(k=>a.removeAttribute(k,h))},m=(h,k)=>{const w=A(h);if(!w)return h;let b=i;if(b||(b=k&&k==w?e:w),b!=w){const T=Qe(w,b);let f=0;for(const{offset:L,actual:P,expected:q}of T){const z=L+f,K=a.createRange(h.start.getShiftedBy(z),h.start.getShiftedBy(z+P.length)),de=Ze(K,h).getAttributes(),ue=Array.from(de).filter(([he])=>s.schema.getAttributeProperties(he).isFormatting),$=a.createText(q,ue);u($),s.insertContent($,K),f+=q.length}return a.createRange(h.start,h.start.getShiftedBy(b.length))}},g=h=>{const{plugins:k}=this.editor;if(a.setSelection(h.end),k.has("TwoStepCaretMovement"))k.get("TwoStepCaretMovement")._handleForwardMovement();else for(const w of["linkHref",...r,...c])a.removeSelectionAttribute(w)};if(n.isCollapsed){const h=n.getFirstPosition();if(n.hasAttribute("linkHref")){const k=n.getAttribute("linkHref"),w=x(h,"linkHref",k,s),b=m(w,k);u(b||w),b&&g(b)}else if(e!==""){const k=S(n.getAttributes());k.set("linkHref",e),r.forEach(b=>{k.set(b,!0)});const w=s.insertContent(a.createText(i||e,k),h);g(w)}}else{const h=Array.from(n.getRanges()),k=s.schema.getValidRanges(h,"linkHref"),w=[];for(const f of n.getSelectedBlocks())s.schema.checkAttribute(f,"linkHref")&&w.push(a.createRangeOn(f));const b=w.slice();for(const f of k)this._isRangeToUpdate(f,w)&&b.push(f);const T=h.map(f=>({start:W.fromPosition(f.start,"toPrevious"),end:W.fromPosition(f.end,"toNext")}));for(let f of b){const L=(f.start.textNode||f.start.nodeAfter).getAttribute("linkHref");f=m(f,L)||f,u(f)}a.setSelection(T.map(f=>{const L=f.start.toPosition(),P=f.end.toPosition();return f.start.detach(),f.end.detach(),s.createRange(L,P)}))}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,s=i.getSelectedElement();return C(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 Qe(l,o){const e=Ie(l,o),t={equal:0,insert:0,delete:0},i=[];let s="",n="";for(const r of[...e,null])r=="insert"?n+=o[t.equal+t.insert]:r=="delete"?s+=l[t.equal+t.delete]:(s.length||n.length)&&(i.push({offset:t.equal,actual:s,expected:n}),s="",n=""),r&&t[r]++;return i}function Ze(l,o){if(!l.isCollapsed)return ne(l.getItems());const e=l.start;return e.textNode?e.textNode:!e.nodeBefore||e.isEqual(o.start)?e.nodeAfter:e.nodeBefore}class et extends ie{refresh(){const o=this.editor.model,e=o.document.selection,t=e.getSelectedElement();C(t,o.schema)?this.isEnabled=o.schema.checkAttribute(t,"linkHref"):this.isEnabled=o.schema.checkAttributeInSelection(e,"linkHref")}execute(){const o=this.editor,e=this.editor.model,t=e.document.selection,i=o.commands.get("link");e.change(s=>{const n=t.isCollapsed?[x(t.getFirstPosition(),"linkHref",t.getAttribute("linkHref"),e)]:e.schema.getValidRanges(t.getRanges(),"linkHref");for(const r of n)if(s.removeAttribute("linkHref",r),i)for(const c of i.manualDecorators)s.removeAttribute(c.id,r)})}}class tt extends Le(){constructor({id:e,label:t,attributes:i,classes:s,styles:n,defaultValue:r}){super();d(this,"id");d(this,"defaultValue");d(this,"label");d(this,"attributes");d(this,"classes");d(this,"styles");this.id=e,this.set("value",void 0),this.defaultValue=r,this.label=t,this.attributes=i,this.classes=s,this.styles=n}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const it="ck-link_selected",ee="automatic",st="manual",nt=/^(https?:)?\/\//;class v extends V{constructor(e){super(e);d(this,"_linkOpeners",[]);e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1,toolbar:["linkPreview","|","editLink","linkProperties","unlink"]})}static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[G,be,_e]}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,r)=>Z(re(n,t),r)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:n=>n.getAttribute("href")}}),e.commands.add("link",new Ye(e)),e.commands.add("unlink",new et(e));const i=We(e.t,Xe(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(n=>n.mode===ee)),this._enableManualDecorators(i.filter(n=>n.mode===st)),e.plugins.get(G).registerAttribute("linkHref"),pe(e,"linkHref","a",it),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&&nt.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 r=new tt(n);s.add(r),t.conversion.for("downcast").attributeToElement({model:r.id,view:(c,{writer:a,schema:u},{item:m})=>{if((m.is("selection")||u.isInline(m))&&c){const g=a.createAttributeElement("a",r.attributes,{priority:5});r.classes&&a.addClass(r.classes,g);for(const h in r.styles)a.setStyle(h,r.styles[h],g);return a.setCustomProperty("link",!0,g),g}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...r._createPattern()},model:{key:r.id}})})}_enableLinkOpen(){const e=this.editor,i=e.editing.view.document,s=n=>{this._linkOpeners.some(r=>r(n))||Je(n)};this.listenTo(i,"click",(n,r)=>{if(!(Ve.isMac?r.domEvent.metaKey:r.domEvent.ctrlKey))return;let a=r.domTarget;if(a.tagName.toLowerCase()!="a"&&(a=a.closest("a")),!a)return;const u=a.getAttribute("href");u&&(n.stop(),r.preventDefault(),s(u))},{context:"$capture"}),this.listenTo(i,"keydown",(n,r)=>{const a=e.commands.get("link").value;a&&r.keyCode===ve.enter&&r.altKey&&(n.stop(),s(a))})}_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(r=>{ot(r,rt(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(r=>{const c=r.createRangeIn(n.content);for(const a of c.getItems())if(a.hasAttribute("linkHref")){const u=N(a.getAttribute("linkHref"),i);r.setAttribute("linkHref",u,a)}})})}}function ot(l,o){l.removeSelectionAttribute("linkHref");for(const e of o)l.removeSelectionAttribute(e)}function rt(l){return l.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))}class lt extends p{constructor(o){super(o);const e=this.bindTemplate;this.set({href:void 0,withText:!0}),this.extendTemplate({attributes:{class:["ck-link-toolbar__preview"],href:e.to("href"),target:"_blank",rel:"noopener noreferrer"},on:{click:e.to(t=>{if(this.href){const i=()=>t.preventDefault();this.fire("navigate",this.href,i)}})}}),this.template.tag="a"}}class at extends y{constructor(e,t){super(e);d(this,"focusTracker",new B);d(this,"keystrokes",new F);d(this,"backButtonView");d(this,"saveButtonView");d(this,"displayedTextInputView");d(this,"urlInputView");d(this,"children");d(this,"providersListChildren");d(this,"_validators");d(this,"_focusables",new R);d(this,"_focusCycler");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 D({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-link-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Re({view:this}),[this.urlInputView,this.saveButtonView,...this.providersListChildren,this.backButtonView,this.displayedTextInputView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createBackButton(){const e=this.locale.t,t=new p(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:H,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new p(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 U(this.locale);return e.extendTemplate({attributes:{class:["ck-link-form__providers-list"]}}),e.items.bindTo(this.providersListChildren).using(t=>{const i=new O(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 ct extends y{constructor(e){super(e);d(this,"focusTracker",new B);d(this,"keystrokes",new F);d(this,"backButtonView");d(this,"listView");d(this,"listChildren");d(this,"emptyListInformation");d(this,"children");d(this,"_focusables",new R);d(this,"_focusCycler");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 D({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 U(this.locale);return e.extendTemplate({attributes:{class:["ck-link-providers__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new O(this.locale);return i.children.add(t),i}),e}_createBackButton(){const e=this.locale.t,t=new p(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:H,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 y(this.locale);return e.setTemplate({tag:"p",attributes:{class:["ck","ck-link__empty-list-info"]},children:[{text:this.bindTemplate.to("emptyListPlaceholder")}]}),e}}class dt extends y{constructor(e){super(e);d(this,"focusTracker",new B);d(this,"keystrokes",new F);d(this,"backButtonView");d(this,"children");d(this,"listChildren");d(this,"_focusables",new R);d(this,"_focusCycler");this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new D({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 p(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:H,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 U(this.locale);return e.extendTemplate({attributes:{class:["ck-link__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new O(this.locale);return i.children.add(t),i}),e}}class ut extends p{constructor(e){super(e);d(this,"arrowView");this.set({withText:!0}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-link__button"]}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new He;return e.content=Ae,e}}const _="link-ui";class ae extends V{constructor(){super(...arguments);d(this,"toolbarView",null);d(this,"formView",null);d(this,"linkProviderItemsView",null);d(this,"propertiesView",null);d(this,"_balloon");d(this,"_linksProviders",new se)}static get requires(){return[X,v]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;this.set("selectedLinkableText",void 0),e.editing.view.addObserver(ye),this._balloon=e.plugins.get(X),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:_,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:_,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:I},{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 xe(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,r)=>{this._hideUI(),r()}),t.keystrokes.set(I,(n,r)=>{this._addFormView(),r()}),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(at))(e.locale,ht(e));return n.displayedTextInputView.bind("isEnabled").to(this,"selectedLinkableText",r=>r!==void 0),n.urlInputView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("label").to(i,"value",r=>t(r?"Update":"Insert")),this.listenTo(n,"submit",()=>{if(n.isValid()){const r=n.urlInputView.fieldView.element.value,c=N(r,s),a=n.displayedTextInputView.fieldView.element.value;e.execute("link",c,this._getDecoratorSwitchesState(),a!==this.selectedLinkableText?a:void 0),this._closeFormView()}}),this.listenTo(n.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(n,"cancel",()=>{this._closeFormView()}),n.keystrokes.set("Esc",(r,c)=>{this._closeFormView(),c()}),n.providersListChildren.bindTo(this._linksProviders).using(r=>this._createLinksListProviderButton(r)),n}_createLinkProviderListView(e){return e.getListItems().map(({href:t,label:i,icon:s})=>{const n=new p;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 ct(t.locale),{emptyListPlaceholder:n,label:r}=e;return s.emptyListPlaceholder=n||i("No links available"),s.title=r,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(dt))(e.locale);return this.listenTo(i,"back",()=>{e.editing.view.focus(),this._removePropertiesView()}),i.listChildren.bindTo(t.manualDecorators).using(s=>{const n=new Se(e.locale);return n.set({label:s.label,withText:!0}),n.bind("isOn").toMany([s,t],"value",(r,c)=>c===void 0&&r===void 0?!!s.defaultValue:!!r),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(v)._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(p);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:link",()=>{const t=this._createButton(Be);return t.set({role:"menuitemcheckbox"}),t}),e.ui.componentFactory.add("linkPreview",t=>{const i=new lt(t),s=e.config.get("link.allowedProtocols"),n=e.commands.get("link"),r=t.t;i.bind("isEnabled").to(n,"value",a=>!!a),i.bind("href").to(n,"value",a=>a&&re(a,s));const c=a=>{if(!a){i.label=void 0,i.icon=void 0,i.tooltip=r("Open link in new tab");return}const u=this._getLinkProviderLinkByHref(a);if(u){const{label:m,tooltip:g,icon:h}=u.item;i.label=m,i.tooltip=g||!1,i.icon=h}else i.label=a,i.icon=void 0,i.tooltip=r("Open link in new tab")};return c(n.value),this.listenTo(n,"change:value",(a,u,m)=>{c(m)}),this.listenTo(i,"navigate",(a,u,m)=>{const g=this._getLinkProviderLinkByHref(u);if(!g)return;const{provider:h,item:k}=g,{navigate:w}=h;w&&w(k)&&(a.stop(),m())}),i}),e.ui.componentFactory.add("unlink",t=>{const i=e.commands.get("unlink"),s=new p(t),n=t.t;return s.set({label:n("Unlink"),icon:Pe,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 p(t),n=t.t;return s.set({label:n("Edit link"),icon:Ee,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 p(t),n=t.t;return s.set({label:n("Link properties"),icon:Ce,tooltip:!0}),s.bind("isEnabled").to(i,"isEnabled",i,"value",i,"manualDecorators",(r,c,a)=>r&&!!c&&a.length>0),this.listenTo(s,"execute",()=>{this._addPropertiesView()}),s})}_createLinksListProviderButton(e){const t=this.editor.locale,i=new ut(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),r=i.t;return n.set({label:r("Link"),icon:oe,keystroke:I,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",c=>!!c),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(I,(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())}),Fe({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideUI(!1)}})}_addToolbarView(){this.toolbarView||this._createViews(),!this._isToolbarInPanel&&this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this.formView.backButtonView.isVisible=e.isEnabled&&!!e.value,this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.selectedLinkableText=this._getSelectedLinkableText(),this.formView.displayedTextInputView.fieldView.value=this.selectedLinkableText||"",this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_addPropertiesView(){this.propertiesView||this._createViews(),!this._arePropertiesInPanel&&(this.propertiesView.disableCssTransitions(),this._balloon.add({view:this.propertiesView,position:this._getBalloonPositionData()}),this.propertiesView.enableCssTransitions(),this.propertiesView.focus())}_showLinksProviderView(e){this.linkProviderItemsView&&this._removeLinksProviderView(),this.linkProviderItemsView=this._createLinkProviderItemsView(e),this._addLinkProviderItemsView(e)}_addLinkProviderItemsView(e){this.linkProviderItemsView.listChildren.clear(),this.linkProviderItemsView.listChildren.addMany(this._createLinkProviderListView(e)),this._balloon.add({view:this.linkProviderItemsView,position:this._getBalloonPositionData()}),this.linkProviderItemsView.focus()}_closeFormView(){const e=this.editor.commands.get("link");this.selectedLinkableText=void 0,e.value!==void 0?this._removeFormView():this._hideUI()}_removePropertiesView(){this._arePropertiesInPanel&&this._balloon.remove(this.propertiesView)}_removeLinksProviderView(){this._isLinksListInPanel&&this._balloon.remove(this.linkProviderItemsView)}_removeFormView(e=!0){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.displayedTextInputView.fieldView.reset(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._isToolbarVisible?this._addFormView():this._addToolbarView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addToolbarView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(e=!0){const t=this.editor;this._isUIInPanel&&(this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeLinksProviderView(),this._removePropertiesView(),this._removeFormView(e),this._isToolbarInPanel&&this._balloon.remove(this.toolbarView),this._hideFakeVisualSelection())}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),s=r();const n=()=>{const c=this._getSelectedLinkElement(),a=r();i&&!c||!i&&a!==s?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=c,s=a};function r(){return t.selection.focus.getAncestors().reverse().find(c=>c.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(_)){const s=this.editor.editing.mapper.markerNameToElements(_);if(s){const n=Array.from(s),r=e.createRange(e.createPositionBefore(n[0]),e.createPositionAfter(n[n.length-1]));return{target:e.domConverter.viewRangeToDom(r)}}}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&&De(i))return E(t.getFirstPosition());{const s=t.getFirstRange().getTrimmed(),n=E(s.start),r=E(s.end);return!n||n!=r?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(_))t.updateMarker(_,{range:i});else if(i.start.isAtEnd){const s=i.start.getLastMatchingPosition(({item:n})=>!e.schema.isContent(n),{boundaries:i});t.addMarker(_,{usingOperation:!1,affectsData:!1,range:t.createRange(s,i.end)})}else t.addMarker(_,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(_)&&e.change(t=>{t.removeMarker(_)})}}function E(l){return l.getAncestors().find(o=>$e(o))||null}function ht(l){const o=l.t,e=l.config.get("link.allowCreatingEmptyLinks");return[t=>{if(!e&&!t.url.length)return o("Link URL must not be empty.")}]}const mt=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"),ft=2;class kt extends V{static get requires(){return[ke,v]}static get pluginName(){return"AutoLink"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(o,e){return e.textNode&&e.textNode.hasAttribute("linkHref")?x(e,"linkHref",e.textNode.getAttribute("linkHref"),o):null}_selectEntireLinks(o,e){const i=this.editor.model,s=i.document.selection,n=s.getFirstPosition(),r=s.getLastPosition();let c=e.getJoined(this._expandLinkRange(i,n)||e);c&&(c=c.getJoined(this._expandLinkRange(i,r)||e)),c&&(c.start.isBefore(n)||c.end.isAfter(r))&&o.setSelection(c)}_enablePasteLinking(){const o=this.editor,e=o.model,t=e.document.selection,i=o.plugins.get("ClipboardPipeline"),s=o.commands.get("link");i.on("inputTransformation",(n,r)=>{if(!this.isEnabled||!s.isEnabled||t.isCollapsed||r.method!=="paste"||t.rangeCount>1)return;const c=t.getFirstRange(),a=r.dataTransfer.getData("text/plain");if(!a)return;const u=a.match(ce);u&&u[2]===a&&(e.change(m=>{this._selectEntireLinks(m,c),s.execute(a)}),n.stop())},{priority:"high"})}_enableTypingHandling(){const o=this.editor,e=new ge(o.model,t=>{let i=t;if(!gt(i))return;i=i.slice(0,-1),"!.:,;?".includes(i[i.length-1])&&(i=i.slice(0,-1));const s=te(i);if(s)return{url:s,removedTrailingCharacters:t.length-i.length}});e.on("matched:data",(t,i)=>{const{batch:s,range:n,url:r,removedTrailingCharacters:c}=i;if(!s.isTyping)return;const a=n.end.getShiftedBy(-c),u=a.getShiftedBy(-r.length),m=o.model.createRange(u,a);this._applyAutoLink(r,m)}),e.bind("isEnabled").to(this)}_enableEnterHandling(){const o=this.editor,e=o.model,t=o.commands.get("enter");t&&t.on("execute",()=>{var n;const i=e.document.selection.getFirstPosition();let s;(n=i.parent.previousSibling)!=null&&n.is("element")?s=e.createRangeIn(i.parent.previousSibling):s=e.createRange(e.createPositionAt(i.parent,0),i),this._checkAndApplyAutoLinkOnRange(s)})}_enableShiftEnterHandling(){const o=this.editor,e=o.model,t=o.commands.get("shiftEnter");t&&t.on("execute",()=>{const i=e.document.selection.getFirstPosition(),s=e.createRange(e.createPositionAt(i.parent,0),i.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(s)})}_checkAndApplyAutoLinkOnRange(o){const e=this.editor.model,{text:t,range:i}=we(o,e),s=te(t);if(s){const n=e.createRange(i.end.getShiftedBy(-s.length),i.end);this._applyAutoLink(s,n)}}_applyAutoLink(o,e){const t=this.editor.model,i=this.editor.config.get("link.defaultProtocol"),s=N(o,i);!this.isEnabled||!wt(e,t)||!le(s)||bt(e)||this._persistAutoLink(s,e)}_persistAutoLink(o,e){const t=this.editor.model,i=this.editor.plugins.get("Delete");t.enqueueChange(s=>{s.setAttribute("linkHref",o,e),t.enqueueChange(()=>{i.requestUndoOnBackspace()})})}}function gt(l){return l.length>mt&&l[l.length-1]===" "&&l[l.length-2]!==" "}function te(l){const o=ce.exec(l);return o?o[ft]:null}function wt(l,o){return o.schema.checkAttributeInSelection(o.createSelection(l),"linkHref")}function bt(l){const o=l.start.nodeAfter;return!!o&&o.hasAttribute("linkHref")}class Rt extends V{static get requires(){return[v,ae,kt]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}}class pt extends V{static get requires(){return["ImageEditing","ImageUtils",v]}static get pluginName(){return"LinkImageEditing"}static get isOfficialPlugin(){return!0}afterInit(){const o=this.editor,e=o.model.schema;o.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["linkHref"]}),o.conversion.for("upcast").add(_t(o)),o.conversion.for("downcast").add(Vt(o)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const o=this.editor,t=o.commands.get("link").automaticDecorators;t.length&&o.conversion.for("downcast").add(t.getDispatcherForLinkedImage())}_enableManualDecorators(){const o=this.editor,e=o.commands.get("link");for(const t of e.manualDecorators)o.plugins.has("ImageBlockEditing")&&o.model.schema.extend("imageBlock",{allowAttributes:t.id}),o.plugins.has("ImageInlineEditing")&&o.model.schema.extend("imageInline",{allowAttributes:t.id}),o.conversion.for("downcast").add(vt(t)),o.conversion.for("upcast").add(Lt(o,t))}}function _t(l){const o=l.plugins.has("ImageInlineEditing"),e=l.plugins.get("ImageUtils");return t=>{t.on("element:a",(i,s,n)=>{const r=s.viewItem,c=e.findViewImgElement(r);if(!c)return;const a=c.findAncestor(h=>e.isBlockImageView(h));if(o&&!a)return;const u={attributes:["href"]};if(!n.consumable.consume(r,u))return;const m=r.getAttribute("href");if(!m)return;let g=s.modelCursor.parent;if(!g.is("element","imageBlock")){const h=n.convertItem(c,s.modelCursor);s.modelRange=h.modelRange,s.modelCursor=h.modelCursor,g=s.modelCursor.nodeBefore}g&&g.is("element","imageBlock")&&n.writer.setAttribute("linkHref",m,g)},{priority:"high"})}}function Vt(l){const o=l.plugins.get("ImageUtils");return e=>{e.on("attribute:linkHref:imageBlock",(t,i,s)=>{if(!s.consumable.consume(i.item,t.name))return;const n=s.mapper.toViewElement(i.item),r=s.writer,c=Array.from(n.getChildren()).find(m=>m.is("element","a")),a=o.findViewImgElement(n),u=a.parent.is("element","picture")?a.parent:a;if(c)i.attributeNewValue?r.setAttribute("href",i.attributeNewValue,c):(r.move(r.createRangeOn(u),r.createPositionAt(n,0)),r.remove(c));else{const m=r.createContainerElement("a",{href:i.attributeNewValue});r.insert(r.createPositionAt(n,0),m),r.move(r.createRangeOn(u),r.createPositionAt(m,0))}},{priority:"high"})}}function vt(l){return o=>{o.on(`attribute:${l.id}:imageBlock`,(e,t,i)=>{const s=i.mapper.toViewElement(t.item),n=Array.from(s.getChildren()).find(r=>r.is("element","a"));if(n){if(l.value===void 0){for(const r in l.attributes)i.writer.removeAttribute(r,n);l.classes&&i.writer.removeClass(l.classes,n);for(const r in l.styles)i.writer.removeStyle(r,n);return}for(const[r,c]of S(l.attributes))i.writer.setAttribute(r,c,n);l.classes&&i.writer.addClass(l.classes,n);for(const r in l.styles)i.writer.setStyle(r,l.styles[r],n)}})}}function Lt(l,o){const e=l.plugins.has("ImageInlineEditing"),t=l.plugins.get("ImageUtils");return i=>{i.on("element:a",(s,n,r)=>{const c=n.viewItem,a=t.findViewImgElement(c);if(!a)return;const u=a.findAncestor(k=>t.isBlockImageView(k));if(e&&!u)return;const g=new Te(o._createPattern()).match(c);if(!g||!r.consumable.consume(c,g.match))return;const h=n.modelCursor.nodeBefore||n.modelCursor.parent;r.writer.setAttribute(o.id,!0,h)},{priority:"high"})}}class It extends V{static get requires(){return[v,ae,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}static get isOfficialPlugin(){return!0}init(){const o=this.editor,e=o.editing.view.document;this.listenTo(e,"click",(t,i)=>{this._isSelectedLinkedImage(o.model.document.selection)&&(i.preventDefault(),t.stop())},{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const o=this.editor,e=o.t;o.ui.componentFactory.add("linkImage",t=>{const i=new p(t),s=o.plugins.get("LinkUI"),n=o.commands.get("link");return i.set({isEnabled:!0,label:e("Link image"),icon:oe,keystroke:I,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(n,"isEnabled"),i.bind("isOn").to(n,"value",r=>!!r),this.listenTo(i,"execute",()=>{this._isSelectedLinkedImage(o.model.document.selection)?s._addToolbarView():s._showUI(!0)}),i})}_isSelectedLinkedImage(o){const e=o.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(e)&&e.hasAttribute("linkHref")}}class Dt extends V{static get requires(){return[pt,It]}static get pluginName(){return"LinkImage"}static get isOfficialPlugin(){return!0}}export{kt as AutoLink,Rt as Link,Ye as LinkCommand,v as LinkEditing,at as LinkFormView,Dt as LinkImage,pt as LinkImageEditing,It as LinkImageUI,ae as LinkUI,et as UnlinkCommand,N as addLinkProtocolIfApplicable,re as ensureSafeUrl,C as isLinkableElement};