From 54173637c836c26e1ba2a4e9f559fd55a0de1075 Mon Sep 17 00:00:00 2001 From: Marcel Baumgartner Date: Thu, 16 Feb 2023 21:58:19 +0100 Subject: [PATCH] Added configuration menu. Added some services. New translation system. Assets --- Moonlight/App/Exceptions/DisplayException.cs | 32 + Moonlight/App/Helpers/ConfigUtils.cs | 43 + Moonlight/App/Helpers/SmartTranslateHelper.cs | 56 + Moonlight/App/Helpers/TranslationHelper.cs | 58 - .../Controllers/Api/Moonlight/Resources.cs | 23 + Moonlight/App/Services/ConfigService.cs | 7 +- .../App/Services/SmartTranslateService.cs | 85 + Moonlight/App/Services/TotpService.cs | 62 + Moonlight/App/Services/TranslationService.cs | 98 - Moonlight/App/Services/UserService.cs | 181 + Moonlight/Moonlight.csproj | 3 +- Moonlight/Pages/_Layout.cshtml | 11 +- Moonlight/Program.cs | 18 +- Moonlight/Properties/launchSettings.json | 2 +- .../Components/Alerts/BannedAlert.razor | 5 +- .../Components/Alerts/DisabledAlert.razor | 5 +- .../Alerts/SetupCompletedAlert.razor | 10 + .../ComponentErrorBoundary.razor | 12 +- .../ErrorBoundaries/GlobalErrorBoundary.razor | 12 +- .../ErrorBoundaries/PageErrorBoundary.razor | 11 +- .../Shared/Components/Forms/WButton.razor | 44 + .../Shared/Components/Partials/Footer.razor | 7 +- .../Shared/Components/Partials/Navbar.razor | 5 +- .../Shared/Components/Partials/Sidebar.razor | 5 +- .../Components/Partials/SidebarMenu.razor | 55 +- Moonlight/Shared/Components/Partials/TL.razor | 31 + .../Components/StateLogic/IsSetup.razor | 20 + .../Components/StateLogic/NonSetup.razor | 20 + Moonlight/Shared/Views/Setup/Features.razor | 69 + Moonlight/Shared/Views/Setup/Final.razor | 40 + Moonlight/Shared/Views/Setup/Index.razor | 53 + Moonlight/Shared/Views/Setup/Users.razor | 136 + Moonlight/_Imports.razor | 5 + ....GeneratedMSBuildEditorConfig.editorconfig | 36 + .../Moonlight.csproj.AssemblyReference.cache | Bin 200756 -> 201001 bytes Moonlight/resources/lang/de_de.lang | 34 + Moonlight/resources/lang/en_us.json | 67 - Moonlight/wwwroot/assets/js/monaco.js | 2 +- .../ckeditor/ckeditor-balloon-block.bundle.js | 7 + .../ckeditor/ckeditor-balloon.bundle.js | 7 + .../ckeditor/ckeditor-classic.bundle.js | 7 + .../ckeditor/ckeditor-document.bundle.js | 7 + .../custom/ckeditor/ckeditor-inline.bundle.js | 7 + .../custom/cookiealert/cookiealert.bundle.css | 36 + .../custom/cookiealert/cookiealert.bundle.js | 56 + .../plugins/custom/cropper/cropper.bundle.css | 300 + .../plugins/custom/cropper/cropper.bundle.js | 3631 + .../custom/datatables/datatables.bundle.css | 1576 + .../custom/datatables/datatables.bundle.js | 20068 ++++ .../custom/draggable/draggable.bundle.js | 42713 ++++++++ .../custom/flotcharts/flotcharts.bundle.js | 1698 + .../formrepeater/formrepeater.bundle.js | 1007 + .../custom/fslightbox/fslightbox.bundle.js | 1 + .../fullcalendar/fullcalendar.bundle.css | 1323 + .../fullcalendar/fullcalendar.bundle.js | 15010 +++ .../plugins/custom/jkanban/jkanban.bundle.css | 147 + .../plugins/custom/jkanban/jkanban.bundle.js | 1 + .../custom/jstree/images/jstree/32px.png | Bin 0 -> 2387 bytes .../custom/jstree/images/jstree/throbber.gif | Bin 0 -> 1464 bytes .../plugins/custom/jstree/jstree.bundle.css | 1327 + .../plugins/custom/jstree/jstree.bundle.js | 8681 ++ .../plugins/custom/leaflet/leaflet.bundle.css | 905 + .../plugins/custom/leaflet/leaflet.bundle.js | 24 + .../plugins/custom/prismjs/prismjs.bundle.css | 192 + .../plugins/custom/prismjs/prismjs.bundle.js | 3485 + .../tinymce/skins/content/dark/content.css | 84 + .../skins/content/dark/content.min.css | 73 + .../tinymce/skins/content/default/content.css | 78 + .../skins/content/default/content.min.css | 67 + .../skins/content/document/content.css | 81 + .../skins/content/document/content.min.css | 70 + .../tinymce/skins/content/writer/content.css | 79 + .../skins/content/writer/content.min.css | 68 + .../tinymce/skins/ui/oxide-dark/content.css | 846 + .../skins/ui/oxide-dark/content.inline.css | 857 + .../ui/oxide-dark/content.inline.min.css | 726 + .../skins/ui/oxide-dark/content.min.css | 722 + .../skins/ui/oxide-dark/content.mobile.css | 34 + .../ui/oxide-dark/content.mobile.min.css | 32 + .../tinymce/skins/ui/oxide-dark/skin.css | 3620 + .../tinymce/skins/ui/oxide-dark/skin.min.css | 3485 + .../skins/ui/oxide-dark/skin.mobile.css | 791 + .../skins/ui/oxide-dark/skin.mobile.min.css | 748 + .../skins/ui/oxide-dark/skin.shadowdom.css | 42 + .../ui/oxide-dark/skin.shadowdom.min.css | 40 + .../custom/tinymce/skins/ui/oxide/content.css | 865 + .../tinymce/skins/ui/oxide/content.inline.css | 857 + .../skins/ui/oxide/content.inline.min.css | 726 + .../tinymce/skins/ui/oxide/content.min.css | 734 + .../tinymce/skins/ui/oxide/content.mobile.css | 34 + .../skins/ui/oxide/content.mobile.min.css | 32 + .../custom/tinymce/skins/ui/oxide/skin.css | 3620 + .../tinymce/skins/ui/oxide/skin.min.css | 3485 + .../tinymce/skins/ui/oxide/skin.mobile.css | 791 + .../skins/ui/oxide/skin.mobile.min.css | 748 + .../tinymce/skins/ui/oxide/skin.shadowdom.css | 42 + .../skins/ui/oxide/skin.shadowdom.min.css | 40 + .../plugins/custom/tinymce/tinymce.bundle.js | 83705 ++++++++++++++++ .../plugins/custom/typedjs/typedjs.bundle.js | 1052 + .../vis-timeline/vis-timeline.bundle.css | 1240 + .../vis-timeline/vis-timeline.bundle.js | 64 + .../fonts/@fortawesome/fa-brands-400.ttf | Bin 0 -> 181852 bytes .../fonts/@fortawesome/fa-brands-400.woff2 | Bin 0 -> 105536 bytes .../fonts/@fortawesome/fa-regular-400.ttf | Bin 0 -> 60520 bytes .../fonts/@fortawesome/fa-regular-400.woff2 | Bin 0 -> 23940 bytes .../fonts/@fortawesome/fa-solid-900.ttf | Bin 0 -> 388460 bytes .../fonts/@fortawesome/fa-solid-900.woff2 | Bin 0 -> 154228 bytes .../fonts/@fortawesome/fa-v4compatibility.ttf | Bin 0 -> 10556 bytes .../@fortawesome/fa-v4compatibility.woff2 | Bin 0 -> 4960 bytes .../bootstrap-icons/bootstrap-icons.woff | Bin 0 -> 137216 bytes .../bootstrap-icons/bootstrap-icons.woff2 | Bin 0 -> 102380 bytes .../global/fonts/fonticon/fonticon.css | 235 + .../global/fonts/fonticon/fonticon.eot | Bin 0 -> 23872 bytes .../global/fonts/fonticon/fonticon.svg | 225 + .../global/fonts/fonticon/fonticon.ttf | Bin 0 -> 23704 bytes .../global/fonts/fonticon/fonticon.woff | Bin 0 -> 13260 bytes .../global/fonts/fonticon/fonticon.woff2 | Bin 0 -> 11244 bytes .../fonts/line-awesome/la-brands-400.eot | Bin 0 -> 156260 bytes .../fonts/line-awesome/la-brands-400.svg | 1313 + .../fonts/line-awesome/la-brands-400.ttf | Bin 0 -> 156072 bytes .../fonts/line-awesome/la-brands-400.woff | Bin 0 -> 98673 bytes .../fonts/line-awesome/la-brands-400.woff2 | Bin 0 -> 84772 bytes .../fonts/line-awesome/la-regular-400.eot | Bin 0 -> 33916 bytes .../fonts/line-awesome/la-regular-400.svg | 467 + .../fonts/line-awesome/la-regular-400.ttf | Bin 0 -> 33724 bytes .../fonts/line-awesome/la-regular-400.woff | Bin 0 -> 15489 bytes .../fonts/line-awesome/la-regular-400.woff2 | Bin 0 -> 12900 bytes .../fonts/line-awesome/la-solid-900.eot | Bin 0 -> 226312 bytes .../fonts/line-awesome/la-solid-900.svg | 2894 + .../fonts/line-awesome/la-solid-900.ttf | Bin 0 -> 226128 bytes .../fonts/line-awesome/la-solid-900.woff | Bin 0 -> 125421 bytes .../fonts/line-awesome/la-solid-900.woff2 | Bin 0 -> 96752 bytes .../assets/plugins/global/plugins.bundle.css | 34646 +++++++ .../assets/plugins/global/plugins.bundle.js | 71787 +++++++++++++ .../global/sourcemaps/tiny-slider.css.map | 1 + 135 files changed, 325420 insertions(+), 305 deletions(-) create mode 100644 Moonlight/App/Exceptions/DisplayException.cs create mode 100644 Moonlight/App/Helpers/ConfigUtils.cs create mode 100644 Moonlight/App/Helpers/SmartTranslateHelper.cs delete mode 100644 Moonlight/App/Helpers/TranslationHelper.cs create mode 100644 Moonlight/App/Http/Controllers/Api/Moonlight/Resources.cs create mode 100644 Moonlight/App/Services/SmartTranslateService.cs create mode 100644 Moonlight/App/Services/TotpService.cs delete mode 100644 Moonlight/App/Services/TranslationService.cs create mode 100644 Moonlight/App/Services/UserService.cs create mode 100644 Moonlight/Shared/Components/Alerts/SetupCompletedAlert.razor create mode 100644 Moonlight/Shared/Components/Forms/WButton.razor create mode 100644 Moonlight/Shared/Components/Partials/TL.razor create mode 100644 Moonlight/Shared/Components/StateLogic/IsSetup.razor create mode 100644 Moonlight/Shared/Components/StateLogic/NonSetup.razor create mode 100644 Moonlight/Shared/Views/Setup/Features.razor create mode 100644 Moonlight/Shared/Views/Setup/Final.razor create mode 100644 Moonlight/Shared/Views/Setup/Index.razor create mode 100644 Moonlight/Shared/Views/Setup/Users.razor create mode 100644 Moonlight/resources/lang/de_de.lang delete mode 100644 Moonlight/resources/lang/en_us.json create mode 100644 Moonlight/wwwroot/assets/plugins/custom/ckeditor/ckeditor-balloon-block.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/ckeditor/ckeditor-balloon.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/ckeditor/ckeditor-document.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/ckeditor/ckeditor-inline.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/cookiealert/cookiealert.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/cookiealert/cookiealert.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/cropper/cropper.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/cropper/cropper.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/datatables/datatables.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/datatables/datatables.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/draggable/draggable.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/flotcharts/flotcharts.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/formrepeater/formrepeater.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/fslightbox/fslightbox.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/fullcalendar/fullcalendar.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/fullcalendar/fullcalendar.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/jkanban/jkanban.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/jkanban/jkanban.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/jstree/images/jstree/32px.png create mode 100644 Moonlight/wwwroot/assets/plugins/custom/jstree/images/jstree/throbber.gif create mode 100644 Moonlight/wwwroot/assets/plugins/custom/jstree/jstree.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/jstree/jstree.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/leaflet/leaflet.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/leaflet/leaflet.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/prismjs/prismjs.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/prismjs/prismjs.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/content/dark/content.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/content/dark/content.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/content/default/content.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/content/default/content.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/content/document/content.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/content/document/content.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/content/writer/content.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/content/writer/content.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/content.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/content.inline.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/content.inline.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/content.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/content.mobile.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/content.mobile.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/skin.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/skin.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/skin.mobile.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/skin.mobile.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/skin.shadowdom.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/content.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/content.inline.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/content.inline.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/content.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/content.mobile.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/content.mobile.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/skin.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/skin.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/skin.mobile.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/skin.mobile.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/skin.shadowdom.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/skins/ui/oxide/skin.shadowdom.min.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/tinymce/tinymce.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/typedjs/typedjs.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/custom/vis-timeline/vis-timeline.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/custom/vis-timeline/vis-timeline.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/@fortawesome/fa-brands-400.ttf create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/@fortawesome/fa-brands-400.woff2 create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/@fortawesome/fa-regular-400.ttf create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/@fortawesome/fa-regular-400.woff2 create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/@fortawesome/fa-solid-900.ttf create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/@fortawesome/fa-solid-900.woff2 create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/@fortawesome/fa-v4compatibility.ttf create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/@fortawesome/fa-v4compatibility.woff2 create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/bootstrap-icons/bootstrap-icons.woff create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/bootstrap-icons/bootstrap-icons.woff2 create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/fonticon/fonticon.css create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/fonticon/fonticon.eot create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/fonticon/fonticon.svg create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/fonticon/fonticon.ttf create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/fonticon/fonticon.woff create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/fonticon/fonticon.woff2 create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-brands-400.eot create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-brands-400.svg create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-brands-400.ttf create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-brands-400.woff create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-brands-400.woff2 create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-regular-400.eot create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-regular-400.svg create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-regular-400.ttf create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-regular-400.woff create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-regular-400.woff2 create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-solid-900.eot create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-solid-900.svg create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-solid-900.ttf create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-solid-900.woff create mode 100644 Moonlight/wwwroot/assets/plugins/global/fonts/line-awesome/la-solid-900.woff2 create mode 100644 Moonlight/wwwroot/assets/plugins/global/plugins.bundle.css create mode 100644 Moonlight/wwwroot/assets/plugins/global/plugins.bundle.js create mode 100644 Moonlight/wwwroot/assets/plugins/global/sourcemaps/tiny-slider.css.map diff --git a/Moonlight/App/Exceptions/DisplayException.cs b/Moonlight/App/Exceptions/DisplayException.cs new file mode 100644 index 0000000..f873800 --- /dev/null +++ b/Moonlight/App/Exceptions/DisplayException.cs @@ -0,0 +1,32 @@ +using System.Runtime.Serialization; + +namespace Moonlight.App.Exceptions; + +[Serializable] +public class DisplayException : Exception +{ + // + // For guidelines regarding the creation of new exception types, see + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp + // and + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp + // + + public DisplayException() + { + } + + public DisplayException(string message) : base(message) + { + } + + public DisplayException(string message, Exception inner) : base(message, inner) + { + } + + protected DisplayException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } +} \ No newline at end of file diff --git a/Moonlight/App/Helpers/ConfigUtils.cs b/Moonlight/App/Helpers/ConfigUtils.cs new file mode 100644 index 0000000..1f5196a --- /dev/null +++ b/Moonlight/App/Helpers/ConfigUtils.cs @@ -0,0 +1,43 @@ +using Newtonsoft.Json; + +namespace Moonlight.App.Helpers; + +public class ConfigUtils +{ + public static void SaveConfigurationAsJson(IConfiguration configuration, string filePath) + { + // Serialize the configuration to a JSON object + var jsonObject = new Dictionary(); + foreach (var section in configuration.GetChildren()) + { + SerializeSection(section, jsonObject); + } + + // Convert the JSON object to a JSON string + var jsonString = JsonConvert.SerializeObject(jsonObject); + + // Write the JSON string to a file + File.WriteAllText(filePath, jsonString); + } + + private static void SerializeSection(IConfigurationSection section, IDictionary jsonObject) + { + var children = section.GetChildren(); + + if (!children.Any()) + { + // Leaf node + jsonObject[section.Key] = section.Value; + } + else + { + // Non-leaf node + var childObject = new Dictionary(); + foreach (var childSection in children) + { + SerializeSection(childSection, childObject); + } + jsonObject[section.Key] = childObject; + } + } +} \ No newline at end of file diff --git a/Moonlight/App/Helpers/SmartTranslateHelper.cs b/Moonlight/App/Helpers/SmartTranslateHelper.cs new file mode 100644 index 0000000..96b4599 --- /dev/null +++ b/Moonlight/App/Helpers/SmartTranslateHelper.cs @@ -0,0 +1,56 @@ +namespace Moonlight.App.Helpers; + +public class SmartTranslateHelper +{ + private readonly Dictionary> Languages; + + public SmartTranslateHelper() + { + Languages = new(); + + foreach (var file in Directory.GetFiles("resources/lang")) + { + if (Path.GetExtension(file) == ".lang") + { + var langKey = Path.GetFileName(file) + .Replace(Path.GetExtension(file), ""); + + var lines = File.ReadAllLines(file); + var content = new Dictionary(); + + foreach (var line in lines) + { + var parts = line.Split(";"); + content.Add(parts[0], parts[1]); + } + + Languages.Add(langKey, content); + } + } + } + + public string Translate(string langKey, string content) + { + if (!Languages.ContainsKey(langKey)) + Languages.Add(langKey, new Dictionary()); + + if (!Languages[langKey].ContainsKey(content)) + { + Languages[langKey].Add(content, content); + + File.WriteAllLines($"resources/lang/{langKey}.lang", GenerateData(Languages[langKey])); + } + + return Languages[langKey][content]; + } + + private string[] GenerateData(Dictionary data) + { + var dataList = new List(); + + foreach (var d in data) + dataList.Add($"{d.Key};{d.Value}"); + + return dataList.ToArray(); + } +} \ No newline at end of file diff --git a/Moonlight/App/Helpers/TranslationHelper.cs b/Moonlight/App/Helpers/TranslationHelper.cs deleted file mode 100644 index 601ce2b..0000000 --- a/Moonlight/App/Helpers/TranslationHelper.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Logging.Net; -using Newtonsoft.Json; - -namespace Moonlight.App.Helpers -{ - public class TranslationHelper - { - private readonly Dictionary Languages; - - public TranslationHelper() - { - Languages = new(); - - foreach (var file in Directory.GetFiles("resources/lang")) - { - var langKey = Path.GetFileName(file) - .Replace(Path.GetExtension(file), ""); - - Languages.Add(langKey, new ConfigurationBuilder() - .AddJsonFile(file) - .Build()); - } - } - - public string? Get(string langKey, string key) - { - if (Languages.ContainsKey(langKey)) - { - var parts = key.Split("."); - - IConfigurationSection? section = null; - foreach (var part in parts) - { - if (part == parts.Last()) - { - if (section == null) - return Languages[langKey].GetValue(part); - else - return section.GetValue(part); - } - else - { - if (section == null) - section = Languages[langKey].GetSection(part); - else - section = section.GetSection(part); - } - } - - return key; - } - else - { - return "Invalid lang key"; - } - } - } -} diff --git a/Moonlight/App/Http/Controllers/Api/Moonlight/Resources.cs b/Moonlight/App/Http/Controllers/Api/Moonlight/Resources.cs new file mode 100644 index 0000000..2740349 --- /dev/null +++ b/Moonlight/App/Http/Controllers/Api/Moonlight/Resources.cs @@ -0,0 +1,23 @@ +using Logging.Net; +using Microsoft.AspNetCore.Mvc; + +namespace Moonlight.App.Http.Controllers.Api.Moonlight; + +[ApiController] +[Route("api/moonlight/resources")] +public class Resources : Controller +{ + [HttpGet("images/{name}")] + public ActionResult GetImage([FromRoute] string name) + { + if (name.Contains("..")) + { + //TODO: Add security warn + return NotFound(); + } + + var fs = new FileStream($"resources/public/images/{name}", FileMode.Open); + + return File(fs, "application/octet-stream", name); + } +} \ No newline at end of file diff --git a/Moonlight/App/Services/ConfigService.cs b/Moonlight/App/Services/ConfigService.cs index 7c6b3c9..7a315cb 100644 --- a/Moonlight/App/Services/ConfigService.cs +++ b/Moonlight/App/Services/ConfigService.cs @@ -1,6 +1,6 @@ using System.Text; -using Logging.Net; using Microsoft.Extensions.Primitives; +using Moonlight.App.Helpers; namespace Moonlight.App.Services; @@ -43,4 +43,9 @@ public class ConfigService : IConfiguration get => Configuration[key]; set => Configuration[key] = value; } + + public void Save() + { + ConfigUtils.SaveConfigurationAsJson(Configuration, "..\\..\\appsettings.json"); + } } \ No newline at end of file diff --git a/Moonlight/App/Services/SmartTranslateService.cs b/Moonlight/App/Services/SmartTranslateService.cs new file mode 100644 index 0000000..f82390a --- /dev/null +++ b/Moonlight/App/Services/SmartTranslateService.cs @@ -0,0 +1,85 @@ +using Moonlight.App.Helpers; + +namespace Moonlight.App.Services; + +public class SmartTranslateService +{ + private string LanguageCode { get; set; } = "en_us"; + private readonly string FallbackLanguage = "en_us"; + + private SmartTranslateHelper Helper { get; } + private HttpContext HttpContext { get; } + + public SmartTranslateService(SmartTranslateHelper helper, IHttpContextAccessor httpContextAccessor) + { + Helper = helper; + HttpContext = httpContextAccessor.HttpContext!; + + LanguageCode = FallbackLanguage; + + try + { + var langHeader = HttpContext.Request.Headers["Accept-Language"].ToString(); + var important = langHeader.Split(";").First().ToLower().Split(","); + + foreach (var v in important) + { + if (v.Contains("de")) + { + LanguageCode = "de_de"; + break; + } + else if (v.Contains("en")) + { + LanguageCode = "en_us"; + break; + } + } + + var cookies = HttpContext.Request.Headers["Cookie"].ToString() + .Split(new string[] { ",", ";" }, StringSplitOptions.TrimEntries); + + foreach (var cookie in cookies) + { + var name = cookie.Split("=").First().Trim(); + var value = cookie.Split("=").Last().Trim(); + + if (name == "lang") + { + if (value.Contains("de")) + { + LanguageCode = "de_de"; + break; + } + else if (value.Contains("en")) + { + LanguageCode = "en_us"; + break; + } + } + } + } + catch (Exception) + { + // ignored + } + } + + public string Translate(string key) + { + try + { + var text = Helper.Translate(LanguageCode, key); + + if (text == null) + return key; + + return text; + } + catch (Exception ex) + { + Logging.Net.Logger.Error(ex); + return key; + } + } +} \ No newline at end of file diff --git a/Moonlight/App/Services/TotpService.cs b/Moonlight/App/Services/TotpService.cs new file mode 100644 index 0000000..4ca5c34 --- /dev/null +++ b/Moonlight/App/Services/TotpService.cs @@ -0,0 +1,62 @@ +using Moonlight.App.Repositories; +using Moonlight.App.Services.Sessions; +using OtpNet; + +namespace Moonlight.App.Services; + +public class TotpService +{ + private readonly IdentityService IdentityService; + private readonly UserRepository UserRepository; + + public TotpService(IdentityService identityService, UserRepository userRepository) + { + IdentityService = identityService; + UserRepository = userRepository; + } + + public Task Verify(string secret, string code) + { + var totp = new Totp(Base32Encoding.ToBytes(secret)); + var codeserver = totp.ComputeTotp(); + return Task.FromResult(codeserver == code); + } + + public async Task GetEnabled() + { + var user = await IdentityService.Get(); + + return user!.TotpEnabled; + } + + public async Task GetSecret() + { + var user = await IdentityService.Get(); + + return user!.TotpSecret; + } + + public async Task Enable() + { + var user = await IdentityService.Get(); + + user.TotpEnabled = true; + user.TotpSecret = GenerateSecret(); + + UserRepository.Update(user); + } + + public async Task Disable() + { + var user = await IdentityService.Get(); + + user.TotpEnabled = false; + + UserRepository.Update(user); + } + + private string GenerateSecret() + { + return Base32Encoding.ToString(KeyGeneration.GenerateRandomKey(20)); + } +} \ No newline at end of file diff --git a/Moonlight/App/Services/TranslationService.cs b/Moonlight/App/Services/TranslationService.cs deleted file mode 100644 index 50a223f..0000000 --- a/Moonlight/App/Services/TranslationService.cs +++ /dev/null @@ -1,98 +0,0 @@ -using Microsoft.AspNetCore.Components; -using Moonlight.App.Helpers; - -namespace Moonlight.App.Services -{ - public class TranslationService - { - private string LanguageCode { get; set; } = "en_us"; - private readonly string FallbackLanguage = "en_us"; - - private TranslationHelper Helper { get; } - private HttpContext HttpContext { get; } - - public TranslationService(TranslationHelper helper, IHttpContextAccessor httpContextAccessor) - { - Helper = helper; - HttpContext = httpContextAccessor.HttpContext!; - - LanguageCode = FallbackLanguage; - - try - { - var langHeader = HttpContext.Request.Headers["Accept-Language"].ToString(); - var important = langHeader.Split(";").First().ToLower().Split(","); - - foreach (var v in important) - { - if (v.Contains("de")) - { - LanguageCode = "de_de"; - break; - } - else if (v.Contains("en")) - { - LanguageCode = "en_us"; - break; - } - } - - var cookies = HttpContext.Request.Headers["Cookie"].ToString().Split(new string[] { ",", ";" }, StringSplitOptions.TrimEntries); - - foreach (var cookie in cookies) - { - var name = cookie.Split("=").First().Trim(); - var value = cookie.Split("=").Last().Trim(); - - if (name == "lang") - { - if (value.Contains("de")) - { - LanguageCode = "de_de"; - break; - } - else if (value.Contains("en")) - { - LanguageCode = "en_us"; - break; - } - } - } - } - catch (Exception) - { - - } - } - - public string Translate(string key, params object[] parameters) - { - try - { - var text = Helper.Get(LanguageCode, key); - - if (text == null) - return key; - - int i = 0; - foreach (var param in parameters) - { - text = text.Replace($"{{{i}}}", param.ToString()); - i++; - } - - return text; - } - catch (Exception ex) - { - Logging.Net.Logger.Error(ex); - return key; - } - } - - public MarkupString TranslateMarkup(string key, params object[] parameters) - { - return new MarkupString(Translate(key, parameters)); - } - } -} diff --git a/Moonlight/App/Services/UserService.cs b/Moonlight/App/Services/UserService.cs new file mode 100644 index 0000000..07a611f --- /dev/null +++ b/Moonlight/App/Services/UserService.cs @@ -0,0 +1,181 @@ +using JWT.Algorithms; +using JWT.Builder; +using Moonlight.App.Database.Entities; +using Moonlight.App.Exceptions; +using Moonlight.App.Models.Misc; +using Moonlight.App.Repositories; + +namespace Moonlight.App.Services; + +public class UserService +{ + private readonly UserRepository UserRepository; + private readonly TotpService TotpService; + private readonly ConfigService ConfigService; + + private readonly string JwtSecret; + + public UserService( + UserRepository userRepository, + TotpService totpService, + ConfigService configService) + { + UserRepository = userRepository; + TotpService = totpService; + ConfigService = configService; + + JwtSecret = ConfigService + .GetSection("Moonlight") + .GetSection("Security") + .GetValue("Token"); + } + + public async Task Register(string email, string password, string firstname, string lastname) + { + var emailTaken = UserRepository.Get().FirstOrDefault(x => x.Email == email) != null; + + if (emailTaken) + { + //AuditLogService.Log("register:fail", $"Invalid email: {email}"); + throw new DisplayException("The email is already in use"); + } + + var user = UserRepository.Add(new() + { + Address = "", + Admin = false, + City = "", + Country = "", + Email = email, + Password = BCrypt.Net.BCrypt.HashPassword(password), + FirstName = firstname, + LastName = lastname, + State = "", + Status = UserStatus.Unverified, + CreatedAt = DateTime.Now, + DiscordDiscriminator = "", + DiscordId = -1, + DiscordUsername = "", + TotpEnabled = false, + TotpSecret = "", + UpdatedAt = DateTime.Now, + TokenValidTime = DateTime.Now.AddDays(-5) + }); + + //AuditLogService.Log("register:done", $"A new user has registered: Email: {email}"); + + //var mail = new WelcomeMail(user); + //await MailService.Send(mail, user); + + return JwtBuilder.Create() + .WithAlgorithm(new HMACSHA256Algorithm()) + .WithSecret(JwtSecret) + .AddClaim("exp", DateTimeOffset.UtcNow.AddDays(10).ToUnixTimeSeconds()) + .AddClaim("iat", DateTimeOffset.UtcNow.ToUnixTimeSeconds()) + .AddClaim("userid", user.Id) + .Encode(); + } + + public Task CheckTotp(string email, string password) + { + var user = UserRepository.Get() + .FirstOrDefault( + x => x.Email.Equals( + email + ) + ); + + if (user == null) + { + //AuditLogService.Log("login:fail", $"Invalid email: {email}. Password: {password}"); + throw new DisplayException("Email and password combination not found"); + } + + if (BCrypt.Net.BCrypt.Verify(password, user.Password)) + { + return Task.FromResult(user.TotpEnabled); + } + + //AuditLogService.Log("login:fail", $"Invalid email: {email}. Password: {password}"); + throw new DisplayException("Email and password combination not found");; + } + + public async Task Login(string email, string password, string totpCode = "") + { + var needTotp = await CheckTotp(email, password); + + var user = UserRepository.Get() + .FirstOrDefault( + x => x.Email.Equals( + email + ) + ); + + if (needTotp) + { + if (string.IsNullOrEmpty(totpCode)) + throw new DisplayException("2FA code must be provided"); + + var totpCodeValid = await TotpService.Verify(user.TotpSecret, totpCode); + + if (totpCodeValid) + { + //AuditLogService.Log("login:success", $"{user.Email} has successfully logged in"); + + return JwtBuilder.Create() + .WithAlgorithm(new HMACSHA256Algorithm()) + .WithSecret(JwtSecret) + .AddClaim("exp", DateTimeOffset.UtcNow.AddDays(10).ToUnixTimeSeconds()) + .AddClaim("iat", DateTimeOffset.UtcNow.ToUnixTimeSeconds()) + .AddClaim("userid", user.Id) + .Encode(); + } + else + { + //AuditLogService.Log("login:fail", $"Invalid totp code: {totpCode}"); + throw new DisplayException("2FA code invalid"); + } + } + else + { + //AuditLogService.Log("login:success", $"{user.Email} has successfully logged in"); + + return JwtBuilder.Create() + .WithAlgorithm(new HMACSHA256Algorithm()) + .WithSecret(JwtSecret) + .AddClaim("exp", DateTimeOffset.UtcNow.AddDays(10).ToUnixTimeSeconds()) + .AddClaim("iat", DateTimeOffset.UtcNow.ToUnixTimeSeconds()) + .AddClaim("userid", user.Id) + .Encode(); + } + } + + public async Task ChangePassword(User user, string password) + { + user.Password = BCrypt.Net.BCrypt.HashPassword(password); + user.TokenValidTime = DateTime.Now; + UserRepository.Update(user); + + //var mail = new NewPasswordMail(user); + //await MailService.Send(mail, user); + + //AuditLogService.Log("password:change", "The password has been set to a new one"); + } + + public Task SftpLogin(int id, string password) + { + var user = UserRepository.Get().FirstOrDefault(x => x.Id == id); + + if (user == null) + throw new Exception("Unknown user"); + + if (BCrypt.Net.BCrypt.Verify(password, user.Password)) + { + //TODO: Maybe log + return Task.FromResult(user); + } + + //TODO: Log + throw new Exception("Invalid userid or password"); + } +} \ No newline at end of file diff --git a/Moonlight/Moonlight.csproj b/Moonlight/Moonlight.csproj index c6398c4..dbaf2c7 100644 --- a/Moonlight/Moonlight.csproj +++ b/Moonlight/Moonlight.csproj @@ -53,11 +53,10 @@ - - + diff --git a/Moonlight/Pages/_Layout.cshtml b/Moonlight/Pages/_Layout.cshtml index 839e4ce..9b1e388 100644 --- a/Moonlight/Pages/_Layout.cshtml +++ b/Moonlight/Pages/_Layout.cshtml @@ -25,7 +25,7 @@ - + @@ -45,6 +45,8 @@ + + @@ -69,7 +71,7 @@
- Logo + Logo
@@ -79,14 +81,14 @@ + + - - @@ -106,6 +108,5 @@ - \ No newline at end of file diff --git a/Moonlight/Program.cs b/Moonlight/Program.cs index 4f4131d..bf288ee 100644 --- a/Moonlight/Program.cs +++ b/Moonlight/Program.cs @@ -1,5 +1,6 @@ using BlazorTable; using CurrieTechnologies.Razor.SweetAlert2; +using Logging.Net; using Moonlight.App.Database; using Moonlight.App.Helpers; using Moonlight.App.Repositories; @@ -14,6 +15,8 @@ namespace Moonlight { public static void Main(string[] args) { + Logger.Info($"Working dir: {Directory.GetCurrentDirectory()}"); + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -32,17 +35,19 @@ namespace Moonlight builder.Services.AddScoped(); // Services - builder.Services.AddScoped(); builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); - builder.Services.AddScoped(); builder.Services.AddScoped(); - + builder.Services.AddScoped(); + builder.Services.AddScoped(); + builder.Services.AddScoped(); + builder.Services.AddScoped(); + // Helpers - builder.Services.AddSingleton(); + builder.Services.AddSingleton(); // Third party services @@ -60,12 +65,11 @@ namespace Moonlight app.UseHsts(); } - app.UseHttpsRedirection(); - app.UseStaticFiles(); - app.UseRouting(); + app.MapControllers(); + app.MapBlazorHub(); app.MapFallbackToPage("/_Host"); diff --git a/Moonlight/Properties/launchSettings.json b/Moonlight/Properties/launchSettings.json index 042088f..acd90c6 100644 --- a/Moonlight/Properties/launchSettings.json +++ b/Moonlight/Properties/launchSettings.json @@ -14,7 +14,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "https://localhost:7118;http://localhost:5118", + "applicationUrl": "http://moonlight.testy:5118;https://localhost:7118;http://localhost:5118", "dotnetRunMessages": true }, "IIS Express": { diff --git a/Moonlight/Shared/Components/Alerts/BannedAlert.razor b/Moonlight/Shared/Components/Alerts/BannedAlert.razor index 56c9b20..cf1e10f 100644 --- a/Moonlight/Shared/Components/Alerts/BannedAlert.razor +++ b/Moonlight/Shared/Components/Alerts/BannedAlert.razor @@ -1,6 +1,5 @@ @using Moonlight.App.Services -@inject TranslationService TranslationService @inject ConfigService ConfigService @{ @@ -13,9 +12,9 @@
Logo
-

@(TranslationService.Translate("Alerts.Banned.Title"))

+

Your account is banned from moonlight

- @(TranslationService.Translate("Alerts.Banned.Details")) + Your account is banned from using moonlight. Your data will be deleted shortly
\ No newline at end of file diff --git a/Moonlight/Shared/Components/Alerts/DisabledAlert.razor b/Moonlight/Shared/Components/Alerts/DisabledAlert.razor index cd2c745..dd5746c 100644 --- a/Moonlight/Shared/Components/Alerts/DisabledAlert.razor +++ b/Moonlight/Shared/Components/Alerts/DisabledAlert.razor @@ -1,6 +1,5 @@ @using Moonlight.App.Services -@inject TranslationService TranslationService @inject ConfigService ConfigService @{ @@ -13,9 +12,9 @@
Logo
-

@(TranslationService.Translate("Alerts.Disabled.Title"))

+

Your moonlight account is disabled

- @(TranslationService.Translate("Alerts.Disabled.Details")) + Your moonlight account is currently disabled. But dont worry your data is still saved
\ No newline at end of file diff --git a/Moonlight/Shared/Components/Alerts/SetupCompletedAlert.razor b/Moonlight/Shared/Components/Alerts/SetupCompletedAlert.razor new file mode 100644 index 0000000..c1759f9 --- /dev/null +++ b/Moonlight/Shared/Components/Alerts/SetupCompletedAlert.razor @@ -0,0 +1,10 @@ +@using Moonlight.App.Services + +
+
+

Setup complete

+
+ It looks like this moonlight instance is ready to go +
+
+
\ No newline at end of file diff --git a/Moonlight/Shared/Components/ErrorBoundaries/ComponentErrorBoundary.razor b/Moonlight/Shared/Components/ErrorBoundaries/ComponentErrorBoundary.razor index 7d022b2..ae4bb92 100644 --- a/Moonlight/Shared/Components/ErrorBoundaries/ComponentErrorBoundary.razor +++ b/Moonlight/Shared/Components/ErrorBoundaries/ComponentErrorBoundary.razor @@ -1,11 +1,9 @@ -@using Moonlight.App.Services -@using Logging.Net +@using Logging.Net @using Moonlight.App.Services.Sessions @inherits ErrorBoundary @inject IdentityService IdentityService -@inject TranslationService TranslationService @if (CurrentException is null) { @@ -18,11 +16,11 @@ else if (ErrorContent is not null)
- @TranslationService.Translate("Crashes.Component.Title") + Ooops. This component is crashed
- @TranslationService.Translate("Crashes.Component.Details") + This component is crashed. The error has been reported to the moonlight team
@@ -35,11 +33,11 @@ else
- @TranslationService.Translate("Crashes.Component.Title") + Ooops. This component is crashed
- @TranslationService.Translate("Crashes.Component.Details") + This component is crashed. The error has been reported to the moonlight team
diff --git a/Moonlight/Shared/Components/ErrorBoundaries/GlobalErrorBoundary.razor b/Moonlight/Shared/Components/ErrorBoundaries/GlobalErrorBoundary.razor index bf34c98..e3771cd 100644 --- a/Moonlight/Shared/Components/ErrorBoundaries/GlobalErrorBoundary.razor +++ b/Moonlight/Shared/Components/ErrorBoundaries/GlobalErrorBoundary.razor @@ -1,11 +1,9 @@ -@using Moonlight.App.Services -@using Logging.Net +@using Logging.Net @using Moonlight.App.Services.Sessions @inherits ErrorBoundary @inject IdentityService IdentityService -@inject TranslationService TranslationService @if (CurrentException is null) { @@ -18,11 +16,11 @@ else if (ErrorContent is not null)
- @(TranslationService.Translate("Crashes.Global.Title")) + Ooops. Your moonlight client is crashed
- @(TranslationService.Translate("Crashes.Global.Details")) + This error has been reported to the moonlight team
@@ -35,11 +33,11 @@ else
- @TranslationService.Translate("Crashes.Global.Title") + Ooops. Your moonlight client is crashed
- @TranslationService.Translate("Crashes.Global.Details") + This error has been reported to the moonlight team
diff --git a/Moonlight/Shared/Components/ErrorBoundaries/PageErrorBoundary.razor b/Moonlight/Shared/Components/ErrorBoundaries/PageErrorBoundary.razor index b6f1a61..44678f0 100644 --- a/Moonlight/Shared/Components/ErrorBoundaries/PageErrorBoundary.razor +++ b/Moonlight/Shared/Components/ErrorBoundaries/PageErrorBoundary.razor @@ -5,7 +5,6 @@ @inherits ErrorBoundary @inject IdentityService IdentityService -@inject TranslationService TranslationService @if (CurrentException is null) { @@ -18,14 +17,13 @@ else if (ErrorContent is not null)
- @TranslationService.Translate("Crashes.Page.Title") + Ooops. This page is crashed
- @TranslationService.Translate("Crashes.Page.Details") + This page is crashed. The error has been reported to the moonlight team. Meanwhile you can try reloading the page
- Broken cable } @@ -36,14 +34,13 @@ else
- @TranslationService.Translate("Crashes.Page.Title") + Ooops. This page is crashed
- @TranslationService.Translate("Crashes.Page.Details") + This page is crashed. The error has been reported to the moonlight team. Meanwhile you can try reloading the page
- Broken cable } diff --git a/Moonlight/Shared/Components/Forms/WButton.razor b/Moonlight/Shared/Components/Forms/WButton.razor new file mode 100644 index 0000000..a949e90 --- /dev/null +++ b/Moonlight/Shared/Components/Forms/WButton.razor @@ -0,0 +1,44 @@ +@if (!Working) +{ + +} +else +{ + +} + +@code +{ + private bool Working { get; set; } = false; + + [Parameter] + public string CssClasses { get; set; } = "btn-primary"; + + [Parameter] + public string Text { get; set; } = "Mache was"; + + [Parameter] + public string WorkingText { get; set; } = "Verarbeite..."; + + [Parameter] + public Func? OnClick { get; set; } + + private async Task Do() + { + Working = true; + StateHasChanged(); + await Task.Run(async () => + { + if(OnClick != null) + await OnClick.Invoke(); + + Working = false; + await InvokeAsync(StateHasChanged); + }); + } +} \ No newline at end of file diff --git a/Moonlight/Shared/Components/Partials/Footer.razor b/Moonlight/Shared/Components/Partials/Footer.razor index 55ac663..e8931f5 100644 --- a/Moonlight/Shared/Components/Partials/Footer.razor +++ b/Moonlight/Shared/Components/Partials/Footer.razor @@ -1,6 +1,5 @@ @using Moonlight.App.Services -@inject TranslationService TranslationService @inject ConfigService ConfigService @{ @@ -20,17 +19,17 @@ diff --git a/Moonlight/Shared/Components/Partials/Navbar.razor b/Moonlight/Shared/Components/Partials/Navbar.razor index a989814..0eb23bc 100644 --- a/Moonlight/Shared/Components/Partials/Navbar.razor +++ b/Moonlight/Shared/Components/Partials/Navbar.razor @@ -8,7 +8,6 @@ @inject IdentityService IdentityService @inject NavigationManager NavigationManager @inject CookieService CookieService -@inject TranslationService TranslationService diff --git a/Moonlight/Shared/Components/Partials/Sidebar.razor b/Moonlight/Shared/Components/Partials/Sidebar.razor index 73648be..b572ce8 100644 --- a/Moonlight/Shared/Components/Partials/Sidebar.razor +++ b/Moonlight/Shared/Components/Partials/Sidebar.razor @@ -3,7 +3,6 @@ @using Moonlight.App.Services @inject IdentityService IdentityService -@inject TranslationService TranslationService @inject ConfigService ConfigService @inject IJSRuntime JsRuntime @@ -17,7 +16,7 @@ @if (sidebar == "dark-sidebar") { - Logo + Logo } else { @@ -40,7 +39,7 @@ diff --git a/Moonlight/Shared/Components/Partials/SidebarMenu.razor b/Moonlight/Shared/Components/Partials/SidebarMenu.razor index 9eac443..d8cfb09 100644 --- a/Moonlight/Shared/Components/Partials/SidebarMenu.razor +++ b/Moonlight/Shared/Components/Partials/SidebarMenu.razor @@ -2,7 +2,6 @@ @using Moonlight.App.Services.Sessions @using Moonlight.App.Database.Entities -@inject TranslationService TranslationService @inject IdentityService IdentityService
@@ -15,7 +14,7 @@ - @TranslationService.Translate("Sidebar.Menu.Login") + Login
} @@ -34,7 +33,7 @@ else - @TranslationService.Translate("Sidebar.Menu.Dashboard") + Dashboard @@ -69,7 +68,7 @@ else - @TranslationService.Translate("Sidebar.Menu.Domain") + Domain @@ -79,7 +78,7 @@ else - @TranslationService.Translate("Sidebar.Menu.Servers") + Servers @@ -119,7 +118,7 @@ else { @@ -170,7 +169,7 @@ else - @TranslationService.Translate("Sidebar.Menu.Cleanup") + Cleanup @@ -179,7 +178,7 @@ else - @TranslationService.Translate("Sidebar.Menu.Nodes") + Nodes @@ -188,7 +187,7 @@ else - @TranslationService.Translate("Sidebar.Menu.Images") + Images @@ -198,7 +197,7 @@ else - @TranslationService.Translate("Sidebar.Menu.AaPanel") + aaPanel @@ -225,7 +224,7 @@ else - @TranslationService.Translate("Sidebar.Menu.Users") + Users } diff --git a/Moonlight/Shared/Components/Partials/TL.razor b/Moonlight/Shared/Components/Partials/TL.razor new file mode 100644 index 0000000..6c5887b --- /dev/null +++ b/Moonlight/Shared/Components/Partials/TL.razor @@ -0,0 +1,31 @@ +@using Microsoft.AspNetCore.Components.Rendering +@using Logging.Net +@using Moonlight.App.Services + +@inject SmartTranslateService SmartTranslateService + +@{ + var x = ""; + + if (ChildContent != null) + { + var rb = new RenderTreeBuilder(); + ChildContent.Invoke(rb); + + foreach (var frame in rb.GetFrames().Array) + { + if (frame.Sequence != 0) + x += frame.MarkupContent; + } + + x = SmartTranslateService.Translate(x); + } +} + +@(x) + +@code +{ + [Parameter] + public RenderFragment? ChildContent { get; set; } +} \ No newline at end of file diff --git a/Moonlight/Shared/Components/StateLogic/IsSetup.razor b/Moonlight/Shared/Components/StateLogic/IsSetup.razor new file mode 100644 index 0000000..65c41fa --- /dev/null +++ b/Moonlight/Shared/Components/StateLogic/IsSetup.razor @@ -0,0 +1,20 @@ +@using Moonlight.App.Services + +@inject ConfigService ConfigService + +@{ + var setupComplete = ConfigService + .GetSection("Moonlight") + .GetValue("SetupComplete"); +} + +@if (!setupComplete) +{ + @ChildContent +} + +@code +{ + [Parameter] + public RenderFragment ChildContent { get; set; } +} \ No newline at end of file diff --git a/Moonlight/Shared/Components/StateLogic/NonSetup.razor b/Moonlight/Shared/Components/StateLogic/NonSetup.razor new file mode 100644 index 0000000..3e8d511 --- /dev/null +++ b/Moonlight/Shared/Components/StateLogic/NonSetup.razor @@ -0,0 +1,20 @@ +@using Moonlight.App.Services + +@inject ConfigService ConfigService + +@{ + var setupComplete = ConfigService + .GetSection("Moonlight") + .GetValue("SetupComplete"); +} + +@if (setupComplete) +{ + @ChildContent +} + +@code +{ + [Parameter] + public RenderFragment ChildContent { get; set; } +} \ No newline at end of file diff --git a/Moonlight/Shared/Views/Setup/Features.razor b/Moonlight/Shared/Views/Setup/Features.razor new file mode 100644 index 0000000..50febfd --- /dev/null +++ b/Moonlight/Shared/Views/Setup/Features.razor @@ -0,0 +1,69 @@ +@page "/setup/features" + +@using Moonlight.App.Services + +@inject ConfigService ConfigService +@inject NavigationManager NavigationManager +@inject SmartTranslateService SmartTranslateService + + +
+
+ Configure features (3/4) +
+
+
+ +
+
+ + +
+
+
+ +
+
+
+ + + + +@code +{ + private bool EnableSupportChat + { + get => bool.Parse( + ConfigService + .GetSection("Moonlight") + .GetSection("SupportChat") + ["Enabled"]! + ); + set => ConfigService + .GetSection("Moonlight") + .GetSection("SupportChat") + ["Enabled"] = value.ToString(); + } + + private Task Save() + { + ConfigService.Save(); + NavigationManager.NavigateTo("/setup/final"); + + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/Moonlight/Shared/Views/Setup/Final.razor b/Moonlight/Shared/Views/Setup/Final.razor new file mode 100644 index 0000000..b259144 --- /dev/null +++ b/Moonlight/Shared/Views/Setup/Final.razor @@ -0,0 +1,40 @@ +@page "/setup/final" + +@using Moonlight.App.Services +@using Moonlight.App.Services.Interop + +@inject ConfigService ConfigService +@inject NavigationManager NavigationManager +@inject SmartTranslateService SmartTranslateService +@inject ToastService ToastService + + +
+
+ Finalize installation (4/4) +
+
+
+ + +
+
+
+
+ + + + +@code +{ + private async Task Save() + { + ConfigService.GetSection("Moonlight")["SetupComplete"] = true.ToString(); + ConfigService.Save(); + await ToastService.Success(SmartTranslateService.Translate("Moonlight basic settings successfully configured")); + NavigationManager.NavigateTo("/"); + } +} \ No newline at end of file diff --git a/Moonlight/Shared/Views/Setup/Index.razor b/Moonlight/Shared/Views/Setup/Index.razor new file mode 100644 index 0000000..dbdf13b --- /dev/null +++ b/Moonlight/Shared/Views/Setup/Index.razor @@ -0,0 +1,53 @@ +@page "/setup" +@using Moonlight.App.Services + +@inject ConfigService ConfigService +@inject NavigationManager NavigationManager +@inject SmartTranslateService SmartTranslateService + + +
+
+ Configure basics (1/4) +
+
+ +
+ + + + +
+
+ + + + Next + +
+
+
+
+ + + + +@code +{ + private Task Save() + { + ConfigService.Save(); + NavigationManager.NavigateTo("/setup/users"); + + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/Moonlight/Shared/Views/Setup/Users.razor b/Moonlight/Shared/Views/Setup/Users.razor new file mode 100644 index 0000000..a18f6be --- /dev/null +++ b/Moonlight/Shared/Views/Setup/Users.razor @@ -0,0 +1,136 @@ +@page "/setup/users" +@using Moonlight.App.Services +@using Microsoft.AspNetCore.Components +@using Moonlight.App.Database.Entities +@using Moonlight.App.Exceptions +@using Moonlight.App.Services.Interop +@using Logging.Net + +@inject UserService UserService +@inject SmartTranslateService SmartTranslateService +@inject AlertService AlertService +@inject ToastService ToastService + + +
+
+ Add admin accounts (2/4) +
+
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+
+
+ + + + +@code +{ + private User NewUser = new(); + + private async Task Save() + { + try + { + await UserService.Register( + NewUser.Email, + NewUser.Password, + NewUser.FirstName, + NewUser.LastName + ); + + await ToastService.Success( + SmartTranslateService.Translate("User successfully created") + ); + } + catch (DisplayException e) + { + await AlertService.Error( + SmartTranslateService.Translate("Error"), + e.Message + ); + } + catch (Exception e) + { + await AlertService.Error( + SmartTranslateService.Translate("Error"), + SmartTranslateService.Translate("An error occured while creating user") + ); + + Logger.Error("Error while creating user"); + Logger.Error(e); + } + + NewUser = new(); + + await InvokeAsync(StateHasChanged); + } +} \ No newline at end of file diff --git a/Moonlight/_Imports.razor b/Moonlight/_Imports.razor index 7a3be04..8998fc6 100644 --- a/Moonlight/_Imports.razor +++ b/Moonlight/_Imports.razor @@ -7,3 +7,8 @@ @using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.JSInterop @using Moonlight +@using Moonlight.Shared.Components +@using Moonlight.Shared.Components.StateLogic +@using Moonlight.Shared.Components.Alerts +@using Moonlight.Shared.Components.Forms +@using Moonlight.Shared.Components.Partials \ No newline at end of file diff --git a/Moonlight/obj/Debug/net6.0/Moonlight.GeneratedMSBuildEditorConfig.editorconfig b/Moonlight/obj/Debug/net6.0/Moonlight.GeneratedMSBuildEditorConfig.editorconfig index 3aa6954..9994e17 100644 --- a/Moonlight/obj/Debug/net6.0/Moonlight.GeneratedMSBuildEditorConfig.editorconfig +++ b/Moonlight/obj/Debug/net6.0/Moonlight.GeneratedMSBuildEditorConfig.editorconfig @@ -27,6 +27,10 @@ build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcQWxlcnRzXERpc2FibGVkQWxlcnQucmF6b3I= build_metadata.AdditionalFiles.CssScope = +[C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Components/Alerts/SetupCompletedAlert.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcQWxlcnRzXFNldHVwQ29tcGxldGVkQWxlcnQucmF6b3I= +build_metadata.AdditionalFiles.CssScope = + [C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Components/ErrorBoundaries/ComponentErrorBoundary.razor] build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcRXJyb3JCb3VuZGFyaWVzXENvbXBvbmVudEVycm9yQm91bmRhcnkucmF6b3I= build_metadata.AdditionalFiles.CssScope = @@ -39,6 +43,10 @@ build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcRXJyb3JCb3VuZGFyaWVzXFBhZ2VFcnJvckJvdW5kYXJ5LnJhem9y build_metadata.AdditionalFiles.CssScope = +[C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Components/Forms/WButton.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcRm9ybXNcV0J1dHRvbi5yYXpvcg== +build_metadata.AdditionalFiles.CssScope = + [C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Components/Partials/Footer.razor] build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcUGFydGlhbHNcRm9vdGVyLnJhem9y build_metadata.AdditionalFiles.CssScope = @@ -63,6 +71,18 @@ build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcUGFydGlhbHNcVGhlbWVTd2l0Y2hlci5yYXpvcg== build_metadata.AdditionalFiles.CssScope = +[C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Components/Partials/TL.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcUGFydGlhbHNcVEwucmF6b3I= +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Components/StateLogic/IsSetup.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcU3RhdGVMb2dpY1xJc1NldHVwLnJhem9y +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Components/StateLogic/NonSetup.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXENvbXBvbmVudHNcU3RhdGVMb2dpY1xOb25TZXR1cC5yYXpvcg== +build_metadata.AdditionalFiles.CssScope = + [C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Layouts/MainLayout.razor] build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXExheW91dHNcTWFpbkxheW91dC5yYXpvcg== build_metadata.AdditionalFiles.CssScope = @@ -75,6 +95,22 @@ build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXFZpZXdzXEluZGV4LnJhem9y build_metadata.AdditionalFiles.CssScope = +[C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Views/Setup/Features.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXFZpZXdzXFNldHVwXEZlYXR1cmVzLnJhem9y +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Views/Setup/Final.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXFZpZXdzXFNldHVwXEZpbmFsLnJhem9y +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Views/Setup/Index.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXFZpZXdzXFNldHVwXEluZGV4LnJhem9y +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/Shared/Views/Setup/Users.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXFZpZXdzXFNldHVwXFVzZXJzLnJhem9y +build_metadata.AdditionalFiles.CssScope = + [C:/Users/marce/source/repos/MoonlightPublic/Moonlight/Moonlight/_Imports.razor] build_metadata.AdditionalFiles.TargetPath = X0ltcG9ydHMucmF6b3I= build_metadata.AdditionalFiles.CssScope = diff --git a/Moonlight/obj/Debug/net6.0/Moonlight.csproj.AssemblyReference.cache b/Moonlight/obj/Debug/net6.0/Moonlight.csproj.AssemblyReference.cache index 0b8ef8d7b413725e4a51f91480daaa2c53d09ad3..7159cc691996052e3788c98bda6b35057517cbc0 100644 GIT binary patch delta 149 zcmdn8fM?|*9u79f1V#o1#@NY$+@8~#7`YmwTca6UqnWlwGvDN&?z5dqFThC8P|qMH zCo?G~FSW!J$aKm{tjaI)&Cg3r&eu!H$zcSVz`*dY_gdTE8yt*`j6BE+7@2@_UW#@NY$+@8~#7`YmwTca6UqnWlwGvDL~0KC!)dH?_b diff --git a/Moonlight/resources/lang/de_de.lang b/Moonlight/resources/lang/de_de.lang new file mode 100644 index 0000000..b890393 --- /dev/null +++ b/Moonlight/resources/lang/de_de.lang @@ -0,0 +1,34 @@ +Open support;Open support +About us;About us +Imprint;Imprint +Privacy;Privacy +Login;Login +Register;Register +Insert brand name...;Insert brand name... +Save and continue;Save and continue +Saving;Saving +Configure basics;Configure basics +Brand name;Brand name +test;test +Insert first name...;Insert first name... +Insert last name...;Insert last name... +Insert email address...;Insert email address... +Add;Add +Adding...;Adding... +Add admin accounts;Add admin accounts +First name;First name +Last name;Last name +Email address;Email address +Enter password;Enter password +Next;Next +Back;Back +Configure features;Configure features +Support chat;Support chat +Finish;Finish +Finalize installation;Finalize installation +Moonlight basic settings successfully configured;Moonlight basic settings successfully configured +Ooops. This page is crashed;Ooops. This page is crashed +This page is crashed. The error has been reported to the moonlight team. Meanwhile you can try reloading the page;This page is crashed. The error has been reported to the moonlight team. Meanwhile you can try reloading the page +Setup complete;Setup complete +It looks like this moonlight instance is ready to go;It looks like this moonlight instance is ready to go +User successfully created;User successfully created diff --git a/Moonlight/resources/lang/en_us.json b/Moonlight/resources/lang/en_us.json deleted file mode 100644 index 4ffd327..0000000 --- a/Moonlight/resources/lang/en_us.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "Crashes": { - "Component": { - "Title": "Ooops. Something went wrong", - "Details": "This component has crashed" - }, - "Page": { - "Title": "Ooops. Something went wrong", - "Details": "This site has crashed" - }, - "Global": { - "Title": "Ooops. Something went wrong", - "Details": "Your moonlight client has crashed" - } - }, - "Footer": { - "AboutUs": "About us", - "Imprint": "Imprint", - "Privacy": "Privacy" - }, - "Alerts": { - "Banned": { - "Title": "Your account is banned from moonlight", - "Details": "Your data will be deleted shortly. For more information contact support" - }, - "Disabled": { - "Title": "Your account is temporary banned from moonlight", - "Details": "Your data is is still saved but the access to it is not possible at this time. For more information contact support" - } - }, - "Navbar": { - "Account": { - "Settings": "Account settings" - }, - "Logout": "Logout" - }, - "Sidebar": { - "Footer": { - "OpenSupport": "Open support" - }, - "Menu": { - "Login": "Login", - "Register": "Register", - "Dashboard": "Dashboard", - "Order": "Order", - "Website": "Website", - "Database": "Database", - "Domain": "Domain", - "Servers": "Servers", - "Websites": "Websites", - "Databases": "Databases", - "Domains": "Domains", - "Changelog": "Changelog", - "Admin": "Admin", - "System": "System", - "Overview": "Overview", - "Manager": "Manager", - "Cleanup": "Cleanup", - "Nodes": "Nodes", - "Images": "Images", - "AaPanel": "AaPanel", - "Users": "Users", - "Support": "Support", - "Statistics": "Statistics" - } - } -} \ No newline at end of file diff --git a/Moonlight/wwwroot/assets/js/monaco.js b/Moonlight/wwwroot/assets/js/monaco.js index 585b939..2cbdaf5 100644 --- a/Moonlight/wwwroot/assets/js/monaco.js +++ b/Moonlight/wwwroot/assets/js/monaco.js @@ -1 +1 @@ -require.config({ paths: { 'vs': '_content/BlazorMonaco/lib/monaco-editor/min/vs' } }); \ No newline at end of file +var require = { paths: { vs: '/_content/BlazorMonaco/lib/monaco-editor/min/vs' } }; \ No newline at end of file diff --git a/Moonlight/wwwroot/assets/plugins/custom/ckeditor/ckeditor-balloon-block.bundle.js b/Moonlight/wwwroot/assets/plugins/custom/ckeditor/ckeditor-balloon-block.bundle.js new file mode 100644 index 0000000..5d44a0f --- /dev/null +++ b/Moonlight/wwwroot/assets/plugins/custom/ckeditor/ckeditor-balloon-block.bundle.js @@ -0,0 +1,7 @@ +!function(t){const e=t.en=t.en||{};e.dictionary=Object.assign(e.dictionary||{},{"%0 of %1":"%0 of %1",Aquamarine:"Aquamarine",Black:"Black","Block quote":"Block quote",Blue:"Blue",Bold:"Bold","Break text":"Break text","Bulleted List":"Bulleted List",Cancel:"Cancel","Cannot upload file:":"Cannot upload file:","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Choose heading":"Choose heading",Column:"Column","Could not insert image at the current position.":"Could not insert image at the current position.","Could not obtain resized image URL.":"Could not obtain resized image URL.","Decrease indent":"Decrease indent","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Downloadable:"Downloadable","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Editor toolbar":"Editor toolbar","Enter image caption":"Enter image caption","Full size image":"Full size image",Green:"Green",Grey:"Grey","Header column":"Header column","Header row":"Header row",Heading:"Heading","Heading 1":"Heading 1","Heading 2":"Heading 2","Heading 3":"Heading 3","Heading 4":"Heading 4","Heading 5":"Heading 5","Heading 6":"Heading 6","Image toolbar":"Image toolbar","image widget":"image widget","In line":"In line","Increase indent":"Increase indent","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert image":"Insert image","Insert image or file":"Insert image or file","Insert media":"Insert media","Insert paragraph after block":"Insert paragraph after block","Insert paragraph before block":"Insert paragraph before block","Insert row above":"Insert row above","Insert row below":"Insert row below","Insert table":"Insert table","Inserting image failed":"Inserting image failed",Italic:"Italic","Left aligned image":"Left aligned image","Light blue":"Light blue","Light green":"Light green","Light grey":"Light grey",Link:"Link","Link URL":"Link URL","Media URL":"Media URL","media widget":"media widget","Merge cell down":"Merge cell down","Merge cell left":"Merge cell left","Merge cell right":"Merge cell right","Merge cell up":"Merge cell up","Merge cells":"Merge cells",Next:"Next","Numbered List":"Numbered List","Open in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab",Orange:"Orange",Paragraph:"Paragraph","Paste the media URL in the input.":"Paste the media URL in the input.",Previous:"Previous",Purple:"Purple",Red:"Red",Redo:"Redo","Rich Text Editor":"Rich Text Editor","Rich Text Editor, %0":"Rich Text Editor, %0","Right aligned image":"Right aligned image",Row:"Row",Save:"Save","Select all":"Select all","Select column":"Select column","Select row":"Select row","Selecting resized image failed":"Selecting resized image failed","Show more items":"Show more items","Side image":"Side image","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically","Table toolbar":"Table toolbar","Text alternative":"Text alternative","The URL must not be empty.":"The URL must not be empty.","This link has no URL":"This link has no URL","This media URL is not supported.":"This media URL is not supported.","Tip: Paste the URL into the content to embed faster.":"Tip: Paste the URL into the content to embed faster.","Toggle caption off":"Toggle caption off","Toggle caption on":"Toggle caption on",Turquoise:"Turquoise",Undo:"Undo",Unlink:"Unlink","Upload failed":"Upload failed","Upload in progress":"Upload in progress",White:"White","Widget toolbar":"Widget toolbar","Wrap text":"Wrap text",Yellow:"Yellow"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})), +/*! + * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + * For licensing, see LICENSE.md. + */ +function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BalloonEditor=e():t.BalloonEditor=e()}(self,(()=>(()=>{"use strict";var t={3062:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck-content blockquote{border-left:5px solid #ccc;font-style:italic;margin-left:0;margin-right:0;overflow:hidden;padding-left:1.5em;padding-right:1.5em}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}","",{version:3,sources:["webpack://./../ckeditor5-block-quote/theme/blockquote.css"],names:[],mappings:"AAKA,uBAWC,0BAAsC,CADtC,iBAAkB,CAFlB,aAAc,CACd,cAAe,CAPf,eAAgB,CAIhB,kBAAmB,CADnB,mBAOD,CAEA,gCACC,aAAc,CACd,2BACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content blockquote {\n\t/* See #12 */\n\toverflow: hidden;\n\n\t/* https://github.com/ckeditor/ckeditor5-block-quote/issues/15 */\n\tpadding-right: 1.5em;\n\tpadding-left: 1.5em;\n\n\tmargin-left: 0;\n\tmargin-right: 0;\n\tfont-style: italic;\n\tborder-left: solid 5px hsl(0, 0%, 80%);\n}\n\n.ck-content[dir="rtl"] blockquote {\n\tborder-left: 0;\n\tborder-right: solid 5px hsl(0, 0%, 80%);\n}\n'],sourceRoot:""}]);const a=s},7657:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-block-toolbar-button{transform:translateX(calc(var(--ck-spacing-large)*-1))}","",{version:3,sources:["webpack://./theme/theme.css"],names:[],mappings:"AAMA,4BACC,sDACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* Give the block toolbar button some space, moving it a few pixels away from the editable area. */\n.ck.ck-block-toolbar-button {\n\ttransform: translateX( calc(-1 * var(--ck-spacing-large)) );\n}\n"],sourceRoot:""}]);const a=s},903:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,'.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position{display:inline;pointer-events:none;position:relative}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{position:absolute;width:0}.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__selection-handle,.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__type-around{display:none}:root{--ck-clipboard-drop-target-dot-width:12px;--ck-clipboard-drop-target-dot-height:8px;--ck-clipboard-drop-target-color:var(--ck-color-focus-border)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{background:var(--ck-clipboard-drop-target-color);border:1px solid var(--ck-clipboard-drop-target-color);bottom:calc(var(--ck-clipboard-drop-target-dot-height)*-.5);margin-left:-1px;top:calc(var(--ck-clipboard-drop-target-dot-height)*-.5)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span:after{border-color:var(--ck-clipboard-drop-target-color) transparent transparent transparent;border-style:solid;border-width:calc(var(--ck-clipboard-drop-target-dot-height)) calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0 calc(var(--ck-clipboard-drop-target-dot-width)*.5);content:"";display:block;height:0;left:50%;position:absolute;top:calc(var(--ck-clipboard-drop-target-dot-height)*-.5);transform:translateX(-50%);width:0}.ck.ck-editor__editable .ck-widget.ck-clipboard-drop-target-range{outline:var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color)!important}.ck.ck-editor__editable .ck-widget:-webkit-drag{zoom:.6;outline:none!important}',"",{version:3,sources:["webpack://./../ckeditor5-clipboard/theme/clipboard.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-clipboard/clipboard.css"],names:[],mappings:"AASC,8DACC,cAAe,CAEf,mBAAoB,CADpB,iBAOD,CAJC,mEACC,iBAAkB,CAClB,OACD,CAWA,qJACC,YACD,CCzBF,MACC,yCAA0C,CAC1C,yCAA0C,CAC1C,6DACD,CAOE,mEAIC,gDAAiD,CADjD,sDAAuD,CAFvD,2DAA8D,CAI9D,gBAAiB,CAHjB,wDAqBD,CAfC,yEAWC,sFAAuF,CAEvF,kBAAmB,CADnB,qKAA0K,CAX1K,UAAW,CAIX,aAAc,CAFd,QAAS,CAIT,QAAS,CADT,iBAAkB,CAElB,wDAA2D,CAE3D,0BAA2B,CAR3B,OAYD,CA2DF,kEACC,gGACD,CAKA,gDACC,OAAS,CACT,sBACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-editor__editable {\n\t/*\n\t * Vertical drop target (in text).\n\t */\n\t& .ck.ck-clipboard-drop-target-position {\n\t\tdisplay: inline;\n\t\tposition: relative;\n\t\tpointer-events: none;\n\n\t\t& span {\n\t\t\tposition: absolute;\n\t\t\twidth: 0;\n\t\t}\n\t}\n\n\t/*\n\t * Styles of the widget being dragged (its preview).\n\t */\n\t& .ck-widget:-webkit-drag {\n\t\t& > .ck-widget__selection-handle {\n\t\t\tdisplay: none;\n\t\t}\n\n\t\t& > .ck-widget__type-around {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-clipboard-drop-target-dot-width: 12px;\n\t--ck-clipboard-drop-target-dot-height: 8px;\n\t--ck-clipboard-drop-target-color: var(--ck-color-focus-border)\n}\n\n.ck.ck-editor__editable {\n\t/*\n\t * Vertical drop target (in text).\n\t */\n\t& .ck.ck-clipboard-drop-target-position {\n\t\t& span {\n\t\t\tbottom: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\t\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\t\t\tborder: 1px solid var(--ck-clipboard-drop-target-color);\n\t\t\tbackground: var(--ck-clipboard-drop-target-color);\n\t\t\tmargin-left: -1px;\n\n\t\t\t/* The triangle above the marker */\n\t\t\t&::after {\n\t\t\t\tcontent: "";\n\t\t\t\twidth: 0;\n\t\t\t\theight: 0;\n\n\t\t\t\tdisplay: block;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 50%;\n\t\t\t\ttop: calc(var(--ck-clipboard-drop-target-dot-height) * -.5);\n\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t\tborder-color: var(--ck-clipboard-drop-target-color) transparent transparent transparent;\n\t\t\t\tborder-width: calc(var(--ck-clipboard-drop-target-dot-height)) calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0 calc(.5 * var(--ck-clipboard-drop-target-dot-width));\n\t\t\t\tborder-style: solid;\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t// Horizontal drop target (between blocks).\n\t& .ck.ck-clipboard-drop-target-position {\n\t\tdisplay: block;\n\t\tposition: relative;\n\t\twidth: 100%;\n\t\theight: 0;\n\t\tmargin: 0;\n\t\ttext-align: initial;\n\n\t\t& .ck-clipboard-drop-target__line {\n\t\t\tposition: absolute;\n\t\t\twidth: 100%;\n\t\t\theight: 0;\n\t\t\tborder: 1px solid var(--ck-clipboard-drop-target-color);\n\t\t\tmargin-top: -1px;\n\n\t\t\t&::before {\n\t\t\t\tcontent: "";\n\t\t\t\twidth: 0;\n\t\t\t\theight: 0;\n\n\t\t\t\tdisplay: block;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: calc(-1 * var(--ck-clipboard-drop-target-dot-size));\n\t\t\t\ttop: 0;\n\n\t\t\t\ttransform: translateY(-50%);\n\t\t\t\tborder-color: transparent transparent transparent var(--ck-clipboard-drop-target-color);\n\t\t\t\tborder-width: var(--ck-clipboard-drop-target-dot-size) 0 var(--ck-clipboard-drop-target-dot-size) calc(2 * var(--ck-clipboard-drop-target-dot-size));\n\t\t\t\tborder-style: solid;\n\t\t\t}\n\n\t\t\t&::after {\n\t\t\t\tcontent: "";\n\t\t\t\twidth: 0;\n\t\t\t\theight: 0;\n\n\t\t\t\tdisplay: block;\n\t\t\t\tposition: absolute;\n\t\t\t\tright: calc(-1 * var(--ck-clipboard-drop-target-dot-size));\n\t\t\t\ttop: 0;\n\n\t\t\t\ttransform: translateY(-50%);\n\t\t\t\tborder-color: transparent var(--ck-clipboard-drop-target-color) transparent transparent;\n\t\t\t\tborder-width: var(--ck-clipboard-drop-target-dot-size) calc(2 * var(--ck-clipboard-drop-target-dot-size)) var(--ck-clipboard-drop-target-dot-size) 0;\n\t\t\t\tborder-style: solid;\n\t\t\t}\n\t\t}\n\t}\n\t*/\n\n\t/*\n\t * Styles of the widget that it a drop target.\n\t */\n\t& .ck-widget.ck-clipboard-drop-target-range {\n\t\toutline: var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color) !important;\n\t}\n\n\t/*\n\t * Styles of the widget being dragged (its preview).\n\t */\n\t& .ck-widget:-webkit-drag {\n\t\tzoom: 0.6;\n\t\toutline: none !important;\n\t}\n}\n'],sourceRoot:""}]);const a=s},4717:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck .ck-placeholder,.ck.ck-placeholder{position:relative}.ck .ck-placeholder:before,.ck.ck-placeholder:before{content:attr(data-placeholder);left:0;pointer-events:none;position:absolute;right:0}.ck.ck-read-only .ck-placeholder:before{display:none}.ck.ck-reset_all .ck-placeholder{position:relative}.ck .ck-placeholder:before,.ck.ck-placeholder:before{color:var(--ck-color-engine-placeholder-text);cursor:text}","",{version:3,sources:["webpack://./../ckeditor5-engine/theme/placeholder.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-engine/placeholder.css"],names:[],mappings:"AAMA,uCAEC,iBAWD,CATC,qDAIC,8BAA+B,CAF/B,MAAO,CAKP,mBAAoB,CANpB,iBAAkB,CAElB,OAKD,CAKA,wCACC,YACD,CAQD,iCACC,iBACD,CC5BC,qDAEC,6CAA8C,CAD9C,WAED",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* See ckeditor/ckeditor5#936. */\n.ck.ck-placeholder,\n.ck .ck-placeholder {\n\tposition: relative;\n\n\t&::before {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\tright: 0;\n\t\tcontent: attr(data-placeholder);\n\n\t\t/* See ckeditor/ckeditor5#469. */\n\t\tpointer-events: none;\n\t}\n}\n\n/* See ckeditor/ckeditor5#1987. */\n.ck.ck-read-only .ck-placeholder {\n\t&::before {\n\t\tdisplay: none;\n\t}\n}\n\n/*\n * Rules for the `ck-placeholder` are loaded before the rules for `ck-reset_all` in the base CKEditor 5 DLL build.\n * This fix overwrites the incorrectly set `position: static` from `ck-reset_all`.\n * See https://github.com/ckeditor/ckeditor5/issues/11418.\n */\n.ck.ck-reset_all .ck-placeholder {\n\tposition: relative;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* See ckeditor/ckeditor5#936. */\n.ck.ck-placeholder, .ck .ck-placeholder {\n\t&::before {\n\t\tcursor: text;\n\t\tcolor: var(--ck-color-engine-placeholder-text);\n\t}\n}\n"],sourceRoot:""}]);const a=s},9315:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-editor__editable span[data-ck-unsafe-element]{display:none}","",{version:3,sources:["webpack://./../ckeditor5-engine/theme/renderer.css"],names:[],mappings:"AAMA,qDACC,YACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* Elements marked by the Renderer as hidden should be invisible in the editor. */\n.ck.ck-editor__editable span[data-ck-unsafe-element] {\n\tdisplay: none;\n}\n"],sourceRoot:""}]);const a=s},8733:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-heading_heading1{font-size:20px}.ck.ck-heading_heading2{font-size:17px}.ck.ck-heading_heading3{font-size:14px}.ck[class*=ck-heading_heading]{font-weight:700}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__button .ck-button__label{width:8em}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__panel .ck-list__item{min-width:18em}","",{version:3,sources:["webpack://./../ckeditor5-heading/theme/heading.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-heading/heading.css"],names:[],mappings:"AAKA,wBACC,cACD,CAEA,wBACC,cACD,CAEA,wBACC,cACD,CAEA,+BACC,eACD,CCZC,2EACC,SACD,CAEA,uEACC,cACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-heading_heading1 {\n\tfont-size: 20px;\n}\n\n.ck.ck-heading_heading2 {\n\tfont-size: 17px;\n}\n\n.ck.ck-heading_heading3 {\n\tfont-size: 14px;\n}\n\n.ck[class*="ck-heading_heading"] {\n\tfont-weight: bold;\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* Resize dropdown's button label. */\n.ck.ck-dropdown.ck-heading-dropdown {\n\t& .ck-dropdown__button .ck-button__label {\n\t\twidth: 8em;\n\t}\n\n\t& .ck-dropdown__panel .ck-list__item {\n\t\tmin-width: 18em;\n\t}\n}\n"],sourceRoot:""}]);const a=s},3508:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck-content .image{clear:both;display:table;margin:.9em auto;min-width:50px;text-align:center}.ck-content .image img{display:block;margin:0 auto;max-width:100%;min-width:100%}.ck-content .image-inline{align-items:flex-start;display:inline-flex;max-width:100%}.ck-content .image-inline picture{display:flex}.ck-content .image-inline img,.ck-content .image-inline picture{flex-grow:1;flex-shrink:1;max-width:100%}.ck.ck-editor__editable .image>figcaption.ck-placeholder:before{overflow:hidden;padding-left:inherit;padding-right:inherit;text-overflow:ellipsis;white-space:nowrap}.ck.ck-editor__editable .image-inline.ck-widget_selected,.ck.ck-editor__editable .image.ck-widget_selected{z-index:1}.ck.ck-editor__editable .image-inline.ck-widget_selected ::selection{display:none}.ck.ck-editor__editable td .image-inline img,.ck.ck-editor__editable th .image-inline img{max-width:none}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/image.css"],names:[],mappings:"AAMC,mBAEC,UAAW,CADX,aAAc,CAOd,gBAAkB,CAGlB,cAAe,CARf,iBAuBD,CAbC,uBAEC,aAAc,CAGd,aAAc,CAGd,cAAe,CAGf,cACD,CAGD,0BAYC,sBAAuB,CANvB,mBAAoB,CAGpB,cAoBD,CAdC,kCACC,YACD,CAGA,gEAGC,WAAY,CACZ,aAAc,CAGd,cACD,CAUD,gEASC,eAAgB,CARhB,oBAAqB,CACrB,qBAAsB,CAQtB,sBAAuB,CAFvB,kBAGD,CAWA,2GACC,SAUD,CAHC,qEACC,YACD,CAOA,0FACC,cACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content {\n\t& .image {\n\t\tdisplay: table;\n\t\tclear: both;\n\t\ttext-align: center;\n\n\t\t/* Make sure there is some space between the content and the image. Center image by default. */\n\t\t/* The first value should be equal to --ck-spacing-large variable if used in the editor context\n\t \tto avoid the content jumping (See https://github.com/ckeditor/ckeditor5/issues/9825). */\n\t\tmargin: 0.9em auto;\n\n\t\t/* Make sure the caption will be displayed properly (See: https://github.com/ckeditor/ckeditor5/issues/1870). */\n\t\tmin-width: 50px;\n\n\t\t& img {\n\t\t\t/* Prevent unnecessary margins caused by line-height (see #44). */\n\t\t\tdisplay: block;\n\n\t\t\t/* Center the image if its width is smaller than the content\'s width. */\n\t\t\tmargin: 0 auto;\n\n\t\t\t/* Make sure the image never exceeds the size of the parent container (ckeditor/ckeditor5-ui#67). */\n\t\t\tmax-width: 100%;\n\n\t\t\t/* Make sure the image is never smaller than the parent container (See: https://github.com/ckeditor/ckeditor5/issues/9300). */\n\t\t\tmin-width: 100%\n\t\t}\n\t}\n\n\t& .image-inline {\n\t\t/*\n\t\t * Normally, the .image-inline would have "display: inline-block" and "img { width: 100% }" (to follow the wrapper while resizing).\n\t\t * Unfortunately, together with "srcset", it gets automatically stretched up to the width of the editing root.\n\t\t * This strange behavior does not happen with inline-flex.\n\t\t */\n\t\tdisplay: inline-flex;\n\n\t\t/* While being resized, don\'t allow the image to exceed the width of the editing root. */\n\t\tmax-width: 100%;\n\n\t\t/* This is required by Safari to resize images in a sensible way. Without this, the browser breaks the ratio. */\n\t\talign-items: flex-start;\n\n\t\t/* When the picture is present it must act as a flex container to let the img resize properly */\n\t\t& picture {\n\t\t\tdisplay: flex;\n\t\t}\n\n\t\t/* When the picture is present, it must act like a resizable img. */\n\t\t& picture,\n\t\t& img {\n\t\t\t/* This is necessary for the img to span the entire .image-inline wrapper and to resize properly. */\n\t\t\tflex-grow: 1;\n\t\t\tflex-shrink: 1;\n\n\t\t\t/* Prevents overflowing the editing root boundaries when an inline image is very wide. */\n\t\t\tmax-width: 100%;\n\t\t}\n\t}\n}\n\n.ck.ck-editor__editable {\n\t/*\n\t * Inhertit the content styles padding of the
in case the integration overrides `text-align: center`\n\t * of `.image` (e.g. to the left/right). This ensures the placeholder stays at the padding just like the native\n\t * caret does, and not at the edge of
.\n\t */\n\t& .image > figcaption.ck-placeholder::before {\n\t\tpadding-left: inherit;\n\t\tpadding-right: inherit;\n\n\t\t/*\n\t\t * Make sure the image caption placeholder doesn\'t overflow the placeholder area.\n\t\t * See https://github.com/ckeditor/ckeditor5/issues/9162.\n\t\t */\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t}\n\n\n\t/*\n\t * Make sure the selected inline image always stays on top of its siblings.\n\t * See https://github.com/ckeditor/ckeditor5/issues/9108.\n\t */\n\t& .image.ck-widget_selected {\n\t\tz-index: 1;\n\t}\n\n\t& .image-inline.ck-widget_selected {\n\t\tz-index: 1;\n\n\t\t/*\n\t\t * Make sure the native browser selection style is not displayed.\n\t\t * Inline image widgets have their own styles for the selected state and\n\t\t * leaving this up to the browser is asking for a visual collision.\n\t\t */\n\t\t& ::selection {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\n\t/* The inline image nested in the table should have its original size if not resized.\n\tSee https://github.com/ckeditor/ckeditor5/issues/9117. */\n\t& td,\n\t& th {\n\t\t& .image-inline img {\n\t\t\tmax-width: none;\n\t\t}\n\t}\n}\n'],sourceRoot:""}]);const a=s},2640:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,":root{--ck-color-image-caption-background:#f7f7f7;--ck-color-image-caption-text:#333;--ck-color-image-caption-highligted-background:#fd0}.ck-content .image>figcaption{background-color:var(--ck-color-image-caption-background);caption-side:bottom;color:var(--ck-color-image-caption-text);display:table-caption;font-size:.75em;outline-offset:-1px;padding:.6em;word-break:break-word}.ck.ck-editor__editable .image>figcaption.image__caption_highlighted{animation:ck-image-caption-highlight .6s ease-out}@keyframes ck-image-caption-highlight{0%{background-color:var(--ck-color-image-caption-highligted-background)}to{background-color:var(--ck-color-image-caption-background)}}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/imagecaption.css"],names:[],mappings:"AAKA,MACC,2CAAoD,CACpD,kCAA8C,CAC9C,mDACD,CAGA,8BAKC,yDAA0D,CAH1D,mBAAoB,CAEpB,wCAAyC,CAHzC,qBAAsB,CAMtB,eAAgB,CAChB,mBAAoB,CAFpB,YAAa,CAHb,qBAMD,CAGA,qEACC,iDACD,CAEA,sCACC,GACC,oEACD,CAEA,GACC,yDACD,CACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-color-image-caption-background: hsl(0, 0%, 97%);\n\t--ck-color-image-caption-text: hsl(0, 0%, 20%);\n\t--ck-color-image-caption-highligted-background: hsl(52deg 100% 50%);\n}\n\n/* Content styles */\n.ck-content .image > figcaption {\n\tdisplay: table-caption;\n\tcaption-side: bottom;\n\tword-break: break-word;\n\tcolor: var(--ck-color-image-caption-text);\n\tbackground-color: var(--ck-color-image-caption-background);\n\tpadding: .6em;\n\tfont-size: .75em;\n\toutline-offset: -1px;\n}\n\n/* Editing styles */\n.ck.ck-editor__editable .image > figcaption.image__caption_highlighted {\n\tanimation: ck-image-caption-highlight .6s ease-out;\n}\n\n@keyframes ck-image-caption-highlight {\n\t0% {\n\t\tbackground-color: var(--ck-color-image-caption-highligted-background);\n\t}\n\n\t100% {\n\t\tbackground-color: var(--ck-color-image-caption-background);\n\t}\n}\n"],sourceRoot:""}]);const a=s},5083:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,":root{--ck-image-style-spacing:1.5em;--ck-inline-image-style-spacing:calc(var(--ck-image-style-spacing)/2)}.ck-content .image-style-block-align-left,.ck-content .image-style-block-align-right{max-width:calc(100% - var(--ck-image-style-spacing))}.ck-content .image-style-align-left,.ck-content .image-style-align-right{clear:none}.ck-content .image-style-side{float:right;margin-left:var(--ck-image-style-spacing);max-width:50%}.ck-content .image-style-align-left{float:left;margin-right:var(--ck-image-style-spacing)}.ck-content .image-style-align-center{margin-left:auto;margin-right:auto}.ck-content .image-style-align-right{float:right;margin-left:var(--ck-image-style-spacing)}.ck-content .image-style-block-align-right{margin-left:auto;margin-right:0}.ck-content .image-style-block-align-left{margin-left:0;margin-right:auto}.ck-content p+.image-style-align-left,.ck-content p+.image-style-align-right,.ck-content p+.image-style-side{margin-top:0}.ck-content .image-inline.image-style-align-left,.ck-content .image-inline.image-style-align-right{margin-bottom:var(--ck-inline-image-style-spacing);margin-top:var(--ck-inline-image-style-spacing)}.ck-content .image-inline.image-style-align-left{margin-right:var(--ck-inline-image-style-spacing)}.ck-content .image-inline.image-style-align-right{margin-left:var(--ck-inline-image-style-spacing)}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover){background-color:var(--ck-color-button-on-background)}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__action:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__action:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover):after{display:none}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover){background-color:var(--ck-color-button-on-hover-background)}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/imagestyle.css"],names:[],mappings:"AAKA,MACC,8BAA+B,CAC/B,qEACD,CAMC,qFAEC,oDACD,CAIA,yEAEC,UACD,CAEA,8BACC,WAAY,CACZ,yCAA0C,CAC1C,aACD,CAEA,oCACC,UAAW,CACX,0CACD,CAEA,sCACC,gBAAiB,CACjB,iBACD,CAEA,qCACC,WAAY,CACZ,yCACD,CAEA,2CAEC,gBAAiB,CADjB,cAED,CAEA,0CACC,aAAc,CACd,iBACD,CAGA,6GAGC,YACD,CAGC,mGAGC,kDAAmD,CADnD,+CAED,CAEA,iDACC,iDACD,CAEA,kDACC,gDACD,CAUC,0lBAGC,qDAKD,CAHC,8nBACC,YACD,CAKD,oVAGC,2DACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-image-style-spacing: 1.5em;\n\t--ck-inline-image-style-spacing: calc(var(--ck-image-style-spacing) / 2);\n}\n\n.ck-content {\n\t/* Provides a minimal side margin for the left and right aligned images, so that the user has a visual feedback\n\tconfirming successful application of the style if image width exceeds the editor's size.\n\tSee https://github.com/ckeditor/ckeditor5/issues/9342 */\n\t& .image-style-block-align-left,\n\t& .image-style-block-align-right {\n\t\tmax-width: calc(100% - var(--ck-image-style-spacing));\n\t}\n\n\t/* Allows displaying multiple floating images in the same line.\n\tSee https://github.com/ckeditor/ckeditor5/issues/9183#issuecomment-804988132 */\n\t& .image-style-align-left,\n\t& .image-style-align-right {\n\t\tclear: none;\n\t}\n\n\t& .image-style-side {\n\t\tfloat: right;\n\t\tmargin-left: var(--ck-image-style-spacing);\n\t\tmax-width: 50%;\n\t}\n\n\t& .image-style-align-left {\n\t\tfloat: left;\n\t\tmargin-right: var(--ck-image-style-spacing);\n\t}\n\n\t& .image-style-align-center {\n\t\tmargin-left: auto;\n\t\tmargin-right: auto;\n\t}\n\n\t& .image-style-align-right {\n\t\tfloat: right;\n\t\tmargin-left: var(--ck-image-style-spacing);\n\t}\n\n\t& .image-style-block-align-right {\n\t\tmargin-right: 0;\n\t\tmargin-left: auto;\n\t}\n\n\t& .image-style-block-align-left {\n\t\tmargin-left: 0;\n\t\tmargin-right: auto;\n\t}\n\n\t/* Simulates margin collapsing with the preceding paragraph, which does not work for the floating elements. */\n\t& p + .image-style-align-left,\n\t& p + .image-style-align-right,\n\t& p + .image-style-side {\n\t\tmargin-top: 0;\n\t}\n\n\t& .image-inline {\n\t\t&.image-style-align-left,\n\t\t&.image-style-align-right {\n\t\t\tmargin-top: var(--ck-inline-image-style-spacing);\n\t\t\tmargin-bottom: var(--ck-inline-image-style-spacing);\n\t\t}\n\n\t\t&.image-style-align-left {\n\t\t\tmargin-right: var(--ck-inline-image-style-spacing);\n\t\t}\n\n\t\t&.image-style-align-right {\n\t\t\tmargin-left: var(--ck-inline-image-style-spacing);\n\t\t}\n\t}\n}\n\n.ck.ck-splitbutton {\n\t/* The button should display as a regular drop-down if the action button\n\tis forced to fire the same action as the arrow button. */\n\t&.ck-splitbutton_flatten {\n\t\t&:hover,\n\t\t&.ck-splitbutton_open {\n\t\t\t& > .ck-splitbutton__action:not(.ck-disabled),\n\t\t\t& > .ck-splitbutton__arrow:not(.ck-disabled),\n\t\t\t& > .ck-splitbutton__arrow:not(.ck-disabled):not(:hover) {\n\t\t\t\tbackground-color: var(--ck-color-button-on-background);\n\n\t\t\t\t&::after {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t&.ck-splitbutton_open:hover {\n\t\t\t& > .ck-splitbutton__action:not(.ck-disabled),\n\t\t\t& > .ck-splitbutton__arrow:not(.ck-disabled),\n\t\t\t& > .ck-splitbutton__arrow:not(.ck-disabled):not(:hover) {\n\t\t\t\tbackground-color: var(--ck-color-button-on-hover-background);\n\t\t\t}\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const a=s},4036:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,'.ck-image-upload-complete-icon{border-radius:50%;display:block;position:absolute;right:min(var(--ck-spacing-medium),6%);top:min(var(--ck-spacing-medium),6%);z-index:1}.ck-image-upload-complete-icon:after{content:"";position:absolute}:root{--ck-color-image-upload-icon:#fff;--ck-color-image-upload-icon-background:#008a00;--ck-image-upload-icon-size:20;--ck-image-upload-icon-width:2px;--ck-image-upload-icon-is-visible:clamp(0px,100% - 50px,1px)}.ck-image-upload-complete-icon{animation-delay:0ms,3s;animation-duration:.5s,.5s;animation-fill-mode:forwards,forwards;animation-name:ck-upload-complete-icon-show,ck-upload-complete-icon-hide;background:var(--ck-color-image-upload-icon-background);font-size:calc(1px*var(--ck-image-upload-icon-size));height:calc(var(--ck-image-upload-icon-is-visible)*var(--ck-image-upload-icon-size));opacity:0;overflow:hidden;width:calc(var(--ck-image-upload-icon-is-visible)*var(--ck-image-upload-icon-size))}.ck-image-upload-complete-icon:after{animation-delay:.5s;animation-duration:.5s;animation-fill-mode:forwards;animation-name:ck-upload-complete-icon-check;border-right:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);border-top:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);box-sizing:border-box;height:0;left:25%;opacity:0;top:50%;transform:scaleX(-1) rotate(135deg);transform-origin:left top;width:0}@keyframes ck-upload-complete-icon-show{0%{opacity:0}to{opacity:1}}@keyframes ck-upload-complete-icon-hide{0%{opacity:1}to{opacity:0}}@keyframes ck-upload-complete-icon-check{0%{height:0;opacity:1;width:0}33%{height:0;width:.3em}to{height:.45em;opacity:1;width:.3em}}',"",{version:3,sources:["webpack://./../ckeditor5-image/theme/imageuploadicon.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-image/imageuploadicon.css"],names:[],mappings:"AAKA,+BAUC,iBAAkB,CATlB,aAAc,CACd,iBAAkB,CAOlB,sCAAwC,CADxC,oCAAsC,CAGtC,SAMD,CAJC,qCACC,UAAW,CACX,iBACD,CChBD,MACC,iCAA8C,CAC9C,+CAA4D,CAG5D,8BAA+B,CAC/B,gCAAiC,CACjC,4DACD,CAEA,+BAWC,sBAA4B,CAN5B,0BAAgC,CADhC,qCAAuC,CADvC,wEAA0E,CAD1E,uDAAwD,CAMxD,oDAAuD,CAWvD,oFAAuF,CAlBvF,SAAU,CAgBV,eAAgB,CAChB,mFA0BD,CAtBC,qCAgBC,mBAAsB,CADtB,sBAAyB,CAEzB,4BAA6B,CAH7B,4CAA6C,CAF7C,sFAAuF,CADvF,oFAAqF,CASrF,qBAAsB,CAdtB,QAAS,CAJT,QAAS,CAGT,SAAU,CADV,OAAQ,CAKR,mCAAoC,CACpC,yBAA0B,CAH1B,OAcD,CAGD,wCACC,GACC,SACD,CAEA,GACC,SACD,CACD,CAEA,wCACC,GACC,SACD,CAEA,GACC,SACD,CACD,CAEA,yCACC,GAGC,QAAS,CAFT,SAAU,CACV,OAED,CACA,IAEC,QAAS,CADT,UAED,CACA,GAGC,YAAc,CAFd,SAAU,CACV,UAED,CACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-image-upload-complete-icon {\n\tdisplay: block;\n\tposition: absolute;\n\n\t/*\n\t * Smaller images should have the icon closer to the border.\n\t * Match the icon position with the linked image indicator brought by the link image feature.\n\t */\n\ttop: min(var(--ck-spacing-medium), 6%);\n\tright: min(var(--ck-spacing-medium), 6%);\n\tborder-radius: 50%;\n\tz-index: 1;\n\n\t&::after {\n\t\tcontent: "";\n\t\tposition: absolute;\n\t}\n}\n','/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-color-image-upload-icon: hsl(0, 0%, 100%);\n\t--ck-color-image-upload-icon-background: hsl(120, 100%, 27%);\n\n\t/* Match the icon size with the linked image indicator brought by the link image feature. */\n\t--ck-image-upload-icon-size: 20;\n\t--ck-image-upload-icon-width: 2px;\n\t--ck-image-upload-icon-is-visible: clamp(0px, 100% - 50px, 1px);\n}\n\n.ck-image-upload-complete-icon {\n\topacity: 0;\n\tbackground: var(--ck-color-image-upload-icon-background);\n\tanimation-name: ck-upload-complete-icon-show, ck-upload-complete-icon-hide;\n\tanimation-fill-mode: forwards, forwards;\n\tanimation-duration: 500ms, 500ms;\n\n\t/* To make animation scalable. */\n\tfont-size: calc(1px * var(--ck-image-upload-icon-size));\n\n\t/* Hide completed upload icon after 3 seconds. */\n\tanimation-delay: 0ms, 3000ms;\n\n\t/*\n\t * Use CSS math to simulate container queries.\n\t * https://css-tricks.com/the-raven-technique-one-step-closer-to-container-queries/#what-about-showing-and-hiding-things\n\t */\n\toverflow: hidden;\n\twidth: calc(var(--ck-image-upload-icon-is-visible) * var(--ck-image-upload-icon-size));\n\theight: calc(var(--ck-image-upload-icon-is-visible) * var(--ck-image-upload-icon-size));\n\n\t/* This is check icon element made from border-width mixed with animations. */\n\t&::after {\n\t\t/* Because of border transformation we need to "hard code" left position. */\n\t\tleft: 25%;\n\n\t\ttop: 50%;\n\t\topacity: 0;\n\t\theight: 0;\n\t\twidth: 0;\n\n\t\ttransform: scaleX(-1) rotate(135deg);\n\t\ttransform-origin: left top;\n\t\tborder-top: var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);\n\t\tborder-right: var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);\n\n\t\tanimation-name: ck-upload-complete-icon-check;\n\t\tanimation-duration: 500ms;\n\t\tanimation-delay: 500ms;\n\t\tanimation-fill-mode: forwards;\n\n\t\t/* #1095. While reset is not providing proper box-sizing for pseudoelements, we need to handle it. */\n\t\tbox-sizing: border-box;\n\t}\n}\n\n@keyframes ck-upload-complete-icon-show {\n\tfrom {\n\t\topacity: 0;\n\t}\n\n\tto {\n\t\topacity: 1;\n\t}\n}\n\n@keyframes ck-upload-complete-icon-hide {\n\tfrom {\n\t\topacity: 1;\n\t}\n\n\tto {\n\t\topacity: 0;\n\t}\n}\n\n@keyframes ck-upload-complete-icon-check {\n\t0% {\n\t\topacity: 1;\n\t\twidth: 0;\n\t\theight: 0;\n\t}\n\t33% {\n\t\twidth: 0.3em;\n\t\theight: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t\twidth: 0.3em;\n\t\theight: 0.45em;\n\t}\n}\n'],sourceRoot:""}]);const a=s},3773:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,'.ck .ck-upload-placeholder-loader{align-items:center;display:flex;justify-content:center;left:0;position:absolute;top:0}.ck .ck-upload-placeholder-loader:before{content:"";position:relative}:root{--ck-color-upload-placeholder-loader:#b3b3b3;--ck-upload-placeholder-loader-size:32px;--ck-upload-placeholder-image-aspect-ratio:2.8}.ck .ck-image-upload-placeholder{margin:0;width:100%}.ck .ck-image-upload-placeholder.image-inline{width:calc(var(--ck-upload-placeholder-loader-size)*2*var(--ck-upload-placeholder-image-aspect-ratio))}.ck .ck-image-upload-placeholder img{aspect-ratio:var(--ck-upload-placeholder-image-aspect-ratio)}.ck .ck-upload-placeholder-loader{height:100%;width:100%}.ck .ck-upload-placeholder-loader:before{animation:ck-upload-placeholder-loader 1s linear infinite;border-radius:50%;border-right:2px solid transparent;border-top:3px solid var(--ck-color-upload-placeholder-loader);height:var(--ck-upload-placeholder-loader-size);width:var(--ck-upload-placeholder-loader-size)}@keyframes ck-upload-placeholder-loader{to{transform:rotate(1turn)}}',"",{version:3,sources:["webpack://./../ckeditor5-image/theme/imageuploadloader.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-image/imageuploadloader.css"],names:[],mappings:"AAKA,kCAGC,kBAAmB,CADnB,YAAa,CAEb,sBAAuB,CAEvB,MAAO,CALP,iBAAkB,CAIlB,KAOD,CAJC,yCACC,UAAW,CACX,iBACD,CCXD,MACC,4CAAqD,CACrD,wCAAyC,CACzC,8CACD,CAEA,iCAGC,QAAS,CADT,UAgBD,CAbC,8CACC,sGACD,CAEA,qCAOC,4DACD,CAGD,kCAEC,WAAY,CADZ,UAWD,CARC,yCAMC,yDAA0D,CAH1D,iBAAkB,CAElB,kCAAmC,CADnC,8DAA+D,CAF/D,+CAAgD,CADhD,8CAMD,CAGD,wCACC,GACC,uBACD,CACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck .ck-upload-placeholder-loader {\n\tposition: absolute;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\ttop: 0;\n\tleft: 0;\n\n\t&::before {\n\t\tcontent: '';\n\t\tposition: relative;\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-color-upload-placeholder-loader: hsl(0, 0%, 70%);\n\t--ck-upload-placeholder-loader-size: 32px;\n\t--ck-upload-placeholder-image-aspect-ratio: 2.8;\n}\n\n.ck .ck-image-upload-placeholder {\n\t/* We need to control the full width of the SVG gray background. */\n\twidth: 100%;\n\tmargin: 0;\n\n\t&.image-inline {\n\t\twidth: calc( 2 * var(--ck-upload-placeholder-loader-size) * var(--ck-upload-placeholder-image-aspect-ratio) );\n\t}\n\n\t& img {\n\t\t/*\n\t\t * This is an arbitrary aspect for a 1x1 px GIF to display to the user. Not too tall, not too short.\n\t\t * There's nothing special about this number except that it should make the image placeholder look like\n\t\t * a real image during this short period after the upload started and before the image was read from the\n\t\t * file system (and a rich preview was loaded).\n\t\t */\n\t\taspect-ratio: var(--ck-upload-placeholder-image-aspect-ratio);\n\t}\n}\n\n.ck .ck-upload-placeholder-loader {\n\twidth: 100%;\n\theight: 100%;\n\n\t&::before {\n\t\twidth: var(--ck-upload-placeholder-loader-size);\n\t\theight: var(--ck-upload-placeholder-loader-size);\n\t\tborder-radius: 50%;\n\t\tborder-top: 3px solid var(--ck-color-upload-placeholder-loader);\n\t\tborder-right: 2px solid transparent;\n\t\tanimation: ck-upload-placeholder-loader 1s linear infinite;\n\t}\n}\n\n@keyframes ck-upload-placeholder-loader {\n\tto {\n\t\ttransform: rotate( 360deg );\n\t}\n}\n"],sourceRoot:""}]);const a=s},3689:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-editor__editable .image,.ck.ck-editor__editable .image-inline{position:relative}.ck.ck-editor__editable .image .ck-progress-bar,.ck.ck-editor__editable .image-inline .ck-progress-bar{left:0;position:absolute;top:0}.ck.ck-editor__editable .image-inline.ck-appear,.ck.ck-editor__editable .image.ck-appear{animation:fadeIn .7s}.ck.ck-editor__editable .image .ck-progress-bar,.ck.ck-editor__editable .image-inline .ck-progress-bar{background:var(--ck-color-upload-bar-background);height:2px;transition:width .1s;width:0}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/imageuploadprogress.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-image/imageuploadprogress.css"],names:[],mappings:"AAMC,qEAEC,iBACD,CAGA,uGAIC,MAAO,CAFP,iBAAkB,CAClB,KAED,CCRC,yFACC,oBACD,CAID,uGAIC,gDAAiD,CAFjD,UAAW,CAGX,oBAAuB,CAFvB,OAGD,CAGD,kBACC,GAAO,SAAY,CACnB,GAAO,SAAY,CACpB",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-editor__editable {\n\t& .image,\n\t& .image-inline {\n\t\tposition: relative;\n\t}\n\n\t/* Upload progress bar. */\n\t& .image .ck-progress-bar,\n\t& .image-inline .ck-progress-bar {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: 0;\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-editor__editable {\n\t& .image,\n\t& .image-inline {\n\t\t/* Showing animation. */\n\t\t&.ck-appear {\n\t\t\tanimation: fadeIn 700ms;\n\t\t}\n\t}\n\n\t/* Upload progress bar. */\n\t& .image .ck-progress-bar,\n\t& .image-inline .ck-progress-bar {\n\t\theight: 2px;\n\t\twidth: 0;\n\t\tbackground: var(--ck-color-upload-bar-background);\n\t\ttransition: width 100ms;\n\t}\n}\n\n@keyframes fadeIn {\n\tfrom { opacity: 0; }\n\tto { opacity: 1; }\n}\n"],sourceRoot:""}]);const a=s},1905:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-text-alternative-form{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-text-alternative-form .ck-labeled-field-view{display:inline-block}.ck.ck-text-alternative-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-text-alternative-form{flex-wrap:wrap}.ck.ck-text-alternative-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-text-alternative-form .ck-button{flex-basis:50%}}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/textalternativeform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css"],names:[],mappings:"AAOA,6BACC,YAAa,CACb,kBAAmB,CACnB,gBAqBD,CAnBC,oDACC,oBACD,CAEA,uCACC,YACD,CCZA,oCDCD,6BAcE,cAUF,CARE,oDACC,eACD,CAEA,wCACC,cACD,CCrBD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n\n.ck.ck-text-alternative-form {\n\tdisplay: flex;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\n\t& .ck-labeled-field-view {\n\t\tdisplay: inline-block;\n\t}\n\n\t& .ck-label {\n\t\tdisplay: none;\n\t}\n\n\t@mixin ck-media-phone {\n\t\tflex-wrap: wrap;\n\n\t\t& .ck-labeled-field-view {\n\t\t\tflex-basis: 100%;\n\t\t}\n\n\t\t& .ck-button {\n\t\t\tflex-basis: 50%;\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-phone {\n\t@media screen and (max-width: 600px) {\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},9773:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}.ck .ck-link_selected span.image-inline{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-link-selected-background)}.ck .ck-fake-link-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-link-selection_collapsed{border-right:1px solid var(--ck-color-base-text);height:100%;margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}","",{version:3,sources:["webpack://./../ckeditor5-theme-lark/theme/ckeditor5-link/link.css"],names:[],mappings:"AAMA,sBACC,mDAMD,CAHC,wCACC,yFACD,CAOD,4BACC,8CACD,CAGA,sCAEC,gDAAiD,CADjD,WAAY,CAEZ,iBAAkB,CAClB,oCACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* Class added to span element surrounding currently selected link. */\n.ck .ck-link_selected {\n\tbackground: var(--ck-color-link-selected-background);\n\n\t/* Give linked inline images some outline to let the user know they are also part of the link. */\n\t& span.image-inline {\n\t\toutline: var(--ck-widget-outline-thickness) solid var(--ck-color-link-selected-background);\n\t}\n}\n\n/*\n * Classes used by the "fake visual selection" displayed in the content when an input\n * in the link UI has focus (the browser does not render the native selection in this state).\n */\n.ck .ck-fake-link-selection {\n\tbackground: var(--ck-color-link-fake-selection);\n}\n\n/* A collapsed fake visual selection. */\n.ck .ck-fake-link-selection_collapsed {\n\theight: 100%;\n\tborder-right: 1px solid var(--ck-color-base-text);\n\tmargin-right: -1px;\n\toutline: solid 1px hsla(0, 0%, 100%, .5);\n}\n'],sourceRoot:""}]);const a=s},2347:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-link-actions{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-link-actions .ck-link-actions__preview{display:inline-block}.ck.ck-link-actions .ck-link-actions__preview .ck-button__label{overflow:hidden}@media screen and (max-width:600px){.ck.ck-link-actions{flex-wrap:wrap}.ck.ck-link-actions .ck-link-actions__preview{flex-basis:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){flex-basis:50%}}.ck.ck-link-actions .ck-button.ck-link-actions__preview{padding-left:0;padding-right:0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{color:var(--ck-color-link-default);cursor:pointer;max-width:var(--ck-input-width);min-width:3em;padding:0 var(--ck-spacing-medium);text-align:center;text-overflow:ellipsis}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview,.ck.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}[dir=ltr] .ck.ck-link-actions .ck-button:not(:first-child),[dir=rtl] .ck.ck-link-actions .ck-button:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-actions .ck-button.ck-link-actions__preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{max-width:100%;min-width:0}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview),[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}}","",{version:3,sources:["webpack://./../ckeditor5-link/theme/linkactions.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-link/linkactions.css"],names:[],mappings:"AAOA,oBACC,YAAa,CACb,kBAAmB,CACnB,gBAqBD,CAnBC,8CACC,oBAKD,CAHC,gEACC,eACD,CCXD,oCDCD,oBAcE,cAUF,CARE,8CACC,eACD,CAEA,8DACC,cACD,CCrBD,CCKA,wDACC,cAAe,CACf,eAmCD,CAjCC,0EAEC,kCAAmC,CAEnC,cAAe,CAIf,+BAAgC,CAChC,aAAc,CARd,kCAAmC,CASnC,iBAAkB,CAPlB,sBAYD,CAHC,gFACC,yBACD,CAGD,mPAIC,eACD,CAEA,+DACC,eACD,CAGC,gFACC,yBACD,CAWD,qHACC,sCACD,CDvDD,oCC2DC,wDACC,8DAMD,CAJC,0EAEC,cAAe,CADf,WAED,CAGD,gJAME,aAEF,CD1ED",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n\n.ck.ck-link-actions {\n\tdisplay: flex;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\n\t& .ck-link-actions__preview {\n\t\tdisplay: inline-block;\n\n\t\t& .ck-button__label {\n\t\t\toverflow: hidden;\n\t\t}\n\t}\n\n\t@mixin ck-media-phone {\n\t\tflex-wrap: wrap;\n\n\t\t& .ck-link-actions__preview {\n\t\t\tflex-basis: 100%;\n\t\t}\n\n\t\t& .ck-button:not(.ck-link-actions__preview) {\n\t\t\tflex-basis: 50%;\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-phone {\n\t@media screen and (max-width: 600px) {\n\t\t@mixin-content;\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/components/tooltip/mixins/_tooltip.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_unselectable.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n@import "../mixins/_focus.css";\n@import "../mixins/_shadow.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n\n.ck.ck-link-actions {\n\t& .ck-button.ck-link-actions__preview {\n\t\tpadding-left: 0;\n\t\tpadding-right: 0;\n\n\t\t& .ck-button__label {\n\t\t\tpadding: 0 var(--ck-spacing-medium);\n\t\t\tcolor: var(--ck-color-link-default);\n\t\t\ttext-overflow: ellipsis;\n\t\t\tcursor: pointer;\n\n\t\t\t/* Match the box model of the link editor form\'s input so the balloon\n\t\t\tdoes not change width when moving between actions and the form. */\n\t\t\tmax-width: var(--ck-input-width);\n\t\t\tmin-width: 3em;\n\t\t\ttext-align: center;\n\n\t\t\t&:hover {\n\t\t\t\ttext-decoration: underline;\n\t\t\t}\n\t\t}\n\n\t\t&,\n\t\t&:hover,\n\t\t&:focus,\n\t\t&:active {\n\t\t\tbackground: none;\n\t\t}\n\n\t\t&:active {\n\t\t\tbox-shadow: none;\n\t\t}\n\n\t\t&:focus {\n\t\t\t& .ck-button__label {\n\t\t\t\ttext-decoration: underline;\n\t\t\t}\n\t\t}\n\t}\n\n\t@mixin ck-dir ltr {\n\t\t& .ck-button:not(:first-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-dir rtl {\n\t\t& .ck-button:not(:last-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-media-phone {\n\t\t& .ck-button.ck-link-actions__preview {\n\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\n\t\t\t& .ck-button__label {\n\t\t\t\tmin-width: 0;\n\t\t\t\tmax-width: 100%;\n\t\t\t}\n\t\t}\n\n\t\t& .ck-button:not(.ck-link-actions__preview) {\n\t\t\t@mixin ck-dir ltr {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\n\t\t\t@mixin ck-dir rtl {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t}\n\t}\n}\n'],sourceRoot:""}]);const a=s},7754:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-link-form{display:flex}.ck.ck-link-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-link-form{flex-wrap:wrap}.ck.ck-link-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form_layout-vertical{display:block}.ck.ck-link-form_layout-vertical .ck-button.ck-button-cancel,.ck.ck-link-form_layout-vertical .ck-button.ck-button-save{margin-top:var(--ck-spacing-medium)}.ck.ck-link-form_layout-vertical{min-width:var(--ck-input-width);padding:0}.ck.ck-link-form_layout-vertical .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form_layout-vertical .ck-button{border:0;border-radius:0;border-top:1px solid var(--ck-color-base-border);margin:0;padding:var(--ck-spacing-standard);width:50%}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button,[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}.ck.ck-link-form_layout-vertical .ck.ck-list{margin:var(--ck-spacing-standard) var(--ck-spacing-large)}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{border:0;padding:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}","",{version:3,sources:["webpack://./../ckeditor5-link/theme/linkform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-link/linkform.css"],names:[],mappings:"AAOA,iBACC,YAiBD,CAfC,2BACC,YACD,CCNA,oCDCD,iBAQE,cAUF,CARE,wCACC,eACD,CAEA,4BACC,cACD,CCfD,CDuBD,iCACC,aAYD,CALE,wHAEC,mCACD,CE/BF,iCAEC,+BAAgC,CADhC,SA+CD,CA5CC,wDACC,8EAMD,CAJC,uEACC,WAAY,CACZ,UACD,CAGD,4CAIC,QAAS,CADT,eAAgB,CAEhB,gDAAiD,CAHjD,QAAS,CADT,kCAAmC,CAKnC,SAaD,CAnBA,4GAaE,aAMF,CAJE,mEACC,kDACD,CAKF,6CACC,yDAWD,CATC,wEACC,QAAS,CACT,SAAU,CACV,UAKD,CAHC,8EACC,eACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n\n.ck.ck-link-form {\n\tdisplay: flex;\n\n\t& .ck-label {\n\t\tdisplay: none;\n\t}\n\n\t@mixin ck-media-phone {\n\t\tflex-wrap: wrap;\n\n\t\t& .ck-labeled-field-view {\n\t\t\tflex-basis: 100%;\n\t\t}\n\n\t\t& .ck-button {\n\t\t\tflex-basis: 50%;\n\t\t}\n\t}\n}\n\n/*\n * Style link form differently when manual decorators are available.\n * See: https://github.com/ckeditor/ckeditor5-link/issues/186.\n */\n.ck.ck-link-form_layout-vertical {\n\tdisplay: block;\n\n\t/*\n\t * Whether the form is in the responsive mode or not, if there are decorator buttons\n\t * keep the top margin of action buttons medium.\n\t */\n\t& .ck-button {\n\t\t&.ck-button-save,\n\t\t&.ck-button-cancel {\n\t\t\tmargin-top: var(--ck-spacing-medium);\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-phone {\n\t@media screen and (max-width: 600px) {\n\t\t@mixin-content;\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n/*\n * Style link form differently when manual decorators are available.\n * See: https://github.com/ckeditor/ckeditor5-link/issues/186.\n */\n.ck.ck-link-form_layout-vertical {\n\tpadding: 0;\n\tmin-width: var(--ck-input-width);\n\n\t& .ck-labeled-field-view {\n\t\tmargin: var(--ck-spacing-large) var(--ck-spacing-large) var(--ck-spacing-small);\n\n\t\t& .ck-input-text {\n\t\t\tmin-width: 0;\n\t\t\twidth: 100%;\n\t\t}\n\t}\n\n\t& .ck-button {\n\t\tpadding: var(--ck-spacing-standard);\n\t\tmargin: 0;\n\t\tborder-radius: 0;\n\t\tborder: 0;\n\t\tborder-top: 1px solid var(--ck-color-base-border);\n\t\twidth: 50%;\n\n\t\t@mixin ck-dir ltr {\n\t\t\tmargin-left: 0;\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\tmargin-left: 0;\n\n\t\t\t&:last-of-type {\n\t\t\t\tborder-right: 1px solid var(--ck-color-base-border);\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Using additional `.ck` class for stronger CSS specificity than `.ck.ck-link-form > :not(:first-child)`. */\n\t& .ck.ck-list {\n\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-large);\n\n\t\t& .ck-button.ck-switchbutton {\n\t\t\tborder: 0;\n\t\t\tpadding: 0;\n\t\t\twidth: 100%;\n\n\t\t\t&:hover {\n\t\t\t\tbackground: none;\n\t\t\t}\n\t\t}\n\t}\n}\n'],sourceRoot:""}]);const a=s},4652:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck-content .media{clear:both;display:block;margin:.9em 0;min-width:15em}","",{version:3,sources:["webpack://./../ckeditor5-media-embed/theme/mediaembed.css"],names:[],mappings:"AAKA,mBAGC,UAAW,CASX,aAAc,CAJd,aAAe,CAQf,cACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content .media {\n\t/* Don\'t allow floated content overlap the media.\n\thttps://github.com/ckeditor/ckeditor5-media-embed/issues/53 */\n\tclear: both;\n\n\t/* Make sure there is some space between the content and the media. */\n\t/* The first value should be equal to --ck-spacing-large variable if used in the editor context\n\tto avoid the content jumping (See https://github.com/ckeditor/ckeditor5/issues/9825). */\n\tmargin: 0.9em 0;\n\n\t/* Make sure media is not overriden with Bootstrap default `flex` value.\n\tSee: https://github.com/ckeditor/ckeditor5/issues/1373. */\n\tdisplay: block;\n\n\t/* Give the media some minimal width in the content to prevent them\n\tfrom being "squashed" in tight spaces, e.g. in table cells (#44) */\n\tmin-width: 15em;\n}\n'],sourceRoot:""}]);const a=s},7442:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,'.ck-media__wrapper .ck-media__placeholder{align-items:center;display:flex;flex-direction:column}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:block}@media (hover:none){.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:none}}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url{max-width:100%;position:relative}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url:hover .ck-tooltip{opacity:1;visibility:visible}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-media__placeholder__url__text{display:block;overflow:hidden}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="goo.gl/maps"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="maps.app.goo.gl"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="maps.google.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck-media__placeholder__icon *{display:none}.ck-editor__editable:not(.ck-read-only) .ck-media__wrapper>:not(.ck-media__placeholder),.ck-editor__editable:not(.ck-read-only) .ck-widget:not(.ck-widget_selected) .ck-media__placeholder{pointer-events:none}:root{--ck-media-embed-placeholder-icon-size:3em;--ck-color-media-embed-placeholder-url-text:#757575;--ck-color-media-embed-placeholder-url-text-hover:var(--ck-color-base-text)}.ck-media__wrapper{margin:0 auto}.ck-media__wrapper .ck-media__placeholder{background:var(--ck-color-base-foreground);padding:calc(var(--ck-spacing-standard)*3)}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon{background-position:50%;background-size:cover;height:var(--ck-media-embed-placeholder-icon-size);margin-bottom:var(--ck-spacing-large);min-width:var(--ck-media-embed-placeholder-icon-size)}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon .ck-icon{height:100%;width:100%}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url__text{color:var(--ck-color-media-embed-placeholder-url-text);font-style:italic;text-align:center;text-overflow:ellipsis;white-space:nowrap}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:var(--ck-color-media-embed-placeholder-url-text-hover);cursor:pointer;text-decoration:underline}.ck-media__wrapper[data-oembed-url*="open.spotify.com"]{max-height:380px;max-width:300px}.ck-media__wrapper[data-oembed-url*="goo.gl/maps"] .ck-media__placeholder__icon,.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon,.ck-media__wrapper[data-oembed-url*="maps.app.goo.gl"] .ck-media__placeholder__icon,.ck-media__wrapper[data-oembed-url*="maps.google.com"] .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTAuMzc4IiBoZWlnaHQ9IjI1NC4xNjciIHZpZXdCb3g9IjAgMCA2Ni4yNDYgNjcuMjQ4Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcyLjUzMSAtMjE4LjQ1NSkgc2NhbGUoLjk4MDEyKSI+PHJlY3Qgcnk9IjUuMjM4IiByeD0iNS4yMzgiIHk9IjIzMS4zOTkiIHg9IjE3Ni4wMzEiIGhlaWdodD0iNjAuMDk5IiB3aWR0aD0iNjAuMDk5IiBmaWxsPSIjMzRhNjY4IiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxwYXRoIGQ9Im0yMDYuNDc3IDI2MC45LTI4Ljk4NyAyOC45ODdhNS4yMTggNS4yMTggMCAwIDAgMy43OCAxLjYxaDQ5LjYyMWMxLjY5NCAwIDMuMTktLjc5OCA0LjE0Ni0yLjAzN3oiIGZpbGw9IiM1Yzg4YzUiLz48cGF0aCBkPSJNMjI2Ljc0MiAyMjIuOTg4Yy05LjI2NiAwLTE2Ljc3NyA3LjE3LTE2Ljc3NyAxNi4wMTQuMDA3IDIuNzYyLjY2MyA1LjQ3NCAyLjA5MyA3Ljg3NS40My43MDMuODMgMS40MDggMS4xOSAyLjEwNy4zMzMuNTAyLjY1IDEuMDA1Ljk1IDEuNTA4LjM0My40NzcuNjczLjk1Ny45ODggMS40NCAxLjMxIDEuNzY5IDIuNSAzLjUwMiAzLjYzNyA1LjE2OC43OTMgMS4yNzUgMS42ODMgMi42NCAyLjQ2NiAzLjk5IDIuMzYzIDQuMDk0IDQuMDA3IDguMDkyIDQuNiAxMy45MTR2LjAxMmMuMTgyLjQxMi41MTYuNjY2Ljg3OS42NjcuNDAzLS4wMDEuNzY4LS4zMTQuOTMtLjc5OS42MDMtNS43NTYgMi4yMzgtOS43MjkgNC41ODUtMTMuNzk0Ljc4Mi0xLjM1IDEuNjczLTIuNzE1IDIuNDY1LTMuOTkgMS4xMzctMS42NjYgMi4zMjgtMy40IDMuNjM4LTUuMTY5LjMxNS0uNDgyLjY0NS0uOTYyLjk4OC0xLjQzOS4zLS41MDMuNjE3LTEuMDA2Ljk1LTEuNTA4LjM1OS0uNy43Ni0xLjQwNCAxLjE5LTIuMTA3IDEuNDI2LTIuNDAyIDItNS4xMTQgMi4wMDQtNy44NzUgMC04Ljg0NC03LjUxMS0xNi4wMTQtMTYuNzc2LTE2LjAxNHoiIGZpbGw9IiNkZDRiM2UiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PGVsbGlwc2Ugcnk9IjUuNTY0IiByeD0iNS44MjgiIGN5PSIyMzkuMDAyIiBjeD0iMjI2Ljc0MiIgZmlsbD0iIzgwMmQyNyIgcGFpbnQtb3JkZXI9Im1hcmtlcnMgc3Ryb2tlIGZpbGwiLz48cGF0aCBkPSJNMTkwLjMwMSAyMzcuMjgzYy00LjY3IDAtOC40NTcgMy44NTMtOC40NTcgOC42MDZzMy43ODYgOC42MDcgOC40NTcgOC42MDdjMy4wNDMgMCA0LjgwNi0uOTU4IDYuMzM3LTIuNTE2IDEuNTMtMS41NTcgMi4wODctMy45MTMgMi4wODctNi4yOSAwLS4zNjItLjAyMy0uNzIyLS4wNjQtMS4wNzloLTguMjU3djMuMDQzaDQuODVjLS4xOTcuNzU5LS41MzEgMS40NS0xLjA1OCAxLjk4Ni0uOTQyLjk1OC0yLjAyOCAxLjU0OC0zLjkwMSAxLjU0OC0yLjg3NiAwLTUuMjA4LTIuMzcyLTUuMjA4LTUuMjk5IDAtMi45MjYgMi4zMzItNS4yOTkgNS4yMDgtNS4yOTkgMS4zOTkgMCAyLjYxOC40MDcgMy41ODQgMS4yOTNsMi4zODEtMi4zOGMwLS4wMDItLjAwMy0uMDA0LS4wMDQtLjAwNS0xLjU4OC0xLjUyNC0zLjYyLTIuMjE1LTUuOTU1LTIuMjE1em00LjQzIDUuNjYuMDAzLjAwNnYtLjAwM3oiIGZpbGw9IiNmZmYiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0ibTIxNS4xODQgMjUxLjkyOS03Ljk4IDcuOTc5IDI4LjQ3NyAyOC40NzVhNS4yMzMgNS4yMzMgMCAwIDAgLjQ0OS0yLjEyM3YtMzEuMTY1Yy0uNDY5LjY3NS0uOTM0IDEuMzQ5LTEuMzgyIDIuMDA1LS43OTIgMS4yNzUtMS42ODIgMi42NC0yLjQ2NSAzLjk5LTIuMzQ3IDQuMDY1LTMuOTgyIDguMDM4LTQuNTg1IDEzLjc5NC0uMTYyLjQ4NS0uNTI3Ljc5OC0uOTMuNzk5LS4zNjMtLjAwMS0uNjk3LS4yNTUtLjg3OS0uNjY3di0uMDEyYy0uNTkzLTUuODIyLTIuMjM3LTkuODItNC42LTEzLjkxNC0uNzgzLTEuMzUtMS42NzMtMi43MTUtMi40NjYtMy45OS0xLjEzNy0xLjY2Ni0yLjMyNy0zLjQtMy42MzctNS4xNjlsLS4wMDItLjAwM3oiIGZpbGw9IiNjM2MzYzMiLz48cGF0aCBkPSJtMjEyLjk4MyAyNDguNDk1LTM2Ljk1MiAzNi45NTN2LjgxMmE1LjIyNyA1LjIyNyAwIDAgMCA1LjIzOCA1LjIzOGgxLjAxNWwzNS42NjYtMzUuNjY2YTEzNi4yNzUgMTM2LjI3NSAwIDAgMC0yLjc2NC0zLjkgMzcuNTc1IDM3LjU3NSAwIDAgMC0uOTg5LTEuNDQgMzUuMTI3IDM1LjEyNyAwIDAgMC0uOTUtMS41MDhjLS4wODMtLjE2Mi0uMTc2LS4zMjYtLjI2NC0uNDg5eiIgZmlsbD0iI2ZkZGM0ZiIgcGFpbnQtb3JkZXI9Im1hcmtlcnMgc3Ryb2tlIGZpbGwiLz48cGF0aCBkPSJtMjExLjk5OCAyNjEuMDgzLTYuMTUyIDYuMTUxIDI0LjI2NCAyNC4yNjRoLjc4MWE1LjIyNyA1LjIyNyAwIDAgMCA1LjIzOS01LjIzOHYtMS4wNDV6IiBmaWxsPSIjZmZmIiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjwvZz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder{background:#4268b3}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik05NjcuNDg0IDBINTYuNTE3QzI1LjMwNCAwIDAgMjUuMzA0IDAgNTYuNTE3djkxMC45NjZDMCA5OTguNjk0IDI1LjI5NyAxMDI0IDU2LjUyMiAxMDI0SDU0N1Y2MjhINDE0VjQ3M2gxMzNWMzU5LjAyOWMwLTEzMi4yNjIgODAuNzczLTIwNC4yODIgMTk4Ljc1Ni0yMDQuMjgyIDU2LjUxMyAwIDEwNS4wODYgNC4yMDggMTE5LjI0NCA2LjA4OVYyOTlsLTgxLjYxNi4wMzdjLTYzLjk5MyAwLTc2LjM4NCAzMC40OTItNzYuMzg0IDc1LjIzNlY0NzNoMTUzLjQ4N2wtMTkuOTg2IDE1NUg3MDd2Mzk2aDI2MC40ODRjMzEuMjEzIDAgNTYuNTE2LTI1LjMwMyA1Ni41MTYtNTYuNTE2VjU2LjUxNUMxMDI0IDI1LjMwMyA5OTguNjk3IDAgOTY3LjQ4NCAwIiBmaWxsPSIjRkZGRkZFIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#cdf}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder{background:linear-gradient(-135deg,#1400c7,#b800b1,#f50000)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTA0IiBoZWlnaHQ9IjUwNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PHBhdGggaWQ9ImEiIGQ9Ik0wIC4xNTloNTAzLjg0MVY1MDMuOTRIMHoiLz48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+PHVzZSB4bGluazpocmVmPSIjYSIvPjwvbWFzaz48cGF0aCBkPSJNMjUxLjkyMS4xNTljLTY4LjQxOCAwLTc2Ljk5Ny4yOS0xMDMuODY3IDEuNTE2LTI2LjgxNCAxLjIyMy00NS4xMjcgNS40ODItNjEuMTUxIDExLjcxLTE2LjU2NiA2LjQzNy0zMC42MTUgMTUuMDUxLTQ0LjYyMSAyOS4wNTYtMTQuMDA1IDE0LjAwNi0yMi42MTkgMjguMDU1LTI5LjA1NiA0NC42MjEtNi4yMjggMTYuMDI0LTEwLjQ4NyAzNC4zMzctMTEuNzEgNjEuMTUxQy4yOSAxNzUuMDgzIDAgMTgzLjY2MiAwIDI1Mi4wOGMwIDY4LjQxNy4yOSA3Ni45OTYgMS41MTYgMTAzLjg2NiAxLjIyMyAyNi44MTQgNS40ODIgNDUuMTI3IDExLjcxIDYxLjE1MSA2LjQzNyAxNi41NjYgMTUuMDUxIDMwLjYxNSAyOS4wNTYgNDQuNjIxIDE0LjAwNiAxNC4wMDUgMjguMDU1IDIyLjYxOSA0NC42MjEgMjkuMDU3IDE2LjAyNCA2LjIyNyAzNC4zMzcgMTAuNDg2IDYxLjE1MSAxMS43MDkgMjYuODcgMS4yMjYgMzUuNDQ5IDEuNTE2IDEwMy44NjcgMS41MTYgNjguNDE3IDAgNzYuOTk2LS4yOSAxMDMuODY2LTEuNTE2IDI2LjgxNC0xLjIyMyA0NS4xMjctNS40ODIgNjEuMTUxLTExLjcwOSAxNi41NjYtNi40MzggMzAuNjE1LTE1LjA1MiA0NC42MjEtMjkuMDU3IDE0LjAwNS0xNC4wMDYgMjIuNjE5LTI4LjA1NSAyOS4wNTctNDQuNjIxIDYuMjI3LTE2LjAyNCAxMC40ODYtMzQuMzM3IDExLjcwOS02MS4xNTEgMS4yMjYtMjYuODcgMS41MTYtMzUuNDQ5IDEuNTE2LTEwMy44NjYgMC02OC40MTgtLjI5LTc2Ljk5Ny0xLjUxNi0xMDMuODY3LTEuMjIzLTI2LjgxNC01LjQ4Mi00NS4xMjctMTEuNzA5LTYxLjE1MS02LjQzOC0xNi41NjYtMTUuMDUyLTMwLjYxNS0yOS4wNTctNDQuNjIxLTE0LjAwNi0xNC4wMDUtMjguMDU1LTIyLjYxOS00NC42MjEtMjkuMDU2LTE2LjAyNC02LjIyOC0zNC4zMzctMTAuNDg3LTYxLjE1MS0xMS43MUMzMjguOTE3LjQ0OSAzMjAuMzM4LjE1OSAyNTEuOTIxLjE1OVptMCA0NS4zOTFjNjcuMjY1IDAgNzUuMjMzLjI1NyAxMDEuNzk3IDEuNDY5IDI0LjU2MiAxLjEyIDM3LjkwMSA1LjIyNCA0Ni43NzggOC42NzQgMTEuNzU5IDQuNTcgMjAuMTUxIDEwLjAyOSAyOC45NjYgMTguODQ1IDguODE2IDguODE1IDE0LjI3NSAxNy4yMDcgMTguODQ1IDI4Ljk2NiAzLjQ1IDguODc3IDcuNTU0IDIyLjIxNiA4LjY3NCA0Ni43NzggMS4yMTIgMjYuNTY0IDEuNDY5IDM0LjUzMiAxLjQ2OSAxMDEuNzk4IDAgNjcuMjY1LS4yNTcgNzUuMjMzLTEuNDY5IDEwMS43OTctMS4xMiAyNC41NjItNS4yMjQgMzcuOTAxLTguNjc0IDQ2Ljc3OC00LjU3IDExLjc1OS0xMC4wMjkgMjAuMTUxLTE4Ljg0NSAyOC45NjYtOC44MTUgOC44MTYtMTcuMjA3IDE0LjI3NS0yOC45NjYgMTguODQ1LTguODc3IDMuNDUtMjIuMjE2IDcuNTU0LTQ2Ljc3OCA4LjY3NC0yNi41NiAxLjIxMi0zNC41MjcgMS40NjktMTAxLjc5NyAxLjQ2OS02Ny4yNzEgMC03NS4yMzctLjI1Ny0xMDEuNzk4LTEuNDY5LTI0LjU2Mi0xLjEyLTM3LjkwMS01LjIyNC00Ni43NzgtOC42NzQtMTEuNzU5LTQuNTctMjAuMTUxLTEwLjAyOS0yOC45NjYtMTguODQ1LTguODE1LTguODE1LTE0LjI3NS0xNy4yMDctMTguODQ1LTI4Ljk2Ni0zLjQ1LTguODc3LTcuNTU0LTIyLjIxNi04LjY3NC00Ni43NzgtMS4yMTItMjYuNTY0LTEuNDY5LTM0LjUzMi0xLjQ2OS0xMDEuNzk3IDAtNjcuMjY2LjI1Ny03NS4yMzQgMS40NjktMTAxLjc5OCAxLjEyLTI0LjU2MiA1LjIyNC0zNy45MDEgOC42NzQtNDYuNzc4IDQuNTctMTEuNzU5IDEwLjAyOS0yMC4xNTEgMTguODQ1LTI4Ljk2NiA4LjgxNS04LjgxNiAxNy4yMDctMTQuMjc1IDI4Ljk2Ni0xOC44NDUgOC44NzctMy40NSAyMi4yMTYtNy41NTQgNDYuNzc4LTguNjc0IDI2LjU2NC0xLjIxMiAzNC41MzItMS40NjkgMTAxLjc5OC0xLjQ2OVoiIGZpbGw9IiNGRkYiIG1hc2s9InVybCgjYikiLz48cGF0aCBkPSJNMjUxLjkyMSAzMzYuMDUzYy00Ni4zNzggMC04My45NzQtMzcuNTk2LTgzLjk3NC04My45NzMgMC00Ni4zNzggMzcuNTk2LTgzLjk3NCA4My45NzQtODMuOTc0IDQ2LjM3NyAwIDgzLjk3MyAzNy41OTYgODMuOTczIDgzLjk3NCAwIDQ2LjM3Ny0zNy41OTYgODMuOTczLTgzLjk3MyA4My45NzNabTAtMjEzLjMzOGMtNzEuNDQ3IDAtMTI5LjM2NSA1Ny45MTgtMTI5LjM2NSAxMjkuMzY1IDAgNzEuNDQ2IDU3LjkxOCAxMjkuMzY0IDEyOS4zNjUgMTI5LjM2NCA3MS40NDYgMCAxMjkuMzY0LTU3LjkxOCAxMjkuMzY0LTEyOS4zNjQgMC03MS40NDctNTcuOTE4LTEyOS4zNjUtMTI5LjM2NC0xMjkuMzY1Wk00MTYuNjI3IDExNy42MDRjMCAxNi42OTYtMTMuNTM1IDMwLjIzLTMwLjIzMSAzMC4yMy0xNi42OTUgMC0zMC4yMy0xMy41MzQtMzAuMjMtMzAuMjMgMC0xNi42OTYgMTMuNTM1LTMwLjIzMSAzMC4yMy0zMC4yMzEgMTYuNjk2IDAgMzAuMjMxIDEzLjUzNSAzMC4yMzEgMzAuMjMxIiBmaWxsPSIjRkZGIi8+PC9nPjwvc3ZnPg==)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#ffe0fe}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder{background:linear-gradient(90deg,#71c6f4,#0d70a5)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgNDAwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MDAgNDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNNDAwIDIwMGMwIDExMC41LTg5LjUgMjAwLTIwMCAyMDBTMCAzMTAuNSAwIDIwMCA4OS41IDAgMjAwIDBzMjAwIDg5LjUgMjAwIDIwMHpNMTYzLjQgMzA1LjVjODguNyAwIDEzNy4yLTczLjUgMTM3LjItMTM3LjIgMC0yLjEgMC00LjItLjEtNi4yIDkuNC02LjggMTcuNi0xNS4zIDI0LjEtMjUtOC42IDMuOC0xNy45IDYuNC0yNy43IDcuNiAxMC02IDE3LjYtMTUuNCAyMS4yLTI2LjctOS4zIDUuNS0xOS42IDkuNS0zMC42IDExLjctOC44LTkuNC0yMS4zLTE1LjItMzUuMi0xNS4yLTI2LjYgMC00OC4yIDIxLjYtNDguMiA0OC4yIDAgMy44LjQgNy41IDEuMyAxMS00MC4xLTItNzUuNi0yMS4yLTk5LjQtNTAuNC00LjEgNy4xLTYuNSAxNS40LTYuNSAyNC4yIDAgMTYuNyA4LjUgMzEuNSAyMS41IDQwLjEtNy45LS4yLTE1LjMtMi40LTIxLjgtNnYuNmMwIDIzLjQgMTYuNiA0Mi44IDM4LjcgNDcuMy00IDEuMS04LjMgMS43LTEyLjcgMS43LTMuMSAwLTYuMS0uMy05LjEtLjkgNi4xIDE5LjIgMjMuOSAzMy4xIDQ1IDMzLjUtMTYuNSAxMi45LTM3LjMgMjAuNi01OS45IDIwLjYtMy45IDAtNy43LS4yLTExLjUtLjcgMjEuMSAxMy44IDQ2LjUgMjEuOCA3My43IDIxLjgiIHN0eWxlPSJmaWxsOiNmZmYiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text{color:#b8e6ff}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}',"",{version:3,sources:["webpack://./../ckeditor5-media-embed/theme/mediaembedediting.css","webpack://./../ckeditor5-ui/theme/components/tooltip/mixins/_tooltip.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-media-embed/mediaembedediting.css"],names:[],mappings:"AAQC,0CAGC,kBAAmB,CAFnB,YAAa,CACb,qBAoBD,CCpBA,kFACC,aAqBD,CAHC,oBAnBD,kFAoBE,YAEF,CADC,CDlBA,sEAIC,cAAe,CAEf,iBAUD,CCoBD,wFAEC,SAAU,CADV,kBAED,CD3BE,wGAEC,aAAc,CADd,eAED,CAWD,6kBACC,YACD,CAYF,2LACC,mBACD,CElDA,MACC,0CAA2C,CAE3C,mDAA4D,CAC5D,2EACD,CAEA,mBACC,aA+FD,CA7FC,0CAEC,0CAA2C,CAD3C,0CA6BD,CA1BC,uEAIC,uBAA2B,CAC3B,qBAAsB,CAHtB,kDAAmD,CACnD,qCAAsC,CAFtC,qDAUD,CAJC,gFAEC,WAAY,CADZ,UAED,CAGD,4EACC,sDAAuD,CAGvD,iBAAkB,CADlB,iBAAkB,CAElB,sBAAuB,CAHvB,kBAUD,CALC,kFACC,4DAA6D,CAC7D,cAAe,CACf,yBACD,CAIF,wDAEC,gBAAiB,CADjB,eAED,CAEA,4UAIC,wvGACD,CAEA,2EACC,kBAaD,CAXC,wGACC,orBACD,CAEA,6GACC,UAKD,CAHC,mHACC,UACD,CAIF,4EACC,2DAcD,CAZC,yGACC,4jHACD,CAGA,8GACC,aAKD,CAHC,oHACC,UACD,CAIF,6EAEC,iDAaD,CAXC,0GACC,wiCACD,CAEA,+GACC,aAKD,CAHC,qHACC,UACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/components/tooltip/mixins/_tooltip.css";\n\n.ck-media__wrapper {\n\t& .ck-media__placeholder {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: center;\n\n\t\t& .ck-media__placeholder__url {\n\t\t\t@mixin ck-tooltip_enabled;\n\n\t\t\t/* Otherwise the URL will overflow when the content is very narrow. */\n\t\t\tmax-width: 100%;\n\n\t\t\tposition: relative;\n\n\t\t\t&:hover {\n\t\t\t\t@mixin ck-tooltip_visible;\n\t\t\t}\n\n\t\t\t& .ck-media__placeholder__url__text {\n\t\t\t\toverflow: hidden;\n\t\t\t\tdisplay: block;\n\t\t\t}\n\t\t}\n\t}\n\n\t&[data-oembed-url*="twitter.com"],\n\t&[data-oembed-url*="google.com/maps"],\n\t&[data-oembed-url*="goo.gl/maps"],\n\t&[data-oembed-url*="maps.google.com"],\n\t&[data-oembed-url*="maps.app.goo.gl"],\n\t&[data-oembed-url*="facebook.com"],\n\t&[data-oembed-url*="instagram.com"] {\n\t\t& .ck-media__placeholder__icon * {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n\n/* Disable all mouse interaction as long as the editor is not read–only.\n https://github.com/ckeditor/ckeditor5-media-embed/issues/58 */\n.ck-editor__editable:not(.ck-read-only) .ck-media__wrapper > *:not(.ck-media__placeholder) {\n\tpointer-events: none;\n}\n\n/* Disable all mouse interaction when the widget is not selected (e.g. to avoid opening links by accident).\n https://github.com/ckeditor/ckeditor5-media-embed/issues/18 */\n.ck-editor__editable:not(.ck-read-only) .ck-widget:not(.ck-widget_selected) .ck-media__placeholder {\n\tpointer-events: none;\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Enables the tooltip, which is the tooltip is in DOM but\n * not yet displayed.\n */\n@define-mixin ck-tooltip_enabled {\n\t& .ck-tooltip {\n\t\tdisplay: block;\n\n\t\t/*\n\t\t * Don't display tooltips in devices which don't support :hover.\n\t\t * In fact, it's all about iOS, which forces user to click UI elements twice to execute\n\t\t * the primary action, when tooltips are enabled.\n\t\t *\n\t\t * Q: OK, but why not the following query?\n\t\t *\n\t\t * @media (hover) {\n\t\t * display: block;\n\t\t * }\n\t\t *\n\t\t * A: Because FF does not support it and it would completely disable tooltips\n\t\t * in that browser.\n\t\t *\n\t\t * More in https://github.com/ckeditor/ckeditor5/issues/920.\n\t\t */\n\t\t@media (hover:none) {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n\n/**\n * Disables the tooltip making it disappear from DOM.\n */\n@define-mixin ck-tooltip_disabled {\n\t& .ck-tooltip {\n\t\tdisplay: none;\n\t}\n}\n\n/**\n * Shows the tooltip, which is already in DOM.\n * Requires `ck-tooltip_enabled` first.\n */\n@define-mixin ck-tooltip_visible {\n\t& .ck-tooltip {\n\t\tvisibility: visible;\n\t\topacity: 1;\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-media-embed-placeholder-icon-size: 3em;\n\n\t--ck-color-media-embed-placeholder-url-text: hsl(0, 0%, 46%);\n\t--ck-color-media-embed-placeholder-url-text-hover: var(--ck-color-base-text);\n}\n\n.ck-media__wrapper {\n\tmargin: 0 auto;\n\n\t& .ck-media__placeholder {\n\t\tpadding: calc( 3 * var(--ck-spacing-standard) );\n\t\tbackground: var(--ck-color-base-foreground);\n\n\t\t& .ck-media__placeholder__icon {\n\t\t\tmin-width: var(--ck-media-embed-placeholder-icon-size);\n\t\t\theight: var(--ck-media-embed-placeholder-icon-size);\n\t\t\tmargin-bottom: var(--ck-spacing-large);\n\t\t\tbackground-position: center;\n\t\t\tbackground-size: cover;\n\n\t\t\t& .ck-icon {\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t}\n\t\t}\n\n\t\t& .ck-media__placeholder__url__text {\n\t\t\tcolor: var(--ck-color-media-embed-placeholder-url-text);\n\t\t\twhite-space: nowrap;\n\t\t\ttext-align: center;\n\t\t\tfont-style: italic;\n\t\t\ttext-overflow: ellipsis;\n\n\t\t\t&:hover {\n\t\t\t\tcolor: var(--ck-color-media-embed-placeholder-url-text-hover);\n\t\t\t\tcursor: pointer;\n\t\t\t\ttext-decoration: underline;\n\t\t\t}\n\t\t}\n\t}\n\n\t&[data-oembed-url*="open.spotify.com"] {\n\t\tmax-width: 300px;\n\t\tmax-height: 380px;\n\t}\n\n\t&[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon,\n\t&[data-oembed-url*="goo.gl/maps"] .ck-media__placeholder__icon,\n\t&[data-oembed-url*="maps.google.com"] .ck-media__placeholder__icon,\n\t&[data-oembed-url*="maps.app.goo.gl"] .ck-media__placeholder__icon {\n\t\tbackground-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTAuMzc4IiBoZWlnaHQ9IjI1NC4xNjciIHZpZXdCb3g9IjAgMCA2Ni4yNDYgNjcuMjQ4Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcyLjUzMSAtMjE4LjQ1NSkgc2NhbGUoLjk4MDEyKSI+PHJlY3Qgcnk9IjUuMjM4IiByeD0iNS4yMzgiIHk9IjIzMS4zOTkiIHg9IjE3Ni4wMzEiIGhlaWdodD0iNjAuMDk5IiB3aWR0aD0iNjAuMDk5IiBmaWxsPSIjMzRhNjY4IiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxwYXRoIGQ9Ik0yMDYuNDc3IDI2MC45bC0yOC45ODcgMjguOTg3YTUuMjE4IDUuMjE4IDAgMCAwIDMuNzggMS42MWg0OS42MjFjMS42OTQgMCAzLjE5LS43OTggNC4xNDYtMi4wMzd6IiBmaWxsPSIjNWM4OGM1Ii8+PHBhdGggZD0iTTIyNi43NDIgMjIyLjk4OGMtOS4yNjYgMC0xNi43NzcgNy4xNy0xNi43NzcgMTYuMDE0LjAwNyAyLjc2Mi42NjMgNS40NzQgMi4wOTMgNy44NzUuNDMuNzAzLjgzIDEuNDA4IDEuMTkgMi4xMDcuMzMzLjUwMi42NSAxLjAwNS45NSAxLjUwOC4zNDMuNDc3LjY3My45NTcuOTg4IDEuNDQgMS4zMSAxLjc2OSAyLjUgMy41MDIgMy42MzcgNS4xNjguNzkzIDEuMjc1IDEuNjgzIDIuNjQgMi40NjYgMy45OSAyLjM2MyA0LjA5NCA0LjAwNyA4LjA5MiA0LjYgMTMuOTE0di4wMTJjLjE4Mi40MTIuNTE2LjY2Ni44NzkuNjY3LjQwMy0uMDAxLjc2OC0uMzE0LjkzLS43OTkuNjAzLTUuNzU2IDIuMjM4LTkuNzI5IDQuNTg1LTEzLjc5NC43ODItMS4zNSAxLjY3My0yLjcxNSAyLjQ2NS0zLjk5IDEuMTM3LTEuNjY2IDIuMzI4LTMuNCAzLjYzOC01LjE2OS4zMTUtLjQ4Mi42NDUtLjk2Mi45ODgtMS40MzkuMy0uNTAzLjYxNy0xLjAwNi45NS0xLjUwOC4zNTktLjcuNzYtMS40MDQgMS4xOS0yLjEwNyAxLjQyNi0yLjQwMiAyLTUuMTE0IDIuMDA0LTcuODc1IDAtOC44NDQtNy41MTEtMTYuMDE0LTE2Ljc3Ni0xNi4wMTR6IiBmaWxsPSIjZGQ0YjNlIiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxlbGxpcHNlIHJ5PSI1LjU2NCIgcng9IjUuODI4IiBjeT0iMjM5LjAwMiIgY3g9IjIyNi43NDIiIGZpbGw9IiM4MDJkMjciIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0iTTE5MC4zMDEgMjM3LjI4M2MtNC42NyAwLTguNDU3IDMuODUzLTguNDU3IDguNjA2czMuNzg2IDguNjA3IDguNDU3IDguNjA3YzMuMDQzIDAgNC44MDYtLjk1OCA2LjMzNy0yLjUxNiAxLjUzLTEuNTU3IDIuMDg3LTMuOTEzIDIuMDg3LTYuMjkgMC0uMzYyLS4wMjMtLjcyMi0uMDY0LTEuMDc5aC04LjI1N3YzLjA0M2g0Ljg1Yy0uMTk3Ljc1OS0uNTMxIDEuNDUtMS4wNTggMS45ODYtLjk0Mi45NTgtMi4wMjggMS41NDgtMy45MDEgMS41NDgtMi44NzYgMC01LjIwOC0yLjM3Mi01LjIwOC01LjI5OSAwLTIuOTI2IDIuMzMyLTUuMjk5IDUuMjA4LTUuMjk5IDEuMzk5IDAgMi42MTguNDA3IDMuNTg0IDEuMjkzbDIuMzgxLTIuMzhjMC0uMDAyLS4wMDMtLjAwNC0uMDA0LS4wMDUtMS41ODgtMS41MjQtMy42Mi0yLjIxNS01Ljk1NS0yLjIxNXptNC40MyA1LjY2bC4wMDMuMDA2di0uMDAzeiIgZmlsbD0iI2ZmZiIgcGFpbnQtb3JkZXI9Im1hcmtlcnMgc3Ryb2tlIGZpbGwiLz48cGF0aCBkPSJNMjE1LjE4NCAyNTEuOTI5bC03Ljk4IDcuOTc5IDI4LjQ3NyAyOC40NzVjLjI4Ny0uNjQ5LjQ0OS0xLjM2Ni40NDktMi4xMjN2LTMxLjE2NWMtLjQ2OS42NzUtLjkzNCAxLjM0OS0xLjM4MiAyLjAwNS0uNzkyIDEuMjc1LTEuNjgyIDIuNjQtMi40NjUgMy45OS0yLjM0NyA0LjA2NS0zLjk4MiA4LjAzOC00LjU4NSAxMy43OTQtLjE2Mi40ODUtLjUyNy43OTgtLjkzLjc5OS0uMzYzLS4wMDEtLjY5Ny0uMjU1LS44NzktLjY2N3YtLjAxMmMtLjU5My01LjgyMi0yLjIzNy05LjgyLTQuNi0xMy45MTQtLjc4My0xLjM1LTEuNjczLTIuNzE1LTIuNDY2LTMuOTktMS4xMzctMS42NjYtMi4zMjctMy40LTMuNjM3LTUuMTY5bC0uMDAyLS4wMDN6IiBmaWxsPSIjYzNjM2MzIi8+PHBhdGggZD0iTTIxMi45ODMgMjQ4LjQ5NWwtMzYuOTUyIDM2Ljk1M3YuODEyYTUuMjI3IDUuMjI3IDAgMCAwIDUuMjM4IDUuMjM4aDEuMDE1bDM1LjY2Ni0zNS42NjZhMTM2LjI3NSAxMzYuMjc1IDAgMCAwLTIuNzY0LTMuOSAzNy41NzUgMzcuNTc1IDAgMCAwLS45ODktMS40NGMtLjI5OS0uNTAzLS42MTYtMS4wMDYtLjk1LTEuNTA4LS4wODMtLjE2Mi0uMTc2LS4zMjYtLjI2NC0uNDg5eiIgZmlsbD0iI2ZkZGM0ZiIgcGFpbnQtb3JkZXI9Im1hcmtlcnMgc3Ryb2tlIGZpbGwiLz48cGF0aCBkPSJNMjExLjk5OCAyNjEuMDgzbC02LjE1MiA2LjE1MSAyNC4yNjQgMjQuMjY0aC43ODFhNS4yMjcgNS4yMjcgMCAwIDAgNS4yMzktNS4yMzh2LTEuMDQ1eiIgZmlsbD0iI2ZmZiIgcGFpbnQtb3JkZXI9Im1hcmtlcnMgc3Ryb2tlIGZpbGwiLz48L2c+PC9zdmc+);\n\t}\n\n\t&[data-oembed-url*="facebook.com"] .ck-media__placeholder {\n\t\tbackground: hsl(220, 46%, 48%);\n\n\t\t& .ck-media__placeholder__icon {\n\t\t\tbackground-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSIxMDI0cHgiIGhlaWdodD0iMTAyNHB4IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPiAgICAgICAgPHRpdGxlPkZpbGwgMTwvdGl0bGU+ICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPiAgICA8ZGVmcz48L2RlZnM+ICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPiAgICAgICAgPGcgaWQ9ImZMb2dvX1doaXRlIiBmaWxsPSIjRkZGRkZFIj4gICAgICAgICAgICA8cGF0aCBkPSJNOTY3LjQ4NCwwIEw1Ni41MTcsMCBDMjUuMzA0LDAgMCwyNS4zMDQgMCw1Ni41MTcgTDAsOTY3LjQ4MyBDMCw5OTguNjk0IDI1LjI5NywxMDI0IDU2LjUyMiwxMDI0IEw1NDcsMTAyNCBMNTQ3LDYyOCBMNDE0LDYyOCBMNDE0LDQ3MyBMNTQ3LDQ3MyBMNTQ3LDM1OS4wMjkgQzU0NywyMjYuNzY3IDYyNy43NzMsMTU0Ljc0NyA3NDUuNzU2LDE1NC43NDcgQzgwMi4yNjksMTU0Ljc0NyA4NTAuODQyLDE1OC45NTUgODY1LDE2MC44MzYgTDg2NSwyOTkgTDc4My4zODQsMjk5LjAzNyBDNzE5LjM5MSwyOTkuMDM3IDcwNywzMjkuNTI5IDcwNywzNzQuMjczIEw3MDcsNDczIEw4NjAuNDg3LDQ3MyBMODQwLjUwMSw2MjggTDcwNyw2MjggTDcwNywxMDI0IEw5NjcuNDg0LDEwMjQgQzk5OC42OTcsMTAyNCAxMDI0LDk5OC42OTcgMTAyNCw5NjcuNDg0IEwxMDI0LDU2LjUxNSBDMTAyNCwyNS4zMDMgOTk4LjY5NywwIDk2Ny40ODQsMCIgaWQ9IkZpbGwtMSI+PC9wYXRoPiAgICAgICAgPC9nPiAgICA8L2c+PC9zdmc+);\n\t\t}\n\n\t\t& .ck-media__placeholder__url__text {\n\t\t\tcolor: hsl(220, 100%, 90%);\n\n\t\t\t&:hover {\n\t\t\t\tcolor: hsl(0, 0%, 100%);\n\t\t\t}\n\t\t}\n\t}\n\n\t&[data-oembed-url*="instagram.com"] .ck-media__placeholder {\n\t\tbackground: linear-gradient(-135deg,hsl(246, 100%, 39%),hsl(302, 100%, 36%),hsl(0, 100%, 48%));\n\n\t\t& .ck-media__placeholder__icon {\n\t\t\tbackground-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSI1MDRweCIgaGVpZ2h0PSI1MDRweCIgdmlld0JveD0iMCAwIDUwNCA1MDQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+Z2x5cGgtbG9nb19NYXkyMDE2PC90aXRsZT4gICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+ICAgIDxkZWZzPiAgICAgICAgPHBvbHlnb24gaWQ9InBhdGgtMSIgcG9pbnRzPSIwIDAuMTU5IDUwMy44NDEgMC4xNTkgNTAzLjg0MSA1MDMuOTQgMCA1MDMuOTQiPjwvcG9seWdvbj4gICAgPC9kZWZzPiAgICA8ZyBpZD0iZ2x5cGgtbG9nb19NYXkyMDE2IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4gICAgICAgIDxnIGlkPSJHcm91cC0zIj4gICAgICAgICAgICA8bWFzayBpZD0ibWFzay0yIiBmaWxsPSJ3aGl0ZSI+ICAgICAgICAgICAgICAgIDx1c2UgeGxpbms6aHJlZj0iI3BhdGgtMSI+PC91c2U+ICAgICAgICAgICAgPC9tYXNrPiAgICAgICAgICAgIDxnIGlkPSJDbGlwLTIiPjwvZz4gICAgICAgICAgICA8cGF0aCBkPSJNMjUxLjkyMSwwLjE1OSBDMTgzLjUwMywwLjE1OSAxNzQuOTI0LDAuNDQ5IDE0OC4wNTQsMS42NzUgQzEyMS4yNCwyLjg5OCAxMDIuOTI3LDcuMTU3IDg2LjkwMywxMy4zODUgQzcwLjMzNywxOS44MjIgNTYuMjg4LDI4LjQzNiA0Mi4yODIsNDIuNDQxIEMyOC4yNzcsNTYuNDQ3IDE5LjY2Myw3MC40OTYgMTMuMjI2LDg3LjA2MiBDNi45OTgsMTAzLjA4NiAyLjczOSwxMjEuMzk5IDEuNTE2LDE0OC4yMTMgQzAuMjksMTc1LjA4MyAwLDE4My42NjIgMCwyNTIuMDggQzAsMzIwLjQ5NyAwLjI5LDMyOS4wNzYgMS41MTYsMzU1Ljk0NiBDMi43MzksMzgyLjc2IDYuOTk4LDQwMS4wNzMgMTMuMjI2LDQxNy4wOTcgQzE5LjY2Myw0MzMuNjYzIDI4LjI3Nyw0NDcuNzEyIDQyLjI4Miw0NjEuNzE4IEM1Ni4yODgsNDc1LjcyMyA3MC4zMzcsNDg0LjMzNyA4Ni45MDMsNDkwLjc3NSBDMTAyLjkyNyw0OTcuMDAyIDEyMS4yNCw1MDEuMjYxIDE0OC4wNTQsNTAyLjQ4NCBDMTc0LjkyNCw1MDMuNzEgMTgzLjUwMyw1MDQgMjUxLjkyMSw1MDQgQzMyMC4zMzgsNTA0IDMyOC45MTcsNTAzLjcxIDM1NS43ODcsNTAyLjQ4NCBDMzgyLjYwMSw1MDEuMjYxIDQwMC45MTQsNDk3LjAwMiA0MTYuOTM4LDQ5MC43NzUgQzQzMy41MDQsNDg0LjMzNyA0NDcuNTUzLDQ3NS43MjMgNDYxLjU1OSw0NjEuNzE4IEM0NzUuNTY0LDQ0Ny43MTIgNDg0LjE3OCw0MzMuNjYzIDQ5MC42MTYsNDE3LjA5NyBDNDk2Ljg0Myw0MDEuMDczIDUwMS4xMDIsMzgyLjc2IDUwMi4zMjUsMzU1Ljk0NiBDNTAzLjU1MSwzMjkuMDc2IDUwMy44NDEsMzIwLjQ5NyA1MDMuODQxLDI1Mi4wOCBDNTAzLjg0MSwxODMuNjYyIDUwMy41NTEsMTc1LjA4MyA1MDIuMzI1LDE0OC4yMTMgQzUwMS4xMDIsMTIxLjM5OSA0OTYuODQzLDEwMy4wODYgNDkwLjYxNiw4Ny4wNjIgQzQ4NC4xNzgsNzAuNDk2IDQ3NS41NjQsNTYuNDQ3IDQ2MS41NTksNDIuNDQxIEM0NDcuNTUzLDI4LjQzNiA0MzMuNTA0LDE5LjgyMiA0MTYuOTM4LDEzLjM4NSBDNDAwLjkxNCw3LjE1NyAzODIuNjAxLDIuODk4IDM1NS43ODcsMS42NzUgQzMyOC45MTcsMC40NDkgMzIwLjMzOCwwLjE1OSAyNTEuOTIxLDAuMTU5IFogTTI1MS45MjEsNDUuNTUgQzMxOS4xODYsNDUuNTUgMzI3LjE1NCw0NS44MDcgMzUzLjcxOCw0Ny4wMTkgQzM3OC4yOCw0OC4xMzkgMzkxLjYxOSw1Mi4yNDMgNDAwLjQ5Niw1NS42OTMgQzQxMi4yNTUsNjAuMjYzIDQyMC42NDcsNjUuNzIyIDQyOS40NjIsNzQuNTM4IEM0MzguMjc4LDgzLjM1MyA0NDMuNzM3LDkxLjc0NSA0NDguMzA3LDEwMy41MDQgQzQ1MS43NTcsMTEyLjM4MSA0NTUuODYxLDEyNS43MiA0NTYuOTgxLDE1MC4yODIgQzQ1OC4xOTMsMTc2Ljg0NiA0NTguNDUsMTg0LjgxNCA0NTguNDUsMjUyLjA4IEM0NTguNDUsMzE5LjM0NSA0NTguMTkzLDMyNy4zMTMgNDU2Ljk4MSwzNTMuODc3IEM0NTUuODYxLDM3OC40MzkgNDUxLjc1NywzOTEuNzc4IDQ0OC4zMDcsNDAwLjY1NSBDNDQzLjczNyw0MTIuNDE0IDQzOC4yNzgsNDIwLjgwNiA0MjkuNDYyLDQyOS42MjEgQzQyMC42NDcsNDM4LjQzNyA0MTIuMjU1LDQ0My44OTYgNDAwLjQ5Niw0NDguNDY2IEMzOTEuNjE5LDQ1MS45MTYgMzc4LjI4LDQ1Ni4wMiAzNTMuNzE4LDQ1Ny4xNCBDMzI3LjE1OCw0NTguMzUyIDMxOS4xOTEsNDU4LjYwOSAyNTEuOTIxLDQ1OC42MDkgQzE4NC42NSw0NTguNjA5IDE3Ni42ODQsNDU4LjM1MiAxNTAuMTIzLDQ1Ny4xNCBDMTI1LjU2MSw0NTYuMDIgMTEyLjIyMiw0NTEuOTE2IDEwMy4zNDUsNDQ4LjQ2NiBDOTEuNTg2LDQ0My44OTYgODMuMTk0LDQzOC40MzcgNzQuMzc5LDQyOS42MjEgQzY1LjU2NCw0MjAuODA2IDYwLjEwNCw0MTIuNDE0IDU1LjUzNCw0MDAuNjU1IEM1Mi4wODQsMzkxLjc3OCA0Ny45OCwzNzguNDM5IDQ2Ljg2LDM1My44NzcgQzQ1LjY0OCwzMjcuMzEzIDQ1LjM5MSwzMTkuMzQ1IDQ1LjM5MSwyNTIuMDggQzQ1LjM5MSwxODQuODE0IDQ1LjY0OCwxNzYuODQ2IDQ2Ljg2LDE1MC4yODIgQzQ3Ljk4LDEyNS43MiA1Mi4wODQsMTEyLjM4MSA1NS41MzQsMTAzLjUwNCBDNjAuMTA0LDkxLjc0NSA2NS41NjMsODMuMzUzIDc0LjM3OSw3NC41MzggQzgzLjE5NCw2NS43MjIgOTEuNTg2LDYwLjI2MyAxMDMuMzQ1LDU1LjY5MyBDMTEyLjIyMiw1Mi4yNDMgMTI1LjU2MSw0OC4xMzkgMTUwLjEyMyw0Ny4wMTkgQzE3Ni42ODcsNDUuODA3IDE4NC42NTUsNDUuNTUgMjUxLjkyMSw0NS41NSBaIiBpZD0iRmlsbC0xIiBmaWxsPSIjRkZGRkZGIiBtYXNrPSJ1cmwoI21hc2stMikiPjwvcGF0aD4gICAgICAgIDwvZz4gICAgICAgIDxwYXRoIGQ9Ik0yNTEuOTIxLDMzNi4wNTMgQzIwNS41NDMsMzM2LjA1MyAxNjcuOTQ3LDI5OC40NTcgMTY3Ljk0NywyNTIuMDggQzE2Ny45NDcsMjA1LjcwMiAyMDUuNTQzLDE2OC4xMDYgMjUxLjkyMSwxNjguMTA2IEMyOTguMjk4LDE2OC4xMDYgMzM1Ljg5NCwyMDUuNzAyIDMzNS44OTQsMjUyLjA4IEMzMzUuODk0LDI5OC40NTcgMjk4LjI5OCwzMzYuMDUzIDI1MS45MjEsMzM2LjA1MyBaIE0yNTEuOTIxLDEyMi43MTUgQzE4MC40NzQsMTIyLjcxNSAxMjIuNTU2LDE4MC42MzMgMTIyLjU1NiwyNTIuMDggQzEyMi41NTYsMzIzLjUyNiAxODAuNDc0LDM4MS40NDQgMjUxLjkyMSwzODEuNDQ0IEMzMjMuMzY3LDM4MS40NDQgMzgxLjI4NSwzMjMuNTI2IDM4MS4yODUsMjUyLjA4IEMzODEuMjg1LDE4MC42MzMgMzIzLjM2NywxMjIuNzE1IDI1MS45MjEsMTIyLjcxNSBaIiBpZD0iRmlsbC00IiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+ICAgICAgICA8cGF0aCBkPSJNNDE2LjYyNywxMTcuNjA0IEM0MTYuNjI3LDEzNC4zIDQwMy4wOTIsMTQ3LjgzNCAzODYuMzk2LDE0Ny44MzQgQzM2OS43MDEsMTQ3LjgzNCAzNTYuMTY2LDEzNC4zIDM1Ni4xNjYsMTE3LjYwNCBDMzU2LjE2NiwxMDAuOTA4IDM2OS43MDEsODcuMzczIDM4Ni4zOTYsODcuMzczIEM0MDMuMDkyLDg3LjM3MyA0MTYuNjI3LDEwMC45MDggNDE2LjYyNywxMTcuNjA0IiBpZD0iRmlsbC01IiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+ICAgIDwvZz48L3N2Zz4=);\n\t\t}\n\n\t\t/* stylelint-disable-next-line no-descending-specificity */\n\t\t& .ck-media__placeholder__url__text {\n\t\t\tcolor: hsl(302, 100%, 94%);\n\n\t\t\t&:hover {\n\t\t\t\tcolor: hsl(0, 0%, 100%);\n\t\t\t}\n\t\t}\n\t}\n\n\t&[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder {\n\t\t/* Use gradient to contrast with focused widget (ckeditor/ckeditor5-media-embed#22). */\n\t\tbackground: linear-gradient( to right, hsl(201, 85%, 70%), hsl(201, 85%, 35%) );\n\n\t\t& .ck-media__placeholder__icon {\n\t\t\tbackground-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IldoaXRlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDQwMCA0MDAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQwMCA0MDA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPi5zdDB7ZmlsbDojRkZGRkZGO308L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00MDAsMjAwYzAsMTEwLjUtODkuNSwyMDAtMjAwLDIwMFMwLDMxMC41LDAsMjAwUzg5LjUsMCwyMDAsMFM0MDAsODkuNSw0MDAsMjAweiBNMTYzLjQsMzA1LjVjODguNywwLDEzNy4yLTczLjUsMTM3LjItMTM3LjJjMC0yLjEsMC00LjItMC4xLTYuMmM5LjQtNi44LDE3LjYtMTUuMywyNC4xLTI1Yy04LjYsMy44LTE3LjksNi40LTI3LjcsNy42YzEwLTYsMTcuNi0xNS40LDIxLjItMjYuN2MtOS4zLDUuNS0xOS42LDkuNS0zMC42LDExLjdjLTguOC05LjQtMjEuMy0xNS4yLTM1LjItMTUuMmMtMjYuNiwwLTQ4LjIsMjEuNi00OC4yLDQ4LjJjMCwzLjgsMC40LDcuNSwxLjMsMTFjLTQwLjEtMi03NS42LTIxLjItOTkuNC01MC40Yy00LjEsNy4xLTYuNSwxNS40LTYuNSwyNC4yYzAsMTYuNyw4LjUsMzEuNSwyMS41LDQwLjFjLTcuOS0wLjItMTUuMy0yLjQtMjEuOC02YzAsMC4yLDAsMC40LDAsMC42YzAsMjMuNCwxNi42LDQyLjgsMzguNyw0Ny4zYy00LDEuMS04LjMsMS43LTEyLjcsMS43Yy0zLjEsMC02LjEtMC4zLTkuMS0wLjljNi4xLDE5LjIsMjMuOSwzMy4xLDQ1LDMzLjVjLTE2LjUsMTIuOS0zNy4zLDIwLjYtNTkuOSwyMC42Yy0zLjksMC03LjctMC4yLTExLjUtMC43QzExMC44LDI5Ny41LDEzNi4yLDMwNS41LDE2My40LDMwNS41Ii8+PC9zdmc+);\n\t\t}\n\n\t\t& .ck-media__placeholder__url__text {\n\t\t\tcolor: hsl(201, 100%, 86%);\n\n\t\t\t&:hover {\n\t\t\t\tcolor: hsl(0, 0%, 100%);\n\t\t\t}\n\t\t}\n\t}\n}\n'],sourceRoot:""}]);const a=s},9292:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-media-form{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-media-form .ck-labeled-field-view{display:inline-block}.ck.ck-media-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-media-form{flex-wrap:wrap}.ck.ck-media-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-media-form .ck-button{flex-basis:50%}}","",{version:3,sources:["webpack://./../ckeditor5-media-embed/theme/mediaform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css"],names:[],mappings:"AAOA,kBAEC,sBAAuB,CADvB,YAAa,CAEb,kBAAmB,CACnB,gBAqBD,CAnBC,yCACC,oBACD,CAEA,4BACC,YACD,CCbA,oCDCD,kBAeE,cAUF,CARE,yCACC,eACD,CAEA,6BACC,cACD,CCtBD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n\n.ck.ck-media-form {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\n\t& .ck-labeled-field-view {\n\t\tdisplay: inline-block;\n\t}\n\n\t& .ck-label {\n\t\tdisplay: none;\n\t}\n\n\t@mixin ck-media-phone {\n\t\tflex-wrap: wrap;\n\n\t\t& .ck-labeled-field-view {\n\t\t\tflex-basis: 100%;\n\t\t}\n\n\t\t& .ck-button {\n\t\t\tflex-basis: 50%;\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-phone {\n\t@media screen and (max-width: 600px) {\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},1613:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap}:root{--ck-insert-table-dropdown-padding:10px;--ck-insert-table-dropdown-box-height:11px;--ck-insert-table-dropdown-box-width:12px;--ck-insert-table-dropdown-box-margin:1px}.ck .ck-insert-table-dropdown__grid{padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0;width:calc(var(--ck-insert-table-dropdown-box-width)*10 + var(--ck-insert-table-dropdown-box-margin)*20 + var(--ck-insert-table-dropdown-padding)*2)}.ck .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{border:1px solid var(--ck-color-base-border);border-radius:1px;height:var(--ck-insert-table-dropdown-box-height);margin:var(--ck-insert-table-dropdown-box-margin);width:var(--ck-insert-table-dropdown-box-width)}.ck .ck-insert-table-dropdown-grid-box.ck-on{background:var(--ck-color-focus-outer-shadow);border-color:var(--ck-color-focus-border)}","",{version:3,sources:["webpack://./../ckeditor5-table/theme/inserttable.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-table/inserttable.css"],names:[],mappings:"AAKA,oCACC,YAAa,CACb,kBAAmB,CACnB,cACD,CCJA,MACC,uCAAwC,CACxC,0CAA2C,CAC3C,yCAA0C,CAC1C,yCACD,CAEA,oCAGC,yFAA0F,CAD1F,oJAED,CAEA,qCACC,iBACD,CAEA,uCAIC,4CAA6C,CAC7C,iBAAkB,CAHlB,iDAAkD,CAClD,iDAAkD,CAFlD,+CAUD,CAJC,6CAEC,6CAA8C,CAD9C,yCAED",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck .ck-insert-table-dropdown__grid {\n\tdisplay: flex;\n\tflex-direction: row;\n\tflex-wrap: wrap;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-insert-table-dropdown-padding: 10px;\n\t--ck-insert-table-dropdown-box-height: 11px;\n\t--ck-insert-table-dropdown-box-width: 12px;\n\t--ck-insert-table-dropdown-box-margin: 1px;\n}\n\n.ck .ck-insert-table-dropdown__grid {\n\t/* The width of a container should match 10 items in a row so there will be a 10x10 grid. */\n\twidth: calc(var(--ck-insert-table-dropdown-box-width) * 10 + var(--ck-insert-table-dropdown-box-margin) * 20 + var(--ck-insert-table-dropdown-padding) * 2);\n\tpadding: var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0;\n}\n\n.ck .ck-insert-table-dropdown__label {\n\ttext-align: center;\n}\n\n.ck .ck-insert-table-dropdown-grid-box {\n\twidth: var(--ck-insert-table-dropdown-box-width);\n\theight: var(--ck-insert-table-dropdown-box-height);\n\tmargin: var(--ck-insert-table-dropdown-box-margin);\n\tborder: 1px solid var(--ck-color-base-border);\n\tborder-radius: 1px;\n\n\t&.ck-on {\n\t\tborder-color: var(--ck-color-focus-border);\n\t\tbackground: var(--ck-color-focus-outer-shadow);\n\t}\n}\n\n"],sourceRoot:""}]);const a=s},6306:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck-content .table{display:table;margin:.9em auto}.ck-content .table table{border:1px double #b3b3b3;border-collapse:collapse;border-spacing:0;height:100%;width:100%}.ck-content .table table td,.ck-content .table table th{border:1px solid #bfbfbf;min-width:2em;padding:.4em}.ck-content .table table th{background:rgba(0,0,0,.05);font-weight:700}.ck-content[dir=rtl] .table th{text-align:right}.ck-content[dir=ltr] .table th{text-align:left}.ck-editor__editable .ck-table-bogus-paragraph{display:inline-block;width:100%}","",{version:3,sources:["webpack://./../ckeditor5-table/theme/table.css"],names:[],mappings:"AAKA,mBAKC,aAAc,CADd,gBAiCD,CA9BC,yBAYC,yBAAkC,CAVlC,wBAAyB,CACzB,gBAAiB,CAKjB,WAAY,CADZ,UAsBD,CAfC,wDAQC,wBAAiC,CANjC,aAAc,CACd,YAMD,CAEA,4BAEC,0BAA+B,CAD/B,eAED,CAMF,+BACC,gBACD,CAEA,+BACC,eACD,CAEA,+CAKC,oBAAqB,CAMrB,UACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content .table {\n\t/* Give the table widget some air and center it horizontally */\n\t/* The first value should be equal to --ck-spacing-large variable if used in the editor context\n\tto avoid the content jumping (See https://github.com/ckeditor/ckeditor5/issues/9825). */\n\tmargin: 0.9em auto;\n\tdisplay: table;\n\n\t& table {\n\t\t/* The table cells should have slight borders */\n\t\tborder-collapse: collapse;\n\t\tborder-spacing: 0;\n\n\t\t/* Table width and height are set on the parent
. Make sure the table inside stretches\n\t\tto the full dimensions of the container (https://github.com/ckeditor/ckeditor5/issues/6186). */\n\t\twidth: 100%;\n\t\theight: 100%;\n\n\t\t/* The outer border of the table should be slightly darker than the inner lines.\n\t\tAlso see https://github.com/ckeditor/ckeditor5-table/issues/50. */\n\t\tborder: 1px double hsl(0, 0%, 70%);\n\n\t\t& td,\n\t\t& th {\n\t\t\tmin-width: 2em;\n\t\t\tpadding: .4em;\n\n\t\t\t/* The border is inherited from .ck-editor__nested-editable styles, so theoretically it\'s not necessary here.\n\t\t\tHowever, the border is a content style, so it should use .ck-content (so it works outside the editor).\n\t\t\tHence, the duplication. See https://github.com/ckeditor/ckeditor5/issues/6314 */\n\t\t\tborder: 1px solid hsl(0, 0%, 75%);\n\t\t}\n\n\t\t& th {\n\t\t\tfont-weight: bold;\n\t\t\tbackground: hsla(0, 0%, 0%, 5%);\n\t\t}\n\t}\n}\n\n/* Text alignment of the table header should match the editor settings and override the native browser styling,\nwhen content is available outside the editor. See https://github.com/ckeditor/ckeditor5/issues/6638 */\n.ck-content[dir="rtl"] .table th {\n\ttext-align: right;\n}\n\n.ck-content[dir="ltr"] .table th {\n\ttext-align: left;\n}\n\n.ck-editor__editable .ck-table-bogus-paragraph {\n\t/*\n\t * Use display:inline-block to force Chrome/Safari to limit text mutations to this element.\n\t * See https://github.com/ckeditor/ckeditor5/issues/6062.\n\t */\n\tdisplay: inline-block;\n\n\t/*\n\t * Inline HTML elements nested in the span should always be dimensioned in relation to the whole cell width.\n\t * See https://github.com/ckeditor/ckeditor5/issues/9117.\n\t */\n\twidth: 100%;\n}\n'],sourceRoot:""}]);const a=s},3881:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,":root{--ck-color-table-focused-cell-background:rgba(158,207,250,.3)}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table td.ck-editor__nested-editable:focus,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table th.ck-editor__nested-editable:focus{background:var(--ck-color-table-focused-cell-background);border-style:none;outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}","",{version:3,sources:["webpack://./../ckeditor5-theme-lark/theme/ckeditor5-table/tableediting.css"],names:[],mappings:"AAKA,MACC,6DACD,CAKE,8QAGC,wDAAyD,CAKzD,iBAAkB,CAClB,8CAA+C,CAC/C,mBACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-color-table-focused-cell-background: hsla(208, 90%, 80%, .3);\n}\n\n.ck-widget.table {\n\t& td,\n\t& th {\n\t\t&.ck-editor__nested-editable.ck-editor__nested-editable_focused,\n\t\t&.ck-editor__nested-editable:focus {\n\t\t\t/* A very slight background to highlight the focused cell */\n\t\t\tbackground: var(--ck-color-table-focused-cell-background);\n\n\t\t\t/* Fixes the problem where surrounding cells cover the focused cell's border.\n\t\t\tIt does not fix the problem in all places but the UX is improved.\n\t\t\tSee https://github.com/ckeditor/ckeditor5-table/issues/29. */\n\t\t\tborder-style: none;\n\t\t\toutline: 1px solid var(--ck-color-focus-border);\n\t\t\toutline-offset: -1px; /* progressive enhancement - no IE support */\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const a=s},6945:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,':root{--ck-table-selected-cell-background:rgba(158,207,250,.3)}.ck.ck-editor__editable .table table td.ck-editor__editable_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected{box-shadow:unset;caret-color:transparent;outline:unset;position:relative}.ck.ck-editor__editable .table table td.ck-editor__editable_selected:after,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:after{background-color:var(--ck-table-selected-cell-background);bottom:0;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.ck.ck-editor__editable .table table td.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table td.ck-editor__editable_selected:focus,.ck.ck-editor__editable .table table th.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:focus{background-color:transparent}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget{outline:unset}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget>.ck-widget__selection-handle,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget>.ck-widget__selection-handle{display:none}',"",{version:3,sources:["webpack://./../ckeditor5-theme-lark/theme/ckeditor5-table/tableselection.css"],names:[],mappings:"AAKA,MACC,wDACD,CAGC,0IAKC,gBAAiB,CAFjB,uBAAwB,CACxB,aAAc,CAFd,iBAiCD,CA3BC,sJAGC,yDAA0D,CAK1D,QAAS,CAPT,UAAW,CAKX,MAAO,CAJP,mBAAoB,CAEpB,iBAAkB,CAGlB,OAAQ,CAFR,KAID,CAEA,wTAEC,4BACD,CAMA,gKACC,aAKD,CAHC,0NACC,YACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-table-selected-cell-background: hsla(208, 90%, 80%, .3);\n}\n\n.ck.ck-editor__editable .table table {\n\t& td.ck-editor__editable_selected,\n\t& th.ck-editor__editable_selected {\n\t\tposition: relative;\n\t\tcaret-color: transparent;\n\t\toutline: unset;\n\t\tbox-shadow: unset;\n\n\t\t/* https://github.com/ckeditor/ckeditor5/issues/6446 */\n\t\t&:after {\n\t\t\tcontent: '';\n\t\t\tpointer-events: none;\n\t\t\tbackground-color: var(--ck-table-selected-cell-background);\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\tright: 0;\n\t\t\tbottom: 0;\n\t\t}\n\n\t\t& ::selection,\n\t\t&:focus {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t/*\n\t\t * To reduce the amount of noise, all widgets in the table selection have no outline and no selection handle.\n\t\t * See https://github.com/ckeditor/ckeditor5/issues/9491.\n\t\t */\n\t\t& .ck-widget {\n\t\t\toutline: unset;\n\n\t\t\t& > .ck-widget__selection-handle {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const a=s},4906:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-button,a.ck.ck-button{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:block}@media (hover:none){.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:none}}.ck.ck-button,a.ck.ck-button{align-items:center;display:inline-flex;justify-content:left;position:relative}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{display:none}.ck.ck-button.ck-button_with-text .ck-button__label,a.ck.ck-button.ck-button_with-text .ck-button__label{display:inline-block}.ck.ck-button:not(.ck-button_with-text),a.ck.ck-button:not(.ck-button_with-text){justify-content:center}.ck.ck-button:hover .ck-tooltip,a.ck.ck-button:hover .ck-tooltip{opacity:1;visibility:visible}.ck.ck-button:focus:not(:hover) .ck-tooltip,a.ck.ck-button:focus:not(:hover) .ck-tooltip{display:none}.ck.ck-button,a.ck.ck-button{background:var(--ck-color-button-default-background)}.ck.ck-button:not(.ck-disabled):hover,a.ck.ck-button:not(.ck-disabled):hover{background:var(--ck-color-button-default-hover-background)}.ck.ck-button:not(.ck-disabled):active,a.ck.ck-button:not(.ck-disabled):active{background:var(--ck-color-button-default-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-default-active-shadow)}.ck.ck-button.ck-disabled,a.ck.ck-button.ck-disabled{background:var(--ck-color-button-default-disabled-background)}.ck.ck-button,a.ck.ck-button{border-radius:0}.ck-rounded-corners .ck.ck-button,.ck-rounded-corners a.ck.ck-button,.ck.ck-button.ck-rounded-corners,a.ck.ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-button,a.ck.ck-button{-webkit-appearance:none;border:1px solid transparent;cursor:default;font-size:inherit;line-height:1;min-height:var(--ck-ui-component-min-height);min-width:var(--ck-ui-component-min-height);padding:var(--ck-spacing-tiny);text-align:center;transition:box-shadow .2s ease-in-out,border .2s ease-in-out;vertical-align:middle;white-space:nowrap}.ck.ck-button:active,.ck.ck-button:focus,a.ck.ck-button:active,a.ck.ck-button:focus{border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0;outline:none}.ck.ck-button .ck-button__icon use,.ck.ck-button .ck-button__icon use *,a.ck.ck-button .ck-button__icon use,a.ck.ck-button .ck-button__icon use *{color:inherit}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{color:inherit;cursor:inherit;font-size:inherit;font-weight:inherit;vertical-align:middle}[dir=ltr] .ck.ck-button .ck-button__label,[dir=ltr] a.ck.ck-button .ck-button__label{text-align:left}[dir=rtl] .ck.ck-button .ck-button__label,[dir=rtl] a.ck.ck-button .ck-button__label{text-align:right}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{color:inherit}[dir=ltr] .ck.ck-button .ck-button__keystroke,[dir=ltr] a.ck.ck-button .ck-button__keystroke{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-button .ck-button__keystroke,[dir=rtl] a.ck.ck-button .ck-button__keystroke{margin-right:var(--ck-spacing-large)}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{font-weight:700;opacity:.7}.ck.ck-button.ck-disabled:active,.ck.ck-button.ck-disabled:focus,a.ck.ck-button.ck-disabled:active,a.ck.ck-button.ck-disabled:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-button.ck-disabled .ck-button__icon,.ck.ck-button.ck-disabled .ck-button__label,a.ck.ck-button.ck-disabled .ck-button__icon,a.ck.ck-button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__keystroke,a.ck.ck-button.ck-disabled .ck-button__keystroke{opacity:.3}.ck.ck-button.ck-button_with-text,a.ck.ck-button.ck-button_with-text{padding:var(--ck-spacing-tiny) var(--ck-spacing-standard)}[dir=ltr] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=ltr] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-left:calc(var(--ck-spacing-small)*-1);margin-right:var(--ck-spacing-small)}[dir=rtl] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=rtl] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-left:var(--ck-spacing-small);margin-right:calc(var(--ck-spacing-small)*-1)}.ck.ck-button.ck-button_with-keystroke .ck-button__label,a.ck.ck-button.ck-button_with-keystroke .ck-button__label{flex-grow:1}.ck.ck-button.ck-on,a.ck.ck-button.ck-on{background:var(--ck-color-button-on-background)}.ck.ck-button.ck-on:not(.ck-disabled):hover,a.ck.ck-button.ck-on:not(.ck-disabled):hover{background:var(--ck-color-button-on-hover-background)}.ck.ck-button.ck-on:not(.ck-disabled):active,a.ck.ck-button.ck-on:not(.ck-disabled):active{background:var(--ck-color-button-on-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-on-active-shadow)}.ck.ck-button.ck-on.ck-disabled,a.ck.ck-button.ck-on.ck-disabled{background:var(--ck-color-button-on-disabled-background)}.ck.ck-button.ck-button-save,a.ck.ck-button.ck-button-save{color:var(--ck-color-button-save)}.ck.ck-button.ck-button-cancel,a.ck.ck-button.ck-button-cancel{color:var(--ck-color-button-cancel)}.ck.ck-button-action,a.ck.ck-button-action{background:var(--ck-color-button-action-background)}.ck.ck-button-action:not(.ck-disabled):hover,a.ck.ck-button-action:not(.ck-disabled):hover{background:var(--ck-color-button-action-hover-background)}.ck.ck-button-action:not(.ck-disabled):active,a.ck.ck-button-action:not(.ck-disabled):active{background:var(--ck-color-button-action-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-action-active-shadow)}.ck.ck-button-action.ck-disabled,a.ck.ck-button-action.ck-disabled{background:var(--ck-color-button-action-disabled-background)}.ck.ck-button-action,a.ck.ck-button-action{color:var(--ck-color-button-action-text)}.ck.ck-button-bold,a.ck.ck-button-bold{font-weight:700}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/button/button.css","webpack://./../ckeditor5-ui/theme/mixins/_unselectable.css","webpack://./../ckeditor5-ui/theme/components/tooltip/mixins/_tooltip.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/button/button.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/mixins/_button.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_focus.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_shadow.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_disabled.css"],names:[],mappings:"AAQA,6BCCC,qBAAsB,CACtB,wBAAyB,CACzB,oBAAqB,CACrB,gBD6BD,CE/BC,qDACC,aAqBD,CAHC,oBAnBD,qDAoBE,YAEF,CADC,CFvBF,6BAOC,kBAAmB,CADnB,mBAAoB,CAEpB,oBAAqB,CAHrB,iBA4BD,CAvBC,iEACC,YACD,CAGC,yGACC,oBACD,CAID,iFACC,sBACD,CEkBA,iEAEC,SAAU,CADV,kBAED,CAbA,yFACC,YACD,CC7BD,6BCAC,oDD0ID,CCvIE,6EACC,0DACD,CAEA,+EACC,2DAA4C,CAC5C,uEACD,CAID,qDACC,6DACD,CDhBD,6BEDC,eF2ID,CA1IA,wIEGE,qCFuIF,CA1IA,6BA6BC,uBAAwB,CANxB,4BAA6B,CAjB7B,cAAe,CAcf,iBAAkB,CAHlB,aAAc,CAJd,4CAA6C,CAD7C,2CAA4C,CAJ5C,8BAA+B,CAC/B,iBAAkB,CAiBlB,4DAA8D,CAnB9D,qBAAsB,CAFtB,kBAqID,CA3GC,oFGhCA,2BAA2B,CCF3B,2CAA8B,CDC9B,YHqCA,CAIC,kJAEC,aACD,CAGD,iEAIC,aAAc,CACd,cAAe,CAHf,iBAAkB,CAClB,mBAAoB,CAMpB,qBASD,CAlBA,qFAYE,eAMF,CAlBA,qFAgBE,gBAEF,CAEA,yEACC,aAYD,CAbA,6FAIE,mCASF,CAbA,6FAQE,oCAKF,CAbA,yEAWC,eAAiB,CACjB,UACD,CAIC,oIIrFD,oDJyFC,CAOA,gLKhGD,kCLkGC,CAEA,iGACC,UACD,CAGD,qEACC,yDAcD,CAXC,2HAEE,4CAA+C,CAC/C,oCAOF,CAVA,2HAQE,mCAAoC,CADpC,6CAGF,CAKA,mHACC,WACD,CAID,yCC/HA,+CDiIA,CC9HC,yFACC,qDACD,CAEA,2FACC,sDAA4C,CAC5C,kEACD,CAID,iEACC,wDACD,CDmHA,2DACC,iCACD,CAEA,+DACC,mCACD,CAID,2CC7IC,mDDkJD,CC/IE,2FACC,yDACD,CAEA,6FACC,0DAA4C,CAC5C,sEACD,CAID,mEACC,4DACD,CD6HD,2CAIC,wCACD,CAEA,uCAEC,eACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../mixins/_unselectable.css";\n@import "../tooltip/mixins/_tooltip.css";\n\n.ck.ck-button,\na.ck.ck-button {\n\t@mixin ck-unselectable;\n\t@mixin ck-tooltip_enabled;\n\n\tposition: relative;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: left;\n\n\t& .ck-button__label {\n\t\tdisplay: none;\n\t}\n\n\t&.ck-button_with-text {\n\t\t& .ck-button__label {\n\t\t\tdisplay: inline-block;\n\t\t}\n\t}\n\n\t/* Center the icon horizontally in a button without text. */\n\t&:not(.ck-button_with-text) {\n\t\tjustify-content: center;\n\t}\n\n\t&:hover {\n\t\t@mixin ck-tooltip_visible;\n\t}\n\n\t/* Get rid of the native focus outline around the tooltip when focused (but not :hover). */\n\t&:focus:not(:hover) {\n\t\t@mixin ck-tooltip_disabled;\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Makes element unselectable.\n */\n@define-mixin ck-unselectable {\n\t-moz-user-select: none;\n\t-webkit-user-select: none;\n\t-ms-user-select: none;\n\tuser-select: none\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Enables the tooltip, which is the tooltip is in DOM but\n * not yet displayed.\n */\n@define-mixin ck-tooltip_enabled {\n\t& .ck-tooltip {\n\t\tdisplay: block;\n\n\t\t/*\n\t\t * Don't display tooltips in devices which don't support :hover.\n\t\t * In fact, it's all about iOS, which forces user to click UI elements twice to execute\n\t\t * the primary action, when tooltips are enabled.\n\t\t *\n\t\t * Q: OK, but why not the following query?\n\t\t *\n\t\t * @media (hover) {\n\t\t * display: block;\n\t\t * }\n\t\t *\n\t\t * A: Because FF does not support it and it would completely disable tooltips\n\t\t * in that browser.\n\t\t *\n\t\t * More in https://github.com/ckeditor/ckeditor5/issues/920.\n\t\t */\n\t\t@media (hover:none) {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n\n/**\n * Disables the tooltip making it disappear from DOM.\n */\n@define-mixin ck-tooltip_disabled {\n\t& .ck-tooltip {\n\t\tdisplay: none;\n\t}\n}\n\n/**\n * Shows the tooltip, which is already in DOM.\n * Requires `ck-tooltip_enabled` first.\n */\n@define-mixin ck-tooltip_visible {\n\t& .ck-tooltip {\n\t\tvisibility: visible;\n\t\topacity: 1;\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_focus.css";\n@import "../../../mixins/_shadow.css";\n@import "../../../mixins/_disabled.css";\n@import "../../../mixins/_rounded.css";\n@import "../../mixins/_button.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n.ck.ck-button,\na.ck.ck-button {\n\t@mixin ck-button-colors --ck-color-button-default;\n\t@mixin ck-rounded-corners;\n\n\twhite-space: nowrap;\n\tcursor: default;\n\tvertical-align: middle;\n\tpadding: var(--ck-spacing-tiny);\n\ttext-align: center;\n\n\t/* A very important piece of styling. Go to variable declaration to learn more. */\n\tmin-width: var(--ck-ui-component-min-height);\n\tmin-height: var(--ck-ui-component-min-height);\n\n\t/* Normalize the height of the line. Removing this will break consistent height\n\tamong text and text-less buttons (with icons). */\n\tline-height: 1;\n\n\t/* Enable font size inheritance, which allows fluid UI scaling. */\n\tfont-size: inherit;\n\n\t/* Avoid flickering when the foucs border shows up. */\n\tborder: 1px solid transparent;\n\n\t/* Apply some smooth transition to the box-shadow and border. */\n\ttransition: box-shadow .2s ease-in-out, border .2s ease-in-out;\n\n\t/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/189 */\n\t-webkit-appearance: none;\n\n\t&:active,\n\t&:focus {\n\t\t@mixin ck-focus-ring;\n\t\t@mixin ck-box-shadow var(--ck-focus-outer-shadow);\n\t}\n\n\t/* Allow icon coloring using the text "color" property. */\n\t& .ck-button__icon {\n\t\t& use,\n\t\t& use * {\n\t\t\tcolor: inherit;\n\t\t}\n\t}\n\n\t& .ck-button__label {\n\t\t/* Enable font size inheritance, which allows fluid UI scaling. */\n\t\tfont-size: inherit;\n\t\tfont-weight: inherit;\n\t\tcolor: inherit;\n\t\tcursor: inherit;\n\n\t\t/* Must be consistent with .ck-icon\'s vertical align. Otherwise, buttons with and\n\t\twithout labels (but with icons) have different sizes in Chrome */\n\t\tvertical-align: middle;\n\n\t\t@mixin ck-dir ltr {\n\t\t\ttext-align: left;\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\ttext-align: right;\n\t\t}\n\t}\n\n\t& .ck-button__keystroke {\n\t\tcolor: inherit;\n\n\t\t@mixin ck-dir ltr {\n\t\t\tmargin-left: var(--ck-spacing-large);\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\tmargin-right: var(--ck-spacing-large);\n\t\t}\n\n\t\tfont-weight: bold;\n\t\topacity: .7;\n\t}\n\n\t/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/70 */\n\t&.ck-disabled {\n\t\t&:active,\n\t\t&:focus {\n\t\t\t/* The disabled button should have a slightly less visible shadow when focused. */\n\t\t\t@mixin ck-box-shadow var(--ck-focus-disabled-outer-shadow);\n\t\t}\n\n\t\t& .ck-button__icon {\n\t\t\t@mixin ck-disabled;\n\t\t}\n\n\t\t/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/98 */\n\t\t& .ck-button__label {\n\t\t\t@mixin ck-disabled;\n\t\t}\n\n\t\t& .ck-button__keystroke {\n\t\t\topacity: .3;\n\t\t}\n\t}\n\n\t&.ck-button_with-text {\n\t\tpadding: var(--ck-spacing-tiny) var(--ck-spacing-standard);\n\n\t\t/* stylelint-disable-next-line no-descending-specificity */\n\t\t& .ck-button__icon {\n\t\t\t@mixin ck-dir ltr {\n\t\t\t\tmargin-left: calc(-1 * var(--ck-spacing-small));\n\t\t\t\tmargin-right: var(--ck-spacing-small);\n\t\t\t}\n\n\t\t\t@mixin ck-dir rtl {\n\t\t\t\tmargin-right: calc(-1 * var(--ck-spacing-small));\n\t\t\t\tmargin-left: var(--ck-spacing-small);\n\t\t\t}\n\t\t}\n\t}\n\n\t&.ck-button_with-keystroke {\n\t\t/* stylelint-disable-next-line no-descending-specificity */\n\t\t& .ck-button__label {\n\t\t\tflex-grow: 1;\n\t\t}\n\t}\n\n\t/* A style of the button which is currently on, e.g. its feature is active. */\n\t&.ck-on {\n\t\t@mixin ck-button-colors --ck-color-button-on;\n\t}\n\n\t&.ck-button-save {\n\t\tcolor: var(--ck-color-button-save);\n\t}\n\n\t&.ck-button-cancel {\n\t\tcolor: var(--ck-color-button-cancel);\n\t}\n}\n\n/* A style of the button which handles the primary action. */\n.ck.ck-button-action,\na.ck.ck-button-action {\n\t@mixin ck-button-colors --ck-color-button-action;\n\n\tcolor: var(--ck-color-button-action-text);\n}\n\n.ck.ck-button-bold,\na.ck.ck-button-bold {\n\tfont-weight: bold;\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements a button of given background color.\n *\n * @param {String} $background - Background color of the button.\n * @param {String} $border - Border color of the button.\n */\n@define-mixin ck-button-colors $prefix {\n\tbackground: var($(prefix)-background);\n\n\t&:not(.ck-disabled) {\n\t\t&:hover {\n\t\t\tbackground: var($(prefix)-hover-background);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground: var($(prefix)-active-background);\n\t\t\tbox-shadow: inset 0 2px 2px var($(prefix)-active-shadow);\n\t\t}\n\t}\n\n\t/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/98 */\n\t&.ck-disabled {\n\t\tbackground: var($(prefix)-disabled-background);\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A visual style of focused element's border.\n */\n@define-mixin ck-focus-ring {\n\t/* Disable native outline. */\n\toutline: none;\n\tborder: var(--ck-focus-ring)\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A helper to combine multiple shadows.\n */\n@define-mixin ck-box-shadow $shadowA, $shadowB: 0 0 {\n\tbox-shadow: $shadowA, $shadowB;\n}\n\n/**\n * Gives an element a drop shadow so it looks like a floating panel.\n */\n@define-mixin ck-drop-shadow {\n\t@mixin ck-box-shadow var(--ck-drop-shadow);\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A class which indicates that an element holding it is disabled.\n */\n@define-mixin ck-disabled {\n\topacity: var(--ck-disabled-opacity);\n}\n"],sourceRoot:""}]);const a=s},5332:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{display:block}:root{--ck-switch-button-toggle-width:2.6153846154em;--ck-switch-button-toggle-inner-size:1.0769230769em;--ck-switch-button-toggle-spacing:1px;--ck-switch-button-translation:calc(var(--ck-switch-button-toggle-width) - var(--ck-switch-button-toggle-inner-size) - var(--ck-switch-button-toggle-spacing)*2)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__label{margin-right:calc(var(--ck-spacing-large)*2)}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__label{margin-left:calc(var(--ck-spacing-large)*2)}.ck.ck-button.ck-switchbutton .ck-button__toggle{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle.ck-rounded-corners{border-radius:var(--ck-border-radius)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-left:auto}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-right:auto}.ck.ck-button.ck-switchbutton .ck-button__toggle{background:var(--ck-color-switch-button-off-background);transition:background .4s ease;width:var(--ck-switch-button-toggle-width)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:calc(var(--ck-border-radius)*.5)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{background:var(--ck-color-switch-button-inner-background);height:var(--ck-switch-button-toggle-inner-size);margin:var(--ck-switch-button-toggle-spacing);transition:all .3s ease;width:var(--ck-switch-button-toggle-inner-size)}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover{background:var(--ck-color-switch-button-off-hover-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover .ck-button__toggle__inner{box-shadow:0 0 0 5px var(--ck-color-switch-button-inner-shadow)}.ck.ck-button.ck-switchbutton.ck-disabled .ck-button__toggle{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle{background:var(--ck-color-switch-button-on-background)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle:hover{background:var(--ck-color-switch-button-on-hover-background)}[dir=ltr] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(var( --ck-switch-button-translation ))}[dir=rtl] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(calc(var( --ck-switch-button-translation )*-1))}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/button/switchbutton.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/button/switchbutton.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_disabled.css"],names:[],mappings:"AASE,4HACC,aACD,CCCF,MAEC,8CAA+C,CAE/C,mDAAoD,CACpD,qCAAsC,CACtC,gKAKD,CAGC,0DAGE,4CAOF,CAVA,0DAQE,2CAEF,CAEA,iDC3BA,eDoEA,CAzCA,yICvBC,qCDgED,CAzCA,2DAKE,gBAoCF,CAzCA,2DAUE,iBA+BF,CAzCA,iDAiBC,uDAAwD,CAHxD,8BAAiC,CAEjC,0CAyBD,CAtBC,2EC9CD,eD2DC,CAbA,6LC1CA,qCAAsC,CD4CpC,8CAWF,CAbA,2EASC,yDAA0D,CAD1D,gDAAiD,CAFjD,6CAA8C,CAM9C,uBAA0B,CAL1B,+CAMD,CAEA,uDACC,6DAKD,CAHC,iFACC,+DACD,CAIF,6DExEA,kCF0EA,CAEA,uDACC,sDAkBD,CAhBC,6DACC,4DACD,CAEA,2FAKE,2DAMF,CAXA,2FASE,oEAEF",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-button.ck-switchbutton {\n\t& .ck-button__toggle {\n\t\tdisplay: block;\n\n\t\t& .ck-button__toggle__inner {\n\t\t\tdisplay: block;\n\t\t}\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n@import "../../../mixins/_disabled.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n/* Note: To avoid rendering issues (aliasing) but to preserve the responsive nature\nof the component, floating–point numbers have been used which, for the default font size\n(see: --ck-font-size-base), will generate simple integers. */\n:root {\n\t/* 34px at 13px font-size */\n\t--ck-switch-button-toggle-width: 2.6153846154em;\n\t/* 14px at 13px font-size */\n\t--ck-switch-button-toggle-inner-size: 1.0769230769em;\n\t--ck-switch-button-toggle-spacing: 1px;\n\t--ck-switch-button-translation: calc(\n\t\tvar(--ck-switch-button-toggle-width) -\n\t\tvar(--ck-switch-button-toggle-inner-size) -\n\t\t2 * var(--ck-switch-button-toggle-spacing)\n\t);\n}\n\n.ck.ck-button.ck-switchbutton {\n\t& .ck-button__label {\n\t\t@mixin ck-dir ltr {\n\t\t\t/* Separate the label from the switch */\n\t\t\tmargin-right: calc(2 * var(--ck-spacing-large));\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\t/* Separate the label from the switch */\n\t\t\tmargin-left: calc(2 * var(--ck-spacing-large));\n\t\t}\n\t}\n\n\t& .ck-button__toggle {\n\t\t@mixin ck-rounded-corners;\n\n\t\t@mixin ck-dir ltr {\n\t\t\t/* Make sure the toggle is always to the right as far as possible. */\n\t\t\tmargin-left: auto;\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\t/* Make sure the toggle is always to the left as far as possible. */\n\t\t\tmargin-right: auto;\n\t\t}\n\n\t\t/* Gently animate the background color of the toggle switch */\n\t\ttransition: background 400ms ease;\n\n\t\twidth: var(--ck-switch-button-toggle-width);\n\t\tbackground: var(--ck-color-switch-button-off-background);\n\n\t\t& .ck-button__toggle__inner {\n\t\t\t@mixin ck-rounded-corners {\n\t\t\t\tborder-radius: calc(.5 * var(--ck-border-radius));\n\t\t\t}\n\n\t\t\t/* Leave some tiny bit of space around the inner part of the switch */\n\t\t\tmargin: var(--ck-switch-button-toggle-spacing);\n\t\t\twidth: var(--ck-switch-button-toggle-inner-size);\n\t\t\theight: var(--ck-switch-button-toggle-inner-size);\n\t\t\tbackground: var(--ck-color-switch-button-inner-background);\n\n\t\t\t/* Gently animate the inner part of the toggle switch */\n\t\t\ttransition: all 300ms ease;\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground: var(--ck-color-switch-button-off-hover-background);\n\n\t\t\t& .ck-button__toggle__inner {\n\t\t\t\tbox-shadow: 0 0 0 5px var(--ck-color-switch-button-inner-shadow);\n\t\t\t}\n\t\t}\n\t}\n\n\t&.ck-disabled .ck-button__toggle {\n\t\t@mixin ck-disabled;\n\t}\n\n\t&.ck-on .ck-button__toggle {\n\t\tbackground: var(--ck-color-switch-button-on-background);\n\n\t\t&:hover {\n\t\t\tbackground: var(--ck-color-switch-button-on-hover-background);\n\t\t}\n\n\t\t& .ck-button__toggle__inner {\n\t\t\t/*\n\t\t\t * Move the toggle switch to the right. It will be animated.\n\t\t\t */\n\t\t\t@mixin ck-dir ltr {\n\t\t\t\ttransform: translateX( var( --ck-switch-button-translation ) );\n\t\t\t}\n\n\t\t\t@mixin ck-dir rtl {\n\t\t\t\ttransform: translateX( calc( -1 * var( --ck-switch-button-translation ) ) );\n\t\t\t}\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A class which indicates that an element holding it is disabled.\n */\n@define-mixin ck-disabled {\n\topacity: var(--ck-disabled-opacity);\n}\n"],sourceRoot:""}]);const a=s},6781:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-color-grid{display:grid}:root{--ck-color-grid-tile-size:24px;--ck-color-color-grid-check-icon:#000}.ck.ck-color-grid{grid-gap:5px;padding:8px}.ck.ck-color-grid__tile{border:0;height:var(--ck-color-grid-tile-size);min-height:var(--ck-color-grid-tile-size);min-width:var(--ck-color-grid-tile-size);padding:0;transition:box-shadow .2s ease;width:var(--ck-color-grid-tile-size)}.ck.ck-color-grid__tile.ck-disabled{cursor:unset;transition:unset}.ck.ck-color-grid__tile.ck-color-table__color-tile_bordered{box-shadow:0 0 0 1px var(--ck-color-base-border)}.ck.ck-color-grid__tile .ck.ck-icon{color:var(--ck-color-color-grid-check-icon);display:none}.ck.ck-color-grid__tile.ck-on{box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-base-text)}.ck.ck-color-grid__tile.ck-on .ck.ck-icon{display:block}.ck.ck-color-grid__tile.ck-on,.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){border:0}.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-focus-border)}.ck.ck-color-grid__label{padding:0 var(--ck-spacing-standard)}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/colorgrid/colorgrid.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/colorgrid/colorgrid.css"],names:[],mappings:"AAKA,kBACC,YACD,CCAA,MACC,8BAA+B,CAK/B,qCACD,CAEA,kBACC,YAAa,CACb,WACD,CAEA,wBAOC,QAAS,CALT,qCAAsC,CAEtC,yCAA0C,CAD1C,wCAAyC,CAEzC,SAAU,CACV,8BAA+B,CAL/B,oCAyCD,CAjCC,oCACC,YAAa,CACb,gBACD,CAEA,4DACC,gDACD,CAEA,oCAEC,2CAA4C,CAD5C,YAED,CAEA,8BACC,8FAKD,CAHC,0CACC,aACD,CAGD,8HAIC,QACD,CAEA,gGAEC,iGACD,CAGD,yBACC,oCACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-color-grid {\n\tdisplay: grid;\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n\n:root {\n\t--ck-color-grid-tile-size: 24px;\n\n\t/* Not using global colors here because these may change but some colors in a pallette\n\t * require special treatment. For instance, this ensures no matter what the UI text color is,\n\t * the check icon will look good on the black color tile. */\n\t--ck-color-color-grid-check-icon: hsl(0, 0%, 0%);\n}\n\n.ck.ck-color-grid {\n\tgrid-gap: 5px;\n\tpadding: 8px;\n}\n\n.ck.ck-color-grid__tile {\n\twidth: var(--ck-color-grid-tile-size);\n\theight: var(--ck-color-grid-tile-size);\n\tmin-width: var(--ck-color-grid-tile-size);\n\tmin-height: var(--ck-color-grid-tile-size);\n\tpadding: 0;\n\ttransition: .2s ease box-shadow;\n\tborder: 0;\n\n\t&.ck-disabled {\n\t\tcursor: unset;\n\t\ttransition: unset;\n\t}\n\n\t&.ck-color-table__color-tile_bordered {\n\t\tbox-shadow: 0 0 0 1px var(--ck-color-base-border);\n\t}\n\n\t& .ck.ck-icon {\n\t\tdisplay: none;\n\t\tcolor: var(--ck-color-color-grid-check-icon);\n\t}\n\n\t&.ck-on {\n\t\tbox-shadow: inset 0 0 0 1px var(--ck-color-base-background), 0 0 0 2px var(--ck-color-base-text);\n\n\t\t& .ck.ck-icon {\n\t\t\tdisplay: block;\n\t\t}\n\t}\n\n\t&.ck-on,\n\t&:focus:not( .ck-disabled ),\n\t&:hover:not( .ck-disabled ) {\n\t\t/* Disable the default .ck-button\'s border ring. */\n\t\tborder: 0;\n\t}\n\n\t&:focus:not( .ck-disabled ),\n\t&:hover:not( .ck-disabled ) {\n\t\tbox-shadow: inset 0 0 0 1px var(--ck-color-base-background), 0 0 0 2px var(--ck-color-focus-border);\n\t}\n}\n\n.ck.ck-color-grid__label {\n\tpadding: 0 var(--ck-spacing-standard);\n}\n'],sourceRoot:""}]);const a=s},5485:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,":root{--ck-dropdown-max-width:75vw}.ck.ck-dropdown{display:inline-block;position:relative}.ck.ck-dropdown .ck-dropdown__arrow{pointer-events:none;z-index:var(--ck-z-default)}.ck.ck-dropdown .ck-button.ck-dropdown__button{width:100%}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on .ck-tooltip{display:none}.ck.ck-dropdown .ck-dropdown__panel{-webkit-backface-visibility:hidden;display:none;max-width:var(--ck-dropdown-max-width);position:absolute;z-index:var(--ck-z-modal)}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel-visible{display:inline-block}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_n,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nme,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nmw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw{bottom:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_s,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sme,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_smw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{bottom:auto;top:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se{left:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{right:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_n,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_s{left:50%;transform:translateX(-50%)}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nmw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_smw{left:75%;transform:translateX(-75%)}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nme,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sme{left:25%;transform:translateX(-25%)}.ck.ck-toolbar .ck-dropdown__panel{z-index:calc(var(--ck-z-modal) + 1)}:root{--ck-dropdown-arrow-size:calc(var(--ck-icon-size)*0.5)}.ck.ck-dropdown{font-size:inherit}.ck.ck-dropdown .ck-dropdown__arrow{width:var(--ck-dropdown-arrow-size)}[dir=ltr] .ck.ck-dropdown .ck-dropdown__arrow{margin-left:var(--ck-spacing-standard);right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-dropdown .ck-dropdown__arrow{left:var(--ck-spacing-standard);margin-right:var(--ck-spacing-small)}.ck.ck-dropdown.ck-disabled .ck-dropdown__arrow{opacity:var(--ck-disabled-opacity)}[dir=ltr] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-left:var(--ck-spacing-small)}[dir=rtl] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-right:var(--ck-spacing-small)}.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{overflow:hidden;text-overflow:ellipsis;width:7em}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on{border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-dropdown__button_label-width_auto .ck-button__label{width:auto}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-off:active,.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on:active{box-shadow:none}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-off:active:focus,.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on:active:focus{box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-dropdown__panel{border-radius:0}.ck-rounded-corners .ck.ck-dropdown__panel,.ck.ck-dropdown__panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-dropdown__panel{background:var(--ck-color-dropdown-panel-background);border:1px solid var(--ck-color-dropdown-panel-border);bottom:0;box-shadow:var(--ck-drop-shadow),0 0;min-width:100%}.ck.ck-dropdown__panel.ck-dropdown__panel_se{border-top-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_sw{border-top-right-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_ne{border-bottom-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_nw{border-bottom-right-radius:0}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/dropdown/dropdown.css","webpack://./../ckeditor5-ui/theme/components/tooltip/mixins/_tooltip.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/dropdown/dropdown.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_disabled.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_shadow.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css"],names:[],mappings:"AAOA,MACC,4BACD,CAEA,gBACC,oBAAqB,CACrB,iBAqFD,CAnFC,oCACC,mBAAoB,CACpB,2BACD,CAGA,+CACC,UAOD,CCUA,iEACC,YACD,CDVA,oCAGC,kCAAmC,CAEnC,YAAa,CAEb,sCAAuC,CAEvC,iBAAkB,CAHlB,yBA4DD,CAvDC,+DACC,oBACD,CAEA,mSAKC,WACD,CAEA,mSAUC,WAAY,CADZ,QAED,CAEA,oHAEC,MACD,CAEA,oHAEC,OACD,CAEA,kHAGC,QAAS,CACT,0BACD,CAEA,sHAGC,QAAS,CACT,0BACD,CAEA,sHAGC,QAAS,CACT,0BACD,CAQF,mCACC,mCACD,CEhGA,MACC,sDACD,CAEA,gBAEC,iBA2ED,CAzEC,oCACC,mCACD,CAGC,8CAIC,sCAAuC,CAHvC,gCAID,CAIA,8CACC,+BAAgC,CAGhC,oCACD,CAGD,gDC/BA,kCDiCA,CAIE,mFAEC,oCACD,CAIA,mFAEC,qCACD,CAID,iEAEC,eAAgB,CAChB,sBAAuB,CAFvB,SAGD,CAGA,6EC1DD,kCD4DC,CAGA,qDACC,2BAA4B,CAC5B,4BACD,CAEA,sGACC,UACD,CAGA,yHAEC,eAKD,CAHC,qIE7EF,2CF+EE,CAKH,uBGlFC,eH8GD,CA5BA,qFG9EE,qCH0GF,CA5BA,uBAIC,oDAAqD,CACrD,sDAAuD,CACvD,QAAS,CE1FT,oCAA8B,CF6F9B,cAmBD,CAfC,6CACC,wBACD,CAEA,6CACC,yBACD,CAEA,6CACC,2BACD,CAEA,6CACC,4BACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import \"../tooltip/mixins/_tooltip.css\";\n\n:root {\n\t--ck-dropdown-max-width: 75vw;\n}\n\n.ck.ck-dropdown {\n\tdisplay: inline-block;\n\tposition: relative;\n\n\t& .ck-dropdown__arrow {\n\t\tpointer-events: none;\n\t\tz-index: var(--ck-z-default);\n\t}\n\n\t/* Dropdown button should span horizontally, e.g. in vertical toolbars */\n\t& .ck-button.ck-dropdown__button {\n\t\twidth: 100%;\n\n\t\t/* Disable main button's tooltip when the dropdown is open. Otherwise the panel may\n\t\tpartially cover the tooltip */\n\t\t&.ck-on {\n\t\t\t@mixin ck-tooltip_disabled;\n\t\t}\n\t}\n\n\t& .ck-dropdown__panel {\n\t\t/* This is to get rid of flickering when the tooltip is shown under the panel,\n\t\twhich looks like the panel moves vertically a pixel down and up. */\n\t\t-webkit-backface-visibility: hidden;\n\n\t\tdisplay: none;\n\t\tz-index: var(--ck-z-modal);\n\t\tmax-width: var(--ck-dropdown-max-width);\n\n\t\tposition: absolute;\n\n\t\t&.ck-dropdown__panel-visible {\n\t\t\tdisplay: inline-block;\n\t\t}\n\n\t\t&.ck-dropdown__panel_ne,\n\t\t&.ck-dropdown__panel_nw,\n\t\t&.ck-dropdown__panel_n,\n\t\t&.ck-dropdown__panel_nmw,\n\t\t&.ck-dropdown__panel_nme {\n\t\t\tbottom: 100%;\n\t\t}\n\n\t\t&.ck-dropdown__panel_se,\n\t\t&.ck-dropdown__panel_sw,\n\t\t&.ck-dropdown__panel_smw,\n\t\t&.ck-dropdown__panel_sme,\n\t\t&.ck-dropdown__panel_s {\n\t\t\t/*\n\t\t\t * Using transform: translate3d( 0, 100%, 0 ) causes blurry dropdown on Chrome 67-78+ on non-retina displays.\n\t\t\t * See https://github.com/ckeditor/ckeditor5/issues/1053.\n\t\t\t */\n\t\t\ttop: 100%;\n\t\t\tbottom: auto;\n\t\t}\n\n\t\t&.ck-dropdown__panel_ne,\n\t\t&.ck-dropdown__panel_se {\n\t\t\tleft: 0px;\n\t\t}\n\n\t\t&.ck-dropdown__panel_nw,\n\t\t&.ck-dropdown__panel_sw {\n\t\t\tright: 0px;\n\t\t}\n\n\t\t&.ck-dropdown__panel_s,\n\t\t&.ck-dropdown__panel_n {\n\t\t\t/* Positioning panels relative to the center of the button */\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t}\n\n\t\t&.ck-dropdown__panel_nmw,\n\t\t&.ck-dropdown__panel_smw {\n\t\t\t/* Positioning panels relative to the middle-west of the button */\n\t\t\tleft: 75%;\n\t\t\ttransform: translateX(-75%);\n\t\t}\n\n\t\t&.ck-dropdown__panel_nme,\n\t\t&.ck-dropdown__panel_sme {\n\t\t\t/* Positioning panels relative to the middle-east of the button */\n\t\t\tleft: 25%;\n\t\t\ttransform: translateX(-25%);\n\t\t}\n\t}\n}\n\n/*\n * Toolbar dropdown panels should be always above the UI (eg. other dropdown panels) from the editor's content.\n * See https://github.com/ckeditor/ckeditor5/issues/7874\n */\n.ck.ck-toolbar .ck-dropdown__panel {\n\tz-index: calc( var(--ck-z-modal) + 1 );\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Enables the tooltip, which is the tooltip is in DOM but\n * not yet displayed.\n */\n@define-mixin ck-tooltip_enabled {\n\t& .ck-tooltip {\n\t\tdisplay: block;\n\n\t\t/*\n\t\t * Don't display tooltips in devices which don't support :hover.\n\t\t * In fact, it's all about iOS, which forces user to click UI elements twice to execute\n\t\t * the primary action, when tooltips are enabled.\n\t\t *\n\t\t * Q: OK, but why not the following query?\n\t\t *\n\t\t * @media (hover) {\n\t\t * display: block;\n\t\t * }\n\t\t *\n\t\t * A: Because FF does not support it and it would completely disable tooltips\n\t\t * in that browser.\n\t\t *\n\t\t * More in https://github.com/ckeditor/ckeditor5/issues/920.\n\t\t */\n\t\t@media (hover:none) {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n\n/**\n * Disables the tooltip making it disappear from DOM.\n */\n@define-mixin ck-tooltip_disabled {\n\t& .ck-tooltip {\n\t\tdisplay: none;\n\t}\n}\n\n/**\n * Shows the tooltip, which is already in DOM.\n * Requires `ck-tooltip_enabled` first.\n */\n@define-mixin ck-tooltip_visible {\n\t& .ck-tooltip {\n\t\tvisibility: visible;\n\t\topacity: 1;\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n@import "../../../mixins/_disabled.css";\n@import "../../../mixins/_shadow.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n:root {\n\t--ck-dropdown-arrow-size: calc(0.5 * var(--ck-icon-size));\n}\n\n.ck.ck-dropdown {\n\t/* Enable font size inheritance, which allows fluid UI scaling. */\n\tfont-size: inherit;\n\n\t& .ck-dropdown__arrow {\n\t\twidth: var(--ck-dropdown-arrow-size);\n\t}\n\n\t@mixin ck-dir ltr {\n\t\t& .ck-dropdown__arrow {\n\t\t\tright: var(--ck-spacing-standard);\n\n\t\t\t/* A space to accommodate the triangle. */\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-dir rtl {\n\t\t& .ck-dropdown__arrow {\n\t\t\tleft: var(--ck-spacing-standard);\n\n\t\t\t/* A space to accommodate the triangle. */\n\t\t\tmargin-right: var(--ck-spacing-small);\n\t\t}\n\t}\n\n\t&.ck-disabled .ck-dropdown__arrow {\n\t\t@mixin ck-disabled;\n\t}\n\n\t& .ck-button.ck-dropdown__button {\n\t\t@mixin ck-dir ltr {\n\t\t\t&:not(.ck-button_with-text) {\n\t\t\t\t/* Make sure dropdowns with just an icon have the right inner spacing */\n\t\t\t\tpadding-left: var(--ck-spacing-small);\n\t\t\t}\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\t&:not(.ck-button_with-text) {\n\t\t\t\t/* Make sure dropdowns with just an icon have the right inner spacing */\n\t\t\t\tpadding-right: var(--ck-spacing-small);\n\t\t\t}\n\t\t}\n\n\t\t/* #23 */\n\t\t& .ck-button__label {\n\t\t\twidth: 7em;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\n\t\t/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/70 */\n\t\t&.ck-disabled .ck-button__label {\n\t\t\t@mixin ck-disabled;\n\t\t}\n\n\t\t/* https://github.com/ckeditor/ckeditor5/issues/816 */\n\t\t&.ck-on {\n\t\t\tborder-bottom-left-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;\n\t\t}\n\n\t\t&.ck-dropdown__button_label-width_auto .ck-button__label {\n\t\t\twidth: auto;\n\t\t}\n\n\t\t/* https://github.com/ckeditor/ckeditor5/issues/8699 */\n\t\t&.ck-off:active,\n\t\t&.ck-on:active {\n\t\t\tbox-shadow: none;\n\t\t\t\n\t\t\t&:focus {\n\t\t\t\t@mixin ck-box-shadow var(--ck-focus-outer-shadow);\n\t\t\t}\n\t\t}\n\t}\n}\n\n.ck.ck-dropdown__panel {\n\t@mixin ck-rounded-corners;\n\t@mixin ck-drop-shadow;\n\n\tbackground: var(--ck-color-dropdown-panel-background);\n\tborder: 1px solid var(--ck-color-dropdown-panel-border);\n\tbottom: 0;\n\n\t/* Make sure the panel is at least as wide as the drop-down\'s button. */\n\tmin-width: 100%;\n\n\t/* Disabled corner border radius to be consistent with the .dropdown__button\n\thttps://github.com/ckeditor/ckeditor5/issues/816 */\n\t&.ck-dropdown__panel_se {\n\t\tborder-top-left-radius: 0;\n\t}\n\n\t&.ck-dropdown__panel_sw {\n\t\tborder-top-right-radius: 0;\n\t}\n\n\t&.ck-dropdown__panel_ne {\n\t\tborder-bottom-left-radius: 0;\n\t}\n\n\t&.ck-dropdown__panel_nw {\n\t\tborder-bottom-right-radius: 0;\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A class which indicates that an element holding it is disabled.\n */\n@define-mixin ck-disabled {\n\topacity: var(--ck-disabled-opacity);\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A helper to combine multiple shadows.\n */\n@define-mixin ck-box-shadow $shadowA, $shadowB: 0 0 {\n\tbox-shadow: $shadowA, $shadowB;\n}\n\n/**\n * Gives an element a drop shadow so it looks like a floating panel.\n */\n@define-mixin ck-drop-shadow {\n\t@mixin ck-box-shadow var(--ck-drop-shadow);\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},3949:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-dropdown .ck-dropdown__panel .ck-list{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list,.ck.ck-dropdown .ck-dropdown__panel .ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}","",{version:3,sources:["webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/dropdown/listdropdown.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css"],names:[],mappings:"AAOA,6CCIC,eDqBD,CAzBA,iICQE,qCAAsC,CDJtC,wBAqBF,CAfE,mFCND,eDYC,CANA,6MCFA,qCAAsC,CDKpC,2BAA4B,CAC5B,4BAA6B,CAF7B,wBAIF,CAEA,kFCdD,eDmBC,CALA,2MCVA,qCAAsC,CDYpC,wBAAyB,CACzB,yBAEF",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n\n.ck.ck-dropdown .ck-dropdown__panel .ck-list {\n\t/* Disabled radius of top-left border to be consistent with .dropdown__button\n\thttps://github.com/ckeditor/ckeditor5/issues/816 */\n\t@mixin ck-rounded-corners {\n\t\tborder-top-left-radius: 0;\n\t}\n\n\t/* Make sure the button belonging to the first/last child of the list goes well with the\n\tborder radius of the entire panel. */\n\t& .ck-list__item {\n\t\t&:first-child .ck-button {\n\t\t\t@mixin ck-rounded-corners {\n\t\t\t\tborder-top-left-radius: 0;\n\t\t\t\tborder-bottom-left-radius: 0;\n\t\t\t\tborder-bottom-right-radius: 0;\n\t\t\t}\n\t\t}\n\n\t\t&:last-child .ck-button {\n\t\t\t@mixin ck-rounded-corners {\n\t\t\t\tborder-top-left-radius: 0;\n\t\t\t\tborder-top-right-radius: 0;\n\t\t\t}\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},7686:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,'.ck.ck-splitbutton{font-size:inherit}.ck.ck-splitbutton .ck-splitbutton__action:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button .ck-tooltip{display:none}:root{--ck-color-split-button-hover-background:#ebebeb;--ck-color-split-button-hover-border:#b3b3b3}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__action{border-bottom-right-radius:unset;border-top-right-radius:unset}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__action{border-bottom-left-radius:unset;border-top-left-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow{min-width:unset}[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-bottom-left-radius:unset;border-top-left-radius:unset}[dir=rtl] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-bottom-right-radius:unset;border-top-right-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow svg{width:var(--ck-dropdown-arrow-size)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover),.ck.ck-splitbutton:hover>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover){background:var(--ck-color-split-button-hover-background)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled):after{background-color:var(--ck-color-split-button-hover-border);content:"";height:100%;position:absolute;width:1px}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled):after{left:-1px}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled):after{right:-1px}.ck.ck-splitbutton.ck-splitbutton_open{border-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__action{border-bottom-left-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__arrow{border-bottom-right-radius:0}',"",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/dropdown/splitbutton.css","webpack://./../ckeditor5-ui/theme/components/tooltip/mixins/_tooltip.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/dropdown/splitbutton.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css"],names:[],mappings:"AAOA,mBAEC,iBAUD,CARC,iDACC,qCACD,CC0BA,8DACC,YACD,CClCD,MACC,gDAAyD,CACzD,4CACD,CAMC,oIAKE,gCAAiC,CADjC,6BASF,CAbA,oIAWE,+BAAgC,CADhC,4BAGF,CAEA,0CAGC,eAiBD,CApBA,oDAQE,+BAAgC,CADhC,4BAaF,CApBA,oDAcE,gCAAiC,CADjC,6BAOF,CAHC,8CACC,mCACD,CASA,0KACC,wDACD,CAIA,8JAKC,0DAA2D,CAJ3D,UAAW,CAGX,WAAY,CAFZ,iBAAkB,CAClB,SAGD,CAGC,kLACC,SACD,CAIA,kLACC,UACD,CAMF,uCC7EA,eDuFA,CAVA,qHCzEC,qCDmFD,CARE,qKACC,2BACD,CAEA,mKACC,4BACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../tooltip/mixins/_tooltip.css";\n\n.ck.ck-splitbutton {\n\t/* Enable font size inheritance, which allows fluid UI scaling. */\n\tfont-size: inherit;\n\n\t& .ck-splitbutton__action:focus {\n\t\tz-index: calc(var(--ck-z-default) + 1);\n\t}\n\n\t/* Disable tooltips for the buttons when the button is "open" */\n\t&.ck-splitbutton_open > .ck-button {\n\t\t@mixin ck-tooltip_disabled;\n\t}\n}\n\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Enables the tooltip, which is the tooltip is in DOM but\n * not yet displayed.\n */\n@define-mixin ck-tooltip_enabled {\n\t& .ck-tooltip {\n\t\tdisplay: block;\n\n\t\t/*\n\t\t * Don't display tooltips in devices which don't support :hover.\n\t\t * In fact, it's all about iOS, which forces user to click UI elements twice to execute\n\t\t * the primary action, when tooltips are enabled.\n\t\t *\n\t\t * Q: OK, but why not the following query?\n\t\t *\n\t\t * @media (hover) {\n\t\t * display: block;\n\t\t * }\n\t\t *\n\t\t * A: Because FF does not support it and it would completely disable tooltips\n\t\t * in that browser.\n\t\t *\n\t\t * More in https://github.com/ckeditor/ckeditor5/issues/920.\n\t\t */\n\t\t@media (hover:none) {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n\n/**\n * Disables the tooltip making it disappear from DOM.\n */\n@define-mixin ck-tooltip_disabled {\n\t& .ck-tooltip {\n\t\tdisplay: none;\n\t}\n}\n\n/**\n * Shows the tooltip, which is already in DOM.\n * Requires `ck-tooltip_enabled` first.\n */\n@define-mixin ck-tooltip_visible {\n\t& .ck-tooltip {\n\t\tvisibility: visible;\n\t\topacity: 1;\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n\n:root {\n\t--ck-color-split-button-hover-background: hsl(0, 0%, 92%);\n\t--ck-color-split-button-hover-border: hsl(0, 0%, 70%);\n}\n\n.ck.ck-splitbutton {\n\t/*\n\t * Note: ck-rounded and ck-dir mixins don\'t go together (because they both use @nest).\n\t */\n\t&:hover > .ck-splitbutton__action,\n\t&.ck-splitbutton_open > .ck-splitbutton__action {\n\t\t@nest [dir="ltr"] & {\n\t\t\t/* Don\'t round the action button on the right side */\n\t\t\tborder-top-right-radius: unset;\n\t\t\tborder-bottom-right-radius: unset;\n\t\t}\n\n\t\t@nest [dir="rtl"] & {\n\t\t\t/* Don\'t round the action button on the left side */\n\t\t\tborder-top-left-radius: unset;\n\t\t\tborder-bottom-left-radius: unset;\n\t\t}\n\t}\n\n\t& > .ck-splitbutton__arrow {\n\t\t/* It\'s a text-less button and since the icon is positioned absolutely in such situation,\n\t\tit must get some arbitrary min-width. */\n\t\tmin-width: unset;\n\n\t\t@nest [dir="ltr"] & {\n\t\t\t/* Don\'t round the arrow button on the left side */\n\t\t\tborder-top-left-radius: unset;\n\t\t\tborder-bottom-left-radius: unset;\n\t\t}\n\n\t\t@nest [dir="rtl"] & {\n\t\t\t/* Don\'t round the arrow button on the right side */\n\t\t\tborder-top-right-radius: unset;\n\t\t\tborder-bottom-right-radius: unset;\n\t\t}\n\n\t\t& svg {\n\t\t\twidth: var(--ck-dropdown-arrow-size);\n\t\t}\n\t}\n\n\t/* When the split button is "open" (the arrow is on) or being hovered, it should get some styling\n\tas a whole. The background of both buttons should stand out and there should be a visual\n\tseparation between both buttons. */\n\t&.ck-splitbutton_open,\n\t&:hover {\n\t\t/* When the split button hovered as a whole, not as individual buttons. */\n\t\t& > .ck-button:not(.ck-on):not(.ck-disabled):not(:hover) {\n\t\t\tbackground: var(--ck-color-split-button-hover-background);\n\t\t}\n\n\t\t/* Splitbutton separator needs to be set with the ::after pseudoselector\n\t\tto display properly the borders on focus */\n\t\t& > .ck-splitbutton__arrow:not(.ck-disabled)::after {\n\t\t\tcontent: \'\';\n\t\t\tposition: absolute;\n\t\t\twidth: 1px;\n\t\t\theight: 100%;\n\t\t\tbackground-color: var(--ck-color-split-button-hover-border);\n\t\t}\n\n\t\t@nest [dir="ltr"] & {\n\t\t\t& > .ck-splitbutton__arrow:not(.ck-disabled)::after {\n\t\t\t\tleft: -1px;\n\t\t\t}\n\t\t}\n\n\t\t@nest [dir="rtl"] & {\n\t\t\t& > .ck-splitbutton__arrow:not(.ck-disabled)::after {\n\t\t\t\tright: -1px;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Don\'t round the bottom left and right corners of the buttons when "open"\n\thttps://github.com/ckeditor/ckeditor5/issues/816 */\n\t&.ck-splitbutton_open {\n\t\t@mixin ck-rounded-corners {\n\t\t\t& > .ck-splitbutton__action {\n\t\t\t\tborder-bottom-left-radius: 0;\n\t\t\t}\n\n\t\t\t& > .ck-splitbutton__arrow {\n\t\t\t\tborder-bottom-right-radius: 0;\n\t\t\t}\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},7339:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,":root{--ck-toolbar-dropdown-max-width:60vw}.ck.ck-toolbar-dropdown>.ck-dropdown__panel{max-width:var(--ck-toolbar-dropdown-max-width);width:max-content}.ck.ck-toolbar-dropdown>.ck-dropdown__panel .ck-button:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-toolbar-dropdown .ck-toolbar{border:0}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/dropdown/toolbardropdown.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/dropdown/toolbardropdown.css"],names:[],mappings:"AAKA,MACC,oCACD,CAEA,4CAGC,8CAA+C,CAD/C,iBAQD,CAJE,6DACC,qCACD,CCZF,oCACC,QACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-toolbar-dropdown-max-width: 60vw;\n}\n\n.ck.ck-toolbar-dropdown > .ck-dropdown__panel {\n\t/* https://github.com/ckeditor/ckeditor5/issues/5586 */\n\twidth: max-content;\n\tmax-width: var(--ck-toolbar-dropdown-max-width);\n\n\t& .ck-button {\n\t\t&:focus {\n\t\t\tz-index: calc(var(--ck-z-default) + 1);\n\t\t}\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-toolbar-dropdown .ck-toolbar {\n\tborder: 0;\n}\n"],sourceRoot:""}]);const a=s},9688:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,":root{--ck-color-editable-blur-selection:#d9d9d9}.ck.ck-editor__editable:not(.ck-editor__nested-editable){border-radius:0}.ck-rounded-corners .ck.ck-editor__editable:not(.ck-editor__nested-editable),.ck.ck-editor__editable.ck-rounded-corners:not(.ck-editor__nested-editable){border-radius:var(--ck-border-radius)}.ck.ck-editor__editable.ck-focused:not(.ck-editor__nested-editable){border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;outline:none}.ck.ck-editor__editable_inline{border:1px solid transparent;overflow:auto;padding:0 var(--ck-spacing-standard)}.ck.ck-editor__editable_inline[dir=ltr]{text-align:left}.ck.ck-editor__editable_inline[dir=rtl]{text-align:right}.ck.ck-editor__editable_inline>:first-child{margin-top:var(--ck-spacing-large)}.ck.ck-editor__editable_inline>:last-child{margin-bottom:var(--ck-spacing-large)}.ck.ck-editor__editable_inline.ck-blurred ::selection{background:var(--ck-color-editable-blur-selection)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_n]:after{border-bottom-color:var(--ck-color-base-foreground)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_s]:after{border-top-color:var(--ck-color-base-foreground)}","",{version:3,sources:["webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/editorui/editorui.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_focus.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_shadow.css"],names:[],mappings:"AAWA,MACC,0CACD,CAEA,yDCJC,eDWD,CAPA,yJCAE,qCDOF,CAJC,oEEPA,2BAA2B,CCF3B,qCAA8B,CDC9B,YFWA,CAGD,+BAGC,4BAA6B,CAF7B,aAAc,CACd,oCA6BD,CA1BC,wCACC,eACD,CAEA,wCACC,gBACD,CAGA,4CACC,kCACD,CAGA,2CAKC,qCACD,CAGA,sDACC,kDACD,CAKA,gEACC,mDACD,CAIA,gEACC,gDACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n@import "../../../mixins/_disabled.css";\n@import "../../../mixins/_shadow.css";\n@import "../../../mixins/_focus.css";\n@import "../../mixins/_button.css";\n\n:root {\n\t--ck-color-editable-blur-selection: hsl(0, 0%, 85%);\n}\n\n.ck.ck-editor__editable:not(.ck-editor__nested-editable) {\n\t@mixin ck-rounded-corners;\n\n\t&.ck-focused {\n\t\t@mixin ck-focus-ring;\n\t\t@mixin ck-box-shadow var(--ck-inner-shadow);\n\t}\n}\n\n.ck.ck-editor__editable_inline {\n\toverflow: auto;\n\tpadding: 0 var(--ck-spacing-standard);\n\tborder: 1px solid transparent;\n\n\t&[dir="ltr"] {\n\t\ttext-align: left;\n\t}\n\n\t&[dir="rtl"] {\n\t\ttext-align: right;\n\t}\n\n\t/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/116 */\n\t& > *:first-child {\n\t\tmargin-top: var(--ck-spacing-large);\n\t}\n\n\t/* https://github.com/ckeditor/ckeditor5/issues/847 */\n\t& > *:last-child {\n\t\t/*\n\t\t * This value should match with the default margins of the block elements (like .media or .image)\n\t\t * to avoid a content jumping when the fake selection container shows up (See https://github.com/ckeditor/ckeditor5/issues/9825).\n\t\t */\n\t\tmargin-bottom: var(--ck-spacing-large);\n\t}\n\n\t/* https://github.com/ckeditor/ckeditor5/issues/6517 */\n\t&.ck-blurred ::selection {\n\t\tbackground: var(--ck-color-editable-blur-selection);\n\t}\n}\n\n/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/111 */\n.ck.ck-balloon-panel.ck-toolbar-container[class*="arrow_n"] {\n\t&::after {\n\t\tborder-bottom-color: var(--ck-color-base-foreground);\n\t}\n}\n\n.ck.ck-balloon-panel.ck-toolbar-container[class*="arrow_s"] {\n\t&::after {\n\t\tborder-top-color: var(--ck-color-base-foreground);\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A visual style of focused element's border.\n */\n@define-mixin ck-focus-ring {\n\t/* Disable native outline. */\n\toutline: none;\n\tborder: var(--ck-focus-ring)\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A helper to combine multiple shadows.\n */\n@define-mixin ck-box-shadow $shadowA, $shadowB: 0 0 {\n\tbox-shadow: $shadowA, $shadowB;\n}\n\n/**\n * Gives an element a drop shadow so it looks like a floating panel.\n */\n@define-mixin ck-drop-shadow {\n\t@mixin ck-box-shadow var(--ck-drop-shadow);\n}\n"],sourceRoot:""}]);const a=s},8847:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-form__header{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}:root{--ck-form-header-height:38px}.ck.ck-form__header{border-bottom:1px solid var(--ck-color-base-border);height:var(--ck-form-header-height);line-height:var(--ck-form-header-height);padding:var(--ck-spacing-small) var(--ck-spacing-large)}.ck.ck-form__header .ck-form__header__label{font-weight:700}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/formheader/formheader.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/formheader/formheader.css"],names:[],mappings:"AAKA,oBAIC,kBAAmB,CAHnB,YAAa,CACb,kBAAmB,CACnB,gBAAiB,CAEjB,6BACD,CCNA,MACC,4BACD,CAEA,oBAIC,mDAAoD,CAFpD,mCAAoC,CACpC,wCAAyC,CAFzC,uDAQD,CAHC,4CACC,eACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-form__header {\n\tdisplay: flex;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\talign-items: center;\n\tjustify-content: space-between;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-form-header-height: 38px;\n}\n\n.ck.ck-form__header {\n\tpadding: var(--ck-spacing-small) var(--ck-spacing-large);\n\theight: var(--ck-form-header-height);\n\tline-height: var(--ck-form-header-height);\n\tborder-bottom: 1px solid var(--ck-color-base-border);\n\n\t& .ck-form__header__label {\n\t\tfont-weight: bold;\n\t}\n}\n"],sourceRoot:""}]);const a=s},6574:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-icon{vertical-align:middle}:root{--ck-icon-size:calc(var(--ck-line-height-base)*var(--ck-font-size-normal))}.ck.ck-icon{font-size:.8333350694em;height:var(--ck-icon-size);width:var(--ck-icon-size);will-change:transform}.ck.ck-icon,.ck.ck-icon *{color:inherit;cursor:inherit}.ck.ck-icon :not([fill]){fill:currentColor}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/icon/icon.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/icon/icon.css"],names:[],mappings:"AAKA,YACC,qBACD,CCFA,MACC,0EACD,CAEA,YAKC,uBAAwB,CAHxB,0BAA2B,CAD3B,yBAA0B,CAY1B,qBAcD,CAZC,0BARA,aAAc,CAGd,cAgBA,CAJC,yBAEC,iBACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-icon {\n\tvertical-align: middle;\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-icon-size: calc(var(--ck-line-height-base) * var(--ck-font-size-normal));\n}\n\n.ck.ck-icon {\n\twidth: var(--ck-icon-size);\n\theight: var(--ck-icon-size);\n\n\t/* Multiplied by the height of the line in "px" should give SVG "viewport" dimensions */\n\tfont-size: .8333350694em;\n\n\tcolor: inherit;\n\n\t/* Inherit cursor style (#5). */\n\tcursor: inherit;\n\n\t/* This will prevent blurry icons on Firefox. See #340. */\n\twill-change: transform;\n\n\t& * {\n\t\t/* Inherit cursor style (#5). */\n\t\tcursor: inherit;\n\n\t\t/* Allows dynamic coloring of the icons. */\n\t\tcolor: inherit;\n\n\t\t&:not([fill]) {\n\t\t\t/* Needed by FF. */\n\t\t\tfill: currentColor;\n\t\t}\n\t}\n}\n'],sourceRoot:""}]);const a=s},4879:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,":root{--ck-input-width:18em;--ck-input-text-width:var(--ck-input-width)}.ck.ck-input{border-radius:0}.ck-rounded-corners .ck.ck-input,.ck.ck-input.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input{background:var(--ck-color-input-background);border:1px solid var(--ck-color-input-border);min-height:var(--ck-ui-component-min-height);min-width:var(--ck-input-width);padding:var(--ck-spacing-extra-tiny) var(--ck-spacing-medium);transition:box-shadow .1s ease-in-out,border .1s ease-in-out}.ck.ck-input:focus{border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0;outline:none}.ck.ck-input[readonly]{background:var(--ck-color-input-disabled-background);border:1px solid var(--ck-color-input-disabled-border);color:var(--ck-color-input-disabled-text)}.ck.ck-input[readonly]:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-input.ck-error{animation:ck-input-shake .3s ease both;border-color:var(--ck-color-input-error-border)}.ck.ck-input.ck-error:focus{box-shadow:var(--ck-focus-error-outer-shadow),0 0}@keyframes ck-input-shake{20%{transform:translateX(-2px)}40%{transform:translateX(2px)}60%{transform:translateX(-1px)}80%{transform:translateX(1px)}}","",{version:3,sources:["webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/input/input.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_focus.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_shadow.css"],names:[],mappings:"AASA,MACC,qBAAsB,CAGtB,2CACD,CAEA,aCLC,eD2CD,CAtCA,iECDE,qCDuCF,CAtCA,aAGC,2CAA4C,CAC5C,6CAA8C,CAK9C,4CAA6C,CAH7C,+BAAgC,CADhC,6DAA8D,CAO9D,4DA0BD,CAxBC,mBEnBA,2BAA2B,CCF3B,2CAA8B,CDC9B,YFuBA,CAEA,uBAEC,oDAAqD,CADrD,sDAAuD,CAEvD,yCAMD,CAJC,6BG/BD,oDHkCC,CAGD,sBAEC,sCAAuC,CADvC,+CAMD,CAHC,4BGzCD,iDH2CC,CAIF,0BACC,IACC,0BACD,CAEA,IACC,yBACD,CAEA,IACC,0BACD,CAEA,IACC,yBACD,CACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n@import "../../../mixins/_focus.css";\n@import "../../../mixins/_shadow.css";\n\n:root {\n\t--ck-input-width: 18em;\n\n\t/* Backward compatibility. */\n\t--ck-input-text-width: var(--ck-input-width);\n}\n\n.ck.ck-input {\n\t@mixin ck-rounded-corners;\n\n\tbackground: var(--ck-color-input-background);\n\tborder: 1px solid var(--ck-color-input-border);\n\tpadding: var(--ck-spacing-extra-tiny) var(--ck-spacing-medium);\n\tmin-width: var(--ck-input-width);\n\n\t/* This is important to stay of the same height as surrounding buttons */\n\tmin-height: var(--ck-ui-component-min-height);\n\n\t/* Apply some smooth transition to the box-shadow and border. */\n\ttransition: box-shadow .1s ease-in-out, border .1s ease-in-out;\n\n\t&:focus {\n\t\t@mixin ck-focus-ring;\n\t\t@mixin ck-box-shadow var(--ck-focus-outer-shadow);\n\t}\n\n\t&[readonly] {\n\t\tborder: 1px solid var(--ck-color-input-disabled-border);\n\t\tbackground: var(--ck-color-input-disabled-background);\n\t\tcolor: var(--ck-color-input-disabled-text);\n\n\t\t&:focus {\n\t\t\t/* The read-only input should have a slightly less visible shadow when focused. */\n\t\t\t@mixin ck-box-shadow var(--ck-focus-disabled-outer-shadow);\n\t\t}\n\t}\n\n\t&.ck-error {\n\t\tborder-color: var(--ck-color-input-error-border);\n\t\tanimation: ck-input-shake .3s ease both;\n\n\t\t&:focus {\n\t\t\t@mixin ck-box-shadow var(--ck-focus-error-outer-shadow);\n\t\t}\n\t}\n}\n\n@keyframes ck-input-shake {\n\t20% {\n\t\ttransform: translateX(-2px);\n\t}\n\n\t40% {\n\t\ttransform: translateX(2px);\n\t}\n\n\t60% {\n\t\ttransform: translateX(-1px);\n\t}\n\n\t80% {\n\t\ttransform: translateX(1px);\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A visual style of focused element's border.\n */\n@define-mixin ck-focus-ring {\n\t/* Disable native outline. */\n\toutline: none;\n\tborder: var(--ck-focus-ring)\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A helper to combine multiple shadows.\n */\n@define-mixin ck-box-shadow $shadowA, $shadowB: 0 0 {\n\tbox-shadow: $shadowA, $shadowB;\n}\n\n/**\n * Gives an element a drop shadow so it looks like a floating panel.\n */\n@define-mixin ck-drop-shadow {\n\t@mixin ck-box-shadow var(--ck-drop-shadow);\n}\n"],sourceRoot:""}]);const a=s},3662:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-label{display:block}.ck.ck-voice-label{display:none}.ck.ck-label{font-weight:700}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/label/label.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/label/label.css"],names:[],mappings:"AAKA,aACC,aACD,CAEA,mBACC,YACD,CCNA,aACC,eACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-label {\n\tdisplay: block;\n}\n\n.ck.ck-voice-label {\n\tdisplay: none;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-label {\n\tfont-weight: bold;\n}\n"],sourceRoot:""}]);const a=s},2577:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper{display:flex;position:relative}.ck.ck-labeled-field-view .ck.ck-label{display:block;position:absolute}:root{--ck-labeled-field-view-transition:.1s cubic-bezier(0,0,0.24,0.95);--ck-labeled-field-empty-unfocused-max-width:100% - 2 * var(--ck-spacing-medium);--ck-color-labeled-field-label-background:var(--ck-color-base-background)}.ck.ck-labeled-field-view{border-radius:0}.ck-rounded-corners .ck.ck-labeled-field-view,.ck.ck-labeled-field-view.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper{width:100%}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{top:0}[dir=ltr] .ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{left:0}[dir=rtl] .ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{right:0}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{background:var(--ck-color-labeled-field-label-background);font-weight:400;line-height:normal;max-width:100%;overflow:hidden;padding:0 calc(var(--ck-font-size-tiny)*.5);pointer-events:none;text-overflow:ellipsis;transform:translate(var(--ck-spacing-medium),-6px) scale(.75);transform-origin:0 0;transition:transform var(--ck-labeled-field-view-transition),padding var(--ck-labeled-field-view-transition),background var(--ck-labeled-field-view-transition)}.ck.ck-labeled-field-view.ck-error .ck-input:not([readonly])+.ck.ck-label,.ck.ck-labeled-field-view.ck-error>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view .ck-labeled-field-view__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-field-view .ck-labeled-field-view__status.ck-labeled-field-view__status_error{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view.ck-disabled>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{color:var(--ck-color-input-disabled-text)}[dir=ltr] .ck.ck-labeled-field-view.ck-disabled.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,[dir=ltr] .ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{transform:translate(var(--ck-spacing-medium),calc(var(--ck-font-size-base)*.6)) scale(1)}[dir=rtl] .ck.ck-labeled-field-view.ck-disabled.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,[dir=rtl] .ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{transform:translate(calc(var(--ck-spacing-medium)*-1),calc(var(--ck-font-size-base)*.6)) scale(1)}.ck.ck-labeled-field-view.ck-disabled.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{background:transparent;max-width:calc(var(--ck-labeled-field-empty-unfocused-max-width));padding:0}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown>.ck.ck-button{background:transparent}.ck.ck-labeled-field-view.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown>.ck-button>.ck-button__label{opacity:0}.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown+.ck-label{max-width:calc(var(--ck-labeled-field-empty-unfocused-max-width) - var(--ck-dropdown-arrow-size) - var(--ck-spacing-standard))}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/labeledfield/labeledfieldview.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/labeledfield/labeledfieldview.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css"],names:[],mappings:"AAMC,mEACC,YAAa,CACb,iBACD,CAEA,uCACC,aAAc,CACd,iBACD,CCND,MACC,kEAAsE,CACtE,gFAAiF,CACjF,yEACD,CAEA,0BCHC,eD4GD,CAzGA,2FCCE,qCDwGF,CAtGC,mEACC,UAmCD,CAjCC,gFACC,KA+BD,CAhCA,0FAIE,MA4BF,CAhCA,0FAQE,OAwBF,CAhCA,gFAiBC,yDAA0D,CAG1D,eAAmB,CADnB,kBAAoB,CAOpB,cAAe,CAFf,eAAgB,CANhB,2CAA8C,CAP9C,mBAAoB,CAYpB,sBAAuB,CARvB,6DAA+D,CAH/D,oBAAqB,CAgBrB,+JAID,CAQA,mKACC,gCACD,CAGD,yDACC,mCAAoC,CACpC,kCAAmC,CAInC,kBAKD,CAHC,6FACC,gCACD,CAID,4OAEC,yCACD,CAIA,oUAGE,wFAYF,CAfA,oUAOE,iGAQF,CAfA,gTAaC,sBAAuB,CAFvB,iEAAkE,CAGlE,SACD,CAKA,8FACC,sBACD,CAGA,yIACC,SACD,CAGA,kMACC,8HACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-labeled-field-view {\n\t& > .ck.ck-labeled-field-view__input-wrapper {\n\t\tdisplay: flex;\n\t\tposition: relative;\n\t}\n\n\t& .ck.ck-label {\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n@import "../../../mixins/_rounded.css";\n\n:root {\n\t--ck-labeled-field-view-transition: .1s cubic-bezier(0, 0, 0.24, 0.95);\n\t--ck-labeled-field-empty-unfocused-max-width: 100% - 2 * var(--ck-spacing-medium);\n\t--ck-color-labeled-field-label-background: var(--ck-color-base-background);\n}\n\n.ck.ck-labeled-field-view {\n\t@mixin ck-rounded-corners;\n\n\t& > .ck.ck-labeled-field-view__input-wrapper {\n\t\twidth: 100%;\n\n\t\t& > .ck.ck-label {\n\t\t\ttop: 0px;\n\n\t\t\t@mixin ck-dir ltr {\n\t\t\t\tleft: 0px;\n\t\t\t}\n\n\t\t\t@mixin ck-dir rtl {\n\t\t\t\tright: 0px;\n\t\t\t}\n\n\t\t\tpointer-events: none;\n\t\t\ttransform-origin: 0 0;\n\n\t\t\t/* By default, display the label scaled down above the field. */\n\t\t\ttransform: translate(var(--ck-spacing-medium), -6px) scale(.75);\n\n\t\t\tbackground: var(--ck-color-labeled-field-label-background);\n\t\t\tpadding: 0 calc(.5 * var(--ck-font-size-tiny));\n\t\t\tline-height: initial;\n\t\t\tfont-weight: normal;\n\n\t\t\t/* Prevent overflow when the label is longer than the input */\n\t\t\ttext-overflow: ellipsis;\n\t\t\toverflow: hidden;\n\n\t\t\tmax-width: 100%;\n\n\t\t\ttransition:\n\t\t\t\ttransform var(--ck-labeled-field-view-transition),\n\t\t\t\tpadding var(--ck-labeled-field-view-transition),\n\t\t\t\tbackground var(--ck-labeled-field-view-transition);\n\t\t}\n\t}\n\n\t&.ck-error {\n\t\t& > .ck.ck-labeled-field-view__input-wrapper > .ck.ck-label {\n\t\t\tcolor: var(--ck-color-base-error);\n\t\t}\n\n\t\t& .ck-input:not([readonly]) + .ck.ck-label {\n\t\t\tcolor: var(--ck-color-base-error);\n\t\t}\n\t}\n\n\t& .ck-labeled-field-view__status {\n\t\tfont-size: var(--ck-font-size-small);\n\t\tmargin-top: var(--ck-spacing-small);\n\n\t\t/* Let the info wrap to the next line to avoid stretching the layout horizontally.\n\t\tThe status could be very long. */\n\t\twhite-space: normal;\n\n\t\t&.ck-labeled-field-view__status_error {\n\t\t\tcolor: var(--ck-color-base-error);\n\t\t}\n\t}\n\n\t/* Disabled fields and fields that have no focus should fade out. */\n\t&.ck-disabled > .ck.ck-labeled-field-view__input-wrapper > .ck.ck-label,\n\t&.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused) > .ck.ck-labeled-field-view__input-wrapper > .ck.ck-label {\n\t\tcolor: var(--ck-color-input-disabled-text);\n\t}\n\n\t/* Fields that are disabled or not focused and without a placeholder should have full-sized labels. */\n\t/* stylelint-disable-next-line no-descending-specificity */\n\t&.ck-disabled.ck-labeled-field-view_empty > .ck.ck-labeled-field-view__input-wrapper > .ck.ck-label,\n\t&.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder) > .ck.ck-labeled-field-view__input-wrapper > .ck.ck-label {\n\t\t@mixin ck-dir ltr {\n\t\t\ttransform: translate(var(--ck-spacing-medium), calc(0.6 * var(--ck-font-size-base))) scale(1);\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\ttransform: translate(calc(-1 * var(--ck-spacing-medium)), calc(0.6 * var(--ck-font-size-base))) scale(1);\n\t\t}\n\n\t\t/* Compensate for the default translate position. */\n\t\tmax-width: calc(var(--ck-labeled-field-empty-unfocused-max-width));\n\n\t\tbackground: transparent;\n\t\tpadding: 0;\n\t}\n\n\t/*------ DropdownView integration ----------------------------------------------------------------------------------- */\n\n\t/* Make sure dropdown\' background color in any of dropdown\'s state does not collide with labeled field. */\n\t& > .ck.ck-labeled-field-view__input-wrapper > .ck-dropdown > .ck.ck-button {\n\t\tbackground: transparent;\n\t}\n\n\t/* When the dropdown is "empty", the labeled field label replaces its label. */\n\t&.ck-labeled-field-view_empty > .ck.ck-labeled-field-view__input-wrapper > .ck-dropdown > .ck-button > .ck-button__label {\n\t\topacity: 0;\n\t}\n\n\t/* Make sure the label of the empty, unfocused input does not cover the dropdown arrow. */\n\t&.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder) > .ck.ck-labeled-field-view__input-wrapper > .ck-dropdown + .ck-label {\n\t\tmax-width: calc(var(--ck-labeled-field-empty-unfocused-max-width) - var(--ck-dropdown-arrow-size) - var(--ck-spacing-standard));\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},1046:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-list{display:flex;flex-direction:column;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.ck.ck-list .ck-list__item,.ck.ck-list .ck-list__separator{display:block}.ck.ck-list .ck-list__item>:focus{position:relative;z-index:var(--ck-z-default)}.ck.ck-list{border-radius:0}.ck-rounded-corners .ck.ck-list,.ck.ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-list{background:var(--ck-color-list-background);list-style-type:none}.ck.ck-list__item{cursor:default;min-width:12em}.ck.ck-list__item .ck-button{border-radius:0;min-height:unset;padding:calc(var(--ck-line-height-base)*.2*var(--ck-font-size-base)) calc(var(--ck-line-height-base)*.4*var(--ck-font-size-base));text-align:left;width:100%}.ck.ck-list__item .ck-button .ck-button__label{line-height:calc(var(--ck-line-height-base)*1.2*var(--ck-font-size-base))}.ck.ck-list__item .ck-button:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on{background:var(--ck-color-list-button-on-background);color:var(--ck-color-list-button-on-text)}.ck.ck-list__item .ck-button.ck-on:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-on-background-focus)}.ck.ck-list__item .ck-button.ck-on:focus:not(.ck-disabled){border-color:var(--ck-color-base-background)}.ck.ck-list__item .ck-button:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background)}.ck.ck-list__item .ck-switchbutton.ck-on{background:var(--ck-color-list-background);color:inherit}.ck.ck-list__item .ck-switchbutton.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background);color:inherit}.ck.ck-list__separator{background:var(--ck-color-base-border);height:1px;width:100%}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/list/list.css","webpack://./../ckeditor5-ui/theme/mixins/_unselectable.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/list/list.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css"],names:[],mappings:"AAOA,YAGC,YAAa,CACb,qBAAsB,CCFtB,qBAAsB,CACtB,wBAAyB,CACzB,oBAAqB,CACrB,gBDaD,CAZC,2DAEC,aACD,CAKA,kCACC,iBAAkB,CAClB,2BACD,CEfD,YCEC,eDGD,CALA,+DCME,qCDDF,CALA,YAIC,0CAA2C,CAD3C,oBAED,CAEA,kBACC,cAAe,CACf,cA2DD,CAzDC,6BAIC,eAAgB,CAHhB,gBAAiB,CAQjB,iIAEiE,CARjE,eAAgB,CADhB,UAwCD,CA7BC,+CAEC,yEACD,CAEA,oCACC,eACD,CAEA,mCACC,oDAAqD,CACrD,yCAaD,CAXC,0CACC,eACD,CAEA,2DACC,0DACD,CAEA,2DACC,4CACD,CAGD,qDACC,uDACD,CAMA,yCACC,0CAA2C,CAC3C,aAMD,CAJC,iEACC,uDAAwD,CACxD,aACD,CAKH,uBAGC,sCAAuC,CAFvC,UAAW,CACX,UAED",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../mixins/_unselectable.css";\n\n.ck.ck-list {\n\t@mixin ck-unselectable;\n\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t& .ck-list__item,\n\t& .ck-list__separator {\n\t\tdisplay: block;\n\t}\n\n\t/* Make sure that whatever child of the list item gets focus, it remains on the\n\ttop. Thanks to that, styles like box-shadow, outline, etc. are not masked by\n\tadjacent list items. */\n\t& .ck-list__item > *:focus {\n\t\tposition: relative;\n\t\tz-index: var(--ck-z-default);\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Makes element unselectable.\n */\n@define-mixin ck-unselectable {\n\t-moz-user-select: none;\n\t-webkit-user-select: none;\n\t-ms-user-select: none;\n\tuser-select: none\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_disabled.css";\n@import "../../../mixins/_rounded.css";\n@import "../../../mixins/_shadow.css";\n\n.ck.ck-list {\n\t@mixin ck-rounded-corners;\n\n\tlist-style-type: none;\n\tbackground: var(--ck-color-list-background);\n}\n\n.ck.ck-list__item {\n\tcursor: default;\n\tmin-width: 12em;\n\n\t& .ck-button {\n\t\tmin-height: unset;\n\t\twidth: 100%;\n\t\ttext-align: left;\n\t\tborder-radius: 0;\n\n\t\t/* List items should have the same height. Use absolute units to make sure it is so\n\t\t because e.g. different heading styles may have different height\n\t\t https://github.com/ckeditor/ckeditor5-heading/issues/63 */\n\t\tpadding:\n\t\t\tcalc(.2 * var(--ck-line-height-base) * var(--ck-font-size-base))\n\t\t\tcalc(.4 * var(--ck-line-height-base) * var(--ck-font-size-base));\n\n\t\t& .ck-button__label {\n\t\t\t/* https://github.com/ckeditor/ckeditor5-heading/issues/63 */\n\t\t\tline-height: calc(1.2 * var(--ck-line-height-base) * var(--ck-font-size-base));\n\t\t}\n\n\t\t&:active {\n\t\t\tbox-shadow: none;\n\t\t}\n\n\t\t&.ck-on {\n\t\t\tbackground: var(--ck-color-list-button-on-background);\n\t\t\tcolor: var(--ck-color-list-button-on-text);\n\n\t\t\t&:active {\n\t\t\t\tbox-shadow: none;\n\t\t\t}\n\n\t\t\t&:hover:not(.ck-disabled) {\n\t\t\t\tbackground: var(--ck-color-list-button-on-background-focus);\n\t\t\t}\n\n\t\t\t&:focus:not(.ck-disabled) {\n\t\t\t\tborder-color: var(--ck-color-base-background);\n\t\t\t}\n\t\t}\n\n\t\t&:hover:not(.ck-disabled) {\n\t\t\tbackground: var(--ck-color-list-button-hover-background);\n\t\t}\n\t}\n\n\t/* It\'s unnecessary to change the background/text of a switch toggle; it has different ways\n\tof conveying its state (like the switcher) */\n\t& .ck-switchbutton {\n\t\t&.ck-on {\n\t\t\tbackground: var(--ck-color-list-background);\n\t\t\tcolor: inherit;\n\n\t\t\t&:hover:not(.ck-disabled) {\n\t\t\t\tbackground: var(--ck-color-list-button-hover-background);\n\t\t\t\tcolor: inherit;\n\t\t\t}\n\t\t}\n\t}\n}\n\n.ck.ck-list__separator {\n\theight: 1px;\n\twidth: 100%;\n\tbackground: var(--ck-color-base-border);\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},8793:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,':root{--ck-balloon-panel-arrow-z-index:calc(var(--ck-z-default) - 3)}.ck.ck-balloon-panel{display:none;position:absolute;z-index:var(--ck-z-modal)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{content:"";position:absolute}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_n]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_n]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_s]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_s]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel.ck-balloon-panel_visible{display:block}:root{--ck-balloon-arrow-offset:2px;--ck-balloon-arrow-height:10px;--ck-balloon-arrow-half-width:8px;--ck-balloon-arrow-drop-shadow:0 2px 2px var(--ck-color-shadow-drop)}.ck.ck-balloon-panel{border-radius:0}.ck-rounded-corners .ck.ck-balloon-panel,.ck.ck-balloon-panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-balloon-panel{background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border);box-shadow:var(--ck-drop-shadow),0 0;min-height:15px}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{border-style:solid;height:0;width:0}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-width:0 var(--ck-balloon-arrow-half-width) var(--ck-balloon-arrow-height) var(--ck-balloon-arrow-half-width)}.ck.ck-balloon-panel[class*=arrow_n]:before{border-color:transparent transparent var(--ck-color-panel-border) transparent}.ck.ck-balloon-panel[class*=arrow_n]:after{border-color:transparent transparent var(--ck-color-panel-background) transparent;margin-top:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-width:var(--ck-balloon-arrow-height) var(--ck-balloon-arrow-half-width) 0 var(--ck-balloon-arrow-half-width)}.ck.ck-balloon-panel[class*=arrow_s]:before{border-color:var(--ck-color-panel-border) transparent transparent;filter:drop-shadow(var(--ck-balloon-arrow-drop-shadow))}.ck.ck-balloon-panel[class*=arrow_s]:after{border-color:var(--ck-color-panel-background) transparent transparent transparent;margin-bottom:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:before{left:50%;margin-left:calc(var(--ck-balloon-arrow-half-width)*-1);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:before{left:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:before{right:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:before{bottom:calc(var(--ck-balloon-arrow-height)*-1);left:50%;margin-left:calc(var(--ck-balloon-arrow-half-width)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:before{bottom:calc(var(--ck-balloon-arrow-height)*-1);left:calc(var(--ck-balloon-arrow-half-width)*2)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:before{bottom:calc(var(--ck-balloon-arrow-height)*-1);right:calc(var(--ck-balloon-arrow-half-width)*2)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:before{bottom:calc(var(--ck-balloon-arrow-height)*-1);margin-right:calc(var(--ck-balloon-arrow-half-width)*2);right:25%}.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:before{bottom:calc(var(--ck-balloon-arrow-height)*-1);left:25%;margin-left:calc(var(--ck-balloon-arrow-half-width)*2)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:before{margin-right:calc(var(--ck-balloon-arrow-half-width)*2);right:25%;top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:before{left:25%;margin-left:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}',"",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/panel/balloonpanel.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/panel/balloonpanel.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_shadow.css"],names:[],mappings:"AAKA,MAEC,8DACD,CAEA,qBACC,YAAa,CACb,iBAAkB,CAElB,yBAyCD,CAtCE,+GAEC,UAAW,CACX,iBACD,CAEA,wDACC,6CACD,CAEA,uDACC,uDACD,CAIA,4CACC,6CACD,CAEA,2CACC,uDACD,CAIA,4CACC,6CACD,CAEA,2CACC,uDACD,CAGD,8CACC,aACD,CC9CD,MACC,6BAA8B,CAC9B,8BAA+B,CAC/B,iCAAkC,CAClC,oEACD,CAEA,qBCJC,eD4ID,CAxIA,iFCAE,qCDwIF,CAxIA,qBAMC,2CAA4C,CAC5C,6CAA8C,CEb9C,oCAA8B,CFU9B,eAoID,CA9HE,+GAIC,kBAAmB,CADnB,QAAS,CADT,OAGD,CAIA,uFAEC,mHACD,CAEA,4CACC,6EACD,CAEA,2CACC,iFAAkF,CAClF,yCACD,CAIA,uFAEC,mHACD,CAEA,4CACC,iEAAkE,CAClE,uDACD,CAEA,2CACC,iFAAkF,CAClF,4CACD,CAIA,yGAEC,QAAS,CACT,uDAA0D,CAC1D,2CACD,CAIA,2GAEC,+CAAkD,CAClD,2CACD,CAIA,2GAEC,gDAAmD,CACnD,2CACD,CAIA,yGAIC,8CAAiD,CAFjD,QAAS,CACT,uDAED,CAIA,2GAGC,8CAAiD,CADjD,+CAED,CAIA,2GAGC,8CAAiD,CADjD,gDAED,CAIA,6GAIC,8CAAiD,CADjD,uDAA0D,CAD1D,SAGD,CAIA,6GAIC,8CAAiD,CAFjD,QAAS,CACT,sDAED,CAIA,6GAGC,uDAA0D,CAD1D,SAAU,CAEV,2CACD,CAIA,6GAEC,QAAS,CACT,sDAAyD,CACzD,2CACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t/* Make sure the balloon arrow does not float over its children. */\n\t--ck-balloon-panel-arrow-z-index: calc(var(--ck-z-default) - 3);\n}\n\n.ck.ck-balloon-panel {\n\tdisplay: none;\n\tposition: absolute;\n\n\tz-index: var(--ck-z-modal);\n\n\t&.ck-balloon-panel_with-arrow {\n\t\t&::before,\n\t\t&::after {\n\t\t\tcontent: "";\n\t\t\tposition: absolute;\n\t\t}\n\n\t\t&::before {\n\t\t\tz-index: var(--ck-balloon-panel-arrow-z-index);\n\t\t}\n\n\t\t&::after {\n\t\t\tz-index: calc(var(--ck-balloon-panel-arrow-z-index) + 1);\n\t\t}\n\t}\n\n\t&[class*="arrow_n"] {\n\t\t&::before {\n\t\t\tz-index: var(--ck-balloon-panel-arrow-z-index);\n\t\t}\n\n\t\t&::after {\n\t\t\tz-index: calc(var(--ck-balloon-panel-arrow-z-index) + 1);\n\t\t}\n\t}\n\n\t&[class*="arrow_s"] {\n\t\t&::before {\n\t\t\tz-index: var(--ck-balloon-panel-arrow-z-index);\n\t\t}\n\n\t\t&::after {\n\t\t\tz-index: calc(var(--ck-balloon-panel-arrow-z-index) + 1);\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_visible {\n\t\tdisplay: block;\n\t}\n}\n','/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n@import "../../../mixins/_shadow.css";\n\n:root {\n\t--ck-balloon-arrow-offset: 2px;\n\t--ck-balloon-arrow-height: 10px;\n\t--ck-balloon-arrow-half-width: 8px;\n\t--ck-balloon-arrow-drop-shadow: 0 2px 2px var(--ck-color-shadow-drop);\n}\n\n.ck.ck-balloon-panel {\n\t@mixin ck-rounded-corners;\n\t@mixin ck-drop-shadow;\n\n\tmin-height: 15px;\n\n\tbackground: var(--ck-color-panel-background);\n\tborder: 1px solid var(--ck-color-panel-border);\n\n\t&.ck-balloon-panel_with-arrow {\n\t\t&::before,\n\t\t&::after {\n\t\t\twidth: 0;\n\t\t\theight: 0;\n\t\t\tborder-style: solid;\n\t\t}\n\t}\n\n\t&[class*="arrow_n"] {\n\t\t&::before,\n\t\t&::after {\n\t\t\tborder-width: 0 var(--ck-balloon-arrow-half-width) var(--ck-balloon-arrow-height) var(--ck-balloon-arrow-half-width);\n\t\t}\n\n\t\t&::before {\n\t\t\tborder-color: transparent transparent var(--ck-color-panel-border) transparent;\n\t\t}\n\n\t\t&::after {\n\t\t\tborder-color: transparent transparent var(--ck-color-panel-background) transparent;\n\t\t\tmargin-top: var(--ck-balloon-arrow-offset);\n\t\t}\n\t}\n\n\t&[class*="arrow_s"] {\n\t\t&::before,\n\t\t&::after {\n\t\t\tborder-width: var(--ck-balloon-arrow-height) var(--ck-balloon-arrow-half-width) 0 var(--ck-balloon-arrow-half-width);\n\t\t}\n\n\t\t&::before {\n\t\t\tborder-color: var(--ck-color-panel-border) transparent transparent;\n\t\t\tfilter: drop-shadow(var(--ck-balloon-arrow-drop-shadow));\n\t\t}\n\n\t\t&::after {\n\t\t\tborder-color: var(--ck-color-panel-background) transparent transparent transparent;\n\t\t\tmargin-bottom: var(--ck-balloon-arrow-offset);\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_n {\n\t\t&::before,\n\t\t&::after {\n\t\t\tleft: 50%;\n\t\t\tmargin-left: calc(-1 * var(--ck-balloon-arrow-half-width));\n\t\t\ttop: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_nw {\n\t\t&::before,\n\t\t&::after {\n\t\t\tleft: calc(2 * var(--ck-balloon-arrow-half-width));\n\t\t\ttop: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_ne {\n\t\t&::before,\n\t\t&::after {\n\t\t\tright: calc(2 * var(--ck-balloon-arrow-half-width));\n\t\t\ttop: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_s {\n\t\t&::before,\n\t\t&::after {\n\t\t\tleft: 50%;\n\t\t\tmargin-left: calc(-1 * var(--ck-balloon-arrow-half-width));\n\t\t\tbottom: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_sw {\n\t\t&::before,\n\t\t&::after {\n\t\t\tleft: calc(2 * var(--ck-balloon-arrow-half-width));\n\t\t\tbottom: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_se {\n\t\t&::before,\n\t\t&::after {\n\t\t\tright: calc(2 * var(--ck-balloon-arrow-half-width));\n\t\t\tbottom: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_sme {\n\t\t&::before,\n\t\t&::after {\n\t\t\tright: 25%;\n\t\t\tmargin-right: calc(2 * var(--ck-balloon-arrow-half-width));\n\t\t\tbottom: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_smw {\n\t\t&::before,\n\t\t&::after {\n\t\t\tleft: 25%;\n\t\t\tmargin-left: calc(2 * var(--ck-balloon-arrow-half-width));\n\t\t\tbottom: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_nme {\n\t\t&::before,\n\t\t&::after {\n\t\t\tright: 25%;\n\t\t\tmargin-right: calc(2 * var(--ck-balloon-arrow-half-width));\n\t\t\ttop: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n\n\t&.ck-balloon-panel_arrow_nmw {\n\t\t&::before,\n\t\t&::after {\n\t\t\tleft: 25%;\n\t\t\tmargin-left: calc(2 * var(--ck-balloon-arrow-half-width));\n\t\t\ttop: calc(-1 * var(--ck-balloon-arrow-height));\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A helper to combine multiple shadows.\n */\n@define-mixin ck-box-shadow $shadowA, $shadowB: 0 0 {\n\tbox-shadow: $shadowA, $shadowB;\n}\n\n/**\n * Gives an element a drop shadow so it looks like a floating panel.\n */\n@define-mixin ck-drop-shadow {\n\t@mixin ck-box-shadow var(--ck-drop-shadow);\n}\n"],sourceRoot:""}]);const a=s},4650:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck .ck-balloon-rotator__navigation{align-items:center;display:flex;justify-content:center}.ck .ck-balloon-rotator__content .ck-toolbar{justify-content:center}.ck .ck-balloon-rotator__navigation{background:var(--ck-color-toolbar-background);border-bottom:1px solid var(--ck-color-toolbar-border);padding:0 var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation>*{margin-bottom:var(--ck-spacing-small);margin-right:var(--ck-spacing-small);margin-top:var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation .ck-balloon-rotator__counter{margin-left:var(--ck-spacing-small);margin-right:var(--ck-spacing-standard)}.ck .ck-balloon-rotator__content .ck.ck-annotation-wrapper{box-shadow:none}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/panel/balloonrotator.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/panel/balloonrotator.css"],names:[],mappings:"AAKA,oCAEC,kBAAmB,CADnB,YAAa,CAEb,sBACD,CAKA,6CACC,sBACD,CCXA,oCACC,6CAA8C,CAC9C,sDAAuD,CACvD,iCAgBD,CAbC,sCAGC,qCAAsC,CAFtC,oCAAqC,CACrC,kCAED,CAGA,iEAIC,mCAAoC,CAHpC,uCAID,CAMA,2DACC,eACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck .ck-balloon-rotator__navigation {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n/* Buttons inside a toolbar should be centered when rotator bar is wider.\n * See: https://github.com/ckeditor/ckeditor5-ui/issues/495\n */\n.ck .ck-balloon-rotator__content .ck-toolbar {\n\tjustify-content: center;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck .ck-balloon-rotator__navigation {\n\tbackground: var(--ck-color-toolbar-background);\n\tborder-bottom: 1px solid var(--ck-color-toolbar-border);\n\tpadding: 0 var(--ck-spacing-small);\n\n\t/* Let's keep similar appearance to `ck-toolbar`. */\n\t& > * {\n\t\tmargin-right: var(--ck-spacing-small);\n\t\tmargin-top: var(--ck-spacing-small);\n\t\tmargin-bottom: var(--ck-spacing-small);\n\t}\n\n\t/* Gives counter more breath than buttons. */\n\t& .ck-balloon-rotator__counter {\n\t\tmargin-right: var(--ck-spacing-standard);\n\n\t\t/* We need to use smaller margin because of previous button's right margin. */\n\t\tmargin-left: var(--ck-spacing-small);\n\t}\n}\n\n.ck .ck-balloon-rotator__content {\n\n\t/* Disable default annotation shadow inside rotator with fake panels. */\n\t& .ck.ck-annotation-wrapper {\n\t\tbox-shadow: none;\n\t}\n}\n"],sourceRoot:""}]);const a=s},7676:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck .ck-fake-panel{position:absolute;z-index:calc(var(--ck-z-modal) - 1)}.ck .ck-fake-panel div{position:absolute}.ck .ck-fake-panel div:first-child{z-index:2}.ck .ck-fake-panel div:nth-child(2){z-index:1}:root{--ck-balloon-fake-panel-offset-horizontal:6px;--ck-balloon-fake-panel-offset-vertical:6px}.ck .ck-fake-panel div{background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border);border-radius:var(--ck-border-radius);box-shadow:var(--ck-drop-shadow),0 0;height:100%;min-height:15px;width:100%}.ck .ck-fake-panel div:first-child{margin-left:var(--ck-balloon-fake-panel-offset-horizontal);margin-top:var(--ck-balloon-fake-panel-offset-vertical)}.ck .ck-fake-panel div:nth-child(2){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*2);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*2)}.ck .ck-fake-panel div:nth-child(3){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*3);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*3)}.ck .ck-balloon-panel_arrow_s+.ck-fake-panel,.ck .ck-balloon-panel_arrow_se+.ck-fake-panel,.ck .ck-balloon-panel_arrow_sw+.ck-fake-panel{--ck-balloon-fake-panel-offset-vertical:-6px}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/panel/fakepanel.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/panel/fakepanel.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_shadow.css"],names:[],mappings:"AAKA,mBACC,iBAAkB,CAGlB,mCACD,CAEA,uBACC,iBACD,CAEA,mCACC,SACD,CAEA,oCACC,SACD,CCfA,MACC,6CAA8C,CAC9C,2CACD,CAGA,uBAKC,2CAA4C,CAC5C,6CAA8C,CAC9C,qCAAsC,CCXtC,oCAA8B,CDc9B,WAAY,CAPZ,eAAgB,CAMhB,UAED,CAEA,mCACC,0DAA2D,CAC3D,uDACD,CAEA,oCACC,kEAAqE,CACrE,+DACD,CACA,oCACC,kEAAqE,CACrE,+DACD,CAGA,yIAGC,4CACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck .ck-fake-panel {\n\tposition: absolute;\n\n\t/* Fake panels should be placed under main balloon content. */\n\tz-index: calc(var(--ck-z-modal) - 1);\n}\n\n.ck .ck-fake-panel div {\n\tposition: absolute;\n}\n\n.ck .ck-fake-panel div:nth-child( 1 ) {\n\tz-index: 2;\n}\n\n.ck .ck-fake-panel div:nth-child( 2 ) {\n\tz-index: 1;\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_shadow.css";\n\n:root {\n\t--ck-balloon-fake-panel-offset-horizontal: 6px;\n\t--ck-balloon-fake-panel-offset-vertical: 6px;\n}\n\n/* Let\'s use `.ck-balloon-panel` appearance. See: balloonpanel.css. */\n.ck .ck-fake-panel div {\n\t@mixin ck-drop-shadow;\n\n\tmin-height: 15px;\n\n\tbackground: var(--ck-color-panel-background);\n\tborder: 1px solid var(--ck-color-panel-border);\n\tborder-radius: var(--ck-border-radius);\n\n\twidth: 100%;\n\theight: 100%;\n}\n\n.ck .ck-fake-panel div:nth-child( 1 ) {\n\tmargin-left: var(--ck-balloon-fake-panel-offset-horizontal);\n\tmargin-top: var(--ck-balloon-fake-panel-offset-vertical);\n}\n\n.ck .ck-fake-panel div:nth-child( 2 ) {\n\tmargin-left: calc(var(--ck-balloon-fake-panel-offset-horizontal) * 2);\n\tmargin-top: calc(var(--ck-balloon-fake-panel-offset-vertical) * 2);\n}\n.ck .ck-fake-panel div:nth-child( 3 ) {\n\tmargin-left: calc(var(--ck-balloon-fake-panel-offset-horizontal) * 3);\n\tmargin-top: calc(var(--ck-balloon-fake-panel-offset-vertical) * 3);\n}\n\n/* If balloon is positioned above element, we need to move fake panel to the top. */\n.ck .ck-balloon-panel_arrow_s + .ck-fake-panel,\n.ck .ck-balloon-panel_arrow_se + .ck-fake-panel,\n.ck .ck-balloon-panel_arrow_sw + .ck-fake-panel {\n\t--ck-balloon-fake-panel-offset-vertical: -6px;\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A helper to combine multiple shadows.\n */\n@define-mixin ck-box-shadow $shadowA, $shadowB: 0 0 {\n\tbox-shadow: $shadowA, $shadowB;\n}\n\n/**\n * Gives an element a drop shadow so it looks like a floating panel.\n */\n@define-mixin ck-drop-shadow {\n\t@mixin ck-box-shadow var(--ck-drop-shadow);\n}\n"],sourceRoot:""}]);const a=s},5868:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-sticky-panel .ck-sticky-panel__content_sticky{position:fixed;top:0;z-index:var(--ck-z-modal)}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky_bottom-limit{position:absolute;top:auto}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky{border-top-left-radius:0;border-top-right-radius:0;border-width:0 1px 1px;box-shadow:var(--ck-drop-shadow),0 0}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/panel/stickypanel.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/panel/stickypanel.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_shadow.css"],names:[],mappings:"AAMC,qDAEC,cAAe,CACf,KAAM,CAFN,yBAGD,CAEA,kEAEC,iBAAkB,CADlB,QAED,CCPA,qDAIC,wBAAyB,CACzB,yBAA0B,CAF1B,sBAAuB,CCFxB,oCDKA",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-sticky-panel {\n\t& .ck-sticky-panel__content_sticky {\n\t\tz-index: var(--ck-z-modal); /* #315 */\n\t\tposition: fixed;\n\t\ttop: 0;\n\t}\n\n\t& .ck-sticky-panel__content_sticky_bottom-limit {\n\t\ttop: auto;\n\t\tposition: absolute;\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_shadow.css";\n\n.ck.ck-sticky-panel {\n\t& .ck-sticky-panel__content_sticky {\n\t\t@mixin ck-drop-shadow;\n\n\t\tborder-width: 0 1px 1px;\n\t\tborder-top-left-radius: 0;\n\t\tborder-top-right-radius: 0;\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A helper to combine multiple shadows.\n */\n@define-mixin ck-box-shadow $shadowA, $shadowB: 0 0 {\n\tbox-shadow: $shadowA, $shadowB;\n}\n\n/**\n * Gives an element a drop shadow so it looks like a floating panel.\n */\n@define-mixin ck-drop-shadow {\n\t@mixin ck-box-shadow var(--ck-drop-shadow);\n}\n"],sourceRoot:""}]);const a=s},6764:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,'.ck-vertical-form .ck-button:after{bottom:var(--ck-spacing-small);content:"";position:absolute;right:-1px;top:var(--ck-spacing-small);width:0;z-index:1}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{bottom:var(--ck-spacing-small);content:"";position:absolute;right:-1px;top:var(--ck-spacing-small);width:0;z-index:1}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}[dir=ltr] .ck.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-responsive-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-width)*.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){border:0;border-radius:0;border-top:1px solid var(--ck-color-base-border);margin-top:var(--ck-spacing-large);padding:var(--ck-spacing-standard)}[dir=ltr] .ck.ck-responsive-form>.ck-button:last-child,[dir=ltr] .ck.ck-responsive-form>.ck-button:nth-last-child(2),[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2){margin-left:0}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after,[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child:last-of-type,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2):last-of-type{border-right:1px solid var(--ck-color-base-border)}}',"",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/responsive-form/responsiveform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/responsive-form/responsiveform.css"],names:[],mappings:"AAOA,mCAMC,8BAA+B,CAL/B,UAAW,CAEX,iBAAkB,CAClB,UAAW,CACX,2BAA4B,CAH5B,OAAQ,CAKR,SACD,CCTC,oCDaC,wCAMC,8BAA+B,CAL/B,UAAW,CAEX,iBAAkB,CAClB,UAAW,CACX,2BAA4B,CAH5B,OAAQ,CAKR,SACD,CCnBD,CCAD,qDACC,kDACD,CAEA,uBACC,+BAkED,CAhEC,6BAEC,YACD,CASC,uGACC,sCACD,CDvBD,oCCMD,uBAqBE,SAAU,CACV,oCA6CF,CA3CE,8CACC,wDAWD,CATC,6DACC,WAAY,CACZ,UACD,CAGA,4EACC,kBACD,CAID,iGAMC,QAAS,CADT,eAAgB,CAEhB,gDAAiD,CAJjD,kCAAmC,CADnC,kCAkBD,CApBA,0OAcE,aAMF,CAGC,yMACC,kDACD,CDpEF",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n\n.ck-vertical-form .ck-button::after {\n\tcontent: "";\n\twidth: 0;\n\tposition: absolute;\n\tright: -1px;\n\ttop: var(--ck-spacing-small);\n\tbottom: var(--ck-spacing-small);\n\tz-index: 1;\n}\n\n.ck.ck-responsive-form {\n\t@mixin ck-media-phone {\n\t\t& .ck-button::after {\n\t\t\tcontent: "";\n\t\t\twidth: 0;\n\t\t\tposition: absolute;\n\t\t\tright: -1px;\n\t\t\ttop: var(--ck-spacing-small);\n\t\t\tbottom: var(--ck-spacing-small);\n\t\t\tz-index: 1;\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-phone {\n\t@media screen and (max-width: 600px) {\n\t\t@mixin-content;\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n.ck-vertical-form > .ck-button:nth-last-child(2)::after {\n\tborder-right: 1px solid var(--ck-color-base-border);\n}\n\n.ck.ck-responsive-form {\n\tpadding: var(--ck-spacing-large);\n\n\t&:focus {\n\t\t/* See: https://github.com/ckeditor/ckeditor5/issues/4773 */\n\t\toutline: none;\n\t}\n\n\t@mixin ck-dir ltr {\n\t\t& > :not(:first-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-dir rtl {\n\t\t& > :not(:last-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-media-phone {\n\t\tpadding: 0;\n\t\twidth: calc(.8 * var(--ck-input-width));\n\n\t\t& .ck-labeled-field-view {\n\t\t\tmargin: var(--ck-spacing-large) var(--ck-spacing-large) 0;\n\n\t\t\t& .ck-input-text {\n\t\t\t\tmin-width: 0;\n\t\t\t\twidth: 100%;\n\t\t\t}\n\n\t\t\t/* Let the long error messages wrap in the narrow form. */\n\t\t\t& .ck-labeled-field-view__error {\n\t\t\t\twhite-space: normal;\n\t\t\t}\n\t\t}\n\n\t\t/* Styles for two last buttons in the form (save&cancel, edit&unlink, etc.). */\n\t\t& > .ck-button:nth-last-child(1),\n\t\t& > .ck-button:nth-last-child(2) {\n\t\t\tpadding: var(--ck-spacing-standard);\n\t\t\tmargin-top: var(--ck-spacing-large);\n\n\t\t\tborder-radius: 0;\n\t\t\tborder: 0;\n\t\t\tborder-top: 1px solid var(--ck-color-base-border);\n\n\t\t\t@mixin ck-dir ltr {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\n\t\t\t@mixin ck-dir rtl {\n\t\t\t\tmargin-left: 0;\n\n\t\t\t\t&:last-of-type {\n\t\t\t\t\tborder-right: 1px solid var(--ck-color-base-border);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t& > .ck-button:nth-last-child(2) {\n\t\t\t&::after {\n\t\t\t\tborder-right: 1px solid var(--ck-color-base-border);\n\t\t\t}\n\t\t}\n\t}\n}\n'],sourceRoot:""}]);const a=s},9695:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-block-toolbar-button{position:absolute;z-index:var(--ck-z-default)}:root{--ck-color-block-toolbar-button:var(--ck-color-text);--ck-block-toolbar-button-size:var(--ck-font-size-normal)}.ck.ck-block-toolbar-button{color:var(--ck-color-block-toolbar-button);font-size:var(--ck-block-toolbar-size)}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/toolbar/blocktoolbar.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/toolbar/blocktoolbar.css"],names:[],mappings:"AAKA,4BACC,iBAAkB,CAClB,2BACD,CCHA,MACC,oDAAqD,CACrD,yDACD,CAEA,4BACC,0CAA2C,CAC3C,sCACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-block-toolbar-button {\n\tposition: absolute;\n\tz-index: var(--ck-z-default);\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-color-block-toolbar-button: var(--ck-color-text);\n\t--ck-block-toolbar-button-size: var(--ck-font-size-normal);\n}\n\n.ck.ck-block-toolbar-button {\n\tcolor: var(--ck-color-block-toolbar-button);\n\tfont-size: var(--ck-block-toolbar-size);\n}\n"],sourceRoot:""}]);const a=s},5542:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck.ck-toolbar{align-items:center;display:flex;flex-flow:row nowrap;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.ck.ck-toolbar>.ck-toolbar__items{align-items:center;display:flex;flex-flow:row wrap;flex-grow:1}.ck.ck-toolbar .ck.ck-toolbar__separator{display:inline-block}.ck.ck-toolbar .ck.ck-toolbar__separator:first-child,.ck.ck-toolbar .ck.ck-toolbar__separator:last-child{display:none}.ck.ck-toolbar .ck-toolbar__line-break{flex-basis:100%}.ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items{flex-direction:column}.ck.ck-toolbar.ck-toolbar_floating>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck-dropdown__button .ck-dropdown__arrow{display:none}.ck.ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-toolbar,.ck.ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-toolbar{background:var(--ck-color-toolbar-background);border:1px solid var(--ck-color-toolbar-border);padding:0 var(--ck-spacing-small)}.ck.ck-toolbar .ck.ck-toolbar__separator{align-self:stretch;background:var(--ck-color-toolbar-border);margin-bottom:var(--ck-spacing-small);margin-top:var(--ck-spacing-small);min-width:1px;width:1px}.ck.ck-toolbar .ck-toolbar__line-break{height:0}.ck.ck-toolbar>.ck-toolbar__items>:not(.ck-toolbar__line-break){margin-right:var(--ck-spacing-small)}.ck.ck-toolbar>.ck-toolbar__items:empty+.ck.ck-toolbar__separator{display:none}.ck.ck-toolbar>.ck-toolbar__items>:not(.ck-toolbar__line-break),.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown{margin-bottom:var(--ck-spacing-small);margin-top:var(--ck-spacing-small)}.ck.ck-toolbar.ck-toolbar_vertical{padding:0}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items>.ck{border:0;border-radius:0;margin:0;width:100%}.ck.ck-toolbar.ck-toolbar_compact{padding:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>*{margin:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>:not(:first-child):not(:last-child){border-radius:0}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck.ck-button.ck-dropdown__button{padding-left:var(--ck-spacing-tiny)}.ck-toolbar-container .ck.ck-toolbar{border:0}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck{margin-right:0}.ck.ck-toolbar[dir=rtl]:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-left:0}.ck.ck-toolbar.ck-toolbar_compact[dir=rtl]>.ck-toolbar__items>.ck:first-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.ck.ck-toolbar.ck-toolbar_compact[dir=rtl]>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-bottom-right-radius:0;border-top-right-radius:0}.ck.ck-toolbar.ck-toolbar_grouping[dir=rtl]>.ck-toolbar__items:not(:empty):not(:only-child),.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__separator,[dir=rtl] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr]>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-right:0}.ck.ck-toolbar.ck-toolbar_compact[dir=ltr]>.ck-toolbar__items>.ck:first-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-bottom-right-radius:0;border-top-right-radius:0}.ck.ck-toolbar.ck-toolbar_compact[dir=ltr]>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-bottom-left-radius:0;border-top-left-radius:0}.ck.ck-toolbar.ck-toolbar_grouping[dir=ltr]>.ck-toolbar__items:not(:empty):not(:only-child),.ck.ck-toolbar[dir=ltr]>.ck.ck-toolbar__separator,[dir=ltr] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=ltr] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-right:var(--ck-spacing-small)}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/toolbar/toolbar.css","webpack://./../ckeditor5-ui/theme/mixins/_unselectable.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/toolbar/toolbar.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css"],names:[],mappings:"AAOA,eAKC,kBAAmB,CAFnB,YAAa,CACb,oBAAqB,CCFrB,qBAAsB,CACtB,wBAAyB,CACzB,oBAAqB,CACrB,gBD6CD,CA3CC,kCAGC,kBAAmB,CAFnB,YAAa,CACb,kBAAmB,CAEnB,WAED,CAEA,yCACC,oBAWD,CAJC,yGAEC,YACD,CAGD,uCACC,eACD,CAEA,sDACC,gBACD,CAEA,sDACC,qBACD,CAEA,sDACC,gBACD,CAGC,yFACC,YACD,CE/CF,eCGC,eD0FD,CA7FA,qECOE,qCDsFF,CA7FA,eAGC,6CAA8C,CAE9C,+CAAgD,CADhD,iCAyFD,CAtFC,yCACC,kBAAmB,CAGnB,yCAA0C,CAO1C,qCAAsC,CADtC,kCAAmC,CAPnC,aAAc,CADd,SAUD,CAEA,uCACC,QACD,CAGC,gEAEC,oCACD,CAIA,kEACC,YACD,CAGD,gHAIC,qCAAsC,CADtC,kCAED,CAEA,mCAEC,SAgBD,CAbC,0DAWC,QAAS,CAHT,eAAgB,CAHhB,QAAS,CAHT,UAUD,CAGD,kCAEC,SAWD,CATC,uDAEC,QAMD,CAHC,yFACC,eACD,CASD,kFACC,mCACD,CAvFF,qCA2FE,QAEF,CAYC,+FACC,cACD,CAEA,iJAEC,mCACD,CAEA,qHACC,aACD,CAIC,6JAEC,2BAA4B,CAD5B,wBAED,CAGA,2JAEC,4BAA6B,CAD7B,yBAED,CASD,8RACC,mCACD,CAWA,qHACC,cACD,CAIC,6JAEC,4BAA6B,CAD7B,yBAED,CAGA,2JAEC,2BAA4B,CAD5B,wBAED,CASD,8RACC,oCACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../mixins/_unselectable.css";\n\n.ck.ck-toolbar {\n\t@mixin ck-unselectable;\n\n\tdisplay: flex;\n\tflex-flow: row nowrap;\n\talign-items: center;\n\n\t& > .ck-toolbar__items {\n\t\tdisplay: flex;\n\t\tflex-flow: row wrap;\n\t\talign-items: center;\n\t\tflex-grow: 1;\n\n\t}\n\n\t& .ck.ck-toolbar__separator {\n\t\tdisplay: inline-block;\n\n\t\t/*\n\t\t * A leading or trailing separator makes no sense (separates from nothing on one side).\n\t\t * For instance, it can happen when toolbar items (also separators) are getting grouped one by one and\n\t\t * moved to another toolbar in the dropdown.\n\t\t */\n\t\t&:first-child,\n\t\t&:last-child {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\n\t& .ck-toolbar__line-break {\n\t\tflex-basis: 100%;\n\t}\n\n\t&.ck-toolbar_grouping > .ck-toolbar__items {\n\t\tflex-wrap: nowrap;\n\t}\n\n\t&.ck-toolbar_vertical > .ck-toolbar__items {\n\t\tflex-direction: column;\n\t}\n\n\t&.ck-toolbar_floating > .ck-toolbar__items {\n\t\tflex-wrap: nowrap;\n\t}\n\n\t& > .ck.ck-toolbar__grouped-dropdown {\n\t\t& > .ck-dropdown__button .ck-dropdown__arrow {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Makes element unselectable.\n */\n@define-mixin ck-unselectable {\n\t-moz-user-select: none;\n\t-webkit-user-select: none;\n\t-ms-user-select: none;\n\tuser-select: none\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n.ck.ck-toolbar {\n\t@mixin ck-rounded-corners;\n\n\tbackground: var(--ck-color-toolbar-background);\n\tpadding: 0 var(--ck-spacing-small);\n\tborder: 1px solid var(--ck-color-toolbar-border);\n\n\t& .ck.ck-toolbar__separator {\n\t\talign-self: stretch;\n\t\twidth: 1px;\n\t\tmin-width: 1px;\n\t\tbackground: var(--ck-color-toolbar-border);\n\n\t\t/*\n\t\t * These margins make the separators look better in balloon toolbars (when aligned with the "tip").\n\t\t * See https://github.com/ckeditor/ckeditor5/issues/7493.\n\t\t */\n\t\tmargin-top: var(--ck-spacing-small);\n\t\tmargin-bottom: var(--ck-spacing-small);\n\t}\n\n\t& .ck-toolbar__line-break {\n\t\theight: 0;\n\t}\n\n\t& > .ck-toolbar__items {\n\t\t& > *:not(.ck-toolbar__line-break) {\n\t\t\t/* (#11) Separate toolbar items. */\n\t\t\tmargin-right: var(--ck-spacing-small);\n\t\t}\n\n\t\t/* Don\'t display a separator after an empty items container, for instance,\n\t\twhen all items were grouped */\n\t\t&:empty + .ck.ck-toolbar__separator {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\n\t& > .ck-toolbar__items > *:not(.ck-toolbar__line-break),\n\t& > .ck.ck-toolbar__grouped-dropdown {\n\t\t/* Make sure items wrapped to the next line have v-spacing */\n\t\tmargin-top: var(--ck-spacing-small);\n\t\tmargin-bottom: var(--ck-spacing-small);\n\t}\n\n\t&.ck-toolbar_vertical {\n\t\t/* Items in a vertical toolbar span the entire width. */\n\t\tpadding: 0;\n\n\t\t/* Specificity matters here. See https://github.com/ckeditor/ckeditor5-theme-lark/issues/168. */\n\t\t& > .ck-toolbar__items > .ck {\n\t\t\t/* Items in a vertical toolbar should span the horizontal space. */\n\t\t\twidth: 100%;\n\n\t\t\t/* Items in a vertical toolbar should have no margin. */\n\t\t\tmargin: 0;\n\n\t\t\t/* Items in a vertical toolbar span the entire width so rounded corners are pointless. */\n\t\t\tborder-radius: 0;\n\n\t\t\t/* Items in a vertical toolbar span the entire width so any border is pointless. */\n\t\t\tborder: 0;\n\t\t}\n\t}\n\n\t&.ck-toolbar_compact {\n\t\t/* No spacing around items. */\n\t\tpadding: 0;\n\n\t\t& > .ck-toolbar__items > * {\n\t\t\t/* Compact toolbar items have no spacing between them. */\n\t\t\tmargin: 0;\n\n\t\t\t/* "Middle" children should have no rounded corners. */\n\t\t\t&:not(:first-child):not(:last-child) {\n\t\t\t\tborder-radius: 0;\n\t\t\t}\n\t\t}\n\t}\n\n\t& > .ck.ck-toolbar__grouped-dropdown {\n\t\t/*\n\t\t * Dropdown button has asymmetric padding to fit the arrow.\n\t\t * This button has no arrow so let\'s revert that padding back to normal.\n\t\t */\n\t\t& > .ck.ck-button.ck-dropdown__button {\n\t\t\tpadding-left: var(--ck-spacing-tiny);\n\t\t}\n\t}\n\n\t@nest .ck-toolbar-container & {\n\t\tborder: 0;\n\t}\n}\n\n/* stylelint-disable */\n\n/*\n * Styles for RTL toolbars.\n *\n * Note: In some cases (e.g. a decoupled editor), the toolbar has its own "dir"\n * because its parent is not controlled by the editor framework.\n */\n[dir="rtl"] .ck.ck-toolbar,\n.ck.ck-toolbar[dir="rtl"] {\n\t& > .ck-toolbar__items > .ck {\n\t\tmargin-right: 0;\n\t}\n\n\t&:not(.ck-toolbar_compact) > .ck-toolbar__items > .ck {\n\t\t/* (#11) Separate toolbar items. */\n\t\tmargin-left: var(--ck-spacing-small);\n\t}\n\n\t& > .ck-toolbar__items > .ck:last-child {\n\t\tmargin-left: 0;\n\t}\n\n\t&.ck-toolbar_compact > .ck-toolbar__items > .ck {\n\t\t/* No rounded corners on the right side of the first child. */\n\t\t&:first-child {\n\t\t\tborder-top-left-radius: 0;\n\t\t\tborder-bottom-left-radius: 0;\n\t\t}\n\n\t\t/* No rounded corners on the left side of the last child. */\n\t\t&:last-child {\n\t\t\tborder-top-right-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;\n\t\t}\n\t}\n\n\t/* Separate the the separator form the grouping dropdown when some items are grouped. */\n\t& > .ck.ck-toolbar__separator {\n\t\tmargin-left: var(--ck-spacing-small);\n\t}\n\n\t/* Some spacing between the items and the separator before the grouped items dropdown. */\n\t&.ck-toolbar_grouping > .ck-toolbar__items:not(:empty):not(:only-child) {\n\t\tmargin-left: var(--ck-spacing-small);\n\t}\n}\n\n/*\n * Styles for LTR toolbars.\n *\n * Note: In some cases (e.g. a decoupled editor), the toolbar has its own "dir"\n * because its parent is not controlled by the editor framework.\n */\n[dir="ltr"] .ck.ck-toolbar,\n.ck.ck-toolbar[dir="ltr"] {\n\t& > .ck-toolbar__items > .ck:last-child {\n\t\tmargin-right: 0;\n\t}\n\n\t&.ck-toolbar_compact > .ck-toolbar__items > .ck {\n\t\t/* No rounded corners on the right side of the first child. */\n\t\t&:first-child {\n\t\t\tborder-top-right-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;\n\t\t}\n\n\t\t/* No rounded corners on the left side of the last child. */\n\t\t&:last-child {\n\t\t\tborder-top-left-radius: 0;\n\t\t\tborder-bottom-left-radius: 0;\n\t\t}\n\t}\n\n\t/* Separate the the separator form the grouping dropdown when some items are grouped. */\n\t& > .ck.ck-toolbar__separator {\n\t\tmargin-right: var(--ck-spacing-small);\n\t}\n\n\t/* Some spacing between the items and the separator before the grouped items dropdown. */\n\t&.ck-toolbar_grouping > .ck-toolbar__items:not(:empty):not(:only-child) {\n\t\tmargin-right: var(--ck-spacing-small);\n\t}\n}\n\n/* stylelint-enable */\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},3332:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,'.ck.ck-tooltip,.ck.ck-tooltip .ck-tooltip__text:after{-webkit-backface-visibility:hidden;pointer-events:none;position:absolute}.ck.ck-tooltip{display:none;opacity:0;visibility:hidden;z-index:var(--ck-z-modal)}.ck.ck-tooltip .ck-tooltip__text{display:inline-block}.ck.ck-tooltip .ck-tooltip__text:after{content:"";height:0;width:0}:root{--ck-tooltip-arrow-size:5px}.ck.ck-tooltip{left:50%;top:0;transition:opacity .2s ease-in-out .2s}.ck.ck-tooltip .ck-tooltip__text{border-radius:0}.ck-rounded-corners .ck.ck-tooltip .ck-tooltip__text,.ck.ck-tooltip .ck-tooltip__text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-tooltip .ck-tooltip__text{background:var(--ck-color-tooltip-background);color:var(--ck-color-tooltip-text);font-size:.9em;left:-50%;line-height:1.5;padding:var(--ck-spacing-small) var(--ck-spacing-medium);position:relative}.ck.ck-tooltip .ck-tooltip__text:after{border-style:solid;left:50%;transition:opacity .2s ease-in-out .2s}.ck.ck-tooltip.ck-tooltip_s,.ck.ck-tooltip.ck-tooltip_se,.ck.ck-tooltip.ck-tooltip_sw{bottom:calc(var(--ck-tooltip-arrow-size)*-1);transform:translateY(100%)}.ck.ck-tooltip.ck-tooltip_s .ck-tooltip__text:after,.ck.ck-tooltip.ck-tooltip_se .ck-tooltip__text:after,.ck.ck-tooltip.ck-tooltip_sw .ck-tooltip__text:after{border-color:transparent transparent var(--ck-color-tooltip-background) transparent;border-width:0 var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size);top:calc(var(--ck-tooltip-arrow-size)*-1 + 1px);transform:translateX(-50%)}.ck.ck-tooltip.ck-tooltip_sw{left:auto;right:50%}.ck.ck-tooltip.ck-tooltip_sw .ck-tooltip__text{left:auto;right:calc(var(--ck-tooltip-arrow-size)*-2)}.ck.ck-tooltip.ck-tooltip_sw .ck-tooltip__text:after{left:auto;right:0}.ck.ck-tooltip.ck-tooltip_se{left:50%;right:auto}.ck.ck-tooltip.ck-tooltip_se .ck-tooltip__text{left:calc(var(--ck-tooltip-arrow-size)*-2);right:auto}.ck.ck-tooltip.ck-tooltip_se .ck-tooltip__text:after{left:0;right:auto;transform:translateX(50%)}.ck.ck-tooltip.ck-tooltip_n{top:calc(var(--ck-tooltip-arrow-size)*-1);transform:translateY(-100%)}.ck.ck-tooltip.ck-tooltip_n .ck-tooltip__text:after{border-color:var(--ck-color-tooltip-background) transparent transparent transparent;border-width:var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size) 0 var(--ck-tooltip-arrow-size);bottom:calc(var(--ck-tooltip-arrow-size)*-1);transform:translateX(-50%)}.ck.ck-tooltip.ck-tooltip_e{left:calc(100% + var(--ck-tooltip-arrow-size));top:50%}.ck.ck-tooltip.ck-tooltip_e .ck-tooltip__text{left:0;transform:translateY(-50%)}.ck.ck-tooltip.ck-tooltip_e .ck-tooltip__text:after{border-color:transparent var(--ck-color-tooltip-background) transparent transparent;border-width:var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size) 0;left:calc(var(--ck-tooltip-arrow-size)*-1);top:calc(50% - var(--ck-tooltip-arrow-size)*1)}.ck.ck-tooltip.ck-tooltip_w{left:auto;right:calc(100% + var(--ck-tooltip-arrow-size));top:50%}.ck.ck-tooltip.ck-tooltip_w .ck-tooltip__text{left:0;transform:translateY(-50%)}.ck.ck-tooltip.ck-tooltip_w .ck-tooltip__text:after{border-color:transparent transparent transparent var(--ck-color-tooltip-background);border-width:var(--ck-tooltip-arrow-size) 0 var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size);left:100%;top:calc(50% - var(--ck-tooltip-arrow-size)*1)}',"",{version:3,sources:["webpack://./../ckeditor5-ui/theme/components/tooltip/tooltip.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/components/tooltip/tooltip.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css"],names:[],mappings:"AAKA,sDASC,kCAAmC,CAJnC,mBAAoB,CAHpB,iBAQD,CAEA,eAIC,YAAa,CADb,SAAU,CADV,iBAAkB,CAGlB,yBAWD,CATC,iCACC,oBAOD,CALC,uCACC,UAAW,CAEX,QAAS,CADT,OAED,CCxBF,MACC,2BACD,CAEA,eACC,QAAS,CAMT,KAAM,CAON,sCAwKD,CAtKC,iCChBA,eDqCA,CArBA,yGCZC,qCDiCD,CArBA,iCAOC,6CAA8C,CAF9C,kCAAmC,CAFnC,cAAe,CAMf,SAAU,CALV,eAAgB,CAEhB,wDAAyD,CAEzD,iBAaD,CAVC,uCAOC,kBAAmB,CACnB,QAAS,CAFT,sCAGD,CAYD,sFAGC,4CAA+C,CAC/C,0BASD,CAPC,8JAIC,mFAAoF,CACpF,qGAAsG,CAHtG,+CAAkD,CAClD,0BAGD,CAaD,6BAEC,SAAU,CADV,SAYD,CATC,+CACC,SAAU,CACV,2CACD,CAEA,qDACC,SAAU,CACV,OACD,CAYD,6BACC,QAAS,CACT,UAYD,CAVC,+CAEC,0CAA8C,CAD9C,UAED,CAEA,qDAEC,MAAO,CADP,UAAW,CAEX,yBACD,CAYD,4BACC,yCAA4C,CAC5C,2BAQD,CANC,oDAGC,mFAAoF,CACpF,qGAAsG,CAHtG,4CAA+C,CAC/C,0BAGD,CAUD,4BACC,8CAA+C,CAC/C,OAaD,CAXC,8CACC,MAAO,CACP,0BAQD,CANC,oDAGC,mFAAoF,CACpF,qGAAsG,CAHtG,0CAA6C,CAC7C,8CAGD,CAWF,4BAEC,SAAU,CADV,+CAAgD,CAEhD,OAaD,CAXC,8CACC,MAAO,CACP,0BAQD,CANC,oDAGC,mFAAoF,CACpF,qGAAsG,CAHtG,SAAU,CACV,8CAGD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-tooltip,\n.ck.ck-tooltip .ck-tooltip__text::after {\n\tposition: absolute;\n\n\t/* Without this, hovering the tooltip could keep it visible. */\n\tpointer-events: none;\n\n\t/* This is to get rid of flickering when transitioning opacity in Chrome.\n\tIt\'s weird but it works. */\n\t-webkit-backface-visibility: hidden;\n}\n\n.ck.ck-tooltip {\n\t/* Tooltip is hidden by default. */\n\tvisibility: hidden;\n\topacity: 0;\n\tdisplay: none;\n\tz-index: var(--ck-z-modal);\n\n\t& .ck-tooltip__text {\n\t\tdisplay: inline-block;\n\n\t\t&::after {\n\t\t\tcontent: "";\n\t\t\twidth: 0;\n\t\t\theight: 0;\n\t\t}\n\t}\n}\n','/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../../../mixins/_rounded.css";\n\n:root {\n\t--ck-tooltip-arrow-size: 5px;\n}\n\n.ck.ck-tooltip {\n\tleft: 50%;\n\n\t/*\n\t * Prevent blurry tooltips in LoDPI environments.\n\t * See https://github.com/ckeditor/ckeditor5/issues/1802.\n\t */\n\ttop: 0;\n\n\t/*\n\t * For the transition to work, the tooltip must be controlled\n\t * using visibility+opacity. A delay prevents a "tooltip avalanche"\n\t * i.e. when scanning the toolbar with mouse cursor.\n\t */\n\ttransition: opacity .2s ease-in-out .2s;\n\n\t& .ck-tooltip__text {\n\t\t@mixin ck-rounded-corners;\n\n\t\tfont-size: .9em;\n\t\tline-height: 1.5;\n\t\tcolor: var(--ck-color-tooltip-text);\n\t\tpadding: var(--ck-spacing-small) var(--ck-spacing-medium);\n\t\tbackground: var(--ck-color-tooltip-background);\n\t\tposition: relative;\n\t\tleft: -50%;\n\n\t\t&::after {\n\t\t\t/*\n\t\t\t * For the transition to work, the tooltip must be controlled\n\t\t\t * using visibility+opacity. A delay prevents a "tooltip avalanche"\n\t\t\t * i.e. when scanning the toolbar with mouse cursor.\n\t\t\t */\n\t\t\ttransition: opacity .2s ease-in-out .2s;\n\t\t\tborder-style: solid;\n\t\t\tleft: 50%;\n\t\t}\n\t}\n\n\t/**\n\t * A class that displays the tooltip south of the element.\n\t *\n\t * [element]\n\t * ^\n\t * +-----------+\n\t * | Tooltip |\n\t * +-----------+\n\t */\n\t&.ck-tooltip_s,\n\t&.ck-tooltip_sw,\n\t&.ck-tooltip_se {\n\t\tbottom: calc(-1 * var(--ck-tooltip-arrow-size));\n\t\ttransform: translateY( 100% );\n\n\t\t& .ck-tooltip__text::after {\n\t\t\t/* 1px addresses gliches in rendering causing gap between the triangle and the text */\n\t\t\ttop: calc(-1 * var(--ck-tooltip-arrow-size) + 1px);\n\t\t\ttransform: translateX( -50% );\n\t\t\tborder-color: transparent transparent var(--ck-color-tooltip-background) transparent;\n\t\t\tborder-width: 0 var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size);\n\t\t}\n\t}\n\n\t/**\n\t * A class that displays the tooltip south-west of the element.\n\t *\n\t * [element]\n\t * ^\n\t * +-----------+\n\t * | Tooltip |\n\t * +-----------+\n\t */\n\n\t&.ck-tooltip_sw {\n\t\tright: 50%;\n\t\tleft: auto;\n\n\t\t& .ck-tooltip__text {\n\t\t\tleft: auto;\n\t\t\tright: calc( -2 * var(--ck-tooltip-arrow-size));\n\t\t}\n\n\t\t& .ck-tooltip__text::after {\n\t\t\tleft: auto;\n\t\t\tright: 0;\n\t\t}\n\t}\n\n\t/**\n\t * A class that displays the tooltip south-east of the element.\n\t *\n\t * [element]\n\t * ^\n\t * +-----------+\n\t * | Tooltip |\n\t * +-----------+\n\t */\n\t&.ck-tooltip_se {\n\t\tleft: 50%;\n\t\tright: auto;\n\n\t\t& .ck-tooltip__text {\n\t\t\tright: auto;\n\t\t\tleft: calc( -2 * var(--ck-tooltip-arrow-size));\n\t\t}\n\n\t\t& .ck-tooltip__text::after {\n\t\t\tright: auto;\n\t\t\tleft: 0;\n\t\t\ttransform: translateX( 50% );\n\t\t}\n\t}\n\n\t/**\n\t * A class that displays the tooltip north of the element.\n\t *\n\t * +-----------+\n\t * | Tooltip |\n\t * +-----------+\n\t * V\n\t * [element]\n\t */\n\t&.ck-tooltip_n {\n\t\ttop: calc(-1 * var(--ck-tooltip-arrow-size));\n\t\ttransform: translateY( -100% );\n\n\t\t& .ck-tooltip__text::after {\n\t\t\tbottom: calc(-1 * var(--ck-tooltip-arrow-size));\n\t\t\ttransform: translateX( -50% );\n\t\t\tborder-color: var(--ck-color-tooltip-background) transparent transparent transparent;\n\t\t\tborder-width: var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size) 0 var(--ck-tooltip-arrow-size);\n\t\t}\n\t}\n\n\t/**\n\t * A class that displays the tooltip east of the element.\n\t *\n\t * +----------+\n\t * [element] < | east |\n\t * +----------+\n\t */\n\t&.ck-tooltip_e {\n\t\tleft: calc(100% + var(--ck-tooltip-arrow-size));\n\t\ttop: 50%;\n\n\t\t& .ck-tooltip__text {\n\t\t\tleft: 0;\n\t\t\ttransform: translateY( -50% );\n\n\t\t\t&::after {\n\t\t\t\tleft: calc(-1 * var(--ck-tooltip-arrow-size));\n\t\t\t\ttop: calc(50% - 1 * var(--ck-tooltip-arrow-size));\n\t\t\t\tborder-color: transparent var(--ck-color-tooltip-background) transparent transparent;\n\t\t\t\tborder-width: var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size) 0;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * A class that displays the tooltip west of the element.\n\t *\n\t * +----------+\n\t * | west | > [element]\n\t * +----------+\n\t */\n\t&.ck-tooltip_w {\n\t\tright: calc(100% + var(--ck-tooltip-arrow-size));\n\t\tleft: auto;\n\t\ttop: 50%;\n\n\t\t& .ck-tooltip__text {\n\t\t\tleft: 0;\n\t\t\ttransform: translateY( -50% );\n\n\t\t\t&::after {\n\t\t\t\tleft: 100%;\n\t\t\t\ttop: calc(50% - 1 * var(--ck-tooltip-arrow-size));\n\t\t\t\tborder-color: transparent transparent transparent var(--ck-color-tooltip-background);\n\t\t\t\tborder-width: var(--ck-tooltip-arrow-size) 0 var(--ck-tooltip-arrow-size) var(--ck-tooltip-arrow-size);\n\t\t\t}\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},4793:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck-hidden{display:none!important}.ck-reset_all :not(.ck-reset_all-excluded *),.ck.ck-reset,.ck.ck-reset_all{box-sizing:border-box;height:auto;position:static;width:auto}:root{--ck-z-default:1;--ck-z-modal:calc(var(--ck-z-default) + 999)}.ck-transitions-disabled,.ck-transitions-disabled *{transition:none!important}:root{--ck-color-base-foreground:#fafafa;--ck-color-base-background:#fff;--ck-color-base-border:#c4c4c4;--ck-color-base-action:#61b045;--ck-color-base-focus:#6cb5f9;--ck-color-base-text:#333;--ck-color-base-active:#198cf0;--ck-color-base-active-focus:#0e7fe1;--ck-color-base-error:#db3700;--ck-color-focus-border-coordinates:208,79%,51%;--ck-color-focus-border:hsl(var(--ck-color-focus-border-coordinates));--ck-color-focus-outer-shadow:#bcdefb;--ck-color-focus-disabled-shadow:rgba(119,186,248,.3);--ck-color-focus-error-shadow:rgba(255,64,31,.3);--ck-color-text:var(--ck-color-base-text);--ck-color-shadow-drop:rgba(0,0,0,.15);--ck-color-shadow-drop-active:rgba(0,0,0,.2);--ck-color-shadow-inner:rgba(0,0,0,.1);--ck-color-button-default-background:transparent;--ck-color-button-default-hover-background:#e6e6e6;--ck-color-button-default-active-background:#d9d9d9;--ck-color-button-default-active-shadow:#bfbfbf;--ck-color-button-default-disabled-background:transparent;--ck-color-button-on-background:#dedede;--ck-color-button-on-hover-background:#c4c4c4;--ck-color-button-on-active-background:#bababa;--ck-color-button-on-active-shadow:#a1a1a1;--ck-color-button-on-disabled-background:#dedede;--ck-color-button-action-background:var(--ck-color-base-action);--ck-color-button-action-hover-background:#579e3d;--ck-color-button-action-active-background:#53973b;--ck-color-button-action-active-shadow:#498433;--ck-color-button-action-disabled-background:#7ec365;--ck-color-button-action-text:var(--ck-color-base-background);--ck-color-button-save:#008a00;--ck-color-button-cancel:#db3700;--ck-color-switch-button-off-background:#b0b0b0;--ck-color-switch-button-off-hover-background:#a3a3a3;--ck-color-switch-button-on-background:var(--ck-color-button-action-background);--ck-color-switch-button-on-hover-background:#579e3d;--ck-color-switch-button-inner-background:var(--ck-color-base-background);--ck-color-switch-button-inner-shadow:rgba(0,0,0,.1);--ck-color-dropdown-panel-background:var(--ck-color-base-background);--ck-color-dropdown-panel-border:var(--ck-color-base-border);--ck-color-input-background:var(--ck-color-base-background);--ck-color-input-border:#c7c7c7;--ck-color-input-error-border:var(--ck-color-base-error);--ck-color-input-text:var(--ck-color-base-text);--ck-color-input-disabled-background:#f2f2f2;--ck-color-input-disabled-border:#c7c7c7;--ck-color-input-disabled-text:#757575;--ck-color-list-background:var(--ck-color-base-background);--ck-color-list-button-hover-background:var(--ck-color-button-default-hover-background);--ck-color-list-button-on-background:var(--ck-color-base-active);--ck-color-list-button-on-background-focus:var(--ck-color-base-active-focus);--ck-color-list-button-on-text:var(--ck-color-base-background);--ck-color-panel-background:var(--ck-color-base-background);--ck-color-panel-border:var(--ck-color-base-border);--ck-color-toolbar-background:var(--ck-color-base-foreground);--ck-color-toolbar-border:var(--ck-color-base-border);--ck-color-tooltip-background:var(--ck-color-base-text);--ck-color-tooltip-text:var(--ck-color-base-background);--ck-color-engine-placeholder-text:#707070;--ck-color-upload-bar-background:#6cb5f9;--ck-color-link-default:#0000f0;--ck-color-link-selected-background:rgba(31,176,255,.1);--ck-color-link-fake-selection:rgba(31,176,255,.3);--ck-disabled-opacity:.5;--ck-focus-outer-shadow-geometry:0 0 0 3px;--ck-focus-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-outer-shadow);--ck-focus-disabled-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-disabled-shadow);--ck-focus-error-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-error-shadow);--ck-focus-ring:1px solid var(--ck-color-focus-border);--ck-font-size-base:13px;--ck-line-height-base:1.84615;--ck-font-face:Helvetica,Arial,Tahoma,Verdana,Sans-Serif;--ck-font-size-tiny:0.7em;--ck-font-size-small:0.75em;--ck-font-size-normal:1em;--ck-font-size-big:1.4em;--ck-font-size-large:1.8em;--ck-ui-component-min-height:2.3em}.ck-reset_all :not(.ck-reset_all-excluded *),.ck.ck-reset,.ck.ck-reset_all{word-wrap:break-word;background:transparent;border:0;margin:0;padding:0;text-decoration:none;transition:none;vertical-align:middle}.ck-reset_all :not(.ck-reset_all-excluded *),.ck.ck-reset_all{border-collapse:collapse;color:var(--ck-color-text);cursor:auto;float:none;font:normal normal normal var(--ck-font-size-base)/var(--ck-line-height-base) var(--ck-font-face);text-align:left;white-space:nowrap}.ck-reset_all .ck-rtl :not(.ck-reset_all-excluded *){text-align:right}.ck-reset_all iframe:not(.ck-reset_all-excluded *){vertical-align:inherit}.ck-reset_all textarea:not(.ck-reset_all-excluded *){white-space:pre-wrap}.ck-reset_all input[type=password]:not(.ck-reset_all-excluded *),.ck-reset_all input[type=text]:not(.ck-reset_all-excluded *),.ck-reset_all textarea:not(.ck-reset_all-excluded *){cursor:text}.ck-reset_all input[type=password][disabled]:not(.ck-reset_all-excluded *),.ck-reset_all input[type=text][disabled]:not(.ck-reset_all-excluded *),.ck-reset_all textarea[disabled]:not(.ck-reset_all-excluded *){cursor:default}.ck-reset_all fieldset:not(.ck-reset_all-excluded *){border:2px groove #dfdee3;padding:10px}.ck-reset_all button:not(.ck-reset_all-excluded *)::-moz-focus-inner{border:0;padding:0}.ck[dir=rtl],.ck[dir=rtl] .ck{text-align:right}:root{--ck-border-radius:2px;--ck-inner-shadow:2px 2px 3px var(--ck-color-shadow-inner) inset;--ck-drop-shadow:0 1px 2px 1px var(--ck-color-shadow-drop);--ck-drop-shadow-active:0 3px 6px 1px var(--ck-color-shadow-drop-active);--ck-spacing-unit:0.6em;--ck-spacing-large:calc(var(--ck-spacing-unit)*1.5);--ck-spacing-standard:var(--ck-spacing-unit);--ck-spacing-medium:calc(var(--ck-spacing-unit)*0.8);--ck-spacing-small:calc(var(--ck-spacing-unit)*0.5);--ck-spacing-tiny:calc(var(--ck-spacing-unit)*0.3);--ck-spacing-extra-tiny:calc(var(--ck-spacing-unit)*0.16)}","",{version:3,sources:["webpack://./../ckeditor5-ui/theme/globals/_hidden.css","webpack://./../ckeditor5-ui/theme/globals/_reset.css","webpack://./../ckeditor5-ui/theme/globals/_zindex.css","webpack://./../ckeditor5-ui/theme/globals/_transition.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/globals/_colors.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/globals/_disabled.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/globals/_focus.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/globals/_fonts.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/globals/_reset.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/globals/_rounded.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/globals/_shadow.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-ui/globals/_spacing.css"],names:[],mappings:"AAQA,WAGC,sBACD,CCPA,2EAGC,qBAAsB,CAEtB,WAAY,CACZ,eAAgB,CAFhB,UAGD,CCPA,MACC,gBAAiB,CACjB,4CACD,CCAA,oDAEC,yBACD,CCNA,MACC,kCAAmD,CACnD,+BAAoD,CACpD,8BAAgD,CAChD,8BAAmD,CACnD,6BAAmD,CACnD,yBAA+C,CAC/C,8BAAmD,CACnD,oCAAuD,CACvD,6BAAkD,CAIlD,+CAAwD,CACxD,qEAA+E,CAC/E,qCAAwD,CACxD,qDAA8D,CAC9D,gDAAyD,CACzD,yCAAqD,CACrD,sCAAsD,CACtD,4CAA0D,CAC1D,sCAAsD,CAItD,gDAAuD,CACvD,kDAA+D,CAC/D,mDAAgE,CAChE,+CAA6D,CAC7D,yDAA8D,CAE9D,uCAAuD,CACvD,6CAA4D,CAC5D,8CAA4D,CAC5D,0CAAyD,CACzD,gDAA8D,CAE9D,+DAAsE,CACtE,iDAAkE,CAClE,kDAAkE,CAClE,8CAA+D,CAC/D,oDAAoE,CACpE,6DAAsE,CAEtE,8BAAoD,CACpD,gCAAqD,CAErD,+CAA4D,CAC5D,qDAAiE,CACjE,+EAAqF,CACrF,oDAAmE,CACnE,yEAA8E,CAC9E,oDAAgE,CAIhE,oEAA2E,CAC3E,4DAAoE,CAIpE,2DAAoE,CACpE,+BAAiD,CACjD,wDAAgE,CAChE,+CAA0D,CAC1D,4CAA2D,CAC3D,wCAAwD,CACxD,sCAAsD,CAItD,0DAAmE,CACnE,uFAA6F,CAC7F,gEAAuE,CACvE,4EAAiF,CACjF,8DAAsE,CAItE,2DAAoE,CACpE,mDAA6D,CAI7D,6DAAsE,CACtE,qDAA+D,CAI/D,uDAAgE,CAChE,uDAAiE,CAIjE,0CAAyD,CAIzD,wCAA2D,CAI3D,+BAAoD,CACpD,uDAAmE,CACnE,kDAAgE,CCpGhE,wBAAyB,CCAzB,0CAA2C,CAK3C,gGAAiG,CAKjG,4GAA6G,CAK7G,sGAAuG,CAKvG,sDAAuD,CCvBvD,wBAAyB,CACzB,6BAA8B,CAC9B,wDAA6D,CAE7D,yBAA0B,CAC1B,2BAA4B,CAC5B,yBAA0B,CAC1B,wBAAyB,CACzB,0BAA2B,CCJ3B,kCJoGD,CI9FA,2EAaC,oBAAqB,CANrB,sBAAuB,CADvB,QAAS,CAFT,QAAS,CACT,SAAU,CAGV,oBAAqB,CAErB,eAAgB,CADhB,qBAKD,CAKA,8DAGC,wBAAyB,CAEzB,0BAA2B,CAG3B,WAAY,CACZ,UAAW,CALX,iGAAkG,CAElG,eAAgB,CAChB,kBAGD,CAGC,qDACC,gBACD,CAEA,mDAEC,sBACD,CAEA,qDACC,oBACD,CAEA,mLAGC,WACD,CAEA,iNAGC,cACD,CAEA,qDAEC,yBAAoC,CADpC,YAED,CAEA,qEAGC,QAAQ,CADR,SAED,CAMD,8BAEC,gBACD,CCnFA,MACC,sBAAuB,CCAvB,gEAAiE,CAKjE,0DAA2D,CAK3D,wEAAyE,CCbzE,uBAA8B,CAC9B,mDAA2D,CAC3D,4CAAkD,CAClD,oDAA4D,CAC5D,mDAA2D,CAC3D,kDAA2D,CAC3D,yDFFD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A class which hides an element in DOM.\n */\n.ck-hidden {\n\t/* Override selector specificity. Otherwise, all elements with some display\n\tstyle defined will override this one, which is not a desired result. */\n\tdisplay: none !important;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-reset,\n.ck.ck-reset_all,\n.ck-reset_all *:not(.ck-reset_all-excluded *) {\n\tbox-sizing: border-box;\n\twidth: auto;\n\theight: auto;\n\tposition: static;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-z-default: 1;\n\t--ck-z-modal: calc( var(--ck-z-default) + 999 );\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A class that disables all transitions of the element and its children.\n */\n.ck-transitions-disabled,\n.ck-transitions-disabled * {\n\ttransition: none !important;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-color-base-foreground: \t\t\t\t\t\t\t\thsl(0, 0%, 98%);\n\t--ck-color-base-background: \t\t\t\t\t\t\t\thsl(0, 0%, 100%);\n\t--ck-color-base-border: \t\t\t\t\t\t\t\t\thsl(0, 0%, 77%);\n\t--ck-color-base-action: \t\t\t\t\t\t\t\t\thsl(104, 44%, 48%);\n\t--ck-color-base-focus: \t\t\t\t\t\t\t\t\t\thsl(209, 92%, 70%);\n\t--ck-color-base-text: \t\t\t\t\t\t\t\t\t\thsl(0, 0%, 20%);\n\t--ck-color-base-active: \t\t\t\t\t\t\t\t\thsl(208, 88%, 52%);\n\t--ck-color-base-active-focus:\t\t\t\t\t\t\t\thsl(208, 88%, 47%);\n\t--ck-color-base-error:\t\t\t\t\t\t\t\t\t\thsl(15, 100%, 43%);\n\n\t/* -- Generic colors ------------------------------------------------------------------------ */\n\n\t--ck-color-focus-border-coordinates: \t\t\t\t\t\t208, 79%, 51%;\n\t--ck-color-focus-border: \t\t\t\t\t\t\t\t\thsl(var(--ck-color-focus-border-coordinates));\n\t--ck-color-focus-outer-shadow:\t\t\t\t\t\t\t\thsl(207, 89%, 86%);\n\t--ck-color-focus-disabled-shadow:\t\t\t\t\t\t\thsla(209, 90%, 72%,.3);\n\t--ck-color-focus-error-shadow:\t\t\t\t\t\t\t\thsla(9,100%,56%,.3);\n\t--ck-color-text: \t\t\t\t\t\t\t\t\t\t\tvar(--ck-color-base-text);\n\t--ck-color-shadow-drop: \t\t\t\t\t\t\t\t\thsla(0, 0%, 0%, 0.15);\n\t--ck-color-shadow-drop-active:\t\t\t\t\t\t\t\thsla(0, 0%, 0%, 0.2);\n\t--ck-color-shadow-inner: \t\t\t\t\t\t\t\t\thsla(0, 0%, 0%, 0.1);\n\n\t/* -- Buttons ------------------------------------------------------------------------------- */\n\n\t--ck-color-button-default-background: \t\t\t\t\t\ttransparent;\n\t--ck-color-button-default-hover-background: \t\t\t\thsl(0, 0%, 90%);\n\t--ck-color-button-default-active-background: \t\t\t\thsl(0, 0%, 85%);\n\t--ck-color-button-default-active-shadow: \t\t\t\t\thsl(0, 0%, 75%);\n\t--ck-color-button-default-disabled-background: \t\t\t\ttransparent;\n\n\t--ck-color-button-on-background: \t\t\t\t\t\t\thsl(0, 0%, 87%);\n\t--ck-color-button-on-hover-background: \t\t\t\t\t\thsl(0, 0%, 77%);\n\t--ck-color-button-on-active-background: \t\t\t\t\thsl(0, 0%, 73%);\n\t--ck-color-button-on-active-shadow: \t\t\t\t\t\thsl(0, 0%, 63%);\n\t--ck-color-button-on-disabled-background: \t\t\t\t\thsl(0, 0%, 87%);\n\n\t--ck-color-button-action-background: \t\t\t\t\t\tvar(--ck-color-base-action);\n\t--ck-color-button-action-hover-background: \t\t\t\t\thsl(104, 44%, 43%);\n\t--ck-color-button-action-active-background: \t\t\t\thsl(104, 44%, 41%);\n\t--ck-color-button-action-active-shadow: \t\t\t\t\thsl(104, 44%, 36%);\n\t--ck-color-button-action-disabled-background: \t\t\t\thsl(104, 44%, 58%);\n\t--ck-color-button-action-text: \t\t\t\t\t\t\t\tvar(--ck-color-base-background);\n\n\t--ck-color-button-save: \t\t\t\t\t\t\t\t\thsl(120, 100%, 27%);\n\t--ck-color-button-cancel: \t\t\t\t\t\t\t\t\thsl(15, 100%, 43%);\n\n\t--ck-color-switch-button-off-background:\t\t\t\t\thsl(0, 0%, 69%);\n\t--ck-color-switch-button-off-hover-background:\t\t\t\thsl(0, 0%, 64%);\n\t--ck-color-switch-button-on-background:\t\t\t\t\t\tvar(--ck-color-button-action-background);\n\t--ck-color-switch-button-on-hover-background:\t\t\t\thsl(104, 44%, 43%);\n\t--ck-color-switch-button-inner-background:\t\t\t\t\tvar(--ck-color-base-background);\n\t--ck-color-switch-button-inner-shadow:\t\t\t\t\t\thsla(0, 0%, 0%, 0.1);\n\n\t/* -- Dropdown ------------------------------------------------------------------------------ */\n\n\t--ck-color-dropdown-panel-background: \t\t\t\t\t\tvar(--ck-color-base-background);\n\t--ck-color-dropdown-panel-border: \t\t\t\t\t\t\tvar(--ck-color-base-border);\n\n\t/* -- Input --------------------------------------------------------------------------------- */\n\n\t--ck-color-input-background: \t\t\t\t\t\t\t\tvar(--ck-color-base-background);\n\t--ck-color-input-border: \t\t\t\t\t\t\t\t\thsl(0, 0%, 78%);\n\t--ck-color-input-error-border:\t\t\t\t\t\t\t\tvar(--ck-color-base-error);\n\t--ck-color-input-text: \t\t\t\t\t\t\t\t\t\tvar(--ck-color-base-text);\n\t--ck-color-input-disabled-background: \t\t\t\t\t\thsl(0, 0%, 95%);\n\t--ck-color-input-disabled-border: \t\t\t\t\t\t\thsl(0, 0%, 78%);\n\t--ck-color-input-disabled-text: \t\t\t\t\t\t\thsl(0, 0%, 46%);\n\n\t/* -- List ---------------------------------------------------------------------------------- */\n\n\t--ck-color-list-background: \t\t\t\t\t\t\t\tvar(--ck-color-base-background);\n\t--ck-color-list-button-hover-background: \t\t\t\t\tvar(--ck-color-button-default-hover-background);\n\t--ck-color-list-button-on-background: \t\t\t\t\t\tvar(--ck-color-base-active);\n\t--ck-color-list-button-on-background-focus: \t\t\t\tvar(--ck-color-base-active-focus);\n\t--ck-color-list-button-on-text:\t\t\t\t\t\t\t\tvar(--ck-color-base-background);\n\n\t/* -- Panel --------------------------------------------------------------------------------- */\n\n\t--ck-color-panel-background: \t\t\t\t\t\t\t\tvar(--ck-color-base-background);\n\t--ck-color-panel-border: \t\t\t\t\t\t\t\t\tvar(--ck-color-base-border);\n\n\t/* -- Toolbar ------------------------------------------------------------------------------- */\n\n\t--ck-color-toolbar-background: \t\t\t\t\t\t\t\tvar(--ck-color-base-foreground);\n\t--ck-color-toolbar-border: \t\t\t\t\t\t\t\t\tvar(--ck-color-base-border);\n\n\t/* -- Tooltip ------------------------------------------------------------------------------- */\n\n\t--ck-color-tooltip-background: \t\t\t\t\t\t\t\tvar(--ck-color-base-text);\n\t--ck-color-tooltip-text: \t\t\t\t\t\t\t\t\tvar(--ck-color-base-background);\n\n\t/* -- Engine -------------------------------------------------------------------------------- */\n\n\t--ck-color-engine-placeholder-text: \t\t\t\t\t\thsl(0, 0%, 44%);\n\n\t/* -- Upload -------------------------------------------------------------------------------- */\n\n\t--ck-color-upload-bar-background:\t\t \t\t\t\t\thsl(209, 92%, 70%);\n\n\t/* -- Link -------------------------------------------------------------------------------- */\n\n\t--ck-color-link-default:\t\t\t\t\t\t\t\t\thsl(240, 100%, 47%);\n\t--ck-color-link-selected-background:\t\t\t\t\t\thsla(201, 100%, 56%, 0.1);\n\t--ck-color-link-fake-selection:\t\t\t\t\t\t\t\thsla(201, 100%, 56%, 0.3);\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t/**\n\t * An opacity value of disabled UI item.\n\t */\n\t--ck-disabled-opacity: .5;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t/**\n\t * The geometry of the of focused element's outer shadow.\n\t */\n\t--ck-focus-outer-shadow-geometry: 0 0 0 3px;\n\n\t/**\n\t * A visual style of focused element's outer shadow.\n\t */\n\t--ck-focus-outer-shadow: var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-outer-shadow);\n\n\t/**\n\t * A visual style of focused element's outer shadow (when disabled).\n\t */\n\t--ck-focus-disabled-outer-shadow: var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-disabled-shadow);\n\n\t/**\n\t * A visual style of focused element's outer shadow (when has errors).\n\t */\n\t--ck-focus-error-outer-shadow: var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-error-shadow);\n\n\t/**\n\t * A visual style of focused element's border or outline.\n\t */\n\t--ck-focus-ring: 1px solid var(--ck-color-focus-border);\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-font-size-base: 13px;\n\t--ck-line-height-base: 1.84615;\n\t--ck-font-face: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;\n\n\t--ck-font-size-tiny: 0.7em;\n\t--ck-font-size-small: 0.75em;\n\t--ck-font-size-normal: 1em;\n\t--ck-font-size-big: 1.4em;\n\t--ck-font-size-large: 1.8em;\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t/* This is super-important. This is **manually** adjusted so a button without an icon\n\tis never smaller than a button with icon, additionally making sure that text-less buttons\n\tare perfect squares. The value is also shared by other components which should stay "in-line"\n\twith buttons. */\n\t--ck-ui-component-min-height: 2.3em;\n}\n\n/**\n * Resets an element, ignoring its children.\n */\n.ck.ck-reset,\n.ck.ck-reset_all,\n.ck-reset_all *:not(.ck-reset_all-excluded *) {\n\t/* Do not include inheritable rules here. */\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 0;\n\tbackground: transparent;\n\ttext-decoration: none;\n\tvertical-align: middle;\n\ttransition: none;\n\n\t/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/105 */\n\tword-wrap: break-word;\n}\n\n/**\n * Resets an element AND its children.\n */\n.ck.ck-reset_all,\n.ck-reset_all *:not(.ck-reset_all-excluded *) {\n\t/* These are rule inherited by all children elements. */\n\tborder-collapse: collapse;\n\tfont: normal normal normal var(--ck-font-size-base)/var(--ck-line-height-base) var(--ck-font-face);\n\tcolor: var(--ck-color-text);\n\ttext-align: left;\n\twhite-space: nowrap;\n\tcursor: auto;\n\tfloat: none;\n}\n\n.ck-reset_all {\n\t& .ck-rtl *:not(.ck-reset_all-excluded *) {\n\t\ttext-align: right;\n\t}\n\n\t& iframe:not(.ck-reset_all-excluded *) {\n\t\t/* For IE */\n\t\tvertical-align: inherit;\n\t}\n\n\t& textarea:not(.ck-reset_all-excluded *) {\n\t\twhite-space: pre-wrap;\n\t}\n\n\t& textarea:not(.ck-reset_all-excluded *),\n\t& input[type="text"]:not(.ck-reset_all-excluded *),\n\t& input[type="password"]:not(.ck-reset_all-excluded *) {\n\t\tcursor: text;\n\t}\n\n\t& textarea[disabled]:not(.ck-reset_all-excluded *),\n\t& input[type="text"][disabled]:not(.ck-reset_all-excluded *),\n\t& input[type="password"][disabled]:not(.ck-reset_all-excluded *) {\n\t\tcursor: default;\n\t}\n\n\t& fieldset:not(.ck-reset_all-excluded *) {\n\t\tpadding: 10px;\n\t\tborder: 2px groove hsl(255, 7%, 88%);\n\t}\n\n\t& button:not(.ck-reset_all-excluded *)::-moz-focus-inner {\n\t\t/* See http://stackoverflow.com/questions/5517744/remove-extra-button-spacing-padding-in-firefox */\n\t\tpadding: 0;\n\t\tborder: 0\n\t}\n}\n\n/**\n * Default UI rules for RTL languages.\n */\n.ck[dir="rtl"],\n.ck[dir="rtl"] .ck {\n\ttext-align: right;\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Default border-radius value.\n */\n:root{\n\t--ck-border-radius: 2px;\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t/**\n\t * A visual style of element's inner shadow (i.e. input).\n\t */\n\t--ck-inner-shadow: 2px 2px 3px var(--ck-color-shadow-inner) inset;\n\n\t/**\n\t * A visual style of element's drop shadow (i.e. panel).\n\t */\n\t--ck-drop-shadow: 0 1px 2px 1px var(--ck-color-shadow-drop);\n\n\t/**\n\t * A visual style of element's active shadow (i.e. comment or suggestion).\n\t */\n\t--ck-drop-shadow-active: 0 3px 6px 1px var(--ck-color-shadow-drop-active);\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-spacing-unit: \t\t\t\t\t\t0.6em;\n\t--ck-spacing-large: \t\t\t\t\tcalc(var(--ck-spacing-unit) * 1.5);\n\t--ck-spacing-standard: \t\t\t\t\tvar(--ck-spacing-unit);\n\t--ck-spacing-medium: \t\t\t\t\tcalc(var(--ck-spacing-unit) * 0.8);\n\t--ck-spacing-small: \t\t\t\t\tcalc(var(--ck-spacing-unit) * 0.5);\n\t--ck-spacing-tiny: \t\t\t\t\t\tcalc(var(--ck-spacing-unit) * 0.3);\n\t--ck-spacing-extra-tiny: \t\t\t\tcalc(var(--ck-spacing-unit) * 0.16);\n}\n"],sourceRoot:""}]);const a=s},3488:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,":root{--ck-color-resizer:var(--ck-color-focus-border);--ck-color-resizer-tooltip-background:#262626;--ck-color-resizer-tooltip-text:#f2f2f2;--ck-resizer-border-radius:var(--ck-border-radius);--ck-resizer-tooltip-offset:10px;--ck-resizer-tooltip-height:calc(var(--ck-spacing-small)*2 + 10px)}.ck .ck-widget,.ck .ck-widget.ck-widget_with-selection-handle{position:relative}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{position:absolute}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{display:block}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle:hover>.ck-widget__selection-handle{visibility:visible}.ck .ck-size-view{background:var(--ck-color-resizer-tooltip-background);border:1px solid var(--ck-color-resizer-tooltip-text);border-radius:var(--ck-resizer-border-radius);color:var(--ck-color-resizer-tooltip-text);display:block;font-size:var(--ck-font-size-tiny);height:var(--ck-resizer-tooltip-height);line-height:var(--ck-resizer-tooltip-height);padding:0 var(--ck-spacing-small)}.ck .ck-size-view.ck-orientation-above-center,.ck .ck-size-view.ck-orientation-bottom-left,.ck .ck-size-view.ck-orientation-bottom-right,.ck .ck-size-view.ck-orientation-top-left,.ck .ck-size-view.ck-orientation-top-right{position:absolute}.ck .ck-size-view.ck-orientation-top-left{left:var(--ck-resizer-tooltip-offset);top:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-top-right{right:var(--ck-resizer-tooltip-offset);top:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-right{bottom:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-left{bottom:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-above-center{left:50%;top:calc(var(--ck-resizer-tooltip-height)*-1);transform:translate(-50%)}:root{--ck-widget-outline-thickness:3px;--ck-widget-handler-icon-size:16px;--ck-widget-handler-animation-duration:200ms;--ck-widget-handler-animation-curve:ease;--ck-color-widget-blurred-border:#dedede;--ck-color-widget-hover-border:#ffc83d;--ck-color-widget-editable-focus-background:var(--ck-color-base-background);--ck-color-widget-drag-handler-icon-color:var(--ck-color-base-background)}.ck .ck-widget{outline-color:transparent;outline-style:solid;outline-width:var(--ck-widget-outline-thickness);transition:outline-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_selected,.ck .ck-widget.ck-widget_selected:hover{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-focus-border)}.ck .ck-widget:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-editor__nested-editable{border:1px solid transparent}.ck .ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck .ck-editor__nested-editable:focus{background-color:var(--ck-color-widget-editable-focus-background);border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;outline:none}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{background-color:transparent;border-radius:var(--ck-border-radius) var(--ck-border-radius) 0 0;box-sizing:border-box;left:calc(0px - var(--ck-widget-outline-thickness));opacity:0;padding:4px;top:0;transform:translateY(-100%);transition:background-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),visibility var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{color:var(--ck-color-widget-drag-handler-icon-color);height:var(--ck-widget-handler-icon-size);width:var(--ck-widget-handler-icon-size)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:0;transition:opacity .3s var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover .ck-icon .ck-icon__selected-indicator{opacity:1}.ck .ck-widget.ck-widget_with-selection-handle:hover>.ck-widget__selection-handle{background-color:var(--ck-color-widget-hover-border);opacity:1}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle{background-color:var(--ck-color-focus-border);opacity:1}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:1}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{left:auto;right:calc(0px - var(--ck-widget-outline-thickness))}.ck.ck-editor__editable.ck-read-only .ck-widget{transition:none}.ck.ck-editor__editable.ck-read-only .ck-widget:not(.ck-widget_selected){--ck-widget-outline-thickness:0px}.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{outline-color:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle:hover>.ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle:hover>.ck-widget__selection-handle:hover,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle>.ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle>.ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable blockquote>.ck-widget.ck-widget_with-selection-handle:first-child,.ck.ck-editor__editable>.ck-widget.ck-widget_with-selection-handle:first-child{margin-top:calc(1em + var(--ck-widget-handler-icon-size))}","",{version:3,sources:["webpack://./../ckeditor5-widget/theme/widget.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-widget/widget.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_focus.css","webpack://./../ckeditor5-theme-lark/theme/mixins/_shadow.css"],names:[],mappings:"AAKA,MACC,+CAAgD,CAChD,6CAAsD,CACtD,uCAAgD,CAEhD,kDAAmD,CACnD,gCAAiC,CACjC,kEACD,CAOA,8DAEC,iBAqBD,CAnBC,4EACC,iBAOD,CALC,qFAGC,aACD,CASD,iLACC,kBACD,CAGD,kBACC,qDAAsD,CAEtD,qDAAsD,CACtD,6CAA8C,CAF9C,0CAA2C,CAI3C,aAAc,CADd,kCAAmC,CAGnC,uCAAwC,CACxC,4CAA6C,CAF7C,iCAsCD,CAlCC,8NAKC,iBACD,CAEA,0CAEC,qCAAsC,CADtC,oCAED,CAEA,2CAEC,sCAAuC,CADvC,oCAED,CAEA,8CACC,uCAAwC,CACxC,sCACD,CAEA,6CACC,uCAAwC,CACxC,qCACD,CAGA,8CAEC,QAAS,CADT,6CAAgD,CAEhD,yBACD,CCjFD,MACC,iCAAkC,CAClC,kCAAmC,CACnC,4CAA6C,CAC7C,wCAAyC,CAEzC,wCAAiD,CACjD,sCAAkD,CAClD,2EAA4E,CAC5E,yEACD,CAEA,eAGC,yBAA0B,CAD1B,mBAAoB,CADpB,gDAAiD,CAGjD,6GAUD,CARC,0EAEC,6EACD,CAEA,qBACC,iDACD,CAGD,gCACC,4BAWD,CAPC,yGAKC,iEAAkE,CCnCnE,2BAA2B,CCF3B,qCAA8B,CDC9B,YDqCA,CAIA,4EAKC,4BAA6B,CAa7B,iEAAkE,CAhBlE,qBAAsB,CAoBtB,mDAAoD,CAhBpD,SAAU,CALV,WAAY,CAsBZ,KAAM,CAFN,2BAA4B,CAT5B,6SAgCD,CAnBC,qFAIC,oDAAqD,CADrD,yCAA0C,CAD1C,wCAWD,CANC,kHACC,SAAU,CAGV,+DACD,CAID,wHACC,SACD,CAID,kFAEC,oDAAqD,CADrD,SAED,CAKC,oMAEC,6CAA8C,CAD9C,SAOD,CAHC,gRACC,SACD,CAOH,qFACC,SAAU,CACV,oDACD,CAGA,gDAEC,eAkBD,CAhBC,yEAOC,iCACD,CAGC,gOAEC,gDACD,CAOD,wIAEC,mDAQD,CALE,ghBAEC,gDACD,CAKH,yKAOC,yDACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-color-resizer: var(--ck-color-focus-border);\n\t--ck-color-resizer-tooltip-background: hsl(0, 0%, 15%);\n\t--ck-color-resizer-tooltip-text: hsl(0, 0%, 95%);\n\n\t--ck-resizer-border-radius: var(--ck-border-radius);\n\t--ck-resizer-tooltip-offset: 10px;\n\t--ck-resizer-tooltip-height: calc(var(--ck-spacing-small) * 2 + 10px);\n}\n\n.ck .ck-widget {\n\t/* This is neccessary for type around UI to be positioned properly. */\n\tposition: relative;\n}\n\n.ck .ck-widget.ck-widget_with-selection-handle {\n\t/* Make the widget wrapper a relative positioning container for the drag handle. */\n\tposition: relative;\n\n\t& .ck-widget__selection-handle {\n\t\tposition: absolute;\n\n\t\t& .ck-icon {\n\t\t\t/* Make sure the icon in not a subject to font-size or line-height to avoid\n\t\t\tunnecessary spacing around it. */\n\t\t\tdisplay: block;\n\t\t}\n\t}\n\n\t/* Show the selection handle on mouse hover over the widget, but not for nested widgets. */\n\t&:hover > .ck-widget__selection-handle {\n\t\tvisibility: visible;\n\t}\n\n\t/* Show the selection handle when the widget is selected, but not for nested widgets. */\n\t&.ck-widget_selected > .ck-widget__selection-handle {\n\t\tvisibility: visible;\n\t}\n}\n\n.ck .ck-size-view {\n\tbackground: var(--ck-color-resizer-tooltip-background);\n\tcolor: var(--ck-color-resizer-tooltip-text);\n\tborder: 1px solid var(--ck-color-resizer-tooltip-text);\n\tborder-radius: var(--ck-resizer-border-radius);\n\tfont-size: var(--ck-font-size-tiny);\n\tdisplay: block;\n\tpadding: 0 var(--ck-spacing-small);\n\theight: var(--ck-resizer-tooltip-height);\n\tline-height: var(--ck-resizer-tooltip-height);\n\n\t&.ck-orientation-top-left,\n\t&.ck-orientation-top-right,\n\t&.ck-orientation-bottom-right,\n\t&.ck-orientation-bottom-left,\n\t&.ck-orientation-above-center {\n\t\tposition: absolute;\n\t}\n\n\t&.ck-orientation-top-left {\n\t\ttop: var(--ck-resizer-tooltip-offset);\n\t\tleft: var(--ck-resizer-tooltip-offset);\n\t}\n\n\t&.ck-orientation-top-right {\n\t\ttop: var(--ck-resizer-tooltip-offset);\n\t\tright: var(--ck-resizer-tooltip-offset);\n\t}\n\n\t&.ck-orientation-bottom-right {\n\t\tbottom: var(--ck-resizer-tooltip-offset);\n\t\tright: var(--ck-resizer-tooltip-offset);\n\t}\n\n\t&.ck-orientation-bottom-left {\n\t\tbottom: var(--ck-resizer-tooltip-offset);\n\t\tleft: var(--ck-resizer-tooltip-offset);\n\t}\n\n\t/* Class applied if the widget is too small to contain the size label */\n\t&.ck-orientation-above-center {\n\t\ttop: calc(var(--ck-resizer-tooltip-height) * -1);\n\t\tleft: 50%;\n\t\ttransform: translate(-50%);\n\t}\n}\n",'/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "../mixins/_focus.css";\n@import "../mixins/_shadow.css";\n\n:root {\n\t--ck-widget-outline-thickness: 3px;\n\t--ck-widget-handler-icon-size: 16px;\n\t--ck-widget-handler-animation-duration: 200ms;\n\t--ck-widget-handler-animation-curve: ease;\n\n\t--ck-color-widget-blurred-border: hsl(0, 0%, 87%);\n\t--ck-color-widget-hover-border: hsl(43, 100%, 62%);\n\t--ck-color-widget-editable-focus-background: var(--ck-color-base-background);\n\t--ck-color-widget-drag-handler-icon-color: var(--ck-color-base-background);\n}\n\n.ck .ck-widget {\n\toutline-width: var(--ck-widget-outline-thickness);\n\toutline-style: solid;\n\toutline-color: transparent;\n\ttransition: outline-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);\n\n\t&.ck-widget_selected,\n\t&.ck-widget_selected:hover {\n\t\toutline: var(--ck-widget-outline-thickness) solid var(--ck-color-focus-border);\n\t}\n\n\t&:hover {\n\t\toutline-color: var(--ck-color-widget-hover-border);\n\t}\n}\n\n.ck .ck-editor__nested-editable {\n\tborder: 1px solid transparent;\n\n\t/* The :focus style is applied before .ck-editor__nested-editable_focused class is rendered in the view.\n\tThese styles show a different border for a blink of an eye, so `:focus` need to have same styles applied. */\n\t&.ck-editor__nested-editable_focused,\n\t&:focus {\n\t\t@mixin ck-focus-ring;\n\t\t@mixin ck-box-shadow var(--ck-inner-shadow);\n\n\t\tbackground-color: var(--ck-color-widget-editable-focus-background);\n\t}\n}\n\n.ck .ck-widget.ck-widget_with-selection-handle {\n\t& .ck-widget__selection-handle {\n\t\tpadding: 4px;\n\t\tbox-sizing: border-box;\n\n\t\t/* Background and opacity will be animated as the handler shows up or the widget gets selected. */\n\t\tbackground-color: transparent;\n\t\topacity: 0;\n\n\t\t/* Transition:\n\t\t * background-color for the .ck-widget_selected state change,\n\t\t * visibility for hiding the handler,\n\t\t * opacity for the proper look of the icon when the handler disappears. */\n\t\ttransition:\n\t\t\tbackground-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),\n\t\t\tvisibility var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),\n\t\t\topacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);\n\n\t\t/* Make only top corners round. */\n\t\tborder-radius: var(--ck-border-radius) var(--ck-border-radius) 0 0;\n\n\t\t/* Place the drag handler outside the widget wrapper. */\n\t\ttransform: translateY(-100%);\n\t\tleft: calc(0px - var(--ck-widget-outline-thickness));\n\t\ttop: 0;\n\n\t\t& .ck-icon {\n\t\t\t/* Make sure the dimensions of the icon are independent of the fon-size of the content. */\n\t\t\twidth: var(--ck-widget-handler-icon-size);\n\t\t\theight: var(--ck-widget-handler-icon-size);\n\t\t\tcolor: var(--ck-color-widget-drag-handler-icon-color);\n\n\t\t\t/* The "selected" part of the icon is invisible by default */\n\t\t\t& .ck-icon__selected-indicator {\n\t\t\t\topacity: 0;\n\n\t\t\t\t/* Note: The animation is longer on purpose. Simply feels better. */\n\t\t\t\ttransition: opacity 300ms var(--ck-widget-handler-animation-curve);\n\t\t\t}\n\t\t}\n\n\t\t/* Advertise using the look of the icon that once clicked the handler, the widget will be selected. */\n\t\t&:hover .ck-icon .ck-icon__selected-indicator {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\t/* Show the selection handler on mouse hover over the widget, but not for nested widgets. */\n\t&:hover > .ck-widget__selection-handle {\n\t\topacity: 1;\n\t\tbackground-color: var(--ck-color-widget-hover-border);\n\t}\n\n\t/* Show the selection handler when the widget is selected, but not for nested widgets. */\n\t&.ck-widget_selected,\n\t&.ck-widget_selected:hover {\n\t\t& > .ck-widget__selection-handle {\n\t\t\topacity: 1;\n\t\t\tbackground-color: var(--ck-color-focus-border);\n\n\t\t\t/* When the widget is selected, notify the user using the proper look of the icon. */\n\t\t\t& .ck-icon .ck-icon__selected-indicator {\n\t\t\t\topacity: 1;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/* In a RTL environment, align the selection handler to the right side of the widget */\n/* stylelint-disable-next-line no-descending-specificity */\n.ck[dir="rtl"] .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle {\n\tleft: auto;\n\tright: calc(0px - var(--ck-widget-outline-thickness));\n}\n\n/* https://github.com/ckeditor/ckeditor5/issues/6415 */\n.ck.ck-editor__editable.ck-read-only .ck-widget {\n\t/* Prevent the :hover outline from showing up because of the used outline-color transition. */\n\ttransition: none;\n\n\t&:not(.ck-widget_selected) {\n\t\t/* Disable visual effects of hover/active widget when CKEditor is in readOnly mode.\n\t\t * See: https://github.com/ckeditor/ckeditor5/issues/1261\n\t\t *\n\t\t * Leave the unit because this custom property is used in calc() by other features.\n\t\t * See: https://github.com/ckeditor/ckeditor5/issues/6775\n\t\t */\n\t\t--ck-widget-outline-thickness: 0px;\n\t}\n\n\t&.ck-widget_with-selection-handle {\n\t\t& .ck-widget__selection-handle,\n\t\t& .ck-widget__selection-handle:hover {\n\t\t\tbackground: var(--ck-color-widget-blurred-border);\n\t\t}\n\t}\n}\n\n/* Style the widget when it\'s selected but the editable it belongs to lost focus. */\n/* stylelint-disable-next-line no-descending-specificity */\n.ck.ck-editor__editable.ck-blurred .ck-widget {\n\t&.ck-widget_selected,\n\t&.ck-widget_selected:hover {\n\t\toutline-color: var(--ck-color-widget-blurred-border);\n\n\t\t&.ck-widget_with-selection-handle {\n\t\t\t& > .ck-widget__selection-handle,\n\t\t\t& > .ck-widget__selection-handle:hover {\n\t\t\t\tbackground: var(--ck-color-widget-blurred-border);\n\t\t\t}\n\t\t}\n\t}\n}\n\n.ck.ck-editor__editable > .ck-widget.ck-widget_with-selection-handle:first-child,\n.ck.ck-editor__editable blockquote > .ck-widget.ck-widget_with-selection-handle:first-child {\n\t/* Do not crop selection handler if a widget is a first-child in the blockquote or in the root editable.\n\tIn fact, anything with overflow: hidden.\n\thttps://github.com/ckeditor/ckeditor5-block-quote/issues/28\n\thttps://github.com/ckeditor/ckeditor5-widget/issues/44\n\thttps://github.com/ckeditor/ckeditor5-widget/issues/66 */\n\tmargin-top: calc(1em + var(--ck-widget-handler-icon-size));\n}\n',"/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A visual style of focused element's border.\n */\n@define-mixin ck-focus-ring {\n\t/* Disable native outline. */\n\toutline: none;\n\tborder: var(--ck-focus-ring)\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * A helper to combine multiple shadows.\n */\n@define-mixin ck-box-shadow $shadowA, $shadowB: 0 0 {\n\tbox-shadow: $shadowA, $shadowB;\n}\n\n/**\n * Gives an element a drop shadow so it looks like a floating panel.\n */\n@define-mixin ck-drop-shadow {\n\t@mixin ck-box-shadow var(--ck-drop-shadow);\n}\n"],sourceRoot:""}]);const a=s},8506:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,".ck .ck-widget_with-resizer{position:relative}.ck .ck-widget__resizer{display:none;left:0;pointer-events:none;position:absolute;top:0}.ck-focused .ck-widget_with-resizer.ck-widget_selected>.ck-widget__resizer{display:block}.ck .ck-widget__resizer__handle{pointer-events:all;position:absolute}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-right,.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-left{cursor:nwse-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-left,.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-right{cursor:nesw-resize}:root{--ck-resizer-size:10px;--ck-resizer-offset:calc(var(--ck-resizer-size)/-2 - 2px);--ck-resizer-border-width:1px}.ck .ck-widget__resizer{outline:1px solid var(--ck-color-resizer)}.ck .ck-widget__resizer__handle{background:var(--ck-color-focus-border);border:var(--ck-resizer-border-width) solid #fff;border-radius:var(--ck-resizer-border-radius);height:var(--ck-resizer-size);width:var(--ck-resizer-size)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-left{left:var(--ck-resizer-offset);top:var(--ck-resizer-offset)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-right{right:var(--ck-resizer-offset);top:var(--ck-resizer-offset)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-right{bottom:var(--ck-resizer-offset);right:var(--ck-resizer-offset)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-left{bottom:var(--ck-resizer-offset);left:var(--ck-resizer-offset)}","",{version:3,sources:["webpack://./../ckeditor5-widget/theme/widgetresize.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-widget/widgetresize.css"],names:[],mappings:"AAKA,4BAEC,iBACD,CAEA,wBACC,YAAa,CAMb,MAAO,CAFP,mBAAoB,CAHpB,iBAAkB,CAMlB,KACD,CAGC,2EACC,aACD,CAGD,gCAIC,kBAAmB,CAHnB,iBAcD,CATC,4IAEC,kBACD,CAEA,4IAEC,kBACD,CCpCD,MACC,sBAAuB,CAGvB,yDAAiE,CACjE,6BACD,CAEA,wBACC,yCACD,CAEA,gCAGC,uCAAwC,CACxC,gDAA6D,CAC7D,6CAA8C,CAH9C,6BAA8B,CAD9B,4BAyBD,CAnBC,oEAEC,6BAA8B,CAD9B,4BAED,CAEA,qEAEC,8BAA+B,CAD/B,4BAED,CAEA,wEACC,+BAAgC,CAChC,8BACD,CAEA,uEACC,+BAAgC,CAChC,6BACD",sourcesContent:["/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck .ck-widget_with-resizer {\n\t/* Make the widget wrapper a relative positioning container for the drag handle. */\n\tposition: relative;\n}\n\n.ck .ck-widget__resizer {\n\tdisplay: none;\n\tposition: absolute;\n\n\t/* The wrapper itself should not interfere with the pointer device, only the handles should. */\n\tpointer-events: none;\n\n\tleft: 0;\n\ttop: 0;\n}\n\n.ck-focused .ck-widget_with-resizer.ck-widget_selected {\n\t& > .ck-widget__resizer {\n\t\tdisplay: block;\n\t}\n}\n\n.ck .ck-widget__resizer__handle {\n\tposition: absolute;\n\n\t/* Resizers are the only UI elements that should interfere with a pointer device. */\n\tpointer-events: all;\n\n\t&.ck-widget__resizer__handle-top-left,\n\t&.ck-widget__resizer__handle-bottom-right {\n\t\tcursor: nwse-resize;\n\t}\n\n\t&.ck-widget__resizer__handle-top-right,\n\t&.ck-widget__resizer__handle-bottom-left {\n\t\tcursor: nesw-resize;\n\t}\n}\n","/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-resizer-size: 10px;\n\n\t/* Set the resizer with a 50% offset. */\n\t--ck-resizer-offset: calc( ( var(--ck-resizer-size) / -2 ) - 2px);\n\t--ck-resizer-border-width: 1px;\n}\n\n.ck .ck-widget__resizer {\n\toutline: 1px solid var(--ck-color-resizer);\n}\n\n.ck .ck-widget__resizer__handle {\n\twidth: var(--ck-resizer-size);\n\theight: var(--ck-resizer-size);\n\tbackground: var(--ck-color-focus-border);\n\tborder: var(--ck-resizer-border-width) solid hsl(0, 0%, 100%);\n\tborder-radius: var(--ck-resizer-border-radius);\n\n\t&.ck-widget__resizer__handle-top-left {\n\t\ttop: var(--ck-resizer-offset);\n\t\tleft: var(--ck-resizer-offset);\n\t}\n\n\t&.ck-widget__resizer__handle-top-right {\n\t\ttop: var(--ck-resizer-offset);\n\t\tright: var(--ck-resizer-offset);\n\t}\n\n\t&.ck-widget__resizer__handle-bottom-right {\n\t\tbottom: var(--ck-resizer-offset);\n\t\tright: var(--ck-resizer-offset);\n\t}\n\n\t&.ck-widget__resizer__handle-bottom-left {\n\t\tbottom: var(--ck-resizer-offset);\n\t\tleft: var(--ck-resizer-offset);\n\t}\n}\n"],sourceRoot:""}]);const a=s},4921:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(1799),i=n.n(o),r=n(2609),s=n.n(r)()(i());s.push([t.id,'.ck .ck-widget .ck-widget__type-around__button{display:block;overflow:hidden;position:absolute;z-index:var(--ck-z-default)}.ck .ck-widget .ck-widget__type-around__button svg{left:50%;position:absolute;top:50%;z-index:calc(var(--ck-z-default) + 2)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_before{left:min(10%,30px);top:calc(var(--ck-widget-outline-thickness)*-.5);transform:translateY(-50%)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_after{bottom:calc(var(--ck-widget-outline-thickness)*-.5);right:min(10%,30px);transform:translateY(50%)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{content:"";display:block;left:1px;position:absolute;top:1px;z-index:calc(var(--ck-z-default) + 1)}.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__fake-caret{display:none;left:0;position:absolute;right:0}.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__fake-caret{left:calc(var(--ck-widget-outline-thickness)*-1);right:calc(var(--ck-widget-outline-thickness)*-1)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__fake-caret{display:block;top:calc(var(--ck-widget-outline-thickness)*-1 - 1px)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__fake-caret{bottom:calc(var(--ck-widget-outline-thickness)*-1 - 1px);display:block}.ck.ck-editor__editable.ck-read-only .ck-widget__type-around,.ck.ck-editor__editable.ck-restricted-editing_mode_restricted .ck-widget__type-around,.ck.ck-editor__editable.ck-widget__type-around_disabled .ck-widget__type-around{display:none}:root{--ck-widget-type-around-button-size:20px;--ck-color-widget-type-around-button-active:var(--ck-color-focus-border);--ck-color-widget-type-around-button-hover:var(--ck-color-widget-hover-border);--ck-color-widget-type-around-button-blurred-editable:var(--ck-color-widget-blurred-border);--ck-color-widget-type-around-button-radar-start-alpha:0;--ck-color-widget-type-around-button-radar-end-alpha:.3;--ck-color-widget-type-around-button-icon:var(--ck-color-base-background)}.ck .ck-widget .ck-widget__type-around__button{background:var(--ck-color-widget-type-around-button);border-radius:100px;height:var(--ck-widget-type-around-button-size);opacity:0;pointer-events:none;transition:opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);width:var(--ck-widget-type-around-button-size)}.ck .ck-widget .ck-widget__type-around__button svg{height:8px;margin-top:1px;transform:translate(-50%,-50%);transition:transform .5s ease;width:10px}.ck .ck-widget .ck-widget__type-around__button svg *{stroke-dasharray:10;stroke-dashoffset:0;fill:none;stroke:var(--ck-color-widget-type-around-button-icon);stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round}.ck .ck-widget .ck-widget__type-around__button svg line{stroke-dasharray:7}.ck .ck-widget .ck-widget__type-around__button:hover{animation:ck-widget-type-around-button-sonar 1s ease infinite}.ck .ck-widget .ck-widget__type-around__button:hover svg polyline{animation:ck-widget-type-around-arrow-dash 2s linear}.ck .ck-widget .ck-widget__type-around__button:hover svg line{animation:ck-widget-type-around-arrow-tip-dash 2s linear}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:1;pointer-events:auto}.ck .ck-widget:not(.ck-widget_selected)>.ck-widget__type-around>.ck-widget__type-around__button{background:var(--ck-color-widget-type-around-button-hover)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover{background:var(--ck-color-widget-type-around-button-active)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{background:linear-gradient(135deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3));border-radius:100px;height:calc(var(--ck-widget-type-around-button-size) - 2px);width:calc(var(--ck-widget-type-around-button-size) - 2px)}.ck .ck-widget.ck-widget_with-selection-handle>.ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:20px}.ck .ck-widget .ck-widget__type-around__fake-caret{animation:ck-widget-type-around-fake-caret-pulse 1s linear infinite normal forwards;background:var(--ck-color-base-text);height:1px;outline:1px solid hsla(0,0%,100%,.5);pointer-events:none}.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_after,.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_before{outline-color:transparent}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected:hover,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer,.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle{opacity:0}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:0;margin-right:20px}.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover){background:var(--ck-color-widget-type-around-button-blurred-editable)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover) svg *{stroke:#999}@keyframes ck-widget-type-around-arrow-dash{0%{stroke-dashoffset:10}20%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-arrow-tip-dash{0%,20%{stroke-dashoffset:7}40%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-button-sonar{0%{box-shadow:0 0 0 0 hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}50%{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-end-alpha))}to{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}}@keyframes ck-widget-type-around-fake-caret-pulse{0%{opacity:1}49%{opacity:1}50%{opacity:0}99%{opacity:0}to{opacity:1}}',"",{version:3,sources:["webpack://./../ckeditor5-widget/theme/widgettypearound.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-widget/widgettypearound.css"],names:[],mappings:"AASC,+CACC,aAAc,CAEd,eAAgB,CADhB,iBAAkB,CAElB,2BAwBD,CAtBC,mDAGC,QAAS,CAFT,iBAAkB,CAClB,OAAQ,CAER,qCACD,CAEA,qFAGC,kBAAoB,CADpB,gDAAoD,CAGpD,0BACD,CAEA,oFAEC,mDAAuD,CACvD,mBAAqB,CAErB,yBACD,CAUA,mLACC,UAAW,CACX,aAAc,CAGd,QAAS,CAFT,iBAAkB,CAClB,OAAQ,CAER,qCACD,CAMD,2EACC,YAAa,CAEb,MAAO,CADP,iBAAkB,CAElB,OACD,CAOA,iFACC,gDAAqD,CACrD,iDACD,CAKA,wHAEC,aAAc,CADd,qDAED,CAKA,uHACC,wDAA6D,CAC7D,aACD,CAoBD,mOACC,YACD,CC3GA,MACC,wCAAyC,CACzC,wEAAyE,CACzE,8EAA+E,CAC/E,2FAA4F,CAC5F,wDAAyD,CACzD,uDAAwD,CACxD,yEACD,CAgBC,+CAGC,oDAAqD,CACrD,mBAAoB,CAFpB,+CAAgD,CAVjD,SAAU,CACV,mBAAoB,CAYnB,uMAAyM,CAJzM,8CAkDD,CA1CC,mDAEC,UAAW,CAGX,cAAe,CAFf,8BAA+B,CAC/B,6BAA8B,CAH9B,UAoBD,CAdC,qDACC,mBAAoB,CACpB,mBAAoB,CAEpB,SAAU,CACV,qDAAsD,CACtD,kBAAmB,CACnB,oBAAqB,CACrB,qBACD,CAEA,wDACC,kBACD,CAGD,qDAIC,6DAcD,CARE,kEACC,oDACD,CAEA,8DACC,wDACD,CAUF,uKAvED,SAAU,CACV,mBAwEC,CAOD,gGACC,0DACD,CAOA,uKAEC,2DAQD,CANC,mLAIC,uEAAkF,CADlF,mBAAoB,CADpB,2DAA4D,CAD5D,0DAID,CAOD,8GACC,gBACD,CAKA,mDAGC,mFAAoF,CAOpF,oCAAqC,CARrC,UAAW,CAOX,oCAAwC,CARxC,mBAUD,CAOC,6JAEC,yBACD,CAUA,yKACC,iDACD,CAMA,uOAlJD,SAAU,CACV,mBAmJC,CAoBA,6yBACC,SACD,CASF,uHACC,aAAc,CACd,iBACD,CAYG,iRAlMF,SAAU,CACV,mBAmME,CAQH,kIACC,qEAKD,CAHC,wIACC,WACD,CAGD,4CACC,GACC,oBACD,CACA,OACC,mBACD,CACD,CAEA,gDACC,OACC,mBACD,CACA,OACC,mBACD,CACD,CAEA,8CACC,GACC,6HACD,CACA,IACC,6HACD,CACA,GACC,+HACD,CACD,CAEA,kDACC,GACC,SACD,CACA,IACC,SACD,CACA,IACC,SACD,CACA,IACC,SACD,CACA,GACC,SACD,CACD",sourcesContent:['/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck .ck-widget {\n\t/*\n\t * Styles of the type around buttons\n\t */\n\t& .ck-widget__type-around__button {\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\toverflow: hidden;\n\t\tz-index: var(--ck-z-default);\n\n\t\t& svg {\n\t\t\tposition: absolute;\n\t\t\ttop: 50%;\n\t\t\tleft: 50%;\n\t\t\tz-index: calc(var(--ck-z-default) + 2);\n\t\t}\n\n\t\t&.ck-widget__type-around__button_before {\n\t\t\t/* Place it in the middle of the outline */\n\t\t\ttop: calc(-0.5 * var(--ck-widget-outline-thickness));\n\t\t\tleft: min(10%, 30px);\n\n\t\t\ttransform: translateY(-50%);\n\t\t}\n\n\t\t&.ck-widget__type-around__button_after {\n\t\t\t/* Place it in the middle of the outline */\n\t\t\tbottom: calc(-0.5 * var(--ck-widget-outline-thickness));\n\t\t\tright: min(10%, 30px);\n\n\t\t\ttransform: translateY(50%);\n\t\t}\n\t}\n\n\t/*\n\t * Styles for the buttons when:\n\t * - the widget is selected,\n\t * - or the button is being hovered (regardless of the widget state).\n\t */\n\t&.ck-widget_selected > .ck-widget__type-around > .ck-widget__type-around__button,\n\t& > .ck-widget__type-around > .ck-widget__type-around__button:hover {\n\t\t&::after {\n\t\t\tcontent: "";\n\t\t\tdisplay: block;\n\t\t\tposition: absolute;\n\t\t\ttop: 1px;\n\t\t\tleft: 1px;\n\t\t\tz-index: calc(var(--ck-z-default) + 1);\n\t\t}\n\t}\n\n\t/*\n\t * Styles for the horizontal "fake caret" which is displayed when the user navigates using the keyboard.\n\t */\n\t& > .ck-widget__type-around > .ck-widget__type-around__fake-caret {\n\t\tdisplay: none;\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\tright: 0;\n\t}\n\n\t/*\n\t * When the widget is hovered the "fake caret" would normally be narrower than the\n\t * extra outline displayed around the widget. Let\'s extend the "fake caret" to match\n\t * the full width of the widget.\n\t */\n\t&:hover > .ck-widget__type-around > .ck-widget__type-around__fake-caret {\n\t\tleft: calc( -1 * var(--ck-widget-outline-thickness) );\n\t\tright: calc( -1 * var(--ck-widget-outline-thickness) );\n\t}\n\n\t/*\n\t * Styles for the horizontal "fake caret" when it should be displayed before the widget (backward keyboard navigation).\n\t */\n\t&.ck-widget_type-around_show-fake-caret_before > .ck-widget__type-around > .ck-widget__type-around__fake-caret {\n\t\ttop: calc( -1 * var(--ck-widget-outline-thickness) - 1px );\n\t\tdisplay: block;\n\t}\n\n\t/*\n\t * Styles for the horizontal "fake caret" when it should be displayed after the widget (forward keyboard navigation).\n\t */\n\t&.ck-widget_type-around_show-fake-caret_after > .ck-widget__type-around > .ck-widget__type-around__fake-caret {\n\t\tbottom: calc( -1 * var(--ck-widget-outline-thickness) - 1px );\n\t\tdisplay: block;\n\t}\n}\n\n/*\n * Integration with the read-only mode of the editor.\n */\n.ck.ck-editor__editable.ck-read-only .ck-widget__type-around {\n\tdisplay: none;\n}\n\n/*\n * Integration with the restricted editing mode (feature) of the editor.\n */\n.ck.ck-editor__editable.ck-restricted-editing_mode_restricted .ck-widget__type-around {\n\tdisplay: none;\n}\n\n/*\n * Integration with the #isEnabled property of the WidgetTypeAround plugin.\n */\n.ck.ck-editor__editable.ck-widget__type-around_disabled .ck-widget__type-around {\n\tdisplay: none;\n}\n','/*\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-widget-type-around-button-size: 20px;\n\t--ck-color-widget-type-around-button-active: var(--ck-color-focus-border);\n\t--ck-color-widget-type-around-button-hover: var(--ck-color-widget-hover-border);\n\t--ck-color-widget-type-around-button-blurred-editable: var(--ck-color-widget-blurred-border);\n\t--ck-color-widget-type-around-button-radar-start-alpha: 0;\n\t--ck-color-widget-type-around-button-radar-end-alpha: .3;\n\t--ck-color-widget-type-around-button-icon: var(--ck-color-base-background);\n}\n\n@define-mixin ck-widget-type-around-button-visible {\n\topacity: 1;\n\tpointer-events: auto;\n}\n\n@define-mixin ck-widget-type-around-button-hidden {\n\topacity: 0;\n\tpointer-events: none;\n}\n\n.ck .ck-widget {\n\t/*\n\t * Styles of the type around buttons\n\t */\n\t& .ck-widget__type-around__button {\n\t\twidth: var(--ck-widget-type-around-button-size);\n\t\theight: var(--ck-widget-type-around-button-size);\n\t\tbackground: var(--ck-color-widget-type-around-button);\n\t\tborder-radius: 100px;\n\t\ttransition: opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve), background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);\n\n\t\t@mixin ck-widget-type-around-button-hidden;\n\n\t\t& svg {\n\t\t\twidth: 10px;\n\t\t\theight: 8px;\n\t\t\ttransform: translate(-50%,-50%);\n\t\t\ttransition: transform .5s ease;\n\t\t\tmargin-top: 1px;\n\n\t\t\t& * {\n\t\t\t\tstroke-dasharray: 10;\n\t\t\t\tstroke-dashoffset: 0;\n\n\t\t\t\tfill: none;\n\t\t\t\tstroke: var(--ck-color-widget-type-around-button-icon);\n\t\t\t\tstroke-width: 1.5px;\n\t\t\t\tstroke-linecap: round;\n\t\t\t\tstroke-linejoin: round;\n\t\t\t}\n\n\t\t\t& line {\n\t\t\t\tstroke-dasharray: 7;\n\t\t\t}\n\t\t}\n\n\t\t&:hover {\n\t\t\t/*\n\t\t\t * Display the "sonar" around the button when hovered.\n\t\t\t */\n\t\t\tanimation: ck-widget-type-around-button-sonar 1s ease infinite;\n\n\t\t\t/*\n\t\t\t * Animate active button\'s icon.\n\t\t\t */\n\t\t\t& svg {\n\t\t\t\t& polyline {\n\t\t\t\t\tanimation: ck-widget-type-around-arrow-dash 2s linear;\n\t\t\t\t}\n\n\t\t\t\t& line {\n\t\t\t\t\tanimation: ck-widget-type-around-arrow-tip-dash 2s linear;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Show type around buttons when the widget gets selected or being hovered.\n\t */\n\t&.ck-widget_selected,\n\t&:hover {\n\t\t& > .ck-widget__type-around > .ck-widget__type-around__button {\n\t\t\t@mixin ck-widget-type-around-button-visible;\n\t\t}\n\t}\n\n\t/*\n\t * Styles for the buttons when the widget is NOT selected (but the buttons are visible\n\t * and still can be hovered).\n\t */\n\t&:not(.ck-widget_selected) > .ck-widget__type-around > .ck-widget__type-around__button {\n\t\tbackground: var(--ck-color-widget-type-around-button-hover);\n\t}\n\n\t/*\n\t * Styles for the buttons when:\n\t * - the widget is selected,\n\t * - or the button is being hovered (regardless of the widget state).\n\t */\n\t&.ck-widget_selected > .ck-widget__type-around > .ck-widget__type-around__button,\n\t& > .ck-widget__type-around > .ck-widget__type-around__button:hover {\n\t\tbackground: var(--ck-color-widget-type-around-button-active);\n\n\t\t&::after {\n\t\t\twidth: calc(var(--ck-widget-type-around-button-size) - 2px);\n\t\t\theight: calc(var(--ck-widget-type-around-button-size) - 2px);\n\t\t\tborder-radius: 100px;\n\t\t\tbackground: linear-gradient(135deg, hsla(0,0%,100%,0) 0%, hsla(0,0%,100%,.3) 100%);\n\t\t}\n\t}\n\n\t/*\n\t * Styles for the "before" button when the widget has a selection handle. Because some space\n\t * is consumed by the handle, the button must be moved slightly to the right to let it breathe.\n\t */\n\t&.ck-widget_with-selection-handle > .ck-widget__type-around > .ck-widget__type-around__button_before {\n\t\tmargin-left: 20px;\n\t}\n\n\t/*\n\t * Styles for the horizontal "fake caret" which is displayed when the user navigates using the keyboard.\n\t */\n\t& .ck-widget__type-around__fake-caret {\n\t\tpointer-events: none;\n\t\theight: 1px;\n\t\tanimation: ck-widget-type-around-fake-caret-pulse linear 1s infinite normal forwards;\n\n\t\t/*\n\t\t * The semi-transparent-outline+background combo improves the contrast\n\t\t * when the background underneath the fake caret is dark.\n\t\t */\n\t\toutline: solid 1px hsla(0, 0%, 100%, .5);\n\t\tbackground: var(--ck-color-base-text);\n\t}\n\n\t/*\n\t * Styles of the widget when the "fake caret" is blinking (e.g. upon keyboard navigation).\n\t * Despite the widget being physically selected in the model, its outline should disappear.\n\t */\n\t&.ck-widget_selected {\n\t\t&.ck-widget_type-around_show-fake-caret_before,\n\t\t&.ck-widget_type-around_show-fake-caret_after {\n\t\t\toutline-color: transparent;\n\t\t}\n\t}\n\n\t&.ck-widget_type-around_show-fake-caret_before,\n\t&.ck-widget_type-around_show-fake-caret_after {\n\t\t/*\n\t\t * When the "fake caret" is visible we simulate that the widget is not selected\n\t\t * (despite being physically selected), so the outline color should be for the\n\t\t * unselected widget.\n\t\t */\n\t\t&.ck-widget_selected:hover {\n\t\t\toutline-color: var(--ck-color-widget-hover-border);\n\t\t}\n\n\t\t/*\n\t\t * Styles of the type around buttons when the "fake caret" is blinking (e.g. upon keyboard navigation).\n\t\t * In this state, the type around buttons would collide with the fake carets so they should disappear.\n\t\t */\n\t\t& > .ck-widget__type-around > .ck-widget__type-around__button {\n\t\t\t@mixin ck-widget-type-around-button-hidden;\n\t\t}\n\n\t\t/*\n\t\t * Fake horizontal caret integration with the selection handle. When the caret is visible, simply\n\t\t * hide the handle because it intersects with the caret (and does not make much sense anyway).\n\t\t */\n\t\t&.ck-widget_with-selection-handle {\n\t\t\t&.ck-widget_selected,\n\t\t\t&.ck-widget_selected:hover {\n\t\t\t\t& > .ck-widget__selection-handle {\n\t\t\t\t\topacity: 0\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * Fake horizontal caret integration with the resize UI. When the caret is visible, simply\n\t\t * hide the resize UI because it creates too much noise. It can be visible when the user\n\t\t * hovers the widget, though.\n\t\t */\n\t\t&.ck-widget_selected.ck-widget_with-resizer > .ck-widget__resizer {\n\t\t\topacity: 0\n\t\t}\n\t}\n}\n\n/*\n * Styles for the "before" button when the widget has a selection handle in an RTL environment.\n * The selection handler is aligned to the right side of the widget so there is no need to create\n * additional space for it next to the "before" button.\n */\n.ck[dir="rtl"] .ck-widget.ck-widget_with-selection-handle .ck-widget__type-around > .ck-widget__type-around__button_before {\n\tmargin-left: 0;\n\tmargin-right: 20px;\n}\n\n/*\n * Hide type around buttons when the widget is selected as a child of a selected\n * nested editable (e.g. mulit-cell table selection).\n *\n * See https://github.com/ckeditor/ckeditor5/issues/7263.\n */\n.ck-editor__nested-editable.ck-editor__editable_selected {\n\t& .ck-widget {\n\t\t&.ck-widget_selected,\n\t\t&:hover {\n\t\t\t& > .ck-widget__type-around > .ck-widget__type-around__button {\n\t\t\t\t@mixin ck-widget-type-around-button-hidden;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/*\n * Styles for the buttons when the widget is selected but the user clicked outside of the editor (blurred the editor).\n */\n.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected > .ck-widget__type-around > .ck-widget__type-around__button:not(:hover) {\n\tbackground: var(--ck-color-widget-type-around-button-blurred-editable);\n\n\t& svg * {\n\t\tstroke: hsl(0,0%,60%);\n\t}\n}\n\n@keyframes ck-widget-type-around-arrow-dash {\n\t0% {\n\t\tstroke-dashoffset: 10;\n\t}\n\t20%, 100% {\n\t\tstroke-dashoffset: 0;\n\t}\n}\n\n@keyframes ck-widget-type-around-arrow-tip-dash {\n\t0%, 20% {\n\t\tstroke-dashoffset: 7;\n\t}\n\t40%, 100% {\n\t\tstroke-dashoffset: 0;\n\t}\n}\n\n@keyframes ck-widget-type-around-button-sonar {\n\t0% {\n\t\tbox-shadow: 0 0 0 0 hsla(var(--ck-color-focus-border-coordinates), var(--ck-color-widget-type-around-button-radar-start-alpha));\n\t}\n\t50% {\n\t\tbox-shadow: 0 0 0 5px hsla(var(--ck-color-focus-border-coordinates), var(--ck-color-widget-type-around-button-radar-end-alpha));\n\t}\n\t100% {\n\t\tbox-shadow: 0 0 0 5px hsla(var(--ck-color-focus-border-coordinates), var(--ck-color-widget-type-around-button-radar-start-alpha));\n\t}\n}\n\n@keyframes ck-widget-type-around-fake-caret-pulse {\n\t0% {\n\t\topacity: 1;\n\t}\n\t49% {\n\t\topacity: 1;\n\t}\n\t50% {\n\t\topacity: 0;\n\t}\n\t99% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n'],sourceRoot:""}]);const a=s},2609:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=t(e);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,o){"string"==typeof t&&(t=[[null,t,""]]);var i={};if(o)for(var r=0;r{function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==n)return;var o,i,r=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(o=n.next()).done)&&(r.push(o.value),!e||r.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);"Object"===o&&t.constructor&&(o=t.constructor.name);if("Map"===o||"Set"===o)return Array.from(t);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return n(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n{var o,i=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),s=[];function a(t){for(var e=-1,n=0;n{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.nc=void 0;var o={};return(()=>{n.d(o,{default:()=>IA});const t=function(){return function t(){t.called=!0}};class e{constructor(e,n){this.source=e,this.name=n,this.path=[],this.stop=t(),this.off=t()}}const i=new Array(256).fill().map(((t,e)=>("0"+e.toString(16)).slice(-2)));function r(){const t=4294967296*Math.random()>>>0,e=4294967296*Math.random()>>>0,n=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0;return"e"+i[t>>0&255]+i[t>>8&255]+i[t>>16&255]+i[t>>24&255]+i[e>>0&255]+i[e>>8&255]+i[e>>16&255]+i[e>>24&255]+i[n>>0&255]+i[n>>8&255]+i[n>>16&255]+i[n>>24&255]+i[o>>0&255]+i[o>>8&255]+i[o>>16&255]+i[o>>24&255]}const s={get(t){return"number"!=typeof t?this[t]||this.normal:t},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function a(t,e){const n=s.get(e.priority);for(let o=0;o{if("object"==typeof e&&null!==e){if(n.has(e))return`[object ${e.constructor.name}]`;n.add(e)}return e},i=e?` ${JSON.stringify(e,o)}`:"",r=d(t);return t+i+r}(t,n)),this.name="CKEditorError",this.context=e,this.data=n}is(t){return"CKEditorError"===t}static rethrowUnexpectedError(t,e){if(t.is&&t.is("CKEditorError"))throw t;const n=new c(t.message,e);throw n.stack=t.stack,n}}function l(t,e){console.warn(...h(t,e))}function d(t){return`\nRead more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-${t}`}function h(t,e){const n=d(t);return e?[t,e,n]:[t,n]}const u="34.1.0",g="object"==typeof window?window:n.g;if(g.CKEDITOR_VERSION)throw new c("ckeditor-duplicated-modules",null);g.CKEDITOR_VERSION=u;const m=Symbol("listeningTo"),p=Symbol("emitterId"),f={on(t,e,n={}){this.listenTo(this,t,e,n)},once(t,e,n){let o=!1;this.listenTo(this,t,(function(t,...n){o||(o=!0,t.off(),e.call(this,t,...n))}),n)},off(t,e){this.stopListening(this,t,e)},listenTo(t,e,n,o={}){let i,r;this[m]||(this[m]={});const s=this[m];w(t)||b(t);const a=w(t);(i=s[a])||(i=s[a]={emitter:t,callbacks:{}}),(r=i.callbacks[e])||(r=i.callbacks[e]=[]),r.push(n),function(t,e,n,o,i){e._addEventListener?e._addEventListener(n,o,i):t._addEventListener.call(e,n,o,i)}(this,t,e,n,o)},stopListening(t,e,n){const o=this[m];let i=t&&w(t);const r=o&&i&&o[i],s=r&&e&&r.callbacks[e];if(!(!o||t&&!r||e&&!s))if(n){y(this,t,e,n);-1!==s.indexOf(n)&&(1===s.length?delete r.callbacks[e]:y(this,t,e,n))}else if(s){for(;n=s.pop();)y(this,t,e,n);delete r.callbacks[e]}else if(r){for(e in r.callbacks)this.stopListening(t,e);delete o[i]}else{for(i in o)this.stopListening(o[i].emitter);delete this[m]}},fire(t,...n){try{const o=t instanceof e?t:new e(this,t),i=o.name;let r=C(this,i);if(o.path.push(this),r){const t=[o,...n];r=Array.from(r);for(let e=0;e{this._delegations||(this._delegations=new Map),t.forEach((t=>{const o=this._delegations.get(t);o?o.set(e,n):this._delegations.set(t,new Map([[e,n]]))}))}}},stopDelegating(t,e){if(this._delegations)if(t)if(e){const n=this._delegations.get(t);n&&n.delete(e)}else this._delegations.delete(t);else this._delegations.clear()},_addEventListener(t,e,n){!function(t,e){const n=_(t);if(n[e])return;let o=e,i=null;const r=[];for(;""!==o&&!n[o];)n[o]={callbacks:[],childEvents:[]},r.push(n[o]),i&&n[o].childEvents.push(i),i=o,o=o.substr(0,o.lastIndexOf(":"));if(""!==o){for(const t of r)t.callbacks=n[o].callbacks.slice();n[o].childEvents.push(i)}}(this,t);const o=A(this,t),i={callback:e,priority:s.get(n.priority)};for(const t of o)a(t,i)},_removeEventListener(t,e){const n=A(this,t);for(const t of n)for(let n=0;n-1?C(t,e.substr(0,e.lastIndexOf(":"))):null}function v(t,n,o){for(let[i,r]of t){r?"function"==typeof r&&(r=r(n.name)):r=n.name;const t=new e(n.source,r);t.path=[...n.path],i.fire(t,...o)}}function y(t,e,n,o){e._removeEventListener?e._removeEventListener(n,o):t._removeEventListener.call(e,n,o)}const x=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};const E="object"==typeof global&&global&&global.Object===Object&&global;var D="object"==typeof self&&self&&self.Object===Object&&self;const M=E||D||Function("return this")();const I=M.Symbol;var S=Object.prototype,T=S.hasOwnProperty,N=S.toString,B=I?I.toStringTag:void 0;const z=function(t){var e=T.call(t,B),n=t[B];try{t[B]=void 0;var o=!0}catch(t){}var i=N.call(t);return o&&(e?t[B]=n:delete t[B]),i};var P=Object.prototype.toString;const L=function(t){return P.call(t)};var O=I?I.toStringTag:void 0;const R=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":O&&O in Object(t)?z(t):L(t)};const j=function(t){if(!x(t))return!1;var e=R(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e};const F=M["__core-js_shared__"];var V=function(){var t=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();const H=function(t){return!!V&&V in t};var U=Function.prototype.toString;const W=function(t){if(null!=t){try{return U.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var q=/^\[object .+?Constructor\]$/,G=Function.prototype,Y=Object.prototype,K=G.toString,Q=Y.hasOwnProperty,$=RegExp("^"+K.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Z=function(t){return!(!x(t)||H(t))&&(j(t)?$:q).test(W(t))};const J=function(t,e){return null==t?void 0:t[e]};const X=function(t,e){var n=J(t,e);return Z(n)?n:void 0};const tt=function(){try{var t=X(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();const et=function(t,e,n){"__proto__"==e&&tt?tt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n};const nt=function(t,e){return t===e||t!=t&&e!=e};var ot=Object.prototype.hasOwnProperty;const it=function(t,e,n){var o=t[e];ot.call(t,e)&&nt(o,n)&&(void 0!==n||e in t)||et(t,e,n)};const rt=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}};const mt=gt(ht);const pt=function(t,e){return mt(lt(t,e,st),t+"")};const ft=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};const kt=function(t){return null!=t&&ft(t.length)&&!j(t)};var bt=/^(?:0|[1-9]\d*)$/;const wt=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&bt.test(t))&&t>-1&&t%1==0&&t1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(i--,r):void 0,s&&_t(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++o{this.set(e,t[e])}),this);se(this);const n=this[Xt];if(t in this&&!n.has(t))throw new c("observable-set-cannot-override",this);Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get:()=>n.get(t),set(e){const o=n.get(t);let i=this.fire("set:"+t,t,e,o);void 0===i&&(i=e),o===i&&n.has(t)||(n.set(t,i),this.fire("change:"+t,t,i,o))}}),this[t]=e},bind(...t){if(!t.length||!le(t))throw new c("observable-bind-wrong-properties",this);if(new Set(t).size!==t.length)throw new c("observable-bind-duplicate-properties",this);se(this);const e=this[ee];t.forEach((t=>{if(e.has(t))throw new c("observable-bind-rebind",this)}));const n=new Map;return t.forEach((t=>{const o={property:t,to:[]};e.set(t,o),n.set(t,o)})),{to:ae,toMany:ce,_observable:this,_bindProperties:t,_to:[],_bindings:n}},unbind(...t){if(!this[Xt])return;const e=this[ee],n=this[te];if(t.length){if(!le(t))throw new c("observable-unbind-wrong-properties",this);t.forEach((t=>{const o=e.get(t);if(!o)return;let i,r,s,a;o.to.forEach((t=>{i=t[0],r=t[1],s=n.get(i),a=s[r],a.delete(o),a.size||delete s[r],Object.keys(s).length||(n.delete(i),this.stopListening(i,"change"))})),e.delete(t)}))}else n.forEach(((t,e)=>{this.stopListening(e,"change")})),n.clear(),e.clear()},decorate(t){const e=this[t];if(!e)throw new c("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:t});this.on(t,((t,n)=>{t.return=e.apply(this,n)})),this[t]=function(...e){return this.fire(t,e)},this[t][oe]=e,this[ne]||(this[ne]=[]),this[ne].push(t)}};Jt(ie,k),ie.stopListening=function(t,e,n){if(!t&&this[ne]){for(const t of this[ne])this[t]=this[t][oe];delete this[ne]}k.stopListening.call(this,t,e,n)};const re=ie;function se(t){t[Xt]||(Object.defineProperty(t,Xt,{value:new Map}),Object.defineProperty(t,te,{value:new Map}),Object.defineProperty(t,ee,{value:new Map}))}function ae(...t){const e=function(...t){if(!t.length)throw new c("observable-bind-to-parse-error",null);const e={to:[]};let n;"function"==typeof t[t.length-1]&&(e.callback=t.pop());return t.forEach((t=>{if("string"==typeof t)n.properties.push(t);else{if("object"!=typeof t)throw new c("observable-bind-to-parse-error",null);n={observable:t,properties:[]},e.to.push(n)}})),e}(...t),n=Array.from(this._bindings.keys()),o=n.length;if(!e.callback&&e.to.length>1)throw new c("observable-bind-to-no-callback",this);if(o>1&&e.callback)throw new c("observable-bind-to-extra-callback",this);var i;e.to.forEach((t=>{if(t.properties.length&&t.properties.length!==o)throw new c("observable-bind-to-properties-length",this);t.properties.length||(t.properties=this._bindProperties)})),this._to=e.to,e.callback&&(this._bindings.get(n[0]).callback=e.callback),i=this._observable,this._to.forEach((t=>{const e=i[te];let n;e.get(t.observable)||i.listenTo(t.observable,"change",((o,r)=>{n=e.get(t.observable)[r],n&&n.forEach((t=>{de(i,t.property)}))}))})),function(t){let e;t._bindings.forEach(((n,o)=>{t._to.forEach((i=>{e=i.properties[n.callback?0:t._bindProperties.indexOf(o)],n.to.push([i.observable,e]),function(t,e,n,o){const i=t[te],r=i.get(n),s=r||{};s[o]||(s[o]=new Set);s[o].add(e),r||i.set(n,s)}(t._observable,n,i.observable,e)}))}))}(this),this._bindProperties.forEach((t=>{de(this._observable,t)}))}function ce(t,e,n){if(this._bindings.size>1)throw new c("observable-bind-to-many-not-one-binding",this);this.to(...function(t,e){const n=t.map((t=>[t,e]));return Array.prototype.concat.apply([],n)}(t,e),n)}function le(t){return t.every((t=>"string"==typeof t))}function de(t,e){const n=t[ee].get(e);let o;n.callback?o=n.callback.apply(t,n.to.map((t=>t[0][t[1]]))):(o=n.to[0],o=o[0][o[1]]),Object.prototype.hasOwnProperty.call(t,e)?t[e]=o:t.set(e,o)}function he(t,...e){e.forEach((e=>{Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)).forEach((n=>{if(n in t.prototype)return;const o=Object.getOwnPropertyDescriptor(e,n);o.enumerable=!1,Object.defineProperty(t.prototype,n,o)}))}))}class ue{constructor(t){this.editor=t,this.set("isEnabled",!0),this._disableStack=new Set}forceDisabled(t){this._disableStack.add(t),1==this._disableStack.size&&(this.on("set:isEnabled",ge,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(t){this._disableStack.delete(t),0==this._disableStack.size&&(this.off("set:isEnabled",ge),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function ge(t){t.return=!1,t.stop()}he(ue,re);class me{constructor(t){this.editor=t,this.set("value",void 0),this.set("isEnabled",!1),this.affectsData=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",(()=>{this.refresh()})),this.on("execute",(t=>{this.isEnabled||t.stop()}),{priority:"high"}),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n&&this.affectsData?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}))}refresh(){this.isEnabled=!0}forceDisabled(t){this._disableStack.add(t),1==this._disableStack.size&&(this.on("set:isEnabled",pe,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(t){this._disableStack.delete(t),0==this._disableStack.size&&(this.off("set:isEnabled",pe),this.refresh())}execute(){}destroy(){this.stopListening()}}function pe(t){t.return=!1,t.stop()}he(me,re);class fe extends me{constructor(t){super(t),this._childCommandsDefinitions=[]}refresh(){}execute(...t){const e=this._getFirstEnabledCommand();return!!e&&e.execute(t)}registerChildCommand(t,e={priority:"normal"}){a(this._childCommandsDefinitions,{command:t,priority:e.priority}),t.on("change:isEnabled",(()=>this._checkEnabled())),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const t=this._childCommandsDefinitions.find((({command:t})=>t.isEnabled));return t&&t.command}}const ke=function(t,e){return function(n){return t(e(n))}};const be=ke(Object.getPrototypeOf,Object);var we=Function.prototype,_e=Object.prototype,Ae=we.toString,Ce=_e.hasOwnProperty,ve=Ae.call(Object);const ye=function(t){if(!vt(t)||"[object Object]"!=R(t))return!1;var e=be(t);if(null===e)return!0;var n=Ce.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ae.call(n)==ve};const xe=function(){this.__data__=[],this.size=0};const Ee=function(t,e){for(var n=t.length;n--;)if(nt(t[n][0],e))return n;return-1};var De=Array.prototype.splice;const Me=function(t){var e=this.__data__,n=Ee(e,t);return!(n<0)&&(n==e.length-1?e.pop():De.call(e,n,1),--this.size,!0)};const Ie=function(t){var e=this.__data__,n=Ee(e,t);return n<0?void 0:e[n][1]};const Se=function(t){return Ee(this.__data__,t)>-1};const Te=function(t,e){var n=this.__data__,o=Ee(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function Ne(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e{this._setToTarget(t,o,e[o],n)}))}}function xo(t){return Co(t,Eo)}function Eo(t){return vo(t)?t:void 0}function Do(t){return!(!t||!t[Symbol.iterator])}class Mo{constructor(t={},e={}){const n=Do(t);if(n||(e=t),this._items=[],this._itemMap=new Map,this._idProperty=e.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],n)for(const e of t)this._items.push(e),this._itemMap.set(this._getItemIdBeforeAdding(e),e)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(t,e){return this.addMany([t],e)}addMany(t,e){if(void 0===e)e=this._items.length;else if(e>this._items.length||e<0)throw new c("collection-add-item-invalid-index",this);for(let n=0;n{this._setUpBindToBinding((e=>new t(e)))},using:t=>{"function"==typeof t?this._setUpBindToBinding((e=>t(e))):this._setUpBindToBinding((e=>e[t]))}}}_setUpBindToBinding(t){const e=this._bindToCollection,n=(n,o,i)=>{const r=e._bindToCollection==this,s=e._bindToInternalToExternalMap.get(o);if(r&&s)this._bindToExternalToInternalMap.set(o,s),this._bindToInternalToExternalMap.set(s,o);else{const n=t(o);if(!n)return void this._skippedIndexesFromExternal.push(i);let r=i;for(const t of this._skippedIndexesFromExternal)i>t&&r--;for(const t of e._skippedIndexesFromExternal)r>=t&&r++;this._bindToExternalToInternalMap.set(o,n),this._bindToInternalToExternalMap.set(n,o),this.add(n,r);for(let t=0;t{const o=this._bindToExternalToInternalMap.get(e);o&&this.remove(o),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce(((t,e)=>(ne&&t.push(e),t)),[])}))}_getItemIdBeforeAdding(t){const e=this._idProperty;let n;if(e in t){if(n=t[e],"string"!=typeof n)throw new c("collection-add-invalid-id",this);if(this.get(n))throw new c("collection-add-item-already-exists",this)}else t[e]=n=r();return n}_remove(t){let e,n,o,i=!1;const r=this._idProperty;if("string"==typeof t?(n=t,o=this._itemMap.get(n),i=!o,o&&(e=this._items.indexOf(o))):"number"==typeof t?(e=t,o=this._items[e],i=!o,o&&(n=o[r])):(o=t,n=o[r],e=this._items.indexOf(o),i=-1==e||!this._itemMap.get(n)),i)throw new c("collection-remove-404",this);this._items.splice(e,1),this._itemMap.delete(n);const s=this._bindToInternalToExternalMap.get(o);return this._bindToInternalToExternalMap.delete(o),this._bindToExternalToInternalMap.delete(s),this.fire("remove",o,e),[o,e]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}he(Mo,k);class Io{constructor(t,e=[],n=[]){this._context=t,this._plugins=new Map,this._availablePlugins=new Map;for(const t of e)t.pluginName&&this._availablePlugins.set(t.pluginName,t);this._contextPlugins=new Map;for(const[t,e]of n)this._contextPlugins.set(t,e),this._contextPlugins.set(e,t),t.pluginName&&this._availablePlugins.set(t.pluginName,t)}*[Symbol.iterator](){for(const t of this._plugins)"function"==typeof t[0]&&(yield t)}get(t){const e=this._plugins.get(t);if(!e){let e=t;throw"function"==typeof t&&(e=t.pluginName||t.name),new c("plugincollection-plugin-not-loaded",this._context,{plugin:e})}return e}has(t){return this._plugins.has(t)}init(t,e=[],n=[]){const o=this,i=this._context;!function t(e,n=new Set){e.forEach((e=>{a(e)&&(n.has(e)||(n.add(e),e.pluginName&&!o._availablePlugins.has(e.pluginName)&&o._availablePlugins.set(e.pluginName,e),e.requires&&t(e.requires,n)))}))}(t),u(t);const r=[...function t(e,n=new Set){return e.map((t=>a(t)?t:o._availablePlugins.get(t))).reduce(((e,o)=>n.has(o)?e:(n.add(o),o.requires&&(u(o.requires,o),t(o.requires,n).forEach((t=>e.add(t)))),e.add(o))),new Set)}(t.filter((t=>!d(t,e))))];!function(t,e){for(const n of e){if("function"!=typeof n)throw new c("plugincollection-replace-plugin-invalid-type",null,{pluginItem:n});const e=n.pluginName;if(!e)throw new c("plugincollection-replace-plugin-missing-name",null,{pluginItem:n});if(n.requires&&n.requires.length)throw new c("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:e});const i=o._availablePlugins.get(e);if(!i)throw new c("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:e});const r=t.indexOf(i);if(-1===r){if(o._contextPlugins.has(i))return;throw new c("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:e})}if(i.requires&&i.requires.length)throw new c("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:e});t.splice(r,1,n),o._availablePlugins.set(e,n)}}(r,n);const s=function(t){return t.map((t=>{const e=o._contextPlugins.get(t)||new t(i);return o._add(t,e),e}))}(r);return g(s,"init").then((()=>g(s,"afterInit"))).then((()=>s));function a(t){return"function"==typeof t}function l(t){return a(t)&&t.isContextPlugin}function d(t,e){return e.some((e=>e===t||(h(t)===e||h(e)===t)))}function h(t){return a(t)?t.pluginName||t.name:t}function u(t,n=null){t.map((t=>a(t)?t:o._availablePlugins.get(t)||t)).forEach((t=>{!function(t,e){if(a(t))return;if(e)throw new c("plugincollection-soft-required",i,{missingPlugin:t,requiredBy:h(e)});throw new c("plugincollection-plugin-not-found",i,{plugin:t})}(t,n),function(t,e){if(!l(e))return;if(l(t))return;throw new c("plugincollection-context-required",i,{plugin:h(t),requiredBy:h(e)})}(t,n),function(t,n){if(!n)return;if(!d(t,e))return;throw new c("plugincollection-required",i,{plugin:h(t),requiredBy:h(n)})}(t,n)}))}function g(t,e){return t.reduce(((t,n)=>n[e]?o._contextPlugins.has(n)?t:t.then(n[e].bind(n)):t),Promise.resolve())}}destroy(){const t=[];for(const[,e]of this)"function"!=typeof e.destroy||this._contextPlugins.has(e)||t.push(e.destroy());return Promise.all(t)}_add(t,e){this._plugins.set(t,e);const n=t.pluginName;if(n){if(this._plugins.has(n))throw new c("plugincollection-plugin-name-conflict",null,{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:t});this._plugins.set(n,e)}}}function So(t){return Array.isArray(t)?t:[t]}function To(t,e,n=1){if("number"!=typeof n)throw new c("translation-service-quantity-not-a-number",null,{quantity:n});const o=Object.keys(window.CKEDITOR_TRANSLATIONS).length;1===o&&(t=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]);const i=e.id||e.string;if(0===o||!function(t,e){return!!window.CKEDITOR_TRANSLATIONS[t]&&!!window.CKEDITOR_TRANSLATIONS[t].dictionary[e]}(t,i))return 1!==n?e.plural:e.string;const r=window.CKEDITOR_TRANSLATIONS[t].dictionary,s=window.CKEDITOR_TRANSLATIONS[t].getPluralForm||(t=>1===t?0:1);if("string"==typeof r[i])return r[i];const a=Number(s(n));return r[i][a]}he(Io,k),window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});const No=["ar","ara","fa","per","fas","he","heb","ku","kur","ug","uig"];function Bo(t){return No.includes(t)?"rtl":"ltr"}class zo{constructor(t={}){this.uiLanguage=t.uiLanguage||"en",this.contentLanguage=t.contentLanguage||this.uiLanguage,this.uiLanguageDirection=Bo(this.uiLanguage),this.contentLanguageDirection=Bo(this.contentLanguage),this.t=(t,e)=>this._t(t,e)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(t,e=[]){e=So(e),"string"==typeof t&&(t={string:t});const n=!!t.plural?e[0]:1;return function(t,e){return t.replace(/%(\d+)/g,((t,n)=>nt.destroy()))).then((()=>this.plugins.destroy()))}_addEditor(t,e){if(this._contextOwner)throw new c("context-addeditor-private-context");this.editors.add(t),e&&(this._contextOwner=t)}_removeEditor(t){return this.editors.has(t)&&this.editors.remove(t),this._contextOwner===t?this.destroy():Promise.resolve()}_getEditorConfig(){const t={};for(const e of this.config.names())["plugins","removePlugins","extraPlugins"].includes(e)||(t[e]=this.config.get(e));return t}static create(t){return new Promise((e=>{const n=new this(t);e(n.initPlugins().then((()=>n)))}))}}class Lo{constructor(t){this.context=t}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}function Oo(t,e){const n=Math.min(t.length,e.length);for(let o=0;ot.data.length)throw new c("view-textproxy-wrong-offsetintext",this);if(n<0||e+n>t.data.length)throw new c("view-textproxy-wrong-length",this);this.data=t.data.substring(e,e+n),this.offsetInText=e}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}is(t){return"$textProxy"===t||"view:$textProxy"===t||"textProxy"===t||"view:textProxy"===t}getAncestors(t={includeSelf:!1,parentFirst:!1}){const e=[];let n=t.includeSelf?this.textNode:this.parent;for(;null!==n;)e[t.parentFirst?"push":"unshift"](n),n=n.parent;return e}}function Ho(t){return Do(t)?new Map(t):function(t){const e=new Map;for(const n in t)e.set(n,t[n]);return e}(t)}class Uo{constructor(...t){this._patterns=[],this.add(...t)}add(...t){for(let e of t)("string"==typeof e||e instanceof RegExp)&&(e={name:e}),this._patterns.push(e)}match(...t){for(const e of t)for(const t of this._patterns){const n=Wo(e,t);if(n)return{element:e,pattern:t,match:n}}return null}matchAll(...t){const e=[];for(const n of t)for(const t of this._patterns){const o=Wo(n,t);o&&e.push({element:n,pattern:t,match:o})}return e.length>0?e:null}getElementName(){if(1!==this._patterns.length)return null;const t=this._patterns[0],e=t.name;return"function"==typeof t||!e||e instanceof RegExp?null:e}}function Wo(t,e){if("function"==typeof e)return e(t);const n={};return e.name&&(n.name=function(t,e){if(t instanceof RegExp)return!!e.match(t);return t===e}(e.name,t.name),!n.name)||e.attributes&&(n.attributes=function(t,e){const n=new Set(e.getAttributeKeys());ye(t)?(void 0!==t.style&&l("matcher-pattern-deprecated-attributes-style-key",t),void 0!==t.class&&l("matcher-pattern-deprecated-attributes-class-key",t)):(n.delete("style"),n.delete("class"));return qo(t,n,(t=>e.getAttribute(t)))}(e.attributes,t),!n.attributes)?null:!(e.classes&&(n.classes=function(t,e){return qo(t,e.getClassNames())}(e.classes,t),!n.classes))&&(!(e.styles&&(n.styles=function(t,e){return qo(t,e.getStyleNames(!0),(t=>e.getStyle(t)))}(e.styles,t),!n.styles))&&n)}function qo(t,e,n){const o=function(t){if(Array.isArray(t))return t.map((t=>ye(t)?(void 0!==t.key&&void 0!==t.value||l("matcher-pattern-missing-key-or-value",t),[t.key,t.value]):[t,!0]));if(ye(t))return Object.entries(t);return[[t,!0]]}(t),i=Array.from(e),r=[];return o.forEach((([t,e])=>{i.forEach((o=>{(function(t,e){return!0===t||t===e||t instanceof RegExp&&e.match(t)})(t,o)&&function(t,e,n){if(!0===t)return!0;const o=n(e);return t===o||t instanceof RegExp&&!!String(o).match(t)}(e,o,n)&&r.push(o)}))})),!o.length||r.lengthi?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=Array(i);++oe===t));return Array.isArray(e)}set(t,e){if(x(t))for(const[e,n]of Object.entries(t))this._styleProcessor.toNormalizedForm(e,n,this._styles);else this._styleProcessor.toNormalizedForm(t,e,this._styles)}remove(t){const e=Mi(t);mi(this._styles,e),delete this._styles[t],this._cleanEmptyObjectsOnPath(e)}getNormalized(t){return this._styleProcessor.getNormalized(t,this._styles)}toString(){return this.isEmpty?"":this._getStylesEntries().map((t=>t.join(":"))).sort().join(";")+";"}getAsString(t){if(this.isEmpty)return;if(this._styles[t]&&!x(this._styles[t]))return this._styles[t];const e=this._styleProcessor.getReducedForm(t,this._styles).find((([e])=>e===t));return Array.isArray(e)?e[1]:void 0}getStyleNames(t=!1){if(this.isEmpty)return[];if(t)return this._styleProcessor.getStyleNames(this._styles);return this._getStylesEntries().map((([t])=>t))}clear(){this._styles={}}_getStylesEntries(){const t=[],e=Object.keys(this._styles);for(const n of e)t.push(...this._styleProcessor.getReducedForm(n,this._styles));return t}_cleanEmptyObjectsOnPath(t){const e=t.split(".");if(!(e.length>1))return;const n=e.splice(0,e.length-1).join("."),o=pi(this._styles,n);if(!o)return;!Array.from(Object.keys(o)).length&&this.remove(n)}}class Di{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(t,e,n){if(x(e))Ii(n,Mi(t),e);else if(this._normalizers.has(t)){const o=this._normalizers.get(t),{path:i,value:r}=o(e);Ii(n,i,r)}else Ii(n,t,e)}getNormalized(t,e){if(!t)return vi({},e);if(void 0!==e[t])return e[t];if(this._extractors.has(t)){const n=this._extractors.get(t);if("string"==typeof n)return pi(e,n);const o=n(t,e);if(o)return o}return pi(e,Mi(t))}getReducedForm(t,e){const n=this.getNormalized(t,e);if(void 0===n)return[];if(this._reducers.has(t)){return this._reducers.get(t)(n)}return[[t,n]]}getStyleNames(t){const e=Array.from(this._consumables.keys()).filter((e=>{const n=this.getNormalized(e,t);return n&&"object"==typeof n?Object.keys(n).length:n})),n=new Set([...e,...Object.keys(t)]);return Array.from(n.values())}getRelatedStyles(t){return this._consumables.get(t)||[]}setNormalizer(t,e){this._normalizers.set(t,e)}setExtractor(t,e){this._extractors.set(t,e)}setReducer(t,e){this._reducers.set(t,e)}setStyleRelation(t,e){this._mapStyleNames(t,e);for(const n of e)this._mapStyleNames(n,[t])}_mapStyleNames(t,e){this._consumables.has(t)||this._consumables.set(t,[]),this._consumables.get(t).push(...e)}}function Mi(t){return t.replace("-",".")}function Ii(t,e,n){let o=n;x(n)&&(o=vi({},pi(t,e),n)),xi(t,e,o)}class Si extends jo{constructor(t,e,n,o){if(super(t),this.name=e,this._attrs=function(t){t=Ho(t);for(const[e,n]of t)null===n?t.delete(e):"string"!=typeof n&&t.set(e,String(n));return t}(n),this._children=[],o&&this._insertChild(0,o),this._classes=new Set,this._attrs.has("class")){const t=this._attrs.get("class");Ti(this._classes,t),this._attrs.delete("class")}this._styles=new Ei(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style")),this._customProperties=new Map,this._unsafeAttributesToRender=[]}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}is(t,e=null){return e?e===this.name&&("element"===t||"view:element"===t):"element"===t||"view:element"===t||"node"===t||"view:node"===t}getChild(t){return this._children[t]}getChildIndex(t){return this._children.indexOf(t)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(t){if("class"==t)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==t){const t=this._styles.toString();return""==t?void 0:t}return this._attrs.get(t)}hasAttribute(t){return"class"==t?this._classes.size>0:"style"==t?!this._styles.isEmpty:this._attrs.has(t)}isSimilar(t){if(!(t instanceof Si))return!1;if(this===t)return!0;if(this.name!=t.name)return!1;if(this._attrs.size!==t._attrs.size||this._classes.size!==t._classes.size||this._styles.size!==t._styles.size)return!1;for(const[e,n]of this._attrs)if(!t._attrs.has(e)||t._attrs.get(e)!==n)return!1;for(const e of this._classes)if(!t._classes.has(e))return!1;for(const e of this._styles.getStyleNames())if(!t._styles.has(e)||t._styles.getAsString(e)!==this._styles.getAsString(e))return!1;return!0}hasClass(...t){for(const e of t)if(!this._classes.has(e))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(t){return this._styles.getAsString(t)}getNormalizedStyle(t){return this._styles.getNormalized(t)}getStyleNames(t=!1){return this._styles.getStyleNames(t)}hasStyle(...t){for(const e of t)if(!this._styles.has(e))return!1;return!0}findAncestor(...t){const e=new Uo(...t);let n=this.parent;for(;n;){if(e.match(n))return n;n=n.parent}return null}getCustomProperty(t){return this._customProperties.get(t)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const t=Array.from(this._classes).sort().join(","),e=this._styles.toString(),n=Array.from(this._attrs).map((t=>`${t[0]}="${t[1]}"`)).sort().join(" ");return this.name+(""==t?"":` class="${t}"`)+(e?` style="${e}"`:"")+(""==n?"":` ${n}`)}shouldRenderUnsafeAttribute(t){return this._unsafeAttributesToRender.includes(t)}_clone(t=!1){const e=[];if(t)for(const n of this.getChildren())e.push(n._clone(t));const n=new this.constructor(this.document,this.name,this._attrs,e);return n._classes=new Set(this._classes),n._styles.set(this._styles.getNormalized()),n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n}_appendChild(t){return this._insertChild(this.childCount,t)}_insertChild(t,e){this._fireChange("children",this);let n=0;const o=function(t,e){if("string"==typeof e)return[new Fo(t,e)];Do(e)||(e=[e]);return Array.from(e).map((e=>"string"==typeof e?new Fo(t,e):e instanceof Vo?new Fo(t,e.data):e))}(this.document,e);for(const e of o)null!==e.parent&&e._remove(),e.parent=this,e.document=this.document,this._children.splice(t,0,e),t++,n++;return n}_removeChildren(t,e=1){this._fireChange("children",this);for(let n=t;n0&&(this._classes.clear(),!0):"style"==t?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(t)}_addClass(t){this._fireChange("attributes",this);for(const e of So(t))this._classes.add(e)}_removeClass(t){this._fireChange("attributes",this);for(const e of So(t))this._classes.delete(e)}_setStyle(t,e){this._fireChange("attributes",this),this._styles.set(t,e)}_removeStyle(t){this._fireChange("attributes",this);for(const e of So(t))this._styles.remove(e)}_setCustomProperty(t,e){this._customProperties.set(t,e)}_removeCustomProperty(t){return this._customProperties.delete(t)}}function Ti(t,e){const n=e.split(/\s+/);t.clear(),n.forEach((e=>t.add(e)))}class Ni extends Si{constructor(t,e,n,o){super(t,e,n,o),this.getFillerOffset=Bi}is(t,e=null){return e?e===this.name&&("containerElement"===t||"view:containerElement"===t||"element"===t||"view:element"===t):"containerElement"===t||"view:containerElement"===t||"element"===t||"view:element"===t||"node"===t||"view:node"===t}}function Bi(){const t=[...this.getChildren()],e=t[this.childCount-1];if(e&&e.is("element","br"))return this.childCount;for(const e of t)if(!e.is("uiElement"))return null;return this.childCount}class zi extends Ni{constructor(t,e,n,o){super(t,e,n,o),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(t),this.bind("isFocused").to(t,"isFocused",(e=>e&&t.selection.editableElement==this)),this.listenTo(t.selection,"change",(()=>{this.isFocused=t.isFocused&&t.selection.editableElement==this}))}is(t,e=null){return e?e===this.name&&("editableElement"===t||"view:editableElement"===t||"containerElement"===t||"view:containerElement"===t||"element"===t||"view:element"===t):"editableElement"===t||"view:editableElement"===t||"containerElement"===t||"view:containerElement"===t||"element"===t||"view:element"===t||"node"===t||"view:node"===t}destroy(){this.stopListening()}}he(zi,re);const Pi=Symbol("rootName");class Li extends zi{constructor(t,e){super(t,e),this.rootName="main"}is(t,e=null){return e?e===this.name&&("rootElement"===t||"view:rootElement"===t||"editableElement"===t||"view:editableElement"===t||"containerElement"===t||"view:containerElement"===t||"element"===t||"view:element"===t):"rootElement"===t||"view:rootElement"===t||"editableElement"===t||"view:editableElement"===t||"containerElement"===t||"view:containerElement"===t||"element"===t||"view:element"===t||"node"===t||"view:node"===t}get rootName(){return this.getCustomProperty(Pi)}set rootName(t){this._setCustomProperty(Pi,t)}set _name(t){this.name=t}}class Oi{constructor(t={}){if(!t.boundaries&&!t.startPosition)throw new c("view-tree-walker-no-start-position",null);if(t.direction&&"forward"!=t.direction&&"backward"!=t.direction)throw new c("view-tree-walker-unknown-direction",t.startPosition,{direction:t.direction});this.boundaries=t.boundaries||null,t.startPosition?this.position=Ri._createAt(t.startPosition):this.position=Ri._createAt(t.boundaries["backward"==t.direction?"end":"start"]),this.direction=t.direction||"forward",this.singleCharacters=!!t.singleCharacters,this.shallow=!!t.shallow,this.ignoreElementEnd=!!t.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}skip(t){let e,n,o;do{o=this.position,({done:e,value:n}=this.next())}while(!e&&t(n));e||(this.position=o)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let t=this.position.clone();const e=this.position,n=t.parent;if(null===n.parent&&t.offset===n.childCount)return{done:!0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};let o;if(n instanceof Fo){if(t.isAtEnd)return this.position=Ri._createAfter(n),this._next();o=n.data[t.offset]}else o=n.getChild(t.offset);if(o instanceof Si)return this.shallow?t.offset++:t=new Ri(o,0),this.position=t,this._formatReturnValue("elementStart",o,e,t,1);if(o instanceof Fo){if(this.singleCharacters)return t=new Ri(o,0),this.position=t,this._next();{let n,i=o.data.length;return o==this._boundaryEndParent?(i=this.boundaries.end.offset,n=new Vo(o,0,i),t=Ri._createAfter(n)):(n=new Vo(o,0,o.data.length),t.offset++),this.position=t,this._formatReturnValue("text",n,e,t,i)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{o=(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-t.offset}const i=new Vo(n,t.offset,o);return t.offset+=o,this.position=t,this._formatReturnValue("text",i,e,t,o)}return t=Ri._createAfter(n),this.position=t,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,e,t)}_previous(){let t=this.position.clone();const e=this.position,n=t.parent;if(null===n.parent&&0===t.offset)return{done:!0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0};let o;if(n instanceof Fo){if(t.isAtStart)return this.position=Ri._createBefore(n),this._previous();o=n.data[t.offset-1]}else o=n.getChild(t.offset-1);if(o instanceof Si)return this.shallow?(t.offset--,this.position=t,this._formatReturnValue("elementStart",o,e,t,1)):(t=new Ri(o,o.childCount),this.position=t,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",o,e,t));if(o instanceof Fo){if(this.singleCharacters)return t=new Ri(o,o.data.length),this.position=t,this._previous();{let n,i=o.data.length;if(o==this._boundaryStartParent){const e=this.boundaries.start.offset;n=new Vo(o,e,o.data.length-e),i=n.data.length,t=Ri._createBefore(n)}else n=new Vo(o,0,o.data.length),t.offset--;return this.position=t,this._formatReturnValue("text",n,e,t,i)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{const e=n===this._boundaryStartParent?this.boundaries.start.offset:0;o=t.offset-e}t.offset-=o;const i=new Vo(n,t.offset,o);return this.position=t,this._formatReturnValue("text",i,e,t,o)}return t=Ri._createBefore(n),this.position=t,this._formatReturnValue("elementStart",n,e,t,1)}_formatReturnValue(t,e,n,o,i){return e instanceof Vo&&(e.offsetInText+e.data.length==e.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?n=Ri._createAfter(e.textNode):(o=Ri._createAfter(e.textNode),this.position=o)),0===e.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?n=Ri._createBefore(e.textNode):(o=Ri._createBefore(e.textNode),this.position=o))),{done:!1,value:{type:t,item:e,previousPosition:n,nextPosition:o,length:i}}}}class Ri{constructor(t,e){this.parent=t,this.offset=e}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}get isAtEnd(){const t=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===t}get root(){return this.parent.root}get editableElement(){let t=this.parent;for(;!(t instanceof zi);){if(!t.parent)return null;t=t.parent}return t}getShiftedBy(t){const e=Ri._createAt(this),n=e.offset+t;return e.offset=n<0?0:n,e}getLastMatchingPosition(t,e={}){e.startPosition=this;const n=new Oi(e);return n.skip(t),n.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(t){const e=this.getAncestors(),n=t.getAncestors();let o=0;for(;e[o]==n[o]&&e[o];)o++;return 0===o?null:e[o-1]}is(t){return"position"===t||"view:position"===t}isEqual(t){return this.parent==t.parent&&this.offset==t.offset}isBefore(t){return"before"==this.compareWith(t)}isAfter(t){return"after"==this.compareWith(t)}compareWith(t){if(this.root!==t.root)return"different";if(this.isEqual(t))return"same";const e=this.parent.is("node")?this.parent.getPath():[],n=t.parent.is("node")?t.parent.getPath():[];e.push(this.offset),n.push(t.offset);const o=Oo(e,n);switch(o){case"prefix":return"before";case"extension":return"after";default:return e[o]0?new this(n,o):new this(o,n)}static _createIn(t){return this._createFromParentsAndOffsets(t,0,t,t.childCount)}static _createOn(t){const e=t.is("$textProxy")?t.offsetSize:1;return this._createFromPositionAndShift(Ri._createBefore(t),e)}}function Fi(t){return!(!t.item.is("attributeElement")&&!t.item.is("uiElement"))}function Vi(t){let e=0;for(const n of t)e++;return e}class Hi{constructor(t=null,e,n){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(t,e,n)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const t=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?t.end:t.start).clone()}get focus(){if(!this._ranges.length)return null;const t=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?t.start:t.end).clone()}get isCollapsed(){return 1===this.rangeCount&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const t of this._ranges)yield t.clone()}getFirstRange(){let t=null;for(const e of this._ranges)t&&!e.start.isBefore(t.start)||(t=e);return t?t.clone():null}getLastRange(){let t=null;for(const e of this._ranges)t&&!e.end.isAfter(t.end)||(t=e);return t?t.clone():null}getFirstPosition(){const t=this.getFirstRange();return t?t.start.clone():null}getLastPosition(){const t=this.getLastRange();return t?t.end.clone():null}isEqual(t){if(this.isFake!=t.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=t.fakeSelectionLabel)return!1;if(this.rangeCount!=t.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(t.anchor)||!this.focus.isEqual(t.focus))return!1;for(const e of this._ranges){let n=!1;for(const o of t._ranges)if(e.isEqual(o)){n=!0;break}if(!n)return!1}return!0}isSimilar(t){if(this.isBackward!=t.isBackward)return!1;const e=Vi(this.getRanges());if(e!=Vi(t.getRanges()))return!1;if(0==e)return!0;for(let e of this.getRanges()){e=e.getTrimmed();let n=!1;for(let o of t.getRanges())if(o=o.getTrimmed(),e.start.isEqual(o.start)&&e.end.isEqual(o.end)){n=!0;break}if(!n)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(t,e,n){if(null===t)this._setRanges([]),this._setFakeOptions(e);else if(t instanceof Hi||t instanceof Ui)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof ji)this._setRanges([t],e&&e.backward),this._setFakeOptions(e);else if(t instanceof Ri)this._setRanges([new ji(t)]),this._setFakeOptions(e);else if(t instanceof jo){const o=!!n&&!!n.backward;let i;if(void 0===e)throw new c("view-selection-setto-required-second-parameter",this);i="in"==e?ji._createIn(t):"on"==e?ji._createOn(t):new ji(Ri._createAt(t,e)),this._setRanges([i],o),this._setFakeOptions(n)}else{if(!Do(t))throw new c("view-selection-setto-not-selectable",this);this._setRanges(t,e&&e.backward),this._setFakeOptions(e)}this.fire("change")}setFocus(t,e){if(null===this.anchor)throw new c("view-selection-setfocus-no-ranges",this);const n=Ri._createAt(t,e);if("same"==n.compareWith(this.focus))return;const o=this.anchor;this._ranges.pop(),"before"==n.compareWith(o)?this._addRange(new ji(n,o),!0):this._addRange(new ji(o,n)),this.fire("change")}is(t){return"selection"===t||"view:selection"===t}_setRanges(t,e=!1){t=Array.from(t),this._ranges=[];for(const e of t)this._addRange(e);this._lastRangeBackward=!!e}_setFakeOptions(t={}){this._isFake=!!t.fake,this._fakeSelectionLabel=t.fake&&t.label||""}_addRange(t,e=!1){if(!(t instanceof ji))throw new c("view-selection-add-range-not-range",this);this._pushRange(t),this._lastRangeBackward=!!e}_pushRange(t){for(const e of this._ranges)if(t.isIntersecting(e))throw new c("view-selection-range-intersects",this,{addedRange:t,intersectingRange:e});this._ranges.push(new ji(t.start,t.end))}}he(Hi,k);class Ui{constructor(t=null,e,n){this._selection=new Hi,this._selection.delegate("change").to(this),this._selection.setTo(t,e,n)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(t){return this._selection.isEqual(t)}isSimilar(t){return this._selection.isSimilar(t)}is(t){return"selection"===t||"documentSelection"==t||"view:selection"==t||"view:documentSelection"==t}_setTo(t,e,n){this._selection.setTo(t,e,n)}_setFocus(t,e){this._selection.setFocus(t,e)}}he(Ui,k);class Wi extends e{constructor(t,e,n){super(t,e),this.startRange=n,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const qi=Symbol("bubbling contexts"),Gi={fire(t,...n){try{const o=t instanceof e?t:new e(this,t),i=Zi(this);if(!i.size)return;if(Ki(o,"capturing",this),Qi(i,"$capture",o,...n))return o.return;const r=o.startRange||this.selection.getFirstRange(),s=r?r.getContainedElement():null,a=!!s&&Boolean($i(i,s));let c=s||function(t){if(!t)return null;const e=t.start.parent,n=t.end.parent,o=e.getPath(),i=n.getPath();return o.length>i.length?e:n}(r);if(Ki(o,"atTarget",c),!a){if(Qi(i,"$text",o,...n))return o.return;Ki(o,"bubbling",c)}for(;c;){if(c.is("rootElement")){if(Qi(i,"$root",o,...n))return o.return}else if(c.is("element")&&Qi(i,c.name,o,...n))return o.return;if(Qi(i,c,o,...n))return o.return;c=c.parent,Ki(o,"bubbling",c)}return Ki(o,"bubbling",this),Qi(i,"$document",o,...n),o.return}catch(t){c.rethrowUnexpectedError(t,this)}},_addEventListener(t,e,n){const o=So(n.context||"$document"),i=Zi(this);for(const r of o){let o=i.get(r);o||(o=Object.create(k),i.set(r,o)),this.listenTo(o,t,e,n)}},_removeEventListener(t,e){const n=Zi(this);for(const o of n.values())this.stopListening(o,t,e)}},Yi=Gi;function Ki(t,e,n){t instanceof Wi&&(t._eventPhase=e,t._currentTarget=n)}function Qi(t,e,n,...o){const i="string"==typeof e?t.get(e):$i(t,e);return!!i&&(i.fire(n,...o),n.stop.called)}function $i(t,e){for(const[n,o]of t)if("function"==typeof n&&n(e))return o;return null}function Zi(t){return t[qi]||(t[qi]=new Map),t[qi]}class Ji{constructor(t){this.selection=new Ui,this.roots=new Mo({idProperty:"rootName"}),this.stylesProcessor=t,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1),this._postFixers=new Set}getRoot(t="main"){return this.roots.get(t)}registerPostFixer(t){this._postFixers.add(t)}destroy(){this.roots.map((t=>t.destroy())),this.stopListening()}_callPostFixers(t){let e=!1;do{for(const n of this._postFixers)if(e=n(t),e)break}while(e)}}he(Ji,Yi),he(Ji,re);class Xi extends Si{constructor(t,e,n,o){super(t,e,n,o),this.getFillerOffset=tr,this._priority=10,this._id=null,this._clonesGroup=null}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new c("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}is(t,e=null){return e?e===this.name&&("attributeElement"===t||"view:attributeElement"===t||"element"===t||"view:element"===t):"attributeElement"===t||"view:attributeElement"===t||"element"===t||"view:element"===t||"node"===t||"view:node"===t}isSimilar(t){return null!==this.id||null!==t.id?this.id===t.id:super.isSimilar(t)&&this.priority==t.priority}_clone(t){const e=super._clone(t);return e._priority=this._priority,e._id=this._id,e}}function tr(){if(er(this))return null;let t=this.parent;for(;t&&t.is("attributeElement");){if(er(t)>1)return null;t=t.parent}return!t||er(t)>1?null:this.childCount}function er(t){return Array.from(t.getChildren()).filter((t=>!t.is("uiElement"))).length}Xi.DEFAULT_PRIORITY=10;class nr extends Si{constructor(t,e,n,o){super(t,e,n,o),this.getFillerOffset=or}is(t,e=null){return e?e===this.name&&("emptyElement"===t||"view:emptyElement"===t||"element"===t||"view:element"===t):"emptyElement"===t||"view:emptyElement"===t||"element"===t||"view:element"===t||"node"===t||"view:node"===t}_insertChild(t,e){if(e&&(e instanceof jo||Array.from(e).length>0))throw new c("view-emptyelement-cannot-add",[this,e])}}function or(){return null}const ir=navigator.userAgent.toLowerCase(),rr={isMac:ar(ir),isWindows:function(t){return t.indexOf("windows")>-1}(ir),isGecko:function(t){return!!t.match(/gecko\/\d+/)}(ir),isSafari:function(t){return t.indexOf(" applewebkit/")>-1&&-1===t.indexOf("chrome")}(ir),isiOS:function(t){return!!t.match(/iphone|ipad/i)||ar(t)&&navigator.maxTouchPoints>0}(ir),isAndroid:function(t){return t.indexOf("android")>-1}(ir),isBlink:function(t){return t.indexOf("chrome/")>-1&&t.indexOf("edge/")<0}(ir),features:{isRegExpUnicodePropertySupported:function(){let t=!1;try{t=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(t){}return t}()}},sr=rr;function ar(t){return t.indexOf("macintosh")>-1}const cr={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},lr={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},dr=function(){const t={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let e=65;e<=90;e++){const n=String.fromCharCode(e);t[n.toLowerCase()]=e}for(let e=48;e<=57;e++)t[e-48]=e;for(let e=112;e<=123;e++)t["f"+(e-111)]=e;for(const e of"`-=[];',./\\")t[e]=e.charCodeAt(0);return t}(),hr=Object.fromEntries(Object.entries(dr).map((([t,e])=>[e,t.charAt(0).toUpperCase()+t.slice(1)])));function ur(t){let e;if("string"==typeof t){if(e=dr[t.toLowerCase()],!e)throw new c("keyboard-unknown-key",null,{key:t})}else e=t.keyCode+(t.altKey?dr.alt:0)+(t.ctrlKey?dr.ctrl:0)+(t.shiftKey?dr.shift:0)+(t.metaKey?dr.cmd:0);return e}function gr(t){return"string"==typeof t&&(t=function(t){return t.split("+").map((t=>t.trim()))}(t)),t.map((t=>"string"==typeof t?function(t){if(t.endsWith("!"))return ur(t.slice(0,-1));const e=ur(t);return sr.isMac&&e==dr.ctrl?dr.cmd:e}(t):t)).reduce(((t,e)=>e+t),0)}function mr(t){let e=gr(t);return Object.entries(sr.isMac?cr:lr).reduce(((t,[n,o])=>(0!=(e&dr[n])&&(e&=~dr[n],t+=o),t)),"")+(e?hr[e]:"")}function pr(t,e){const n="ltr"===e;switch(t){case dr.arrowleft:return n?"left":"right";case dr.arrowright:return n?"right":"left";case dr.arrowup:return"up";case dr.arrowdown:return"down"}}class fr extends Si{constructor(t,e,n,o){super(t,e,n,o),this.getFillerOffset=br}is(t,e=null){return e?e===this.name&&("uiElement"===t||"view:uiElement"===t||"element"===t||"view:element"===t):"uiElement"===t||"view:uiElement"===t||"element"===t||"view:element"===t||"node"===t||"view:node"===t}_insertChild(t,e){if(e&&(e instanceof jo||Array.from(e).length>0))throw new c("view-uielement-cannot-add",this)}render(t){return this.toDomElement(t)}toDomElement(t){const e=t.createElement(this.name);for(const t of this.getAttributeKeys())e.setAttribute(t,this.getAttribute(t));return e}}function kr(t){t.document.on("arrowKey",((e,n)=>function(t,e,n){if(e.keyCode==dr.arrowright){const t=e.domTarget.ownerDocument.defaultView.getSelection(),o=1==t.rangeCount&&t.getRangeAt(0).collapsed;if(o||e.shiftKey){const e=t.focusNode,i=t.focusOffset,r=n.domPositionToView(e,i);if(null===r)return;let s=!1;const a=r.getLastMatchingPosition((t=>(t.item.is("uiElement")&&(s=!0),!(!t.item.is("uiElement")&&!t.item.is("attributeElement")))));if(s){const e=n.viewPositionToDom(a);o?t.collapse(e.parent,e.offset):t.extend(e.parent,e.offset)}}}}(0,n,t.domConverter)),{priority:"low"})}function br(){return null}class wr extends Si{constructor(t,e,n,o){super(t,e,n,o),this.getFillerOffset=_r}is(t,e=null){return e?e===this.name&&("rawElement"===t||"view:rawElement"===t||"element"===t||"view:element"===t):"rawElement"===t||"view:rawElement"===t||t===this.name||t==="view:"+this.name||"element"===t||"view:element"===t||"node"===t||"view:node"===t}_insertChild(t,e){if(e&&(e instanceof jo||Array.from(e).length>0))throw new c("view-rawelement-cannot-add",[this,e])}}function _r(){return null}class Ar{constructor(t,e){this.document=t,this._children=[],e&&this._insertChild(0,e)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(t){return"documentFragment"===t||"view:documentFragment"===t}_appendChild(t){return this._insertChild(this.childCount,t)}getChild(t){return this._children[t]}getChildIndex(t){return this._children.indexOf(t)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(t,e){this._fireChange("children",this);let n=0;const o=function(t,e){if("string"==typeof e)return[new Fo(t,e)];Do(e)||(e=[e]);return Array.from(e).map((e=>"string"==typeof e?new Fo(t,e):e instanceof Vo?new Fo(t,e.data):e))}(this.document,e);for(const e of o)null!==e.parent&&e._remove(),e.parent=this,this._children.splice(t,0,e),t++,n++;return n}_removeChildren(t,e=1){this._fireChange("children",this);for(let n=t;n{}),o.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...o.renderUnsafeAttributes),i}setAttribute(t,e,n){n._setAttribute(t,e)}removeAttribute(t,e){e._removeAttribute(t)}addClass(t,e){e._addClass(t)}removeClass(t,e){e._removeClass(t)}setStyle(t,e,n){ye(t)&&void 0===n&&(n=e),n._setStyle(t,e)}removeStyle(t,e){e._removeStyle(t)}setCustomProperty(t,e,n){n._setCustomProperty(t,e)}removeCustomProperty(t,e){return e._removeCustomProperty(t)}breakAttributes(t){return t instanceof Ri?this._breakAttributes(t):this._breakAttributesRange(t)}breakContainer(t){const e=t.parent;if(!e.is("containerElement"))throw new c("view-writer-break-non-container-element",this.document);if(!e.parent)throw new c("view-writer-break-root",this.document);if(t.isAtStart)return Ri._createBefore(e);if(!t.isAtEnd){const n=e._clone(!1);this.insert(Ri._createAfter(e),n);const o=new ji(t,Ri._createAt(e,"end")),i=new Ri(n,0);this.move(o,i)}return Ri._createAfter(e)}mergeAttributes(t){const e=t.offset,n=t.parent;if(n.is("$text"))return t;if(n.is("attributeElement")&&0===n.childCount){const t=n.parent,e=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new Ri(t,e))}const o=n.getChild(e-1),i=n.getChild(e);if(!o||!i)return t;if(o.is("$text")&&i.is("$text"))return Dr(o,i);if(o.is("attributeElement")&&i.is("attributeElement")&&o.isSimilar(i)){const t=o.childCount;return o._appendChild(i.getChildren()),i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new Ri(o,t))}return t}mergeContainers(t){const e=t.nodeBefore,n=t.nodeAfter;if(!(e&&n&&e.is("containerElement")&&n.is("containerElement")))throw new c("view-writer-merge-containers-invalid-position",this.document);const o=e.getChild(e.childCount-1),i=o instanceof Fo?Ri._createAt(o,"end"):Ri._createAt(e,"end");return this.move(ji._createIn(n),Ri._createAt(e,"end")),this.remove(ji._createOn(n)),i}insert(t,e){Mr(e=Do(e)?[...e]:[e],this.document);const n=e.reduce(((t,e)=>{const n=t[t.length-1],o=!e.is("uiElement");return n&&n.breakAttributes==o?n.nodes.push(e):t.push({breakAttributes:o,nodes:[e]}),t}),[]);let o=null,i=t;for(const{nodes:t,breakAttributes:e}of n){const n=this._insertNodes(i,t,e);o||(o=n.start),i=n.end}return o?new ji(o,i):new ji(t)}remove(t){const e=t instanceof ji?t:ji._createOn(t);if(Tr(e,this.document),e.isCollapsed)return new Ar(this.document);const{start:n,end:o}=this._breakAttributesRange(e,!0),i=n.parent,r=o.offset-n.offset,s=i._removeChildren(n.offset,r);for(const t of s)this._removeFromClonedElementsGroup(t);const a=this.mergeAttributes(n);return e.start=a,e.end=a.clone(),new Ar(this.document,s)}clear(t,e){Tr(t,this.document);const n=t.getWalker({direction:"backward",ignoreElementEnd:!0});for(const o of n){const n=o.item;let i;if(n.is("element")&&e.isSimilar(n))i=ji._createOn(n);else if(!o.nextPosition.isAfter(t.start)&&n.is("$textProxy")){const t=n.getAncestors().find((t=>t.is("element")&&e.isSimilar(t)));t&&(i=ji._createIn(t))}i&&(i.end.isAfter(t.end)&&(i.end=t.end),i.start.isBefore(t.start)&&(i.start=t.start),this.remove(i))}}move(t,e){let n;if(e.isAfter(t.end)){const o=(e=this._breakAttributes(e,!0)).parent,i=o.childCount;t=this._breakAttributesRange(t,!0),n=this.remove(t),e.offset+=o.childCount-i}else n=this.remove(t);return this.insert(e,n)}wrap(t,e){if(!(e instanceof Xi))throw new c("view-writer-wrap-invalid-attribute",this.document);if(Tr(t,this.document),t.isCollapsed){let o=t.start;o.parent.is("element")&&(n=o.parent,!Array.from(n.getChildren()).some((t=>!t.is("uiElement"))))&&(o=o.getLastMatchingPosition((t=>t.item.is("uiElement")))),o=this._wrapPosition(o,e);const i=this.document.selection;return i.isCollapsed&&i.getFirstPosition().isEqual(t.start)&&this.setSelection(o),new ji(o)}return this._wrapRange(t,e);var n}unwrap(t,e){if(!(e instanceof Xi))throw new c("view-writer-unwrap-invalid-attribute",this.document);if(Tr(t,this.document),t.isCollapsed)return t;const{start:n,end:o}=this._breakAttributesRange(t,!0),i=n.parent,r=this._unwrapChildren(i,n.offset,o.offset,e),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new ji(s,a)}rename(t,e){const n=new Ni(this.document,t,e.getAttributes());return this.insert(Ri._createAfter(e),n),this.move(ji._createIn(e),Ri._createAt(n,0)),this.remove(ji._createOn(e)),n}clearClonedElementsGroup(t){this._cloneGroups.delete(t)}createPositionAt(t,e){return Ri._createAt(t,e)}createPositionAfter(t){return Ri._createAfter(t)}createPositionBefore(t){return Ri._createBefore(t)}createRange(t,e){return new ji(t,e)}createRangeOn(t){return ji._createOn(t)}createRangeIn(t){return ji._createIn(t)}createSelection(t,e,n){return new Hi(t,e,n)}createSlot(t){if(!this._slotFactory)throw new c("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,t)}_registerSlotFactory(t){this._slotFactory=t}_clearSlotFactory(){this._slotFactory=null}_insertNodes(t,e,n){let o,i;if(o=n?vr(t):t.parent.is("$text")?t.parent.parent:t.parent,!o)throw new c("view-writer-invalid-position-container",this.document);i=n?this._breakAttributes(t,!0):t.parent.is("$text")?Er(t):t;const r=o._insertChild(i.offset,e);for(const t of e)this._addToClonedElementsGroup(t);const s=i.getShiftedBy(r),a=this.mergeAttributes(i);a.isEqual(i)||s.offset--;const l=this.mergeAttributes(s);return new ji(a,l)}_wrapChildren(t,e,n,o){let i=e;const r=[];for(;i!1,t.parent._insertChild(t.offset,n);const o=new ji(t,t.getShiftedBy(1));this.wrap(o,e);const i=new Ri(n.parent,n.index);n._remove();const r=i.nodeBefore,s=i.nodeAfter;return r instanceof Fo&&s instanceof Fo?Dr(r,s):xr(i)}_wrapAttributeElement(t,e){if(!Nr(t,e))return!1;if(t.name!==e.name||t.priority!==e.priority)return!1;for(const n of t.getAttributeKeys())if("class"!==n&&"style"!==n&&e.hasAttribute(n)&&e.getAttribute(n)!==t.getAttribute(n))return!1;for(const n of t.getStyleNames())if(e.hasStyle(n)&&e.getStyle(n)!==t.getStyle(n))return!1;for(const n of t.getAttributeKeys())"class"!==n&&"style"!==n&&(e.hasAttribute(n)||this.setAttribute(n,t.getAttribute(n),e));for(const n of t.getStyleNames())e.hasStyle(n)||this.setStyle(n,t.getStyle(n),e);for(const n of t.getClassNames())e.hasClass(n)||this.addClass(n,e);return!0}_unwrapAttributeElement(t,e){if(!Nr(t,e))return!1;if(t.name!==e.name||t.priority!==e.priority)return!1;for(const n of t.getAttributeKeys())if("class"!==n&&"style"!==n&&(!e.hasAttribute(n)||e.getAttribute(n)!==t.getAttribute(n)))return!1;if(!e.hasClass(...t.getClassNames()))return!1;for(const n of t.getStyleNames())if(!e.hasStyle(n)||e.getStyle(n)!==t.getStyle(n))return!1;for(const n of t.getAttributeKeys())"class"!==n&&"style"!==n&&this.removeAttribute(n,e);return this.removeClass(Array.from(t.getClassNames()),e),this.removeStyle(Array.from(t.getStyleNames()),e),!0}_breakAttributesRange(t,e=!1){const n=t.start,o=t.end;if(Tr(t,this.document),t.isCollapsed){const n=this._breakAttributes(t.start,e);return new ji(n,n)}const i=this._breakAttributes(o,e),r=i.parent.childCount,s=this._breakAttributes(n,e);return i.offset+=i.parent.childCount-r,new ji(s,i)}_breakAttributes(t,e=!1){const n=t.offset,o=t.parent;if(t.parent.is("emptyElement"))throw new c("view-writer-cannot-break-empty-element",this.document);if(t.parent.is("uiElement"))throw new c("view-writer-cannot-break-ui-element",this.document);if(t.parent.is("rawElement"))throw new c("view-writer-cannot-break-raw-element",this.document);if(!e&&o.is("$text")&&Sr(o.parent))return t.clone();if(Sr(o))return t.clone();if(o.is("$text"))return this._breakAttributes(Er(t),e);if(n==o.childCount){const t=new Ri(o.parent,o.index+1);return this._breakAttributes(t,e)}if(0===n){const t=new Ri(o.parent,o.index);return this._breakAttributes(t,e)}{const t=o.index+1,i=o._clone();o.parent._insertChild(t,i),this._addToClonedElementsGroup(i);const r=o.childCount-n,s=o._removeChildren(n,r);i._appendChild(s);const a=new Ri(o.parent,t);return this._breakAttributes(a,e)}}_addToClonedElementsGroup(t){if(!t.root.is("rootElement"))return;if(t.is("element"))for(const e of t.getChildren())this._addToClonedElementsGroup(e);const e=t.id;if(!e)return;let n=this._cloneGroups.get(e);n||(n=new Set,this._cloneGroups.set(e,n)),n.add(t),t._clonesGroup=n}_removeFromClonedElementsGroup(t){if(t.is("element"))for(const e of t.getChildren())this._removeFromClonedElementsGroup(e);const e=t.id;if(!e)return;const n=this._cloneGroups.get(e);n&&n.delete(t)}}function vr(t){let e=t.parent;for(;!Sr(e);){if(!e)return;e=e.parent}return e}function yr(t,e){return t.prioritye.priority)&&t.getIdentity()n instanceof t)))throw new c("view-writer-insert-invalid-node-type",e);n.is("$text")||Mr(n.getChildren(),e)}}const Ir=[Fo,Xi,Ni,nr,wr,fr];function Sr(t){return t&&(t.is("containerElement")||t.is("documentFragment"))}function Tr(t,e){const n=vr(t.start),o=vr(t.end);if(!n||!o||n!==o)throw new c("view-writer-invalid-range-container",e)}function Nr(t,e){return null===t.id&&null===e.id}function Br(t){return"[object Text]"==Object.prototype.toString.call(t)}const zr=t=>t.createTextNode(" "),Pr=t=>{const e=t.createElement("span");return e.dataset.ckeFiller=!0,e.innerHTML=" ",e},Lr=t=>{const e=t.createElement("br");return e.dataset.ckeFiller=!0,e},Or="⁠".repeat(7);function Rr(t){return Br(t)&&t.data.substr(0,7)===Or}function jr(t){return 7==t.data.length&&Rr(t)}function Fr(t){return Rr(t)?t.data.slice(7):t.data}function Vr(t,e){if(e.keyCode==dr.arrowleft){const t=e.domTarget.ownerDocument.defaultView.getSelection();if(1==t.rangeCount&&t.getRangeAt(0).collapsed){const e=t.getRangeAt(0).startContainer,n=t.getRangeAt(0).startOffset;Rr(e)&&n<=7&&t.collapse(e,0)}}}function Hr(t,e,n,o=!1){n=n||function(t,e){return t===e},Array.isArray(t)||(t=Array.prototype.slice.call(t)),Array.isArray(e)||(e=Array.prototype.slice.call(e));const i=function(t,e,n){const o=Ur(t,e,n);if(-1===o)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const i=Wr(t,o),r=Wr(e,o),s=Ur(i,r,n),a=t.length-s,c=e.length-s;return{firstIndex:o,lastIndexOld:a,lastIndexNew:c}}(t,e,n);return o?function(t,e){const{firstIndex:n,lastIndexOld:o,lastIndexNew:i}=t;if(-1===n)return Array(e).fill("equal");let r=[];n>0&&(r=r.concat(Array(n).fill("equal")));i-n>0&&(r=r.concat(Array(i-n).fill("insert")));o-n>0&&(r=r.concat(Array(o-n).fill("delete")));i0&&n.push({index:o,type:"insert",values:t.slice(o,r)});i-o>0&&n.push({index:o+(r-o),type:"delete",howMany:i-o});return n}(e,i)}function Ur(t,e,n){for(let o=0;o200||i>200||o+i>300)return qr.fastDiff(t,e,n,!0);let r,s;if(il?-1:1;d[o+u]&&(d[o]=d[o+u].slice(0)),d[o]||(d[o]=[]),d[o].push(i>l?r:s);let g=Math.max(i,l),m=g-o;for(;ml;g--)h[g]=u(g);h[l]=u(l),m++}while(h[l]!==c);return d[l].slice(1)}function Gr(t,e,n){t.insertBefore(n,t.childNodes[e]||null)}function Yr(t){const e=t.parentNode;e&&e.removeChild(t)}function Kr(t){return t&&t.nodeType===Node.COMMENT_NODE}function Qr(t){if(t){if(t.defaultView)return t instanceof t.defaultView.Document;if(t.ownerDocument&&t.ownerDocument.defaultView)return t instanceof t.ownerDocument.defaultView.Node}return!1}qr.fastDiff=Hr;var $r=n(6062),Zr=n.n($r),Jr=n(9315),Xr={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Jr.Z,Xr);Jr.Z.locals;class ts{constructor(t,e){this.domDocuments=new Set,this.domConverter=t,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this.selection=e,this.set("isFocused",!1),this.set("isSelecting",!1),sr.isBlink&&!sr.isAndroid&&this.on("change:isSelecting",(()=>{this.isSelecting||this.render()})),this._inlineFiller=null,this._fakeSelectionContainer=null}markToSync(t,e){if("text"===t)this.domConverter.mapViewToDom(e.parent)&&this.markedTexts.add(e);else{if(!this.domConverter.mapViewToDom(e))return;if("attributes"===t)this.markedAttributes.add(e);else{if("children"!==t)throw new c("view-renderer-unknown-type",this);this.markedChildren.add(e)}}}render(){let t;const e=!(sr.isBlink&&!sr.isAndroid)||!this.isSelecting;for(const t of this.markedChildren)this._updateChildrenMappings(t);e?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?t=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(t=this.selection.getFirstPosition(),this.markedChildren.add(t.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(t=this.domConverter.domPositionToView(this._inlineFiller));for(const t of this.markedAttributes)this._updateAttrs(t);for(const e of this.markedChildren)this._updateChildren(e,{inlineFillerPosition:t});for(const e of this.markedTexts)!this.markedChildren.has(e.parent)&&this.domConverter.mapViewToDom(e.parent)&&this._updateText(e,{inlineFillerPosition:t});if(e)if(t){const e=this.domConverter.viewPositionToDom(t),n=e.parent.ownerDocument;Rr(e.parent)?this._inlineFiller=e.parent:this._inlineFiller=es(n,e.parent,e.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(t){const e=this.domConverter.mapViewToDom(t);if(!e)return;const n=Array.from(this.domConverter.mapViewToDom(t).childNodes),o=Array.from(this.domConverter.viewChildrenToDom(t,e.ownerDocument,{withChildren:!1})),i=this._diffNodeLists(n,o),r=this._findReplaceActions(i,n,o);if(-1!==r.indexOf("replace")){const e={equal:0,insert:0,delete:0};for(const i of r)if("replace"===i){const i=e.equal+e.insert,r=e.equal+e.delete,s=t.getChild(i);!s||s.is("uiElement")||s.is("rawElement")||this._updateElementMappings(s,n[r]),Yr(o[i]),e.equal++}else e[i]++}}_updateElementMappings(t,e){this.domConverter.unbindDomElement(e),this.domConverter.bindElements(e,t),this.markedChildren.add(t),this.markedAttributes.add(t)}_getInlineFillerPosition(){const t=this.selection.getFirstPosition();return t.parent.is("$text")?Ri._createBefore(this.selection.getFirstPosition().parent):t}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const t=this.selection.getFirstPosition(),e=this.domConverter.viewPositionToDom(t);return!!(e&&Br(e.parent)&&Rr(e.parent))}_removeInlineFiller(){const t=this._inlineFiller;if(!Rr(t))throw new c("view-renderer-filler-was-lost",this);jr(t)?t.remove():t.data=t.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const t=this.selection.getFirstPosition(),e=t.parent,n=t.offset;if(!this.domConverter.mapViewToDom(e.root))return!1;if(!e.is("element"))return!1;if(!function(t){if("false"==t.getAttribute("contenteditable"))return!1;const e=t.findAncestor((t=>t.hasAttribute("contenteditable")));return!e||"true"==e.getAttribute("contenteditable")}(e))return!1;if(n===e.getFillerOffset())return!1;const o=t.nodeBefore,i=t.nodeAfter;return!(o instanceof Fo||i instanceof Fo)}_updateText(t,e){const n=this.domConverter.findCorrespondingDomText(t),o=this.domConverter.viewToDom(t,n.ownerDocument),i=n.data;let r=o.data;const s=e.inlineFillerPosition;if(s&&s.parent==t.parent&&s.offset==t.index&&(r=Or+r),i!=r){const t=Hr(i,r);for(const e of t)"insert"===e.type?n.insertData(e.index,e.values.join("")):n.deleteData(e.index,e.howMany)}}_updateAttrs(t){const e=this.domConverter.mapViewToDom(t);if(!e)return;const n=Array.from(e.attributes).map((t=>t.name)),o=t.getAttributeKeys();for(const n of o)this.domConverter.setDomElementAttribute(e,n,t.getAttribute(n),t);for(const o of n)t.hasAttribute(o)||this.domConverter.removeDomElementAttribute(e,o)}_updateChildren(t,e){const n=this.domConverter.mapViewToDom(t);if(!n)return;const o=e.inlineFillerPosition,i=this.domConverter.mapViewToDom(t).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(t,n.ownerDocument,{bind:!0}));o&&o.parent===t&&es(n.ownerDocument,r,o.offset);const s=this._diffNodeLists(i,r);let a=0;const c=new Set;for(const t of s)"delete"===t?(c.add(i[a]),Yr(i[a])):"equal"===t&&a++;a=0;for(const t of s)"insert"===t?(Gr(n,a,r[a]),a++):"equal"===t&&(this._markDescendantTextToSync(this.domConverter.domToView(r[a])),a++);for(const t of c)t.parentNode||this.domConverter.unbindDomElement(t)}_diffNodeLists(t,e){return qr(t=function(t,e){const n=Array.from(t);if(0==n.length||!e)return n;n[n.length-1]==e&&n.pop();return n}(t,this._fakeSelectionContainer),e,os.bind(null,this.domConverter))}_findReplaceActions(t,e,n){if(-1===t.indexOf("insert")||-1===t.indexOf("delete"))return t;let o=[],i=[],r=[];const s={equal:0,insert:0,delete:0};for(const a of t)"insert"===a?r.push(n[s.equal+s.insert]):"delete"===a?i.push(e[s.equal+s.delete]):(o=o.concat(qr(i,r,ns).map((t=>"equal"===t?"replace":t))),o.push("equal"),i=[],r=[]),s[a]++;return o.concat(qr(i,r,ns).map((t=>"equal"===t?"replace":t)))}_markDescendantTextToSync(t){if(t)if(t.is("$text"))this.markedTexts.add(t);else if(t.is("element"))for(const e of t.getChildren())this._markDescendantTextToSync(e)}_updateSelection(){if(sr.isBlink&&!sr.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const t=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&t&&(this.selection.isFake?this._updateFakeSelection(t):(this._removeFakeSelection(),this._updateDomSelection(t)))}_updateFakeSelection(t){const e=t.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(t){const e=t.createElement("div");return e.className="ck-fake-selection-container",Object.assign(e.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),e.textContent=" ",e}(e));const n=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(n,this.selection),!this._fakeSelectionNeedsUpdate(t))return;n.parentElement&&n.parentElement==t||t.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||" ";const o=e.getSelection(),i=e.createRange();o.removeAllRanges(),i.selectNodeContents(n),o.addRange(i)}_updateDomSelection(t){const e=t.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(e))return;const n=this.domConverter.viewPositionToDom(this.selection.anchor),o=this.domConverter.viewPositionToDom(this.selection.focus);e.collapse(n.parent,n.offset),e.extend(o.parent,o.offset),sr.isGecko&&function(t,e){const n=t.parent;if(n.nodeType!=Node.ELEMENT_NODE||t.offset!=n.childNodes.length-1)return;const o=n.childNodes[t.offset];o&&"BR"==o.tagName&&e.addRange(e.getRangeAt(0))}(o,e)}_domSelectionNeedsUpdate(t){if(!this.domConverter.isDomSelectionCorrect(t))return!0;const e=t&&this.domConverter.domSelectionToView(t);return(!e||!this.selection.isEqual(e))&&!(!this.selection.isCollapsed&&this.selection.isSimilar(e))}_fakeSelectionNeedsUpdate(t){const e=this._fakeSelectionContainer,n=t.ownerDocument.getSelection();return!e||e.parentElement!==t||(n.anchorNode!==e&&!e.contains(n.anchorNode)||e.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const t of this.domDocuments){if(t.getSelection().rangeCount){const e=t.activeElement,n=this.domConverter.mapDomToView(e);e&&n&&t.getSelection().removeAllRanges()}}}_removeFakeSelection(){const t=this._fakeSelectionContainer;t&&t.remove()}_updateFocus(){if(this.isFocused){const t=this.selection.editableElement;t&&this.domConverter.focus(t)}}}function es(t,e,n){const o=e instanceof Array?e:e.childNodes,i=o[n];if(Br(i))return i.data=Or+i.data,i;{const i=t.createTextNode(Or);return Array.isArray(e)?o.splice(n,0,i):Gr(e,n,i),i}}function ns(t,e){return Qr(t)&&Qr(e)&&!Br(t)&&!Br(e)&&!Kr(t)&&!Kr(e)&&t.tagName.toLowerCase()===e.tagName.toLowerCase()}function os(t,e,n){return e===n||(Br(e)&&Br(n)?e.data===n.data:!(!t.isBlockFiller(e)||!t.isBlockFiller(n)))}he(ts,re);const is={window,document};function rs(t){let e=0;for(;t.previousSibling;)t=t.previousSibling,e++;return e}function ss(t){const e=[];for(;t&&t.nodeType!=Node.DOCUMENT_NODE;)e.unshift(t),t=t.parentNode;return e}const as=Lr(document),cs=zr(document),ls=Pr(document),ds="data-ck-unsafe-attribute-",hs="data-ck-unsafe-element",us=["script","style"];class gs{constructor(t,e={}){this.document=t,this.renderingMode=e.renderingMode||"editing",this.blockFillerMode=e.blockFillerMode||("editing"===this.renderingMode?"br":"nbsp"),this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new Uo,this._encounteredRawContentDomNodes=new WeakSet}bindFakeSelection(t,e){this._fakeSelectionMapping.set(t,new Hi(e))}fakeSelectionToView(t){return this._fakeSelectionMapping.get(t)}bindElements(t,e){this._domToViewMapping.set(t,e),this._viewToDomMapping.set(e,t)}unbindDomElement(t){const e=this._domToViewMapping.get(t);if(e){this._domToViewMapping.delete(t),this._viewToDomMapping.delete(e);for(const e of t.childNodes)this.unbindDomElement(e)}}bindDocumentFragments(t,e){this._domToViewMapping.set(t,e),this._viewToDomMapping.set(e,t)}shouldRenderAttribute(t,e,n){return"data"===this.renderingMode||!(t=t.toLowerCase()).startsWith("on")&&(("srcdoc"!==t||!e.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i))&&("img"===n&&("src"===t||"srcset"===t)||("source"===n&&"srcset"===t||!e.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))))}setContentOf(t,e){if("data"===this.renderingMode)return void(t.innerHTML=e);const n=(new DOMParser).parseFromString(e,"text/html"),o=n.createDocumentFragment(),i=n.body.childNodes;for(;i.length>0;)o.appendChild(i[0]);const r=n.createTreeWalker(o,NodeFilter.SHOW_ELEMENT),s=[];let a;for(;a=r.nextNode();)s.push(a);for(const t of s){for(const e of t.getAttributeNames())this.setDomElementAttribute(t,e,t.getAttribute(e));const e=t.tagName.toLowerCase();this._shouldRenameElement(e)&&(fs(e),t.replaceWith(this._createReplacementDomElement(e,t)))}for(;t.firstChild;)t.firstChild.remove();t.append(o)}viewToDom(t,e,n={}){if(t.is("$text")){const n=this._processDataFromViewText(t);return e.createTextNode(n)}{if(this.mapViewToDom(t))return this.mapViewToDom(t);let o;if(t.is("documentFragment"))o=e.createDocumentFragment(),n.bind&&this.bindDocumentFragments(o,t);else{if(t.is("uiElement"))return o="$comment"===t.name?e.createComment(t.getCustomProperty("$rawContent")):t.render(e,this),n.bind&&this.bindElements(o,t),o;this._shouldRenameElement(t.name)?(fs(t.name),o=this._createReplacementDomElement(t.name)):o=t.hasAttribute("xmlns")?e.createElementNS(t.getAttribute("xmlns"),t.name):e.createElement(t.name),t.is("rawElement")&&t.render(o,this),n.bind&&this.bindElements(o,t);for(const e of t.getAttributeKeys())this.setDomElementAttribute(o,e,t.getAttribute(e),t)}if(!1!==n.withChildren)for(const i of this.viewChildrenToDom(t,e,n))o.appendChild(i);return o}}setDomElementAttribute(t,e,n,o=null){const i=this.shouldRenderAttribute(e,n,t.tagName.toLowerCase())||o&&o.shouldRenderUnsafeAttribute(e);i||l("domconverter-unsafe-attribute-detected",{domElement:t,key:e,value:n}),t.hasAttribute(e)&&!i?t.removeAttribute(e):t.hasAttribute(ds+e)&&i&&t.removeAttribute(ds+e),t.setAttribute(i?e:ds+e,n)}removeDomElementAttribute(t,e){e!=hs&&(t.removeAttribute(e),t.removeAttribute(ds+e))}*viewChildrenToDom(t,e,n={}){const o=t.getFillerOffset&&t.getFillerOffset();let i=0;for(const r of t.getChildren()){o===i&&(yield this._getBlockFiller(e));const t=r.is("element")&&r.getCustomProperty("dataPipeline:transparentRendering");t&&"data"==this.renderingMode?yield*this.viewChildrenToDom(r,e,n):(t&&l("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:r}),yield this.viewToDom(r,e,n)),i++}o===i&&(yield this._getBlockFiller(e))}viewRangeToDom(t){const e=this.viewPositionToDom(t.start),n=this.viewPositionToDom(t.end),o=document.createRange();return o.setStart(e.parent,e.offset),o.setEnd(n.parent,n.offset),o}viewPositionToDom(t){const e=t.parent;if(e.is("$text")){const n=this.findCorrespondingDomText(e);if(!n)return null;let o=t.offset;return Rr(n)&&(o+=7),{parent:n,offset:o}}{let n,o,i;if(0===t.offset){if(n=this.mapViewToDom(e),!n)return null;i=n.childNodes[0]}else{const e=t.nodeBefore;if(o=e.is("$text")?this.findCorrespondingDomText(e):this.mapViewToDom(t.nodeBefore),!o)return null;n=o.parentNode,i=o.nextSibling}if(Br(i)&&Rr(i))return{parent:i,offset:7};return{parent:n,offset:o?rs(o)+1:0}}}domToView(t,e={}){if(this.isBlockFiller(t))return null;const n=this.getHostViewElement(t);if(n)return n;if(Kr(t)&&e.skipComments)return null;if(Br(t)){if(jr(t))return null;{const e=this._processDataFromDomText(t);return""===e?null:new Fo(this.document,e)}}{if(this.mapDomToView(t))return this.mapDomToView(t);let n;if(this.isDocumentFragment(t))n=new Ar(this.document),e.bind&&this.bindDocumentFragments(t,n);else{n=this._createViewElement(t,e),e.bind&&this.bindElements(t,n);const o=t.attributes;if(o)for(let t=o.length-1;t>=0;t--)n._setAttribute(o[t].name,o[t].value);if(this._isViewElementWithRawContent(n,e)||Kr(t)){const e=Kr(t)?t.data:t.innerHTML;return n._setCustomProperty("$rawContent",e),this._encounteredRawContentDomNodes.add(t),n}}if(!1!==e.withChildren)for(const o of this.domChildrenToView(t,e))n._appendChild(o);return n}}*domChildrenToView(t,e={}){for(let n=0;n{const{scrollLeft:e,scrollTop:n}=t;o.push([e,n])})),e.focus(),ms(e,(t=>{const[e,n]=o.shift();t.scrollLeft=e,t.scrollTop=n})),is.window.scrollTo(t,n)}}isElement(t){return t&&t.nodeType==Node.ELEMENT_NODE}isDocumentFragment(t){return t&&t.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(t){return"br"==this.blockFillerMode?t.isEqualNode(as):!("BR"!==t.tagName||!ps(t,this.blockElements)||1!==t.parentNode.childNodes.length)||(t.isEqualNode(ls)||function(t,e){return t.isEqualNode(cs)&&ps(t,e)&&1===t.parentNode.childNodes.length}(t,this.blockElements))}isDomSelectionBackward(t){if(t.isCollapsed)return!1;const e=document.createRange();e.setStart(t.anchorNode,t.anchorOffset),e.setEnd(t.focusNode,t.focusOffset);const n=e.collapsed;return e.detach(),n}getHostViewElement(t){const e=ss(t);for(e.pop();e.length;){const t=e.pop(),n=this._domToViewMapping.get(t);if(n&&(n.is("uiElement")||n.is("rawElement")))return n}return null}isDomSelectionCorrect(t){return this._isDomSelectionPositionCorrect(t.anchorNode,t.anchorOffset)&&this._isDomSelectionPositionCorrect(t.focusNode,t.focusOffset)}registerRawContentMatcher(t){this._rawContentElementMatcher.add(t)}_getBlockFiller(t){switch(this.blockFillerMode){case"nbsp":return zr(t);case"markedNbsp":return Pr(t);case"br":return Lr(t)}}_isDomSelectionPositionCorrect(t,e){if(Br(t)&&Rr(t)&&e<7)return!1;if(this.isElement(t)&&Rr(t.childNodes[e]))return!1;const n=this.mapDomToView(t);return!n||!n.is("uiElement")&&!n.is("rawElement")}_processDataFromViewText(t){let e=t.data;if(t.getAncestors().some((t=>this.preElements.includes(t.name))))return e;if(" "==e.charAt(0)){const n=this._getTouchingInlineViewNode(t,!1);!(n&&n.is("$textProxy")&&this._nodeEndsWithSpace(n))&&n||(e=" "+e.substr(1))}if(" "==e.charAt(e.length-1)){const n=this._getTouchingInlineViewNode(t,!0),o=n&&n.is("$textProxy")&&" "==n.data.charAt(0);" "!=e.charAt(e.length-2)&&n&&!o||(e=e.substr(0,e.length-1)+" ")}return e.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(t){if(t.getAncestors().some((t=>this.preElements.includes(t.name))))return!1;const e=this._processDataFromViewText(t);return" "==e.charAt(e.length-1)}_processDataFromDomText(t){let e=t.data;if(function(t,e){return ss(t).some((t=>t.tagName&&e.includes(t.tagName.toLowerCase())))}(t,this.preElements))return Fr(t);e=e.replace(/[ \n\t\r]{1,}/g," ");const n=this._getTouchingInlineDomNode(t,!1),o=this._getTouchingInlineDomNode(t,!0),i=this._checkShouldLeftTrimDomText(t,n),r=this._checkShouldRightTrimDomText(t,o);i&&(e=e.replace(/^ /,"")),r&&(e=e.replace(/ $/,"")),e=Fr(new Text(e)),e=e.replace(/ \u00A0/g," ");const s=o&&this.isElement(o)&&"BR"!=o.tagName,a=o&&Br(o)&&" "==o.data.charAt(0);return(/( |\u00A0)\u00A0$/.test(e)||!o||s||a)&&(e=e.replace(/\u00A0$/," ")),(i||n&&this.isElement(n)&&"BR"!=n.tagName)&&(e=e.replace(/^\u00A0/," ")),e}_checkShouldLeftTrimDomText(t,e){return!e||(this.isElement(e)?"BR"===e.tagName:!this._encounteredRawContentDomNodes.has(t.previousSibling)&&/[^\S\u00A0]/.test(e.data.charAt(e.data.length-1)))}_checkShouldRightTrimDomText(t,e){return!e&&!Rr(t)}_getTouchingInlineViewNode(t,e){const n=new Oi({startPosition:e?Ri._createAfter(t):Ri._createBefore(t),direction:e?"forward":"backward"});for(const t of n){if(t.item.is("element")&&this.inlineObjectElements.includes(t.item.name))return t.item;if(t.item.is("containerElement"))return null;if(t.item.is("element","br"))return null;if(t.item.is("$textProxy"))return t.item}return null}_getTouchingInlineDomNode(t,e){if(!t.parentNode)return null;const n=e?"firstChild":"lastChild",o=e?"nextSibling":"previousSibling";let i=!0;do{if(!i&&t[n]?t=t[n]:t[o]?(t=t[o],i=!1):(t=t.parentNode,i=!0),!t||this._isBlockElement(t))return null}while(!Br(t)&&"BR"!=t.tagName&&!this._isInlineObjectElement(t));return t}_isBlockElement(t){return this.isElement(t)&&this.blockElements.includes(t.tagName.toLowerCase())}_isInlineObjectElement(t){return this.isElement(t)&&this.inlineObjectElements.includes(t.tagName.toLowerCase())}_createViewElement(t,e){if(Kr(t))return new fr(this.document,"$comment");const n=e.keepOriginalCase?t.tagName:t.tagName.toLowerCase();return new Si(this.document,n)}_isViewElementWithRawContent(t,e){return!1!==e.withChildren&&this._rawContentElementMatcher.match(t)}_shouldRenameElement(t){const e=t.toLowerCase();return"editing"===this.renderingMode&&us.includes(e)}_createReplacementDomElement(t,e=null){const n=document.createElement("span");if(n.setAttribute(hs,t),e){for(;e.firstChild;)n.appendChild(e.firstChild);for(const t of e.getAttributeNames())n.setAttribute(t,e.getAttribute(t))}return n}}function ms(t,e){for(;t&&t!=is.document;)e(t),t=t.parentNode}function ps(t,e){const n=t.parentNode;return n&&n.tagName&&e.includes(n.tagName.toLowerCase())}function fs(t){"script"===t&&l("domconverter-unsafe-script-element-detected"),"style"===t&&l("domconverter-unsafe-style-element-detected")}function ks(t){const e=Object.prototype.toString.apply(t);return"[object Window]"==e||"[object global]"==e}const bs=Jt({},k,{listenTo(t,e,n,o={}){if(Qr(t)||ks(t)){const i={capture:!!o.useCapture,passive:!!o.usePassive},r=this._getProxyEmitter(t,i)||new _s(t,i);this.listenTo(r,e,n,o)}else k.listenTo.call(this,t,e,n,o)},stopListening(t,e,n){if(Qr(t)||ks(t)){const o=this._getAllProxyEmitters(t);for(const t of o)this.stopListening(t,e,n)}else k.stopListening.call(this,t,e,n)},_getProxyEmitter(t,e){return n=this,o=As(t,e),n[m]&&n[m][o]?n[m][o].emitter:null;var n,o},_getAllProxyEmitters(t){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map((e=>this._getProxyEmitter(t,e))).filter((t=>!!t))}}),ws=bs;class _s{constructor(t,e){b(this,As(t,e)),this._domNode=t,this._options=e}}function As(t,e){let n=function(t){return t["data-ck-expando"]||(t["data-ck-expando"]=r())}(t);for(const t of Object.keys(e).sort())e[t]&&(n+="-"+t);return n}Jt(_s.prototype,k,{attach(t){if(this._domListeners&&this._domListeners[t])return;const e=this._createDomListener(t);this._domNode.addEventListener(t,e,this._options),this._domListeners||(this._domListeners={}),this._domListeners[t]=e},detach(t){let e;!this._domListeners[t]||(e=this._events[t])&&e.callbacks.length||this._domListeners[t].removeListener()},_addEventListener(t,e,n){this.attach(t),k._addEventListener.call(this,t,e,n)},_removeEventListener(t,e){k._removeEventListener.call(this,t,e),this.detach(t)},_createDomListener(t){const e=e=>{this.fire(t,e)};return e.removeListener=()=>{this._domNode.removeEventListener(t,e,this._options),delete this._domListeners[t]},e}});class Cs{constructor(t){this.view=t,this.document=t.document,this.isEnabled=!1}enable(){this.isEnabled=!0}disable(){this.isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(t){return t&&3===t.nodeType&&(t=t.parentNode),!(!t||1!==t.nodeType)&&t.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}he(Cs,ws);const vs=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};const ys=function(t){return this.__data__.has(t)};function xs(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new on;++ea))return!1;var l=r.get(t),d=r.get(e);if(l&&d)return l==e&&d==t;var h=-1,u=!0,g=2&n?new Es:void 0;for(r.set(t,e),r.set(e,t);++h{this.listenTo(t,e,((t,e)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(e.target)&&this.onDomEvent(e)}),{useCapture:this.useCapture})}))}fire(t,e,n){this.isEnabled&&this.document.fire(t,new qs(this.view,e,n))}}class Ys extends Gs{constructor(t){super(t),this.domEventType=["keydown","keyup"]}onDomEvent(t){this.fire(t.type,t,{keyCode:t.keyCode,altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,get keystroke(){return ur(this)}})}}const Ks=function(){return M.Date.now()};var Qs=/\s/;const $s=function(t){for(var e=t.length;e--&&Qs.test(t.charAt(e)););return e};var Zs=/^\s+/;const Js=function(t){return t?t.slice(0,$s(t)+1).replace(Zs,""):t};var Xs=/^[-+]0x[0-9a-f]+$/i,ta=/^0b[01]+$/i,ea=/^0o[0-7]+$/i,na=parseInt;const oa=function(t){if("number"==typeof t)return t;if(Go(t))return NaN;if(x(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=x(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Js(t);var n=ta.test(t);return n||ea.test(t)?na(t.slice(2),n?2:8):Xs.test(t)?NaN:+t};var ia=Math.max,ra=Math.min;const sa=function(t,e,n){var o,i,r,s,a,c,l=0,d=!1,h=!1,u=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){var n=o,r=i;return o=i=void 0,l=e,s=t.apply(r,n)}function m(t){return l=t,a=setTimeout(f,e),d?g(t):s}function p(t){var n=t-c;return void 0===c||n>=e||n<0||h&&t-l>=r}function f(){var t=Ks();if(p(t))return k(t);a=setTimeout(f,function(t){var n=e-(t-c);return h?ra(n,r-(t-l)):n}(t))}function k(t){return a=void 0,u&&o?g(t):(o=i=void 0,s)}function b(){var t=Ks(),n=p(t);if(o=arguments,i=this,c=t,n){if(void 0===a)return m(c);if(h)return clearTimeout(a),a=setTimeout(f,e),g(c)}return void 0===a&&(a=setTimeout(f,e)),s}return e=oa(e)||0,x(n)&&(d=!!n.leading,r=(h="maxWait"in n)?ia(oa(n.maxWait)||0,e):r,u="trailing"in n?!!n.trailing:u),b.cancel=function(){void 0!==a&&clearTimeout(a),l=0,o=c=i=a=void 0},b.flush=function(){return void 0===a?s:k(Ks())},b};class aa extends Cs{constructor(t){super(t),this._fireSelectionChangeDoneDebounced=sa((t=>this.document.fire("selectionChangeDone",t)),200)}observe(){const t=this.document;t.on("arrowKey",((e,n)=>{t.selection.isFake&&this.isEnabled&&n.preventDefault()}),{context:"$capture"}),t.on("arrowKey",((e,n)=>{t.selection.isFake&&this.isEnabled&&this._handleSelectionMove(n.keyCode)}),{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(t){const e=this.document.selection,n=new Hi(e.getRanges(),{backward:e.isBackward,fake:!1});t!=dr.arrowleft&&t!=dr.arrowup||n.setTo(n.getFirstPosition()),t!=dr.arrowright&&t!=dr.arrowdown||n.setTo(n.getLastPosition());const o={oldSelection:e,newSelection:n,domSelection:null};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}class ca extends Cs{constructor(t){super(t),this.mutationObserver=t.getObserver(Ws),this.selection=this.document.selection,this.domConverter=t.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=sa((t=>this.document.fire("selectionChangeDone",t)),200),this._clearInfiniteLoopInterval=setInterval((()=>this._clearInfiniteLoop()),1e3),this._documentIsSelectingInactivityTimeoutDebounced=sa((()=>this.document.isSelecting=!1),5e3),this._loopbackCounter=0}observe(t){const e=t.ownerDocument,n=()=>{this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel()};this.listenTo(t,"selectstart",(()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()}),{priority:"highest"}),this.listenTo(t,"keydown",n,{priority:"highest"}),this.listenTo(t,"keyup",n,{priority:"highest"}),this._documents.has(e)||(this.listenTo(e,"mouseup",n,{priority:"highest"}),this.listenTo(e,"selectionchange",((t,n)=>{this._handleSelectionChange(n,e),this._documentIsSelectingInactivityTimeoutDebounced()})),this._documents.add(e))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_handleSelectionChange(t,e){if(!this.isEnabled)return;const n=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(n.anchorNode))return;this.mutationObserver.flush();const o=this.domConverter.domSelectionToView(n);if(0!=o.rangeCount){if(this.view.hasDomSelection=!0,!(this.selection.isEqual(o)&&this.domConverter.isDomSelectionCorrect(n)||++this._loopbackCounter>60))if(this.selection.isSimilar(o))this.view.forceRender();else{const t={oldSelection:this.selection,newSelection:o,domSelection:n};this.document.fire("selectionChange",t),this._fireSelectionChangeDoneDebounced(t)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class la extends Gs{constructor(t){super(t),this.domEventType=["focus","blur"],this.useCapture=!0;const e=this.document;e.on("focus",(()=>{e.isFocused=!0,this._renderTimeoutId=setTimeout((()=>t.change((()=>{}))),50)})),e.on("blur",((n,o)=>{const i=e.selection.editableElement;null!==i&&i!==o.target||(e.isFocused=!1,t.change((()=>{})))}))}onDomEvent(t){this.fire(t.type,t)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class da extends Gs{constructor(t){super(t),this.domEventType=["compositionstart","compositionupdate","compositionend"];const e=this.document;e.on("compositionstart",(()=>{e.isComposing=!0})),e.on("compositionend",(()=>{e.isComposing=!1}))}onDomEvent(t){this.fire(t.type,t)}}class ha extends Gs{constructor(t){super(t),this.domEventType=["beforeinput"]}onDomEvent(t){this.fire(t.type,t)}}function ua(t){return"[object Range]"==Object.prototype.toString.apply(t)}function ga(t){const e=t.ownerDocument.defaultView.getComputedStyle(t);return{top:parseInt(e.borderTopWidth,10),right:parseInt(e.borderRightWidth,10),bottom:parseInt(e.borderBottomWidth,10),left:parseInt(e.borderLeftWidth,10)}}const ma=["top","right","bottom","left","width","height"];class pa{constructor(t){const e=ua(t);if(Object.defineProperty(this,"_source",{value:t._source||t,writable:!0,enumerable:!1}),vo(t)||e)if(e){const e=pa.getDomRangeRects(t);fa(this,pa.getBoundingRect(e))}else fa(this,t.getBoundingClientRect());else if(ks(t)){const{innerWidth:e,innerHeight:n}=t;fa(this,{top:0,right:e,bottom:n,left:0,width:e,height:n})}else fa(this,t)}clone(){return new pa(this)}moveTo(t,e){return this.top=e,this.right=t+this.width,this.bottom=e+this.height,this.left=t,this}moveBy(t,e){return this.top+=e,this.right+=t,this.left+=t,this.bottom+=e,this}getIntersection(t){const e={top:Math.max(this.top,t.top),right:Math.min(this.right,t.right),bottom:Math.min(this.bottom,t.bottom),left:Math.max(this.left,t.left)};return e.width=e.right-e.left,e.height=e.bottom-e.top,e.width<0||e.height<0?null:new pa(e)}getIntersectionArea(t){const e=this.getIntersection(t);return e?e.getArea():0}getArea(){return this.width*this.height}getVisible(){const t=this._source;let e=this.clone();if(!ka(t)){let n=t.parentNode||t.commonAncestorContainer;for(;n&&!ka(n);){const t=new pa(n),o=e.getIntersection(t);if(!o)return null;o.getArea(){for(const e of t){const t=ba._getElementCallbacks(e.target);if(t)for(const n of t)n(e)}}))}}ba._observerInstance=null,ba._elementCallbacks=null;class wa{constructor(t){this._callback=t,this._elements=new Set,this._previousRects=new Map,this._periodicCheckTimeout=null}observe(t){this._elements.add(t),this._checkElementRectsAndExecuteCallback(),1===this._elements.size&&this._startPeriodicCheck()}unobserve(t){this._elements.delete(t),this._previousRects.delete(t),this._elements.size||this._stopPeriodicCheck()}_startPeriodicCheck(){const t=()=>{this._checkElementRectsAndExecuteCallback(),this._periodicCheckTimeout=setTimeout(t,100)};this.listenTo(is.window,"resize",(()=>{this._checkElementRectsAndExecuteCallback()})),this._periodicCheckTimeout=setTimeout(t,100)}_stopPeriodicCheck(){clearTimeout(this._periodicCheckTimeout),this.stopListening(),this._previousRects.clear()}_checkElementRectsAndExecuteCallback(){const t=[];for(const e of this._elements)this._hasRectChanged(e)&&t.push({target:e,contentRect:this._previousRects.get(e)});t.length&&this._callback(t)}_hasRectChanged(t){if(!t.ownerDocument.body.contains(t))return!1;const e=new pa(t),n=this._previousRects.get(t),o=!n||!n.isEqual(e);return this._previousRects.set(t,e),o}}function _a(t,e){t instanceof HTMLTextAreaElement&&(t.value=e),t.innerHTML=e}he(wa,ws);function Aa({target:t,viewportOffset:e=0}){const n=Ma(t);let o=n,i=null;for(;o;){let r;r=Ia(o==n?t:i),va(r,(()=>Sa(t,o)));const s=Sa(t,o);if(Ca(o,s,e),o.parent!=o){if(i=o.frameElement,o=o.parent,!i)return}else o=null}}function Ca(t,e,n){const o=e.clone().moveBy(0,n),i=e.clone().moveBy(0,-n),r=new pa(t).excludeScrollbarsAndBorders();if(![i,o].every((t=>r.contains(t)))){let{scrollX:s,scrollY:a}=t;xa(i,r)?a-=r.top-e.top+n:ya(o,r)&&(a+=e.bottom-r.bottom+n),Ea(e,r)?s-=r.left-e.left+n:Da(e,r)&&(s+=e.right-r.right+n),t.scrollTo(s,a)}}function va(t,e){const n=Ma(t);let o,i;for(;t!=n.document.body;)i=e(),o=new pa(t).excludeScrollbarsAndBorders(),o.contains(i)||(xa(i,o)?t.scrollTop-=o.top-i.top:ya(i,o)&&(t.scrollTop+=i.bottom-o.bottom),Ea(i,o)?t.scrollLeft-=o.left-i.left:Da(i,o)&&(t.scrollLeft+=i.right-o.right)),t=t.parentNode}function ya(t,e){return t.bottom>e.bottom}function xa(t,e){return t.tope.right}function Ma(t){return ua(t)?t.startContainer.ownerDocument.defaultView:t.ownerDocument.defaultView}function Ia(t){if(ua(t)){let e=t.commonAncestorContainer;return Br(e)&&(e=e.parentNode),e}return t.parentNode}function Sa(t,e){const n=Ma(t),o=new pa(t);if(n===e)return o;{let t=n;for(;t!=e;){const e=t.frameElement,n=new pa(e).excludeScrollbarsAndBorders();o.moveBy(n.left,n.top),t=t.parent}}return o}function Ta(t){const e=t.next();return e.done?null:e.value}Object.assign({},{scrollViewportToShowTarget:Aa,scrollAncestorsToShowTarget:function(t){va(Ia(t),(()=>new pa(t)))}});class Na{constructor(){this.set("isFocused",!1),this.set("focusedElement",null),this._elements=new Set,this._nextEventLoopTimeout=null}add(t){if(this._elements.has(t))throw new c("focustracker-add-element-already-exist",this);this.listenTo(t,"focus",(()=>this._focus(t)),{useCapture:!0}),this.listenTo(t,"blur",(()=>this._blur()),{useCapture:!0}),this._elements.add(t)}remove(t){t===this.focusedElement&&this._blur(t),this._elements.has(t)&&(this.stopListening(t),this._elements.delete(t))}destroy(){this.stopListening()}_focus(t){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=t,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout((()=>{this.focusedElement=null,this.isFocused=!1}),0)}}he(Na,ws),he(Na,re);class Ba{constructor(){this._listener=Object.create(ws)}listenTo(t){this._listener.listenTo(t,"keydown",((t,e)=>{this._listener.fire("_keydown:"+ur(e),e)}))}set(t,e,n={}){const o=gr(t),i=n.priority;this._listener.listenTo(this._listener,"_keydown:"+o,((t,n)=>{e(n,(()=>{n.preventDefault(),n.stopPropagation(),t.stop()})),t.return=!0}),{priority:i})}press(t){return!!this._listener.fire("_keydown:"+ur(t),t)}destroy(){this._listener.stopListening()}}class za extends Cs{constructor(t){super(t),this.document.on("keydown",((t,e)=>{if(this.isEnabled&&((n=e.keyCode)==dr.arrowright||n==dr.arrowleft||n==dr.arrowup||n==dr.arrowdown)){const n=new Wi(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(n,e),n.stop.called&&t.stop()}var n}))}observe(){}}class Pa extends Cs{constructor(t){super(t);const e=this.document;e.on("keydown",((t,n)=>{if(!this.isEnabled||n.keyCode!=dr.tab||n.ctrlKey)return;const o=new Wi(e,"tab",e.selection.getFirstRange());e.fire(o,n),o.stop.called&&t.stop()}))}observe(){}}class La{constructor(t){this.document=new Ji(t),this.domConverter=new gs(this.document),this.domRoots=new Map,this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new ts(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting").to(this.document),this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this._writer=new Cr(this.document),this.addObserver(Ws),this.addObserver(ca),this.addObserver(la),this.addObserver(Ys),this.addObserver(aa),this.addObserver(da),this.addObserver(za),this.addObserver(Pa),sr.isAndroid&&this.addObserver(ha),this.document.on("arrowKey",Vr,{priority:"low"}),kr(this),this.on("render",(()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1})),this.listenTo(this.document.selection,"change",(()=>{this._hasChangedSinceTheLastRendering=!0})),this.listenTo(this.document,"change:isFocused",(()=>{this._hasChangedSinceTheLastRendering=!0}))}attachDomRoot(t,e="main"){const n=this.document.getRoot(e);n._name=t.tagName.toLowerCase();const o={};for(const{name:e,value:i}of Array.from(t.attributes))o[e]=i,"class"===e?this._writer.addClass(i.split(" "),n):this._writer.setAttribute(e,i,n);this._initialDomRootAttributes.set(t,o);const i=()=>{this._writer.setAttribute("contenteditable",!n.isReadOnly,n),n.isReadOnly?this._writer.addClass("ck-read-only",n):this._writer.removeClass("ck-read-only",n)};i(),this.domRoots.set(e,t),this.domConverter.bindElements(t,n),this._renderer.markToSync("children",n),this._renderer.markToSync("attributes",n),this._renderer.domDocuments.add(t.ownerDocument),n.on("change:children",((t,e)=>this._renderer.markToSync("children",e))),n.on("change:attributes",((t,e)=>this._renderer.markToSync("attributes",e))),n.on("change:text",((t,e)=>this._renderer.markToSync("text",e))),n.on("change:isReadOnly",(()=>this.change(i))),n.on("change",(()=>{this._hasChangedSinceTheLastRendering=!0}));for(const n of this._observers.values())n.observe(t,e)}detachDomRoot(t){const e=this.domRoots.get(t);Array.from(e.attributes).forEach((({name:t})=>e.removeAttribute(t)));const n=this._initialDomRootAttributes.get(e);for(const t in n)e.setAttribute(t,n[t]);this.domRoots.delete(t),this.domConverter.unbindDomElement(e)}getDomRoot(t="main"){return this.domRoots.get(t)}addObserver(t){let e=this._observers.get(t);if(e)return e;e=new t(this),this._observers.set(t,e);for(const[t,n]of this.domRoots)e.observe(n,t);return e.enable(),e}getObserver(t){return this._observers.get(t)}disableObservers(){for(const t of this._observers.values())t.disable()}enableObservers(){for(const t of this._observers.values())t.enable()}scrollToTheSelection(){const t=this.document.selection.getFirstRange();t&&Aa({target:this.domConverter.viewRangeToDom(t),viewportOffset:20})}focus(){if(!this.document.isFocused){const t=this.document.selection.editableElement;t&&(this.domConverter.focus(t),this.forceRender())}}change(t){if(this.isRenderingInProgress||this._postFixersInProgress)throw new c("cannot-change-view-tree",this);try{if(this._ongoingChange)return t(this._writer);this._ongoingChange=!0;const e=t(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),e}catch(t){c.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.change((()=>{}))}destroy(){for(const t of this._observers.values())t.destroy();this.document.destroy(),this.stopListening()}createPositionAt(t,e){return Ri._createAt(t,e)}createPositionAfter(t){return Ri._createAfter(t)}createPositionBefore(t){return Ri._createBefore(t)}createRange(t,e){return new ji(t,e)}createRangeOn(t){return ji._createOn(t)}createRangeIn(t){return ji._createIn(t)}createSelection(t,e,n){return new Hi(t,e,n)}_disableRendering(t){this._renderingDisabled=t,0==t&&this.change((()=>{}))}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}he(La,re);class Oa{constructor(t){this.parent=null,this._attrs=Ho(t)}get index(){let t;if(!this.parent)return null;if(null===(t=this.parent.getChildIndex(this)))throw new c("model-node-not-found-in-parent",this);return t}get startOffset(){let t;if(!this.parent)return null;if(null===(t=this.parent.getChildStartOffset(this)))throw new c("model-node-not-found-in-parent",this);return t}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const t=this.index;return null!==t&&this.parent.getChild(t+1)||null}get previousSibling(){const t=this.index;return null!==t&&this.parent.getChild(t-1)||null}get root(){let t=this;for(;t.parent;)t=t.parent;return t}isAttached(){return this.root.is("rootElement")}getPath(){const t=[];let e=this;for(;e.parent;)t.unshift(e.startOffset),e=e.parent;return t}getAncestors(t={includeSelf:!1,parentFirst:!1}){const e=[];let n=t.includeSelf?this:this.parent;for(;n;)e[t.parentFirst?"push":"unshift"](n),n=n.parent;return e}getCommonAncestor(t,e={}){const n=this.getAncestors(e),o=t.getAncestors(e);let i=0;for(;n[i]==o[i]&&n[i];)i++;return 0===i?null:n[i-1]}isBefore(t){if(this==t)return!1;if(this.root!==t.root)return!1;const e=this.getPath(),n=t.getPath(),o=Oo(e,n);switch(o){case"prefix":return!0;case"extension":return!1;default:return e[o](t[e[0]]=e[1],t)),{})),t}is(t){return"node"===t||"model:node"===t}_clone(){return new Oa(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(t,e){this._attrs.set(t,e)}_setAttributesTo(t){this._attrs=Ho(t)}_removeAttribute(t){return this._attrs.delete(t)}_clearAttributes(){this._attrs.clear()}}class Ra extends Oa{constructor(t,e){super(e),this._data=t||""}get offsetSize(){return this.data.length}get data(){return this._data}is(t){return"$text"===t||"model:$text"===t||"text"===t||"model:text"===t||"node"===t||"model:node"===t}toJSON(){const t=super.toJSON();return t.data=this.data,t}_clone(){return new Ra(this.data,this.getAttributes())}static fromJSON(t){return new Ra(t.data,t.attributes)}}class ja{constructor(t,e,n){if(this.textNode=t,e<0||e>t.offsetSize)throw new c("model-textproxy-wrong-offsetintext",this);if(n<0||e+n>t.offsetSize)throw new c("model-textproxy-wrong-length",this);this.data=t.data.substring(e,e+n),this.offsetInText=e}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}is(t){return"$textProxy"===t||"model:$textProxy"===t||"textProxy"===t||"model:textProxy"===t}getPath(){const t=this.textNode.getPath();return t.length>0&&(t[t.length-1]+=this.offsetInText),t}getAncestors(t={includeSelf:!1,parentFirst:!1}){const e=[];let n=t.includeSelf?this:this.parent;for(;n;)e[t.parentFirst?"push":"unshift"](n),n=n.parent;return e}hasAttribute(t){return this.textNode.hasAttribute(t)}getAttribute(t){return this.textNode.getAttribute(t)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}class Fa{constructor(t){this._nodes=[],t&&this._insertNodes(0,t)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce(((t,e)=>t+e.offsetSize),0)}getNode(t){return this._nodes[t]||null}getNodeIndex(t){const e=this._nodes.indexOf(t);return-1==e?null:e}getNodeStartOffset(t){const e=this.getNodeIndex(t);return null===e?null:this._nodes.slice(0,e).reduce(((t,e)=>t+e.offsetSize),0)}indexToOffset(t){if(t==this._nodes.length)return this.maxOffset;const e=this._nodes[t];if(!e)throw new c("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(e)}offsetToIndex(t){let e=0;for(const n of this._nodes){if(t>=e&&tt.toJSON()))}}class Va extends Oa{constructor(t,e,n){super(e),this.name=t,this._children=new Fa,n&&this._insertChild(0,n)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}is(t,e=null){return e?e===this.name&&("element"===t||"model:element"===t):"element"===t||"model:element"===t||"node"===t||"model:node"===t}getChild(t){return this._children.getNode(t)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(t){return this._children.getNodeIndex(t)}getChildStartOffset(t){return this._children.getNodeStartOffset(t)}offsetToIndex(t){return this._children.offsetToIndex(t)}getNodeByPath(t){let e=this;for(const n of t)e=e.getChild(e.offsetToIndex(n));return e}findAncestor(t,e={includeSelf:!1}){let n=e.includeSelf?this:this.parent;for(;n;){if(n.name===t)return n;n=n.parent}return null}toJSON(){const t=super.toJSON();if(t.name=this.name,this._children.length>0){t.children=[];for(const e of this._children)t.children.push(e.toJSON())}return t}_clone(t=!1){const e=t?Array.from(this._children).map((t=>t._clone(!0))):null;return new Va(this.name,this.getAttributes(),e)}_appendChild(t){this._insertChild(this.childCount,t)}_insertChild(t,e){const n=function(t){if("string"==typeof t)return[new Ra(t)];Do(t)||(t=[t]);return Array.from(t).map((t=>"string"==typeof t?new Ra(t):t instanceof ja?new Ra(t.data,t.getAttributes()):t))}(e);for(const t of n)null!==t.parent&&t._remove(),t.parent=this;this._children._insertNodes(t,n)}_removeChildren(t,e=1){const n=this._children._removeNodes(t,e);for(const t of n)t.parent=null;return n}static fromJSON(t){let e=null;if(t.children){e=[];for(const n of t.children)n.name?e.push(Va.fromJSON(n)):e.push(Ra.fromJSON(n))}return new Va(t.name,t.attributes,e)}}class Ha{constructor(t={}){if(!t.boundaries&&!t.startPosition)throw new c("model-tree-walker-no-start-position",null);const e=t.direction||"forward";if("forward"!=e&&"backward"!=e)throw new c("model-tree-walker-unknown-direction",t,{direction:e});this.direction=e,this.boundaries=t.boundaries||null,t.startPosition?this.position=t.startPosition.clone():this.position=Wa._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!t.singleCharacters,this.shallow=!!t.shallow,this.ignoreElementEnd=!!t.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}skip(t){let e,n,o,i;do{o=this.position,i=this._visitedParent,({done:e,value:n}=this.next())}while(!e&&t(n));e||(this.position=o,this._visitedParent=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const t=this.position,e=this.position.clone(),n=this._visitedParent;if(null===n.parent&&e.offset===n.maxOffset)return{done:!0};if(n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};const o=qa(e,n),i=o||Ga(e,n,o);if(i instanceof Va)return this.shallow?e.offset++:(e.path.push(0),this._visitedParent=i),this.position=e,Ua("elementStart",i,t,e,1);if(i instanceof Ra){let o;if(this.singleCharacters)o=1;else{let t=i.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offsett&&(t=this.boundaries.start.offset),o=e.offset-t}const i=e.offset-r.startOffset,s=new ja(r,i-o,o);return e.offset-=o,this.position=e,Ua("text",s,t,e,o)}return e.path.pop(),this.position=e,this._visitedParent=n.parent,Ua("elementStart",n,t,e,1)}}function Ua(t,e,n,o,i){return{done:!1,value:{type:t,item:e,previousPosition:n,nextPosition:o,length:i}}}class Wa{constructor(t,e,n="toNone"){if(!t.is("element")&&!t.is("documentFragment"))throw new c("model-position-root-invalid",t);if(!(e instanceof Array)||0===e.length)throw new c("model-position-path-incorrect-format",t,{path:e});t.is("rootElement")?e=e.slice():(e=[...t.getPath(),...e],t=t.root),this.root=t,this.path=e,this.stickiness=n}get offset(){return this.path[this.path.length-1]}set offset(t){this.path[this.path.length-1]=t}get parent(){let t=this.root;for(let e=0;en.path.length){if(e.offset!==o.maxOffset)return!1;e.path=e.path.slice(0,-1),o=o.parent,e.offset++}else{if(0!==n.offset)return!1;n.path=n.path.slice(0,-1)}}}is(t){return"position"===t||"model:position"===t}hasSameParentAs(t){if(this.root!==t.root)return!1;return"same"==Oo(this.getParentPath(),t.getParentPath())}getTransformedByOperation(t){let e;switch(t.type){case"insert":e=this._getTransformedByInsertOperation(t);break;case"move":case"remove":case"reinsert":e=this._getTransformedByMoveOperation(t);break;case"split":e=this._getTransformedBySplitOperation(t);break;case"merge":e=this._getTransformedByMergeOperation(t);break;default:e=Wa._createAt(this)}return e}_getTransformedByInsertOperation(t){return this._getTransformedByInsertion(t.position,t.howMany)}_getTransformedByMoveOperation(t){return this._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany)}_getTransformedBySplitOperation(t){const e=t.movedRange;return e.containsPosition(this)||e.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(t.splitPosition,t.moveTargetPosition):t.graveyardPosition?this._getTransformedByMove(t.graveyardPosition,t.insertionPosition,1):this._getTransformedByInsertion(t.insertionPosition,1)}_getTransformedByMergeOperation(t){const e=t.movedRange;let n;return e.containsPosition(this)||e.start.isEqual(this)?(n=this._getCombined(t.sourcePosition,t.targetPosition),t.sourcePosition.isBefore(t.targetPosition)&&(n=n._getTransformedByDeletion(t.deletionPosition,1))):n=this.isEqual(t.deletionPosition)?Wa._createAt(t.deletionPosition):this._getTransformedByMove(t.deletionPosition,t.graveyardPosition,1),n}_getTransformedByDeletion(t,e){const n=Wa._createAt(this);if(this.root!=t.root)return n;if("same"==Oo(t.getParentPath(),this.getParentPath())){if(t.offsetthis.offset)return null;n.offset-=e}}else if("prefix"==Oo(t.getParentPath(),this.getParentPath())){const o=t.path.length-1;if(t.offset<=this.path[o]){if(t.offset+e>this.path[o])return null;n.path[o]-=e}}return n}_getTransformedByInsertion(t,e){const n=Wa._createAt(this);if(this.root!=t.root)return n;if("same"==Oo(t.getParentPath(),this.getParentPath()))(t.offsete+1;){const e=o.maxOffset-n.offset;0!==e&&t.push(new Ka(n,n.getShiftedBy(e))),n.path=n.path.slice(0,-1),n.offset++,o=o.parent}for(;n.path.length<=this.end.path.length;){const e=this.end.path[n.path.length-1],o=e-n.offset;0!==o&&t.push(new Ka(n,n.getShiftedBy(o))),n.offset=e,n.path.push(0)}return t}getWalker(t={}){return t.boundaries=this,new Ha(t)}*getItems(t={}){t.boundaries=this,t.ignoreElementEnd=!0;const e=new Ha(t);for(const t of e)yield t.item}*getPositions(t={}){t.boundaries=this;const e=new Ha(t);yield e.position;for(const t of e)yield t.nextPosition}getTransformedByOperation(t){switch(t.type){case"insert":return this._getTransformedByInsertOperation(t);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(t);case"split":return[this._getTransformedBySplitOperation(t)];case"merge":return[this._getTransformedByMergeOperation(t)]}return[new Ka(this.start,this.end)]}getTransformedByOperations(t){const e=[new Ka(this.start,this.end)];for(const n of t)for(let t=0;t0?new this(n,o):new this(o,n)}static _createIn(t){return new this(Wa._createAt(t,0),Wa._createAt(t,t.maxOffset))}static _createOn(t){return this._createFromPositionAndShift(Wa._createBefore(t),t.offsetSize)}static _createFromRanges(t){if(0===t.length)throw new c("range-create-from-ranges-empty-array",null);if(1==t.length)return t[0].clone();const e=t[0];t.sort(((t,e)=>t.start.isAfter(e.start)?1:-1));const n=t.indexOf(e),o=new this(e.start,e.end);if(n>0)for(let e=n-1;t[e].end.isEqual(o.start);e++)o.start=Wa._createAt(t[e].start);for(let e=n+1;e{if(e.viewPosition)return;const n=this._modelToViewMapping.get(e.modelPosition.parent);if(!n)throw new c("mapping-model-position-view-parent-not-found",this,{modelPosition:e.modelPosition});e.viewPosition=this.findPositionIn(n,e.modelPosition.offset)}),{priority:"low"}),this.on("viewToModelPosition",((t,e)=>{if(e.modelPosition)return;const n=this.findMappedViewAncestor(e.viewPosition),o=this._viewToModelMapping.get(n),i=this._toModelOffset(e.viewPosition.parent,e.viewPosition.offset,n);e.modelPosition=Wa._createAt(o,i)}),{priority:"low"})}bindElements(t,e){this._modelToViewMapping.set(t,e),this._viewToModelMapping.set(e,t)}unbindViewElement(t,e={}){const n=this.toModelElement(t);if(this._elementToMarkerNames.has(t))for(const e of this._elementToMarkerNames.get(t))this._unboundMarkerNames.add(e);e.defer?this._deferredBindingRemovals.set(t,t.root):(this._viewToModelMapping.delete(t),this._modelToViewMapping.get(n)==t&&this._modelToViewMapping.delete(n))}unbindModelElement(t){const e=this.toViewElement(t);this._modelToViewMapping.delete(t),this._viewToModelMapping.get(e)==t&&this._viewToModelMapping.delete(e)}bindElementToMarker(t,e){const n=this._markerNameToElements.get(e)||new Set;n.add(t);const o=this._elementToMarkerNames.get(t)||new Set;o.add(e),this._markerNameToElements.set(e,n),this._elementToMarkerNames.set(t,o)}unbindElementFromMarkerName(t,e){const n=this._markerNameToElements.get(e);n&&(n.delete(t),0==n.size&&this._markerNameToElements.delete(e));const o=this._elementToMarkerNames.get(t);o&&(o.delete(e),0==o.size&&this._elementToMarkerNames.delete(t))}flushUnboundMarkerNames(){const t=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),t}flushDeferredBindings(){for(const[t,e]of this._deferredBindingRemovals)t.root==e&&this.unbindViewElement(t);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(t){return this._viewToModelMapping.get(t)}toViewElement(t){return this._modelToViewMapping.get(t)}toModelRange(t){return new Ka(this.toModelPosition(t.start),this.toModelPosition(t.end))}toViewRange(t){return new ji(this.toViewPosition(t.start),this.toViewPosition(t.end))}toModelPosition(t){const e={viewPosition:t,mapper:this};return this.fire("viewToModelPosition",e),e.modelPosition}toViewPosition(t,e={isPhantom:!1}){const n={modelPosition:t,mapper:this,isPhantom:e.isPhantom};return this.fire("modelToViewPosition",n),n.viewPosition}markerNameToElements(t){const e=this._markerNameToElements.get(t);if(!e)return null;const n=new Set;for(const t of e)if(t.is("attributeElement"))for(const e of t.getElementsWithSameId())n.add(e);else n.add(t);return n}registerViewToModelLength(t,e){this._viewToModelLengthCallbacks.set(t,e)}findMappedViewAncestor(t){let e=t.parent;for(;!this._viewToModelMapping.has(e);)e=e.parent;return e}_toModelOffset(t,e,n){if(n!=t){return this._toModelOffset(t.parent,t.index,n)+this._toModelOffset(t,e,t)}if(t.is("$text"))return e;let o=0;for(let n=0;n1?e[0]+":"+e[1]:e[0]}class Ja{constructor(t){this._conversionApi={dispatcher:this,...t},this._firedEventsMap=new WeakMap}convertChanges(t,e,n){const o=this._createConversionApi(n,t.getRefreshedItems());for(const e of t.getMarkersToRemove())this._convertMarkerRemove(e.name,e.range,o);const i=this._reduceChanges(t.getChanges());for(const t of i)"insert"===t.type?this._convertInsert(Ka._createFromPositionAndShift(t.position,t.length),o):"reinsert"===t.type?this._convertReinsert(Ka._createFromPositionAndShift(t.position,t.length),o):"remove"===t.type?this._convertRemove(t.position,t.length,t.name,o):this._convertAttribute(t.range,t.attributeKey,t.attributeOldValue,t.attributeNewValue,o);for(const t of o.mapper.flushUnboundMarkerNames()){const n=e.get(t).getRange();this._convertMarkerRemove(t,n,o),this._convertMarkerAdd(t,n,o)}for(const e of t.getMarkersToAdd())this._convertMarkerAdd(e.name,e.range,o);o.mapper.flushDeferredBindings(),o.consumable.verifyAllConsumed("insert")}convert(t,e,n,o={}){const i=this._createConversionApi(n,void 0,o);this._convertInsert(t,i);for(const[t,n]of e)this._convertMarkerAdd(t,n,i);i.consumable.verifyAllConsumed("insert")}convertSelection(t,e,n){const o=Array.from(e.getMarkersAtPosition(t.getFirstPosition())),i=this._createConversionApi(n);if(this._addConsumablesForSelection(i.consumable,t,o),this.fire("selection",{selection:t},i),t.isCollapsed){for(const e of o){const n=e.getRange();if(!Xa(t.getFirstPosition(),e,i.mapper))continue;const o={item:t,markerName:e.name,markerRange:n};i.consumable.test(t,"addMarker:"+e.name)&&this.fire("addMarker:"+e.name,o,i)}for(const e of t.getAttributeKeys()){const n={item:t,range:t.getFirstRange(),attributeKey:e,attributeOldValue:null,attributeNewValue:t.getAttribute(e)};i.consumable.test(t,"attribute:"+n.attributeKey)&&this.fire("attribute:"+n.attributeKey+":$text",n,i)}}}_convertInsert(t,e,n={}){n.doNotAddConsumables||this._addConsumablesForInsert(e.consumable,Array.from(t));for(const n of Array.from(t.getWalker({shallow:!0})).map(tc))this._testAndFire("insert",n,e)}_convertRemove(t,e,n,o){this.fire("remove:"+n,{position:t,length:e},o)}_convertAttribute(t,e,n,o,i){this._addConsumablesForRange(i.consumable,t,`attribute:${e}`);for(const r of t){const t={item:r.item,range:Ka._createFromPositionAndShift(r.previousPosition,r.length),attributeKey:e,attributeOldValue:n,attributeNewValue:o};this._testAndFire(`attribute:${e}`,t,i)}}_convertReinsert(t,e){const n=Array.from(t.getWalker({shallow:!0}));this._addConsumablesForInsert(e.consumable,n);for(const t of n.map(tc))this._testAndFire("insert",{...t,reconversion:!0},e)}_convertMarkerAdd(t,e,n){if("$graveyard"==e.root.rootName)return;const o="addMarker:"+t;if(n.consumable.add(e,o),this.fire(o,{markerName:t,markerRange:e},n),n.consumable.consume(e,o)){this._addConsumablesForRange(n.consumable,e,o);for(const i of e.getItems()){if(!n.consumable.test(i,o))continue;const r={item:i,range:Ka._createOn(i),markerName:t,markerRange:e};this.fire(o,r,n)}}}_convertMarkerRemove(t,e,n){"$graveyard"!=e.root.rootName&&this.fire("removeMarker:"+t,{markerName:t,markerRange:e},n)}_reduceChanges(t){const e={changes:t};return this.fire("reduceChanges",e),e.changes}_addConsumablesForInsert(t,e){for(const n of e){const e=n.item;if(null===t.test(e,"insert")){t.add(e,"insert");for(const n of e.getAttributeKeys())t.add(e,"attribute:"+n)}}return t}_addConsumablesForRange(t,e,n){for(const o of e.getItems())t.add(o,n);return t}_addConsumablesForSelection(t,e,n){t.add(e,"selection");for(const o of n)t.add(e,"addMarker:"+o.name);for(const n of e.getAttributeKeys())t.add(e,"attribute:"+n);return t}_testAndFire(t,e,n){const o=function(t,e){const n=e.item.name||"$text";return`${t}:${n}`}(t,e),i=e.item.is("$textProxy")?n.consumable._getSymbolForTextProxy(e.item):e.item,r=this._firedEventsMap.get(n),s=r.get(i);if(s){if(s.has(o))return;s.add(o)}else r.set(i,new Set([o]));this.fire(o,e,n)}_testAndFireAddAttributes(t,e){const n={item:t,range:Ka._createOn(t)};for(const t of n.item.getAttributeKeys())n.attributeKey=t,n.attributeOldValue=null,n.attributeNewValue=n.item.getAttribute(t),this._testAndFire(`attribute:${t}`,n,e)}_createConversionApi(t,e=new Set,n={}){const o={...this._conversionApi,consumable:new $a,writer:t,options:n,convertItem:t=>this._convertInsert(Ka._createOn(t),o),convertChildren:t=>this._convertInsert(Ka._createIn(t),o,{doNotAddConsumables:!0}),convertAttributes:t=>this._testAndFireAddAttributes(t,o),canReuseView:t=>!e.has(o.mapper.toModelElement(t))};return this._firedEventsMap.set(o,new Map),o}}function Xa(t,e,n){const o=e.getRange(),i=Array.from(t.getAncestors());i.shift(),i.reverse();return!i.some((t=>{if(o.containsItem(t)){return!!n.toViewElement(t).getCustomProperty("addHighlight")}}))}function tc(t){return{item:t.item,range:Ka._createFromPositionAndShift(t.previousPosition,t.length)}}he(Ja,k);class ec{constructor(t,e,n){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,t&&this.setTo(t,e,n)}get anchor(){if(this._ranges.length>0){const t=this._ranges[this._ranges.length-1];return this._lastRangeBackward?t.end:t.start}return null}get focus(){if(this._ranges.length>0){const t=this._ranges[this._ranges.length-1];return this._lastRangeBackward?t.start:t.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(t){if(this.rangeCount!=t.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(t.anchor)||!this.focus.isEqual(t.focus))return!1;for(const e of this._ranges){let n=!1;for(const o of t._ranges)if(e.isEqual(o)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(const t of this._ranges)yield new Ka(t.start,t.end)}getFirstRange(){let t=null;for(const e of this._ranges)t&&!e.start.isBefore(t.start)||(t=e);return t?new Ka(t.start,t.end):null}getLastRange(){let t=null;for(const e of this._ranges)t&&!e.end.isAfter(t.end)||(t=e);return t?new Ka(t.start,t.end):null}getFirstPosition(){const t=this.getFirstRange();return t?t.start.clone():null}getLastPosition(){const t=this.getLastRange();return t?t.end.clone():null}setTo(t,e,n){if(null===t)this._setRanges([]);else if(t instanceof ec)this._setRanges(t.getRanges(),t.isBackward);else if(t&&"function"==typeof t.getRanges)this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof Ka)this._setRanges([t],!!e&&!!e.backward);else if(t instanceof Wa)this._setRanges([new Ka(t)]);else if(t instanceof Oa){const o=!!n&&!!n.backward;let i;if("in"==e)i=Ka._createIn(t);else if("on"==e)i=Ka._createOn(t);else{if(void 0===e)throw new c("model-selection-setto-required-second-parameter",[this,t]);i=new Ka(Wa._createAt(t,e))}this._setRanges([i],o)}else{if(!Do(t))throw new c("model-selection-setto-not-selectable",[this,t]);this._setRanges(t,e&&!!e.backward)}}_setRanges(t,e=!1){const n=(t=Array.from(t)).some((e=>{if(!(e instanceof Ka))throw new c("model-selection-set-ranges-not-range",[this,t]);return this._ranges.every((t=>!t.isEqual(e)))}));if(t.length!==this._ranges.length||n){this._removeAllRanges();for(const e of t)this._pushRange(e);this._lastRangeBackward=!!e,this.fire("change:range",{directChange:!0})}}setFocus(t,e){if(null===this.anchor)throw new c("model-selection-setfocus-no-ranges",[this,t]);const n=Wa._createAt(t,e);if("same"==n.compareWith(this.focus))return;const o=this.anchor;this._ranges.length&&this._popRange(),"before"==n.compareWith(o)?(this._pushRange(new Ka(n,o)),this._lastRangeBackward=!0):(this._pushRange(new Ka(o,n)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(t){return this._attrs.get(t)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(t){return this._attrs.has(t)}removeAttribute(t){this.hasAttribute(t)&&(this._attrs.delete(t),this.fire("change:attribute",{attributeKeys:[t],directChange:!0}))}setAttribute(t,e){this.getAttribute(t)!==e&&(this._attrs.set(t,e),this.fire("change:attribute",{attributeKeys:[t],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}is(t){return"selection"===t||"model:selection"===t}*getSelectedBlocks(){const t=new WeakSet;for(const e of this.getRanges()){const n=ic(e.start,t);n&&rc(n,e)&&(yield n);for(const n of e.getWalker()){const o=n.item;"elementEnd"==n.type&&oc(o,t,e)&&(yield o)}const o=ic(e.end,t);o&&!e.end.isTouching(Wa._createAt(o,0))&&rc(o,e)&&(yield o)}}containsEntireContent(t=this.anchor.root){const e=Wa._createAt(t,0),n=Wa._createAt(t,"end");return e.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}_pushRange(t){this._checkRange(t),this._ranges.push(new Ka(t.start,t.end))}_checkRange(t){for(let e=0;e0;)this._popRange()}_popRange(){this._ranges.pop()}}function nc(t,e){return!e.has(t)&&(e.add(t),t.root.document.model.schema.isBlock(t)&&t.parent)}function oc(t,e,n){return nc(t,e)&&rc(t,n)}function ic(t,e){const n=t.parent.root.document.model.schema,o=t.parent.getAncestors({parentFirst:!0,includeSelf:!0});let i=!1;const r=o.find((t=>!i&&(i=n.isLimit(t),!i&&nc(t,e))));return o.forEach((t=>e.add(t))),r}function rc(t,e){const n=function(t){const e=t.root.document.model.schema;let n=t.parent;for(;n;){if(e.isBlock(n))return n;n=n.parent}}(t);if(!n)return!0;return!e.containsRange(Ka._createOn(n),!0)}he(ec,k);class sc extends Ka{constructor(t,e){super(t,e),ac.call(this)}detach(){this.stopListening()}is(t){return"liveRange"===t||"model:liveRange"===t||"range"==t||"model:range"===t}toRange(){return new Ka(this.start,this.end)}static fromRange(t){return new sc(t.start,t.end)}}function ac(){this.listenTo(this.root.document.model,"applyOperation",((t,e)=>{const n=e[0];n.isDocumentOperation&&cc.call(this,n)}),{priority:"low"})}function cc(t){const e=this.getTransformedByOperation(t),n=Ka._createFromRanges(e),o=!n.isEqual(this),i=function(t,e){switch(e.type){case"insert":return t.containsPosition(e.position);case"move":case"remove":case"reinsert":case"merge":return t.containsPosition(e.sourcePosition)||t.start.isEqual(e.sourcePosition)||t.containsPosition(e.targetPosition);case"split":return t.containsPosition(e.splitPosition)||t.containsPosition(e.insertionPosition)}return!1}(this,t);let r=null;if(o){"$graveyard"==n.root.rootName&&(r="remove"==t.type?t.sourcePosition:t.deletionPosition);const e=this.toRange();this.start=n.start,this.end=n.end,this.fire("change:range",e,{deletionPosition:r})}else i&&this.fire("change:content",this.toRange(),{deletionPosition:r})}he(sc,k);const lc="selection:";class dc{constructor(t){this._selection=new hc(t),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(t){return this._selection.containsEntireContent(t)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(t){return this._selection.getAttribute(t)}hasAttribute(t){return this._selection.hasAttribute(t)}refresh(){this._selection._updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(t){this._selection.observeMarkers(t)}is(t){return"selection"===t||"model:selection"==t||"documentSelection"==t||"model:documentSelection"==t}_setFocus(t,e){this._selection.setFocus(t,e)}_setTo(t,e,n){this._selection.setTo(t,e,n)}_setAttribute(t,e){this._selection.setAttribute(t,e)}_removeAttribute(t){this._selection.removeAttribute(t)}_getStoredAttributes(){return this._selection._getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(t){this._selection.restoreGravity(t)}static _getStoreAttributeKey(t){return lc+t}static _isStoreAttributeKey(t){return t.startsWith(lc)}}he(dc,k);class hc extends ec{constructor(t){super(),this.markers=new Mo({idProperty:"name"}),this._model=t.model,this._document=t,this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this.listenTo(this._model,"applyOperation",((t,e)=>{const n=e[0];n.isDocumentOperation&&"marker"!=n.type&&"rename"!=n.type&&"noop"!=n.type&&(0==this._ranges.length&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))}),{priority:"lowest"}),this.on("change:range",(()=>{for(const t of this.getRanges())if(!this._document._validateSelectionRange(t))throw new c("document-selection-wrong-position",this,{range:t})})),this.listenTo(this._model.markers,"update",((t,e,n,o)=>{this._updateMarker(e,o)})),this.listenTo(this._document,"change",((t,e)=>{!function(t,e){const n=t.document.differ;for(const o of n.getChanges()){if("insert"!=o.type)continue;const n=o.position.parent;o.length===n.maxOffset&&t.enqueueChange(e,(t=>{const e=Array.from(n.getAttributeKeys()).filter((t=>t.startsWith(lc)));for(const o of e)t.removeAttribute(o,n)}))}}(this._model,e)}))}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let t=0;t{if(this._hasChangedRange=!0,e.root==this._document.graveyard){this._selectionRestorePosition=o.deletionPosition;const t=this._ranges.indexOf(e);this._ranges.splice(t,1),e.detach()}})),e}_updateMarkers(){if(!this._observedMarkers.size)return;const t=[];let e=!1;for(const e of this._model.markers){const n=e.name.split(":",1)[0];if(!this._observedMarkers.has(n))continue;const o=e.getRange();for(const n of this.getRanges())o.containsRange(n,!n.isCollapsed)&&t.push(e)}const n=Array.from(this.markers);for(const n of t)this.markers.has(n)||(this.markers.add(n),e=!0);for(const n of Array.from(this.markers))t.includes(n)||(this.markers.remove(n),e=!0);e&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateMarker(t,e){const n=t.name.split(":",1)[0];if(!this._observedMarkers.has(n))return;let o=!1;const i=Array.from(this.markers),r=this.markers.has(t);if(e){let n=!1;for(const t of this.getRanges())if(e.containsRange(t,!t.isCollapsed)){n=!0;break}n&&!r?(this.markers.add(t),o=!0):!n&&r&&(this.markers.remove(t),o=!0)}else r&&(this.markers.remove(t),o=!0);o&&this.fire("change:marker",{oldMarkers:i,directChange:!1})}_updateAttributes(t){const e=Ho(this._getSurroundingAttributes()),n=Ho(this.getAttributes());if(t)this._attributePriority=new Map,this._attrs=new Map;else for(const[t,e]of this._attributePriority)"low"==e&&(this._attrs.delete(t),this._attributePriority.delete(t));this._setAttributesTo(e);const o=[];for(const[t,e]of this.getAttributes())n.has(t)&&n.get(t)===e||o.push(t);for(const[t]of n)this.hasAttribute(t)||o.push(t);o.length>0&&this.fire("change:attribute",{attributeKeys:o,directChange:!1})}_setAttribute(t,e,n=!0){const o=n?"normal":"low";if("low"==o&&"normal"==this._attributePriority.get(t))return!1;return super.getAttribute(t)!==e&&(this._attrs.set(t,e),this._attributePriority.set(t,o),!0)}_removeAttribute(t,e=!0){const n=e?"normal":"low";return("low"!=n||"normal"!=this._attributePriority.get(t))&&(this._attributePriority.set(t,n),!!super.hasAttribute(t)&&(this._attrs.delete(t),!0))}_setAttributesTo(t){const e=new Set;for(const[e,n]of this.getAttributes())t.get(e)!==n&&this._removeAttribute(e,!1);for(const[n,o]of t){this._setAttribute(n,o,!1)&&e.add(n)}return e}*_getStoredAttributes(){const t=this.getFirstPosition().parent;if(this.isCollapsed&&t.isEmpty)for(const e of t.getAttributeKeys())if(e.startsWith(lc)){const n=e.substr(lc.length);yield[n,t.getAttribute(e)]}}_getSurroundingAttributes(){const t=this.getFirstPosition(),e=this._model.schema;let n=null;if(this.isCollapsed){const o=t.textNode?t.textNode:t.nodeBefore,i=t.textNode?t.textNode:t.nodeAfter;if(this.isGravityOverridden||(n=uc(o)),n||(n=uc(i)),!this.isGravityOverridden&&!n){let t=o;for(;t&&!e.isInline(t)&&!n;)t=t.previousSibling,n=uc(t)}if(!n){let t=i;for(;t&&!e.isInline(t)&&!n;)t=t.nextSibling,n=uc(t)}n||(n=this._getStoredAttributes())}else{const t=this.getFirstRange();for(const o of t){if(o.item.is("element")&&e.isObject(o.item))break;if("text"==o.type){n=o.item.getAttributes();break}}}return n}_fixGraveyardSelection(t){const e=this._model.schema.getNearestSelectionRange(t);e&&this._pushRange(e)}}function uc(t){return t instanceof ja||t instanceof Ra?t.getAttributes():null}class gc{constructor(t){this._dispatchers=t}add(t){for(const e of this._dispatchers)t(e);return this}}const mc=function(t){return Ao(t,5)};class pc extends gc{elementToElement(t){return this.add(function(t){(t=mc(t)).model=bc(t.model),t.view=wc(t.view,"container"),t.model.attributes.length&&(t.model.children=!0);return e=>{e.on("insert:"+t.model.name,function(t,e=Dc){return(n,o,i)=>{if(!e(o.item,i.consumable,{preflight:!0}))return;const r=t(o.item,i,o);if(!r)return;e(o.item,i.consumable);const s=i.mapper.toViewPosition(o.range.start);i.mapper.bindElements(o.item,r),i.writer.insert(s,r),i.convertAttributes(o.item),xc(r,o.item.getChildren(),i,{reconversion:o.reconversion})}}(t.view,yc(t.model)),{priority:t.converterPriority||"normal"}),(t.model.children||t.model.attributes.length)&&e.on("reduceChanges",vc(t.model),{priority:"low"})}}(t))}elementToStructure(t){return this.add(function(t){return(t=mc(t)).model=bc(t.model),t.view=wc(t.view,"container"),t.model.children=!0,e=>{if(e._conversionApi.schema.checkChild(t.model.name,"$text"))throw new c("conversion-element-to-structure-disallowed-text",e,{elementName:t.model.name});var n,o;e.on("insert:"+t.model.name,(n=t.view,o=yc(t.model),(t,e,i)=>{if(!o(e.item,i.consumable,{preflight:!0}))return;const r=new Map;i.writer._registerSlotFactory(function(t,e,n){return(o,i="children")=>{const r=o.createContainerElement("$slot");let s=null;if("children"===i)s=Array.from(t.getChildren());else{if("function"!=typeof i)throw new c("conversion-slot-mode-unknown",n.dispatcher,{modeOrFilter:i});s=Array.from(t.getChildren()).filter((t=>i(t)))}return e.set(r,s),r}}(e.item,r,i));const s=n(e.item,i,e);if(i.writer._clearSlotFactory(),!s)return;!function(t,e,n){const o=Array.from(e.values()).flat(),i=new Set(o);if(i.size!=o.length)throw new c("conversion-slot-filter-overlap",n.dispatcher,{element:t});if(i.size!=t.childCount)throw new c("conversion-slot-filter-incomplete",n.dispatcher,{element:t})}(e.item,r,i),o(e.item,i.consumable);const a=i.mapper.toViewPosition(e.range.start);i.mapper.bindElements(e.item,s),i.writer.insert(a,s),i.convertAttributes(e.item),function(t,e,n,o){n.mapper.on("modelToViewPosition",s,{priority:"highest"});let i=null,r=null;for([i,r]of e)xc(t,r,n,o),n.writer.move(n.writer.createRangeIn(i),n.writer.createPositionBefore(i)),n.writer.remove(i);function s(t,e){const n=e.modelPosition.nodeAfter,o=r.indexOf(n);o<0||(e.viewPosition=e.mapper.findPositionIn(i,o))}n.mapper.off("modelToViewPosition",s)}(s,r,i,{reconversion:e.reconversion})}),{priority:t.converterPriority||"normal"}),e.on("reduceChanges",vc(t.model),{priority:"low"})}}(t))}attributeToElement(t){return this.add(function(t){t=mc(t);let e="attribute:"+(t.model.key?t.model.key:t.model);t.model.name&&(e+=":"+t.model.name);if(t.model.values)for(const e of t.model.values)t.view[e]=wc(t.view[e],"attribute");else t.view=wc(t.view,"attribute");const n=_c(t);return o=>{o.on(e,function(t){return(e,n,o)=>{if(!o.consumable.test(n.item,e.name))return;const i=t(n.attributeOldValue,o,n),r=t(n.attributeNewValue,o,n);if(!i&&!r)return;o.consumable.consume(n.item,e.name);const s=o.writer,a=s.document.selection;if(n.item instanceof ec||n.item instanceof dc)s.wrap(a.getFirstRange(),r);else{let t=o.mapper.toViewRange(n.range);null!==n.attributeOldValue&&i&&(t=s.unwrap(t,i)),null!==n.attributeNewValue&&r&&s.wrap(t,r)}}}(n),{priority:t.converterPriority||"normal"})}}(t))}attributeToAttribute(t){return this.add(function(t){t=mc(t);let e="attribute:"+(t.model.key?t.model.key:t.model);t.model.name&&(e+=":"+t.model.name);if(t.model.values)for(const e of t.model.values)t.view[e]=Ac(t.view[e]);else t.view=Ac(t.view);const n=_c(t);return o=>{var i;o.on(e,(i=n,(t,e,n)=>{if(!n.consumable.test(e.item,t.name))return;const o=i(e.attributeOldValue,n,e),r=i(e.attributeNewValue,n,e);if(!o&&!r)return;n.consumable.consume(e.item,t.name);const s=n.mapper.toViewElement(e.item),a=n.writer;if(!s)throw new c("conversion-attribute-to-attribute-on-text",n.dispatcher,e);if(null!==e.attributeOldValue&&o)if("class"==o.key){const t=So(o.value);for(const e of t)a.removeClass(e,s)}else if("style"==o.key){const t=Object.keys(o.value);for(const e of t)a.removeStyle(e,s)}else a.removeAttribute(o.key,s);if(null!==e.attributeNewValue&&r)if("class"==r.key){const t=So(r.value);for(const e of t)a.addClass(e,s)}else if("style"==r.key){const t=Object.keys(r.value);for(const e of t)a.setStyle(e,r.value[e],s)}else a.setAttribute(r.key,r.value,s)}),{priority:t.converterPriority||"normal"})}}(t))}markerToElement(t){return this.add(function(t){return(t=mc(t)).view=wc(t.view,"ui"),e=>{var n;e.on("addMarker:"+t.model,(n=t.view,(t,e,o)=>{e.isOpening=!0;const i=n(e,o);e.isOpening=!1;const r=n(e,o);if(!i||!r)return;const s=e.markerRange;if(s.isCollapsed&&!o.consumable.consume(s,t.name))return;for(const e of s)if(!o.consumable.consume(e.item,t.name))return;const a=o.mapper,c=o.writer;c.insert(a.toViewPosition(s.start),i),o.mapper.bindElementToMarker(i,e.markerName),s.isCollapsed||(c.insert(a.toViewPosition(s.end),r),o.mapper.bindElementToMarker(r,e.markerName)),t.stop()}),{priority:t.converterPriority||"normal"}),e.on("removeMarker:"+t.model,(t.view,(t,e,n)=>{const o=n.mapper.markerNameToElements(e.markerName);if(o){for(const t of o)n.mapper.unbindElementFromMarkerName(t,e.markerName),n.writer.clear(n.writer.createRangeOn(t),t);n.writer.clearClonedElementsGroup(e.markerName),t.stop()}}),{priority:t.converterPriority||"normal"})}}(t))}markerToHighlight(t){return this.add(function(t){return e=>{var n;e.on("addMarker:"+t.model,(n=t.view,(t,e,o)=>{if(!e.item)return;if(!(e.item instanceof ec||e.item instanceof dc||e.item.is("$textProxy")))return;const i=Cc(n,e,o);if(!i)return;if(!o.consumable.consume(e.item,t.name))return;const r=o.writer,s=fc(r,i),a=r.document.selection;if(e.item instanceof ec||e.item instanceof dc)r.wrap(a.getFirstRange(),s,a);else{const t=o.mapper.toViewRange(e.range),n=r.wrap(t,s);for(const t of n.getItems())if(t.is("attributeElement")&&t.isSimilar(s)){o.mapper.bindElementToMarker(t,e.markerName);break}}}),{priority:t.converterPriority||"normal"}),e.on("addMarker:"+t.model,function(t){return(e,n,o)=>{if(!n.item)return;if(!(n.item instanceof Va))return;const i=Cc(t,n,o);if(!i)return;if(!o.consumable.test(n.item,e.name))return;const r=o.mapper.toViewElement(n.item);if(r&&r.getCustomProperty("addHighlight")){o.consumable.consume(n.item,e.name);for(const t of Ka._createIn(n.item))o.consumable.consume(t.item,e.name);r.getCustomProperty("addHighlight")(r,i,o.writer),o.mapper.bindElementToMarker(r,n.markerName)}}}(t.view),{priority:t.converterPriority||"normal"}),e.on("removeMarker:"+t.model,function(t){return(e,n,o)=>{if(n.markerRange.isCollapsed)return;const i=Cc(t,n,o);if(!i)return;const r=fc(o.writer,i),s=o.mapper.markerNameToElements(n.markerName);if(s){for(const t of s)o.mapper.unbindElementFromMarkerName(t,n.markerName),t.is("attributeElement")?o.writer.unwrap(o.writer.createRangeOn(t),r):t.getCustomProperty("removeHighlight")(t,i.id,o.writer);o.writer.clearClonedElementsGroup(n.markerName),e.stop()}}}(t.view),{priority:t.converterPriority||"normal"})}}(t))}markerToData(t){return this.add(function(t){const e=(t=mc(t)).model;t.view||(t.view=n=>({group:e,name:n.substr(t.model.length+1)}));return n=>{var o;n.on("addMarker:"+e,(o=t.view,(t,e,n)=>{const i=o(e.markerName,n);if(!i)return;const r=e.markerRange;n.consumable.consume(r,t.name)&&(kc(r,!1,n,e,i),kc(r,!0,n,e,i),t.stop())}),{priority:t.converterPriority||"normal"}),n.on("removeMarker:"+e,function(t){return(e,n,o)=>{const i=t(n.markerName,o);if(!i)return;const r=o.mapper.markerNameToElements(n.markerName);if(r){for(const t of r)o.mapper.unbindElementFromMarkerName(t,n.markerName),t.is("containerElement")?(s(`data-${i.group}-start-before`,t),s(`data-${i.group}-start-after`,t),s(`data-${i.group}-end-before`,t),s(`data-${i.group}-end-after`,t)):o.writer.clear(o.writer.createRangeOn(t),t);o.writer.clearClonedElementsGroup(n.markerName),e.stop()}function s(t,e){if(e.hasAttribute(t)){const n=new Set(e.getAttribute(t).split(","));n.delete(i.name),0==n.size?o.writer.removeAttribute(t,e):o.writer.setAttribute(t,Array.from(n).join(","),e)}}}}(t.view),{priority:t.converterPriority||"normal"})}}(t))}}function fc(t,e){const n=t.createAttributeElement("span",e.attributes);return e.classes&&n._addClass(e.classes),"number"==typeof e.priority&&(n._priority=e.priority),n._id=e.id,n}function kc(t,e,n,o,i){const r=e?t.start:t.end,s=r.nodeAfter&&r.nodeAfter.is("element")?r.nodeAfter:null,a=r.nodeBefore&&r.nodeBefore.is("element")?r.nodeBefore:null;if(s||a){let t,r;e&&s||!e&&!a?(t=s,r=!0):(t=a,r=!1);const c=n.mapper.toViewElement(t);if(c)return void function(t,e,n,o,i,r){const s=`data-${r.group}-${e?"start":"end"}-${n?"before":"after"}`,a=t.hasAttribute(s)?t.getAttribute(s).split(","):[];a.unshift(r.name),o.writer.setAttribute(s,a.join(","),t),o.mapper.bindElementToMarker(t,i.markerName)}(c,e,r,n,o,i)}!function(t,e,n,o,i){const r=`${i.group}-${e?"start":"end"}`,s=i.name?{name:i.name}:null,a=n.writer.createUIElement(r,s);n.writer.insert(t,a),n.mapper.bindElementToMarker(a,o.markerName)}(n.mapper.toViewPosition(r),e,n,o,i)}function bc(t){return"string"==typeof t&&(t={name:t}),t.attributes?Array.isArray(t.attributes)||(t.attributes=[t.attributes]):t.attributes=[],t.children=!!t.children,t}function wc(t,e){return"function"==typeof t?t:(n,o)=>function(t,e,n){"string"==typeof t&&(t={name:t});let o;const i=e.writer,r=Object.assign({},t.attributes);if("container"==n)o=i.createContainerElement(t.name,r);else if("attribute"==n){const e={priority:t.priority||Xi.DEFAULT_PRIORITY};o=i.createAttributeElement(t.name,r,e)}else o=i.createUIElement(t.name,r);if(t.styles){const e=Object.keys(t.styles);for(const n of e)i.setStyle(n,t.styles[n],o)}if(t.classes){const e=t.classes;if("string"==typeof e)i.addClass(e,o);else for(const t of e)i.addClass(t,o)}return o}(t,o,e)}function _c(t){return t.model.values?(e,n)=>{const o=t.view[e];return o?o(e,n):null}:t.view}function Ac(t){return"string"==typeof t?e=>({key:t,value:e}):"object"==typeof t?t.value?()=>t:e=>({key:t.key,value:e}):t}function Cc(t,e,n){const o="function"==typeof t?t(e,n):t;return o?(o.priority||(o.priority=10),o.id||(o.id=e.markerName),o):null}function vc(t){const e=function(t){return(e,n)=>{if(!e.is("element",t.name))return!1;if("attribute"==n.type){if(t.attributes.includes(n.attributeKey))return!0}else if(t.children)return!0;return!1}}(t);return(t,n)=>{const o=[];n.reconvertedElements||(n.reconvertedElements=new Set);for(const t of n.changes){const i=t.position?t.position.parent:t.range.start.nodeAfter;if(i&&e(i,t)){if(!n.reconvertedElements.has(i)){n.reconvertedElements.add(i);const t=Wa._createBefore(i);o.push({type:"remove",name:i.name,position:t,length:1},{type:"reinsert",name:i.name,position:t,length:1})}}else o.push(t)}n.changes=o}}function yc(t){return(e,n,o={})=>{const i=["insert"];for(const n of t.attributes)e.hasAttribute(n)&&i.push(`attribute:${n}`);return!!i.every((t=>n.test(e,t)))&&(o.preflight||i.forEach((t=>n.consume(e,t))),!0)}}function xc(t,e,n,o){for(const i of e)Ec(t.root,i,n,o)||n.convertItem(i)}function Ec(t,e,n,o){const{writer:i,mapper:r}=n;if(!o.reconversion)return!1;const s=r.toViewElement(e);return!(!s||s.root==t)&&(!!n.canReuseView(s)&&(i.move(i.createRangeOn(s),r.toViewPosition(Wa._createBefore(e))),!0))}function Dc(t,e,{preflight:n}={}){return n?e.test(t,"insert"):e.consume(t,"insert")}function Mc(t){const{schema:e,document:n}=t.model;for(const o of n.getRootNames()){const i=n.getRoot(o);if(i.isEmpty&&!e.checkChild(i,"$text")&&e.checkChild(i,"paragraph"))return t.insertElement("paragraph",i),!0}return!1}function Ic(t,e,n){const o=n.createContext(t);return!!n.checkChild(o,"paragraph")&&!!n.checkChild(o.push("paragraph"),e)}function Sc(t,e){const n=e.createElement("paragraph");return e.insert(n,t),e.createPositionAt(n,0)}class Tc extends gc{elementToElement(t){return this.add(Nc(t))}elementToAttribute(t){return this.add(function(t){Pc(t=mc(t));const e=Lc(t,!1),n=Bc(t.view),o=n?"element:"+n:"element";return n=>{n.on(o,e,{priority:t.converterPriority||"low"})}}(t))}attributeToAttribute(t){return this.add(function(t){t=mc(t);let e=null;("string"==typeof t.view||t.view.key)&&(e=function(t){"string"==typeof t.view&&(t.view={key:t.view});const e=t.view.key;let n;if("class"==e||"style"==e){n={["class"==e?"classes":"styles"]:t.view.value}}else{n={attributes:{[e]:void 0===t.view.value?/[\s\S]*/:t.view.value}}}t.view.name&&(n.name=t.view.name);return t.view=n,e}(t));Pc(t,e);const n=Lc(t,!0);return e=>{e.on("element",n,{priority:t.converterPriority||"low"})}}(t))}elementToMarker(t){return this.add(function(t){return function(t){const e=t.model;t.model=(t,n)=>{const o="string"==typeof e?e:e(t,n);return n.writer.createElement("$marker",{"data-name":o})}}(t=mc(t)),Nc(t)}(t))}dataToMarker(t){return this.add(function(t){(t=mc(t)).model||(t.model=e=>e?t.view+":"+e:t.view);const e=zc(Oc(t,"start")),n=zc(Oc(t,"end"));return o=>{o.on("element:"+t.view+"-start",e,{priority:t.converterPriority||"normal"}),o.on("element:"+t.view+"-end",n,{priority:t.converterPriority||"normal"});const i=s.get("low"),r=s.get("highest"),a=s.get(t.converterPriority)/r;o.on("element",function(t){return(e,n,o)=>{const i=`data-${t.view}`;function r(e,i){for(const r of i){const i=t.model(r,o),s=o.writer.createElement("$marker",{"data-name":i});o.writer.insert(s,e),n.modelCursor.isEqual(e)?n.modelCursor=n.modelCursor.getShiftedBy(1):n.modelCursor=n.modelCursor._getTransformedByInsertion(e,1),n.modelRange=n.modelRange._getTransformedByInsertion(e,1)[0]}}(o.consumable.test(n.viewItem,{attributes:i+"-end-after"})||o.consumable.test(n.viewItem,{attributes:i+"-start-after"})||o.consumable.test(n.viewItem,{attributes:i+"-end-before"})||o.consumable.test(n.viewItem,{attributes:i+"-start-before"}))&&(n.modelRange||Object.assign(n,o.convertChildren(n.viewItem,n.modelCursor)),o.consumable.consume(n.viewItem,{attributes:i+"-end-after"})&&r(n.modelRange.end,n.viewItem.getAttribute(i+"-end-after").split(",")),o.consumable.consume(n.viewItem,{attributes:i+"-start-after"})&&r(n.modelRange.end,n.viewItem.getAttribute(i+"-start-after").split(",")),o.consumable.consume(n.viewItem,{attributes:i+"-end-before"})&&r(n.modelRange.start,n.viewItem.getAttribute(i+"-end-before").split(",")),o.consumable.consume(n.viewItem,{attributes:i+"-start-before"})&&r(n.modelRange.start,n.viewItem.getAttribute(i+"-start-before").split(",")))}}(t),{priority:i+a})}}(t))}}function Nc(t){const e=zc(t=mc(t)),n=Bc(t.view),o=n?"element:"+n:"element";return n=>{n.on(o,e,{priority:t.converterPriority||"normal"})}}function Bc(t){return"string"==typeof t?t:"object"==typeof t&&"string"==typeof t.name?t.name:null}function zc(t){const e=new Uo(t.view);return(n,o,i)=>{const r=e.match(o.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!i.consumable.test(o.viewItem,s))return;const a=function(t,e,n){return t instanceof Function?t(e,n):n.writer.createElement(t)}(t.model,o.viewItem,i);a&&i.safeInsert(a,o.modelCursor)&&(i.consumable.consume(o.viewItem,s),i.convertChildren(o.viewItem,a),i.updateConversionResult(a,o))}}function Pc(t,e=null){const n=null===e||(t=>t.getAttribute(e)),o="object"!=typeof t.model?t.model:t.model.key,i="object"!=typeof t.model||void 0===t.model.value?n:t.model.value;t.model={key:o,value:i}}function Lc(t,e){const n=new Uo(t.view);return(o,i,r)=>{if(!i.modelRange&&e)return;const s=n.match(i.viewItem);if(!s)return;if(!function(t,e){const n="function"==typeof t?t(e):t;if("object"==typeof n&&!Bc(n))return!1;return!n.classes&&!n.attributes&&!n.styles}(t.view,i.viewItem)?delete s.match.name:s.match.name=!0,!r.consumable.test(i.viewItem,s.match))return;const a=t.model.key,c="function"==typeof t.model.value?t.model.value(i.viewItem,r):t.model.value;if(null===c)return;i.modelRange||Object.assign(i,r.convertChildren(i.viewItem,i.modelCursor));const l=function(t,e,n,o){let i=!1;for(const r of Array.from(t.getItems({shallow:n})))o.schema.checkAttribute(r,e.key)&&(i=!0,r.hasAttribute(e.key)||o.writer.setAttribute(e.key,e.value,r));return i}(i.modelRange,{key:a,value:c},e,r);l&&(r.consumable.test(i.viewItem,{name:!0})&&(s.match.name=!0),r.consumable.consume(i.viewItem,s.match))}}function Oc(t,e){const n={};return n.view=t.view+"-"+e,n.model=(e,n)=>{const o=e.getAttribute("name"),i=t.model(o,n);return n.writer.createElement("$marker",{"data-name":i})},n}class Rc{constructor(t,e){this.model=t,this.view=new La(e),this.mapper=new Qa,this.downcastDispatcher=new Ja({mapper:this.mapper,schema:t.schema});const n=this.model.document,o=n.selection,i=this.model.markers;this.listenTo(this.model,"_beforeChanges",(()=>{this.view._disableRendering(!0)}),{priority:"highest"}),this.listenTo(this.model,"_afterChanges",(()=>{this.view._disableRendering(!1)}),{priority:"lowest"}),this.listenTo(n,"change",(()=>{this.view.change((t=>{this.downcastDispatcher.convertChanges(n.differ,i,t),this.downcastDispatcher.convertSelection(o,i,t)}))}),{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(t,e){return(n,o)=>{const i=o.newSelection,r=[];for(const t of i.getRanges())r.push(e.toModelRange(t));const s=t.createSelection(r,{backward:i.isBackward});s.isEqual(t.document.selection)||t.change((t=>{t.setSelection(s)}))}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const o=n.writer,i=n.mapper.toViewPosition(e.range.start),r=o.createText(e.item.data);o.insert(i,r)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((t,e,n)=>{n.convertAttributes(e.item),e.reconversion||!e.item.is("element")||e.item.isEmpty||n.convertChildren(e.item)}),{priority:"lowest"}),this.downcastDispatcher.on("remove",((t,e,n)=>{const o=n.mapper.toViewPosition(e.position),i=e.position.getShiftedBy(e.length),r=n.mapper.toViewPosition(i,{isPhantom:!0}),s=n.writer.createRange(o,r),a=n.writer.remove(s.getTrimmed());for(const t of n.writer.createRangeIn(a).getItems())n.mapper.unbindViewElement(t,{defer:!0})}),{priority:"low"}),this.downcastDispatcher.on("selection",((t,e,n)=>{const o=n.writer,i=o.document.selection;for(const t of i.getRanges())t.isCollapsed&&t.end.parent.isAttached()&&n.writer.mergeAttributes(t.start);o.setSelection(null)}),{priority:"high"}),this.downcastDispatcher.on("selection",((t,e,n)=>{const o=e.selection;if(o.isCollapsed)return;if(!n.consumable.consume(o,"selection"))return;const i=[];for(const t of o.getRanges()){const e=n.mapper.toViewRange(t);i.push(e)}n.writer.setSelection(i,{backward:o.isBackward})}),{priority:"low"}),this.downcastDispatcher.on("selection",((t,e,n)=>{const o=e.selection;if(!o.isCollapsed)return;if(!n.consumable.consume(o,"selection"))return;const i=n.writer,r=o.getFirstPosition(),s=n.mapper.toViewPosition(r),a=i.breakAttributes(s);i.setSelection(a)}),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using((t=>{if("$graveyard"==t.rootName)return null;const e=new Li(this.view.document,t.name);return e.rootName=t.rootName,this.mapper.bindElements(t,e),e}))}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(t){const e="string"==typeof t?t:t.name,n=this.model.markers.get(e);if(!n)throw new c("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:e});this.model.change((()=>{this.model.markers._refresh(n)}))}reconvertItem(t){this.model.change((()=>{this.model.document.differ._refreshItem(t)}))}}he(Rc,re);class jc{constructor(){this._commands=new Map}add(t,e){this._commands.set(t,e)}get(t){return this._commands.get(t)}execute(t,...e){const n=this.get(t);if(!n)throw new c("commandcollection-command-not-found",this,{commandName:t});return n.execute(...e)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const t of this.commands())t.destroy()}}class Fc{constructor(){this._consumables=new Map}add(t,e){let n;t.is("$text")||t.is("documentFragment")?this._consumables.set(t,!0):(this._consumables.has(t)?n=this._consumables.get(t):(n=new Vc(t),this._consumables.set(t,n)),n.add(e))}test(t,e){const n=this._consumables.get(t);return void 0===n?null:t.is("$text")||t.is("documentFragment")?n:n.test(e)}consume(t,e){return!!this.test(t,e)&&(t.is("$text")||t.is("documentFragment")?this._consumables.set(t,!1):this._consumables.get(t).consume(e),!0)}revert(t,e){const n=this._consumables.get(t);void 0!==n&&(t.is("$text")||t.is("documentFragment")?this._consumables.set(t,!0):n.revert(e))}static consumablesFromElement(t){const e={element:t,name:!0,attributes:[],classes:[],styles:[]},n=t.getAttributeKeys();for(const t of n)"style"!=t&&"class"!=t&&e.attributes.push(t);const o=t.getClassNames();for(const t of o)e.classes.push(t);const i=t.getStyleNames();for(const t of i)e.styles.push(t);return e}static createFrom(t,e){if(e||(e=new Fc(t)),t.is("$text"))return e.add(t),e;t.is("element")&&e.add(t,Fc.consumablesFromElement(t)),t.is("documentFragment")&&e.add(t);for(const n of t.getChildren())e=Fc.createFrom(n,e);return e}}class Vc{constructor(t){this.element=t,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(t){t.name&&(this._canConsumeName=!0);for(const e in this._consumables)e in t&&this._add(e,t[e])}test(t){if(t.name&&!this._canConsumeName)return this._canConsumeName;for(const e in this._consumables)if(e in t){const n=this._test(e,t[e]);if(!0!==n)return n}return!0}consume(t){t.name&&(this._canConsumeName=!1);for(const e in this._consumables)e in t&&this._consume(e,t[e])}revert(t){t.name&&(this._canConsumeName=!0);for(const e in this._consumables)e in t&&this._revert(e,t[e])}_add(t,e){const n=It(e)?e:[e],o=this._consumables[t];for(const e of n){if("attributes"===t&&("class"===e||"style"===e))throw new c("viewconsumable-invalid-attribute",this);if(o.set(e,!0),"styles"===t)for(const t of this.element.document.stylesProcessor.getRelatedStyles(e))o.set(t,!0)}}_test(t,e){const n=It(e)?e:[e],o=this._consumables[t];for(const e of n)if("attributes"!==t||"class"!==e&&"style"!==e){const t=o.get(e);if(void 0===t)return null;if(!t)return!1}else{const t="class"==e?"classes":"styles",n=this._test(t,[...this._consumables[t].keys()]);if(!0!==n)return n}return!0}_consume(t,e){const n=It(e)?e:[e],o=this._consumables[t];for(const e of n)if("attributes"!==t||"class"!==e&&"style"!==e){if(o.set(e,!1),"styles"==t)for(const t of this.element.document.stylesProcessor.getRelatedStyles(e))o.set(t,!1)}else{const t="class"==e?"classes":"styles";this._consume(t,[...this._consumables[t].keys()])}}_revert(t,e){const n=It(e)?e:[e],o=this._consumables[t];for(const e of n)if("attributes"!==t||"class"!==e&&"style"!==e){!1===o.get(e)&&o.set(e,!0)}else{const t="class"==e?"classes":"styles";this._revert(t,[...this._consumables[t].keys()])}}}class Hc{constructor(){this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",((t,e)=>{e[0]=new Uc(e[0])}),{priority:"highest"}),this.on("checkChild",((t,e)=>{e[0]=new Uc(e[0]),e[1]=this.getDefinition(e[1])}),{priority:"highest"})}register(t,e){if(this._sourceDefinitions[t])throw new c("schema-cannot-register-item-twice",this,{itemName:t});this._sourceDefinitions[t]=[Object.assign({},e)],this._clearCache()}extend(t,e){if(!this._sourceDefinitions[t])throw new c("schema-cannot-extend-missing-item",this,{itemName:t});this._sourceDefinitions[t].push(Object.assign({},e)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(t){let e;return e="string"==typeof t?t:t.is&&(t.is("$text")||t.is("$textProxy"))?"$text":t.name,this.getDefinitions()[e]}isRegistered(t){return!!this.getDefinition(t)}isBlock(t){const e=this.getDefinition(t);return!(!e||!e.isBlock)}isLimit(t){const e=this.getDefinition(t);return!!e&&!(!e.isLimit&&!e.isObject)}isObject(t){const e=this.getDefinition(t);return!!e&&!!(e.isObject||e.isLimit&&e.isSelectable&&e.isContent)}isInline(t){const e=this.getDefinition(t);return!(!e||!e.isInline)}isSelectable(t){const e=this.getDefinition(t);return!!e&&!(!e.isSelectable&&!e.isObject)}isContent(t){const e=this.getDefinition(t);return!!e&&!(!e.isContent&&!e.isObject)}checkChild(t,e){return!!e&&this._checkContextMatch(e,t)}checkAttribute(t,e){const n=this.getDefinition(t.last);return!!n&&n.allowAttributes.includes(e)}checkMerge(t,e=null){if(t instanceof Wa){const e=t.nodeBefore,n=t.nodeAfter;if(!(e instanceof Va))throw new c("schema-check-merge-no-element-before",this);if(!(n instanceof Va))throw new c("schema-check-merge-no-element-after",this);return this.checkMerge(e,n)}for(const n of e.getChildren())if(!this.checkChild(t,n))return!1;return!0}addChildCheck(t){this.on("checkChild",((e,[n,o])=>{if(!o)return;const i=t(n,o);"boolean"==typeof i&&(e.stop(),e.return=i)}),{priority:"high"})}addAttributeCheck(t){this.on("checkAttribute",((e,[n,o])=>{const i=t(n,o);"boolean"==typeof i&&(e.stop(),e.return=i)}),{priority:"high"})}setAttributeProperties(t,e){this._attributeProperties[t]=Object.assign(this.getAttributeProperties(t),e)}getAttributeProperties(t){return this._attributeProperties[t]||{}}getLimitElement(t){let e;if(t instanceof Wa)e=t.parent;else{e=(t instanceof Ka?[t]:Array.from(t.getRanges())).reduce(((t,e)=>{const n=e.getCommonAncestor();return t?t.getCommonAncestor(n,{includeSelf:!0}):n}),null)}for(;!this.isLimit(e)&&e.parent;)e=e.parent;return e}checkAttributeInSelection(t,e){if(t.isCollapsed){const n=[...t.getFirstPosition().getAncestors(),new Ra("",t.getAttributes())];return this.checkAttribute(n,e)}{const n=t.getRanges();for(const t of n)for(const n of t)if(this.checkAttribute(n.item,e))return!0}return!1}*getValidRanges(t,e){t=function*(t){for(const e of t)yield*e.getMinimalFlatRanges()}(t);for(const n of t)yield*this._getValidRangesForRange(n,e)}getNearestSelectionRange(t,e="both"){if(this.checkChild(t,"$text"))return new Ka(t);let n,o;const i=t.getAncestors().reverse().find((t=>this.isLimit(t)))||t.root;"both"!=e&&"backward"!=e||(n=new Ha({boundaries:Ka._createIn(i),startPosition:t,direction:"backward"})),"both"!=e&&"forward"!=e||(o=new Ha({boundaries:Ka._createIn(i),startPosition:t}));for(const t of function*(t,e){let n=!1;for(;!n;){if(n=!0,t){const e=t.next();e.done||(n=!1,yield{walker:t,value:e.value})}if(e){const t=e.next();t.done||(n=!1,yield{walker:e,value:t.value})}}}(n,o)){const e=t.walker==n?"elementEnd":"elementStart",o=t.value;if(o.type==e&&this.isObject(o.item))return Ka._createOn(o.item);if(this.checkChild(o.nextPosition,"$text"))return new Ka(o.nextPosition)}return null}findAllowedParent(t,e){let n=t.parent;for(;n;){if(this.checkChild(n,e))return n;if(this.isLimit(n))return null;n=n.parent}return null}setAllowedAttributes(t,e,n){const o=n.model;for(const[i,r]of Object.entries(e))o.schema.checkAttribute(t,i)&&n.setAttribute(i,r,t)}removeDisallowedAttributes(t,e){for(const n of t)if(n.is("$text"))nl(this,n,e);else{const t=Ka._createIn(n).getPositions();for(const n of t){nl(this,n.nodeBefore||n.parent,e)}}}getAttributesWithProperty(t,e,n){const o={};for(const[i,r]of t.getAttributes()){const t=this.getAttributeProperties(i);void 0!==t[e]&&(void 0!==n&&n!==t[e]||(o[i]=r))}return o}createContext(t){return new Uc(t)}_clearCache(){this._compiledDefinitions=null}_compile(){const t={},e=this._sourceDefinitions,n=Object.keys(e);for(const o of n)t[o]=Wc(e[o],o);for(const e of n)qc(t,e);for(const e of n)Gc(t,e);for(const e of n)Yc(t,e);for(const e of n)Kc(t,e),Qc(t,e);for(const e of n)$c(t,e),Zc(t,e),Jc(t,e);this._compiledDefinitions=t}_checkContextMatch(t,e,n=e.length-1){const o=e.getItem(n);if(t.allowIn.includes(o.name)){if(0==n)return!0;{const t=this.getDefinition(o);return this._checkContextMatch(t,e,n-1)}}return!1}*_getValidRangesForRange(t,e){let n=t.start,o=t.start;for(const i of t.getItems({shallow:!0}))i.is("element")&&(yield*this._getValidRangesForRange(Ka._createIn(i),e)),this.checkAttribute(i,e)||(n.isEqual(o)||(yield new Ka(n,o)),n=Wa._createAfter(i)),o=Wa._createAfter(i);n.isEqual(o)||(yield new Ka(n,o))}}he(Hc,re);class Uc{constructor(t){if(t instanceof Uc)return t;"string"==typeof t?t=[t]:Array.isArray(t)||(t=t.getAncestors({includeSelf:!0})),this._items=t.map(el)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(t){const e=new Uc([t]);return e._items=[...this._items,...e._items],e}getItem(t){return this._items[t]}*getNames(){yield*this._items.map((t=>t.name))}endsWith(t){return Array.from(this.getNames()).join(" ").endsWith(t)}startsWith(t){return Array.from(this.getNames()).join(" ").startsWith(t)}}function Wc(t,e){const n={name:e,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return function(t,e){for(const n of t){const t=Object.keys(n).filter((t=>t.startsWith("is")));for(const o of t)e[o]=n[o]}}(t,n),Xc(t,n,"allowIn"),Xc(t,n,"allowContentOf"),Xc(t,n,"allowWhere"),Xc(t,n,"allowAttributes"),Xc(t,n,"allowAttributesOf"),Xc(t,n,"allowChildren"),Xc(t,n,"inheritTypesFrom"),function(t,e){for(const n of t){const t=n.inheritAllFrom;t&&(e.allowContentOf.push(t),e.allowWhere.push(t),e.allowAttributesOf.push(t),e.inheritTypesFrom.push(t))}}(t,n),n}function qc(t,e){const n=t[e];for(const o of n.allowChildren){const n=t[o];n&&n.allowIn.push(e)}n.allowChildren.length=0}function Gc(t,e){for(const n of t[e].allowContentOf)if(t[n]){tl(t,n).forEach((t=>{t.allowIn.push(e)}))}delete t[e].allowContentOf}function Yc(t,e){for(const n of t[e].allowWhere){const o=t[n];if(o){const n=o.allowIn;t[e].allowIn.push(...n)}}delete t[e].allowWhere}function Kc(t,e){for(const n of t[e].allowAttributesOf){const o=t[n];if(o){const n=o.allowAttributes;t[e].allowAttributes.push(...n)}}delete t[e].allowAttributesOf}function Qc(t,e){const n=t[e];for(const e of n.inheritTypesFrom){const o=t[e];if(o){const t=Object.keys(o).filter((t=>t.startsWith("is")));for(const e of t)e in n||(n[e]=o[e])}}delete n.inheritTypesFrom}function $c(t,e){const n=t[e],o=n.allowIn.filter((e=>t[e]));n.allowIn=Array.from(new Set(o))}function Zc(t,e){const n=t[e];for(const o of n.allowIn){t[o].allowChildren.push(e)}}function Jc(t,e){const n=t[e];n.allowAttributes=Array.from(new Set(n.allowAttributes))}function Xc(t,e,n){for(const o of t)"string"==typeof o[n]?e[n].push(o[n]):Array.isArray(o[n])&&e[n].push(...o[n])}function tl(t,e){const n=t[e];return(o=t,Object.keys(o).map((t=>o[t]))).filter((t=>t.allowIn.includes(n.name)));var o}function el(t){return"string"==typeof t||t.is("documentFragment")?{name:"string"==typeof t?t:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:t.is("element")?t.name:"$text",*getAttributeKeys(){yield*t.getAttributeKeys()},getAttribute:e=>t.getAttribute(e)}}function nl(t,e,n){for(const o of e.getAttributeKeys())t.checkAttribute(e,o)||n.removeAttribute(o,e)}class ol{constructor(t={}){this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,this.conversionApi=Object.assign({},t),this.conversionApi.convertItem=this._convertItem.bind(this),this.conversionApi.convertChildren=this._convertChildren.bind(this),this.conversionApi.safeInsert=this._safeInsert.bind(this),this.conversionApi.updateConversionResult=this._updateConversionResult.bind(this),this.conversionApi.splitToAllowedParent=this._splitToAllowedParent.bind(this),this.conversionApi.getSplitParts=this._getSplitParts.bind(this),this.conversionApi.keepEmptyElement=this._keepEmptyElement.bind(this)}convert(t,e,n=["$root"]){this.fire("viewCleanup",t),this._modelCursor=function(t,e){let n;for(const o of new Uc(t)){const t={};for(const e of o.getAttributeKeys())t[e]=o.getAttribute(e);const i=e.createElement(o.name,t);n&&e.append(i,n),n=Wa._createAt(i,0)}return n}(n,e),this.conversionApi.writer=e,this.conversionApi.consumable=Fc.createFrom(t),this.conversionApi.store={};const{modelRange:o}=this._convertItem(t,this._modelCursor),i=e.createDocumentFragment();if(o){this._removeEmptyElements();for(const t of Array.from(this._modelCursor.parent.getChildren()))e.append(t,i);i.markers=function(t,e){const n=new Set,o=new Map,i=Ka._createIn(t).getItems();for(const t of i)"$marker"==t.name&&n.add(t);for(const t of n){const n=t.getAttribute("data-name"),i=e.createPositionBefore(t);o.has(n)?o.get(n).end=i.clone():o.set(n,new Ka(i.clone())),e.remove(t)}return o}(i,e)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,i}_convertItem(t,e){const n=Object.assign({viewItem:t,modelCursor:e,modelRange:null});if(t.is("element")?this.fire("element:"+t.name,n,this.conversionApi):t.is("$text")?this.fire("text",n,this.conversionApi):this.fire("documentFragment",n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof Ka))throw new c("view-conversion-dispatcher-incorrect-result",this);return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(t,e){let n=e.is("position")?e:Wa._createAt(e,0);const o=new Ka(n);for(const e of Array.from(t.getChildren())){const t=this._convertItem(e,n);t.modelRange instanceof Ka&&(o.end=t.modelRange.end,n=t.modelCursor)}return{modelRange:o,modelCursor:n}}_safeInsert(t,e){const n=this._splitToAllowedParent(t,e);return!!n&&(this.conversionApi.writer.insert(t,n.position),!0)}_updateConversionResult(t,e){const n=this._getSplitParts(t),o=this.conversionApi.writer;e.modelRange||(e.modelRange=o.createRange(o.createPositionBefore(t),o.createPositionAfter(n[n.length-1])));const i=this._cursorParents.get(t);e.modelCursor=i?o.createPositionAt(i,0):e.modelRange.end}_splitToAllowedParent(t,e){const{schema:n,writer:o}=this.conversionApi;let i=n.findAllowedParent(e,t);if(i){if(i===e.parent)return{position:e};this._modelCursor.parent.getAncestors().includes(i)&&(i=null)}if(!i)return Ic(e,t,n)?{position:Sc(e,o)}:null;const r=this.conversionApi.writer.split(e,i),s=[];for(const t of r.range.getWalker())if("elementEnd"==t.type)s.push(t.item);else{const e=s.pop(),n=t.item;this._registerSplitPair(e,n)}const a=r.range.end.parent;return this._cursorParents.set(t,a),{position:r.position,cursorParent:a}}_registerSplitPair(t,e){this._splitParts.has(t)||this._splitParts.set(t,[t]);const n=this._splitParts.get(t);this._splitParts.set(e,n),n.push(e)}_getSplitParts(t){let e;return e=this._splitParts.has(t)?this._splitParts.get(t):[t],e}_keepEmptyElement(t){this._emptyElementsToKeep.add(t)}_removeEmptyElements(){let t=!1;for(const e of this._splitParts.keys())e.isEmpty&&!this._emptyElementsToKeep.has(e)&&(this.conversionApi.writer.remove(e),this._splitParts.delete(e),t=!0);t&&this._removeEmptyElements()}}he(ol,k);class il{getHtml(t){const e=document.implementation.createHTMLDocument("").createElement("div");return e.appendChild(t),e.innerHTML}}class rl{constructor(t){this.domParser=new DOMParser,this.domConverter=new gs(t,{renderingMode:"data"}),this.htmlWriter=new il}toData(t){const e=this.domConverter.viewToDom(t,document);return this.htmlWriter.getHtml(e)}toView(t){const e=this._toDom(t);return this.domConverter.domToView(e)}registerRawContentMatcher(t){this.domConverter.registerRawContentMatcher(t)}useFillerType(t){this.domConverter.blockFillerMode="marked"==t?"markedNbsp":"nbsp"}_toDom(t){t.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(t=`${t}`);const e=this.domParser.parseFromString(t,"text/html"),n=e.createDocumentFragment(),o=e.body.childNodes;for(;o.length>0;)n.appendChild(o[0]);return n}}class sl{constructor(t,e){this.model=t,this.mapper=new Qa,this.downcastDispatcher=new Ja({mapper:this.mapper,schema:t.schema}),this.downcastDispatcher.on("insert:$text",((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const o=n.writer,i=n.mapper.toViewPosition(e.range.start),r=o.createText(e.item.data);o.insert(i,r)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((t,e,n)=>{n.convertAttributes(e.item),e.reconversion||!e.item.is("element")||e.item.isEmpty||n.convertChildren(e.item)}),{priority:"lowest"}),this.upcastDispatcher=new ol({schema:t.schema}),this.viewDocument=new Ji(e),this.stylesProcessor=e,this.htmlProcessor=new rl(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Cr(this.viewDocument),this.upcastDispatcher.on("text",((t,e,{schema:n,consumable:o,writer:i})=>{let r=e.modelCursor;if(!o.test(e.viewItem))return;if(!n.checkChild(r,"$text")){if(!Ic(r,"$text",n))return;r=Sc(r,i)}o.consume(e.viewItem);const s=i.createText(e.viewItem.data);i.insert(s,r),e.modelRange=i.createRange(r,r.getShiftedBy(s.offsetSize)),e.modelCursor=e.modelRange.end}),{priority:"lowest"}),this.upcastDispatcher.on("element",((t,e,n)=>{if(!e.modelRange&&n.consumable.consume(e.viewItem,{name:!0})){const{modelRange:t,modelCursor:o}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=t,e.modelCursor=o}}),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",((t,e,n)=>{if(!e.modelRange&&n.consumable.consume(e.viewItem,{name:!0})){const{modelRange:t,modelCursor:o}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=t,e.modelCursor=o}}),{priority:"lowest"}),this.decorate("init"),this.decorate("set"),this.decorate("get"),this.on("init",(()=>{this.fire("ready")}),{priority:"lowest"}),this.on("ready",(()=>{this.model.enqueueChange({isUndoable:!1},Mc)}),{priority:"lowest"})}get(t={}){const{rootName:e="main",trim:n="empty"}=t;if(!this._checkIfRootsExists([e]))throw new c("datacontroller-get-non-existent-root",this);const o=this.model.document.getRoot(e);return"empty"!==n||this.model.hasContent(o,{ignoreWhitespaces:!0})?this.stringify(o,t):""}stringify(t,e={}){const n=this.toView(t,e);return this.processor.toData(n)}toView(t,e={}){const n=this.viewDocument,o=this._viewWriter;this.mapper.clearBindings();const i=Ka._createIn(t),r=new Ar(n);this.mapper.bindElements(t,r);const s=t.is("documentFragment")?t.markers:function(t){const e=[],n=t.root.document;if(!n)return new Map;const o=Ka._createIn(t);for(const t of n.model.markers){const n=t.getRange(),i=n.isCollapsed,r=n.start.isEqual(o.start)||n.end.isEqual(o.end);if(i&&r)e.push([t.name,n]);else{const i=o.getIntersection(n);i&&e.push([t.name,i])}}return e.sort((([t,e],[n,o])=>{if("after"!==e.end.compareWith(o.start))return 1;if("before"!==e.start.compareWith(o.end))return-1;switch(e.start.compareWith(o.start)){case"before":return 1;case"after":return-1;default:switch(e.end.compareWith(o.end)){case"before":return 1;case"after":return-1;default:return n.localeCompare(t)}}})),new Map(e)}(t);return this.downcastDispatcher.convert(i,s,o,e),r}init(t){if(this.model.document.version)throw new c("datacontroller-init-document-not-empty",this);let e={};if("string"==typeof t?e.main=t:e=t,!this._checkIfRootsExists(Object.keys(e)))throw new c("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},(t=>{for(const n of Object.keys(e)){const o=this.model.document.getRoot(n);t.insert(this.parse(e[n],o),o,0)}})),Promise.resolve()}set(t,e={}){let n={};if("string"==typeof t?n.main=t:n=t,!this._checkIfRootsExists(Object.keys(n)))throw new c("datacontroller-set-non-existent-root",this);this.model.enqueueChange(e.batchType||{},(t=>{t.setSelection(null),t.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const e of Object.keys(n)){const o=this.model.document.getRoot(e);t.remove(t.createRangeIn(o)),t.insert(this.parse(n[e],o),o,0)}}))}parse(t,e="$root"){const n=this.processor.toView(t);return this.toModel(n,e)}toModel(t,e="$root"){return this.model.change((n=>this.upcastDispatcher.convert(t,n,e)))}addStyleProcessorRules(t){t(this.stylesProcessor)}registerRawContentMatcher(t){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(t),this.htmlProcessor.registerRawContentMatcher(t)}destroy(){this.stopListening()}_checkIfRootsExists(t){for(const e of t)if(!this.model.document.getRootNames().includes(e))return!1;return!0}}he(sl,re);class al{constructor(t,e){this._helpers=new Map,this._downcast=So(t),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=So(e),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(t,e){const n=this._downcast.includes(e);if(!this._upcast.includes(e)&&!n)throw new c("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:t,dispatchers:[e],isDowncast:n})}for(t){if(!this._helpers.has(t))throw new c("conversion-for-unknown-group",this);return this._helpers.get(t)}elementToElement(t){this.for("downcast").elementToElement(t);for(const{model:e,view:n}of cl(t))this.for("upcast").elementToElement({model:e,view:n,converterPriority:t.converterPriority})}attributeToElement(t){this.for("downcast").attributeToElement(t);for(const{model:e,view:n}of cl(t))this.for("upcast").elementToAttribute({view:n,model:e,converterPriority:t.converterPriority})}attributeToAttribute(t){this.for("downcast").attributeToAttribute(t);for(const{model:e,view:n}of cl(t))this.for("upcast").attributeToAttribute({view:n,model:e})}_createConversionHelpers({name:t,dispatchers:e,isDowncast:n}){if(this._helpers.has(t))throw new c("conversion-group-exists",this);const o=n?new pc(e):new Tc(e);this._helpers.set(t,o)}}function*cl(t){if(t.model.values)for(const e of t.model.values){const n={key:t.model.key,value:e},o=t.view[e],i=t.upcastAlso?t.upcastAlso[e]:void 0;yield*ll(n,o,i)}else yield*ll(t.model,t.view,t.upcastAlso)}function*ll(t,e,n){if(yield{model:t,view:e},n)for(const e of So(n))yield{model:t,view:e}}class dl{constructor(t={}){"string"==typeof t&&(t="transparent"===t?{isUndoable:!1}:{},l("batch-constructor-deprecated-string-type"));const{isUndoable:e=!0,isLocal:n=!0,isUndo:o=!1,isTyping:i=!1}=t;this.operations=[],this.isUndoable=e,this.isLocal=n,this.isUndo=o,this.isTyping=i}get type(){return l("batch-type-deprecated"),"default"}get baseVersion(){for(const t of this.operations)if(null!==t.baseVersion)return t.baseVersion;return null}addOperation(t){return t.batch=this,this.operations.push(t),t}}class hl{constructor(t){this.baseVersion=t,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const t=Object.assign({},this);return t.__className=this.constructor.className,delete t.batch,delete t.isDocumentOperation,t}static get className(){return"Operation"}static fromJSON(t){return new this(t.baseVersion)}}class ul{constructor(t){this.markers=new Map,this._children=new Fa,t&&this._insertChild(0,t)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(t){return"documentFragment"===t||"model:documentFragment"===t}getChild(t){return this._children.getNode(t)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(t){return this._children.getNodeIndex(t)}getChildStartOffset(t){return this._children.getNodeStartOffset(t)}getPath(){return[]}getNodeByPath(t){let e=this;for(const n of t)e=e.getChild(e.offsetToIndex(n));return e}offsetToIndex(t){return this._children.offsetToIndex(t)}toJSON(){const t=[];for(const e of this._children)t.push(e.toJSON());return t}static fromJSON(t){const e=[];for(const n of t)n.name?e.push(Va.fromJSON(n)):e.push(Ra.fromJSON(n));return new ul(e)}_appendChild(t){this._insertChild(this.childCount,t)}_insertChild(t,e){const n=function(t){if("string"==typeof t)return[new Ra(t)];Do(t)||(t=[t]);return Array.from(t).map((t=>"string"==typeof t?new Ra(t):t instanceof ja?new Ra(t.data,t.getAttributes()):t))}(e);for(const t of n)null!==t.parent&&t._remove(),t.parent=this;this._children._insertNodes(t,n)}_removeChildren(t,e=1){const n=this._children._removeNodes(t,e);for(const t of n)t.parent=null;return n}}function gl(t,e){const n=(e=fl(e)).reduce(((t,e)=>t+e.offsetSize),0),o=t.parent;bl(t);const i=t.index;return o._insertChild(i,e),kl(o,i+e.length),kl(o,i),new Ka(t,t.getShiftedBy(n))}function ml(t){if(!t.isFlat)throw new c("operation-utils-remove-range-not-flat",this);const e=t.start.parent;bl(t.start),bl(t.end);const n=e._removeChildren(t.start.index,t.end.index-t.start.index);return kl(e,t.start.index),n}function pl(t,e){if(!t.isFlat)throw new c("operation-utils-move-range-not-flat",this);const n=ml(t);return gl(e=e._getTransformedByDeletion(t.start,t.end.offset-t.start.offset),n)}function fl(t){const e=[];t instanceof Array||(t=[t]);for(let n=0;nt.maxOffset)throw new c("move-operation-nodes-do-not-exist",this);if(t===e&&n=n&&this.targetPosition.path[t]t._clone(!0)))),e=new yl(this.position,t,this.baseVersion);return e.shouldReceiveAttributes=this.shouldReceiveAttributes,e}getReversed(){const t=this.position.root.document.graveyard,e=new Wa(t,[0]);return new vl(this.position,this.nodes.maxOffset,e,this.baseVersion+1)}_validate(){const t=this.position.parent;if(!t||t.maxOffsett._clone(!0)))),gl(this.position,t)}toJSON(){const t=super.toJSON();return t.position=this.position.toJSON(),t.nodes=this.nodes.toJSON(),t}static get className(){return"InsertOperation"}static fromJSON(t,e){const n=[];for(const e of t.nodes)e.name?n.push(Va.fromJSON(e)):n.push(Ra.fromJSON(e));const o=new yl(Wa.fromJSON(t.position,e),n,t.baseVersion);return o.shouldReceiveAttributes=t.shouldReceiveAttributes,o}}class xl extends hl{constructor(t,e,n,o,i,r){super(r),this.name=t,this.oldRange=e?e.clone():null,this.newRange=n?n.clone():null,this.affectsData=i,this._markers=o}get type(){return"marker"}clone(){return new xl(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new xl(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){const t=this.newRange?"_set":"_remove";this._markers[t](this.name,this.newRange,!0,this.affectsData)}toJSON(){const t=super.toJSON();return this.oldRange&&(t.oldRange=this.oldRange.toJSON()),this.newRange&&(t.newRange=this.newRange.toJSON()),delete t._markers,t}static get className(){return"MarkerOperation"}static fromJSON(t,e){return new xl(t.name,t.oldRange?Ka.fromJSON(t.oldRange,e):null,t.newRange?Ka.fromJSON(t.newRange,e):null,e.model.markers,t.affectsData,t.baseVersion)}}class El extends hl{constructor(t,e,n,o){super(o),this.position=t,this.position.stickiness="toNext",this.oldName=e,this.newName=n}get type(){return"rename"}clone(){return new El(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new El(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const t=this.position.nodeAfter;if(!(t instanceof Va))throw new c("rename-operation-wrong-position",this);if(t.name!==this.oldName)throw new c("rename-operation-wrong-name",this)}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const t=super.toJSON();return t.position=this.position.toJSON(),t}static get className(){return"RenameOperation"}static fromJSON(t,e){return new El(Wa.fromJSON(t.position,e),t.oldName,t.newName,t.baseVersion)}}class Dl extends hl{constructor(t,e,n,o,i){super(i),this.root=t,this.key=e,this.oldValue=n,this.newValue=o}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Dl(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Dl(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new c("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new c("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new c("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const t=super.toJSON();return t.root=this.root.toJSON(),t}static get className(){return"RootAttributeOperation"}static fromJSON(t,e){if(!e.getRoot(t.root))throw new c("rootattribute-operation-fromjson-no-root",this,{rootName:t.root});return new Dl(e.getRoot(t.root),t.key,t.oldValue,t.newValue,t.baseVersion)}}class Ml extends hl{constructor(t,e,n,o,i){super(i),this.sourcePosition=t.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=e,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=o.clone()}get type(){return"merge"}get deletionPosition(){return new Wa(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const t=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Ka(this.sourcePosition,t)}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const t=this.targetPosition._getTransformedByMergeOperation(this),e=this.sourcePosition.path.slice(0,-1),n=new Wa(this.sourcePosition.root,e)._getTransformedByMergeOperation(this);return new Il(t,this.howMany,n,this.graveyardPosition,this.baseVersion+1)}_validate(){const t=this.sourcePosition.parent,e=this.targetPosition.parent;if(!t.parent)throw new c("merge-operation-source-position-invalid",this);if(!e.parent)throw new c("merge-operation-target-position-invalid",this);if(this.howMany!=t.maxOffset)throw new c("merge-operation-how-many-invalid",this)}_execute(){const t=this.sourcePosition.parent;pl(Ka._createIn(t),this.targetPosition),pl(Ka._createOn(t),this.graveyardPosition)}toJSON(){const t=super.toJSON();return t.sourcePosition=t.sourcePosition.toJSON(),t.targetPosition=t.targetPosition.toJSON(),t.graveyardPosition=t.graveyardPosition.toJSON(),t}static get className(){return"MergeOperation"}static fromJSON(t,e){const n=Wa.fromJSON(t.sourcePosition,e),o=Wa.fromJSON(t.targetPosition,e),i=Wa.fromJSON(t.graveyardPosition,e);return new this(n,t.howMany,o,i,t.baseVersion)}}class Il extends hl{constructor(t,e,n,o,i){super(i),this.splitPosition=t.clone(),this.splitPosition.stickiness="toNext",this.howMany=e,this.insertionPosition=n,this.graveyardPosition=o?o.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const t=this.insertionPosition.path.slice();return t.push(0),new Wa(this.insertionPosition.root,t)}get movedRange(){const t=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Ka(this.splitPosition,t)}clone(){return new this.constructor(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const t=this.splitPosition.root.document.graveyard,e=new Wa(t,[0]);return new Ml(this.moveTargetPosition,this.howMany,this.splitPosition,e,this.baseVersion+1)}_validate(){const t=this.splitPosition.parent,e=this.splitPosition.offset;if(!t||t.maxOffset{for(const e of t.getAttributeKeys())this.removeAttribute(e,t)};if(t instanceof Ka)for(const n of t.getItems())e(n);else e(t)}move(t,e,n){if(this._assertWriterUsedCorrectly(),!(t instanceof Ka))throw new c("writer-move-invalid-range",this);if(!t.isFlat)throw new c("writer-move-range-not-flat",this);const o=Wa._createAt(e,n);if(o.isEqual(t.start))return;if(this._addOperationForAffectedMarkers("move",t),!Ll(t.root,o.root))throw new c("writer-move-different-document",this);const i=t.root.document?t.root.document.version:null,r=new vl(t.start,t.end.offset-t.start.offset,o,i);this.batch.addOperation(r),this.model.applyOperation(r)}remove(t){this._assertWriterUsedCorrectly();const e=(t instanceof Ka?t:Ka._createOn(t)).getMinimalFlatRanges().reverse();for(const t of e)this._addOperationForAffectedMarkers("move",t),Pl(t.start,t.end.offset-t.start.offset,this.batch,this.model)}merge(t){this._assertWriterUsedCorrectly();const e=t.nodeBefore,n=t.nodeAfter;if(this._addOperationForAffectedMarkers("merge",t),!(e instanceof Va))throw new c("writer-merge-no-element-before",this);if(!(n instanceof Va))throw new c("writer-merge-no-element-after",this);t.root.document?this._merge(t):this._mergeDetached(t)}createPositionFromPath(t,e,n){return this.model.createPositionFromPath(t,e,n)}createPositionAt(t,e){return this.model.createPositionAt(t,e)}createPositionAfter(t){return this.model.createPositionAfter(t)}createPositionBefore(t){return this.model.createPositionBefore(t)}createRange(t,e){return this.model.createRange(t,e)}createRangeIn(t){return this.model.createRangeIn(t)}createRangeOn(t){return this.model.createRangeOn(t)}createSelection(t,e,n){return this.model.createSelection(t,e,n)}_mergeDetached(t){const e=t.nodeBefore,n=t.nodeAfter;this.move(Ka._createIn(n),Wa._createAt(e,"end")),this.remove(n)}_merge(t){const e=Wa._createAt(t.nodeBefore,"end"),n=Wa._createAt(t.nodeAfter,0),o=t.root.document.graveyard,i=new Wa(o,[0]),r=t.root.document.version,s=new Ml(n,t.nodeAfter.maxOffset,e,i,r);this.batch.addOperation(s),this.model.applyOperation(s)}rename(t,e){if(this._assertWriterUsedCorrectly(),!(t instanceof Va))throw new c("writer-rename-not-element-instance",this);const n=t.root.document?t.root.document.version:null,o=new El(Wa._createBefore(t),t.name,e,n);this.batch.addOperation(o),this.model.applyOperation(o)}split(t,e){this._assertWriterUsedCorrectly();let n,o,i=t.parent;if(!i.parent)throw new c("writer-split-element-no-parent",this);if(e||(e=i.parent),!t.parent.getAncestors({includeSelf:!0}).includes(e))throw new c("writer-split-invalid-limit-element",this);do{const e=i.root.document?i.root.document.version:null,r=i.maxOffset-t.offset,s=Il.getInsertionPosition(t),a=new Il(t,r,s,null,e);this.batch.addOperation(a),this.model.applyOperation(a),n||o||(n=i,o=t.parent.nextSibling),i=(t=this.createPositionAfter(t.parent)).parent}while(i!==e);return{position:t,range:new Ka(Wa._createAt(n,"end"),Wa._createAt(o,0))}}wrap(t,e){if(this._assertWriterUsedCorrectly(),!t.isFlat)throw new c("writer-wrap-range-not-flat",this);const n=e instanceof Va?e:new Va(e);if(n.childCount>0)throw new c("writer-wrap-element-not-empty",this);if(null!==n.parent)throw new c("writer-wrap-element-attached",this);this.insert(n,t.start);const o=new Ka(t.start.getShiftedBy(1),t.end.getShiftedBy(1));this.move(o,Wa._createAt(n,0))}unwrap(t){if(this._assertWriterUsedCorrectly(),null===t.parent)throw new c("writer-unwrap-element-no-parent",this);this.move(Ka._createIn(t),this.createPositionAfter(t)),this.remove(t)}addMarker(t,e){if(this._assertWriterUsedCorrectly(),!e||"boolean"!=typeof e.usingOperation)throw new c("writer-addmarker-no-usingoperation",this);const n=e.usingOperation,o=e.range,i=void 0!==e.affectsData&&e.affectsData;if(this.model.markers.has(t))throw new c("writer-addmarker-marker-exists",this);if(!o)throw new c("writer-addmarker-no-range",this);return n?(zl(this,t,null,o,i),this.model.markers.get(t)):this.model.markers._set(t,o,n,i)}updateMarker(t,e){this._assertWriterUsedCorrectly();const n="string"==typeof t?t:t.name,o=this.model.markers.get(n);if(!o)throw new c("writer-updatemarker-marker-not-exists",this);if(!e)return l("writer-updatemarker-reconvert-using-editingcontroller",{markerName:n}),void this.model.markers._refresh(o);const i="boolean"==typeof e.usingOperation,r="boolean"==typeof e.affectsData,s=r?e.affectsData:o.affectsData;if(!i&&!e.range&&!r)throw new c("writer-updatemarker-wrong-options",this);const a=o.getRange(),d=e.range?e.range:a;i&&e.usingOperation!==o.managedUsingOperations?e.usingOperation?zl(this,n,null,d,s):(zl(this,n,a,null,s),this.model.markers._set(n,d,void 0,s)):o.managedUsingOperations?zl(this,n,a,d,s):this.model.markers._set(n,d,void 0,s)}removeMarker(t){this._assertWriterUsedCorrectly();const e="string"==typeof t?t:t.name;if(!this.model.markers.has(e))throw new c("writer-removemarker-no-marker",this);const n=this.model.markers.get(e);if(!n.managedUsingOperations)return void this.model.markers._remove(e);zl(this,e,n.getRange(),null,n.affectsData)}setSelection(t,e,n){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(t,e,n)}setSelectionFocus(t,e){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(t,e)}setSelectionAttribute(t,e){if(this._assertWriterUsedCorrectly(),"string"==typeof t)this._setSelectionAttribute(t,e);else for(const[e,n]of Ho(t))this._setSelectionAttribute(e,n)}removeSelectionAttribute(t){if(this._assertWriterUsedCorrectly(),"string"==typeof t)this._removeSelectionAttribute(t);else for(const e of t)this._removeSelectionAttribute(e)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(t){this.model.document.selection._restoreGravity(t)}_setSelectionAttribute(t,e){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const o=dc._getStoreAttributeKey(t);this.setAttribute(o,e,n.anchor.parent)}n._setAttribute(t,e)}_removeSelectionAttribute(t){const e=this.model.document.selection;if(e.isCollapsed&&e.anchor.parent.isEmpty){const n=dc._getStoreAttributeKey(t);this.removeAttribute(n,e.anchor.parent)}e._removeAttribute(t)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new c("writer-incorrect-use",this)}_addOperationForAffectedMarkers(t,e){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const o=n.getRange();let i=!1;if("move"===t)i=e.containsPosition(o.start)||e.start.isEqual(o.start)||e.containsPosition(o.end)||e.end.isEqual(o.end);else{const t=e.nodeBefore,n=e.nodeAfter,r=o.start.parent==t&&o.start.isAtEnd,s=o.end.parent==n&&0==o.end.offset,a=o.end.nodeAfter==n,c=o.start.nodeAfter==n;i=r||s||a||c}i&&this.updateMarker(n.name,{range:o})}}}function Nl(t,e,n,o){const i=t.model,r=i.document;let s,a,c,l=o.start;for(const t of o.getWalker({shallow:!0}))c=t.item.getAttribute(e),s&&a!=c&&(a!=n&&d(),l=s),s=t.nextPosition,a=c;function d(){const o=new Ka(l,s),c=o.root.document?r.version:null,d=new Al(o,e,a,n,c);t.batch.addOperation(d),i.applyOperation(d)}s instanceof Wa&&s!=l&&a!=n&&d()}function Bl(t,e,n,o){const i=t.model,r=i.document,s=o.getAttribute(e);let a,c;if(s!=n){if(o.root===o){const t=o.document?r.version:null;c=new Dl(o,e,s,n,t)}else{a=new Ka(Wa._createBefore(o),t.createPositionAfter(o));const i=a.root.document?r.version:null;c=new Al(a,e,s,n,i)}t.batch.addOperation(c),i.applyOperation(c)}}function zl(t,e,n,o,i){const r=t.model,s=r.document,a=new xl(e,n,o,r.markers,i,s.version);t.batch.addOperation(a),r.applyOperation(a)}function Pl(t,e,n,o){let i;if(t.root.document){const n=o.document,r=new Wa(n.graveyard,[0]);i=new vl(t,e,r,n.version)}else i=new Cl(t,e);n.addOperation(i),o.applyOperation(i)}function Ll(t,e){return t===e||t instanceof Sl&&e instanceof Sl}class Ol{constructor(t){this._markerCollection=t,this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size}bufferOperation(t){switch(t.type){case"insert":if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const e of t.range.getItems({shallow:!0}))this._isInInsertedElement(e.parent)||this._markAttribute(e);break;case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const e=this._isInInsertedElement(t.sourcePosition.parent),n=this._isInInsertedElement(t.targetPosition.parent);e||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),n||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const e=Ka._createFromPositionAndShift(t.position,1);for(const t of this._markerCollection.getMarkersIntersectingRange(e)){const e=t.getData();this.bufferMarkerChange(t.name,e,e)}break}case"split":{const e=t.splitPosition.parent;this._isInInsertedElement(e)||this._markRemove(e,t.splitPosition.offset,t.howMany),this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1);break}case"merge":{const e=t.sourcePosition.parent;this._isInInsertedElement(e.parent)||this._markRemove(e.parent,e.startOffset,1);const n=t.graveyardPosition.parent;this._markInsert(n,t.graveyardPosition.offset,1);const o=t.targetPosition.parent;this._isInInsertedElement(o)||this._markInsert(o,t.targetPosition.offset,e.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(t,e,n){const o=this._changedMarkers.get(t);o?(o.newMarkerData=n,null==o.oldMarkerData.range&&null==n.range&&this._changedMarkers.delete(t)):this._changedMarkers.set(t,{newMarkerData:n,oldMarkerData:e})}getMarkersToRemove(){const t=[];for(const[e,n]of this._changedMarkers)null!=n.oldMarkerData.range&&t.push({name:e,range:n.oldMarkerData.range});return t}getMarkersToAdd(){const t=[];for(const[e,n]of this._changedMarkers)null!=n.newMarkerData.range&&t.push({name:e,range:n.newMarkerData.range});return t}getChangedMarkers(){return Array.from(this._changedMarkers).map((([t,e])=>({name:t,data:{oldRange:e.oldMarkerData.range,newRange:e.newMarkerData.range}})))}hasDataChanges(){if(this._changesInElement.size>0)return!0;for(const{newMarkerData:t,oldMarkerData:e}of this._changedMarkers.values()){if(t.affectsData!==e.affectsData)return!0;if(t.affectsData){const n=t.range&&!e.range,o=!t.range&&e.range,i=t.range&&e.range&&!t.range.isEqual(e.range);if(n||o||i)return!0}}return!1}getChanges(t={includeChangesInGraveyard:!1}){if(this._cachedChanges)return t.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let e=[];for(const t of this._changesInElement.keys()){const n=this._changesInElement.get(t).sort(((t,e)=>t.offset===e.offset?t.type!=e.type?"remove"==t.type?-1:1:0:t.offsett.position.root!=e.position.root?t.position.root.rootNamet));for(const t of e)delete t.changeCount,"attribute"==t.type&&(delete t.position,delete t.length);return this._changeCount=0,this._cachedChangesWithGraveyard=e,this._cachedChanges=e.filter(Fl),t.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._refreshedItems=new Set,this._cachedChanges=null}_refreshItem(t){if(this._isInInsertedElement(t.parent))return;this._markRemove(t.parent,t.startOffset,t.offsetSize),this._markInsert(t.parent,t.startOffset,t.offsetSize),this._refreshedItems.add(t);const e=Ka._createOn(t);for(const t of this._markerCollection.getMarkersIntersectingRange(e)){const e=t.getData();this.bufferMarkerChange(t.name,e,e)}this._cachedChanges=null}_markInsert(t,e,n){const o={type:"insert",offset:e,howMany:n,count:this._changeCount++};this._markChange(t,o)}_markRemove(t,e,n){const o={type:"remove",offset:e,howMany:n,count:this._changeCount++};this._markChange(t,o),this._removeAllNestedChanges(t,e,n)}_markAttribute(t){const e={type:"attribute",offset:t.startOffset,howMany:t.offsetSize,count:this._changeCount++};this._markChange(t.parent,e)}_markChange(t,e){this._makeSnapshot(t);const n=this._getChangesForElement(t);this._handleChange(e,n),n.push(e);for(let t=0;tn.offset){if(o>i){const t={type:"attribute",offset:i,howMany:o-i,count:this._changeCount++};this._handleChange(t,e),e.push(t)}t.nodesToHandle=n.offset-t.offset,t.howMany=t.nodesToHandle}else t.offset>=n.offset&&t.offseti?(t.nodesToHandle=o-i,t.offset=i):t.nodesToHandle=0);if("remove"==n.type&&t.offsetn.offset){const i={type:"attribute",offset:n.offset,howMany:o-n.offset,count:this._changeCount++};this._handleChange(i,e),e.push(i),t.nodesToHandle=n.offset-t.offset,t.howMany=t.nodesToHandle}"attribute"==n.type&&(t.offset>=n.offset&&o<=i?(t.nodesToHandle=0,t.howMany=0,t.offset=0):t.offset<=n.offset&&o>=i&&(n.howMany=0))}}t.howMany=t.nodesToHandle,delete t.nodesToHandle}_getInsertDiff(t,e,n){return{type:"insert",position:Wa._createAt(t,e),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getRemoveDiff(t,e,n){return{type:"remove",position:Wa._createAt(t,e),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(t,e,n){const o=[];n=new Map(n);for(const[i,r]of e){const e=n.has(i)?n.get(i):null;e!==r&&o.push({type:"attribute",position:t.start,range:t.clone(),length:1,attributeKey:i,attributeOldValue:r,attributeNewValue:e,changeCount:this._changeCount++}),n.delete(i)}for(const[e,i]of n)o.push({type:"attribute",position:t.start,range:t.clone(),length:1,attributeKey:e,attributeOldValue:null,attributeNewValue:i,changeCount:this._changeCount++});return o}_isInInsertedElement(t){const e=t.parent;if(!e)return!1;const n=this._changesInElement.get(e),o=t.startOffset;if(n)for(const t of n)if("insert"==t.type&&o>=t.offset&&oo){for(let e=0;ethis._version+1&&this._gaps.set(this._version,t),this._version=t}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(t){if(t.baseVersion!==this.version)throw new c("model-document-history-addoperation-incorrect-version",this,{operation:t,historyVersion:this.version});this._operations.push(t),this._version++,this._baseVersionToOperationIndex.set(t.baseVersion,this._operations.length-1)}getOperations(t,e=this.version){if(!this._operations.length)return[];const n=this._operations[0];void 0===t&&(t=n.baseVersion);let o=e-1;for(const[e,n]of this._gaps)t>e&&te&&othis.lastOperation.baseVersion)return[];let i=this._baseVersionToOperationIndex.get(t);void 0===i&&(i=0);let r=this._baseVersionToOperationIndex.get(o);return void 0===r&&(r=this._operations.length-1),this._operations.slice(i,r+1)}getOperation(t){const e=this._baseVersionToOperationIndex.get(t);if(void 0!==e)return this._operations[e]}setOperationAsUndone(t,e){this._undoPairs.set(e,t),this._undoneOperations.add(t)}isUndoingOperation(t){return this._undoPairs.has(t)}isUndoneOperation(t){return this._undoneOperations.has(t)}getUndoneOperation(t){return this._undoPairs.get(t)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}function Hl(t,e){return!!(n=t.charAt(e-1))&&1==n.length&&/[\ud800-\udbff]/.test(n)&&function(t){return!!t&&1==t.length&&/[\udc00-\udfff]/.test(t)}(t.charAt(e));var n}function Ul(t,e){return!!(n=t.charAt(e))&&1==n.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(n);var n}const Wl=function(){const t=/\p{Regional_Indicator}{2}/u.source,e="(?:"+[/\p{Emoji}[\u{E0020}-\u{E007E}]+\u{E007F}/u,/\p{Emoji}\u{FE0F}?\u{20E3}/u,/\p{Emoji}\u{FE0F}/u,/(?=\p{General_Category=Other_Symbol})\p{Emoji}\p{Emoji_Modifier}*/u].map((t=>t.source)).join("|")+")";return new RegExp(`${t}|${e}(?:‍${e})*`,"ug")}();function ql(t,e){const n=String(t).matchAll(Wl);return Array.from(n).some((t=>t.index{const n=e[0];n.isDocumentOperation&&this.differ.bufferOperation(n)}),{priority:"high"}),this.listenTo(t,"applyOperation",((t,e)=>{const n=e[0];n.isDocumentOperation&&this.history.addOperation(n)}),{priority:"low"}),this.listenTo(this.selection,"change",(()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0})),this.listenTo(t.markers,"update",((t,e,n,o,i)=>{const r={...e.getData(),range:o};this.differ.bufferMarkerChange(e.name,i,r),null===n&&e.on("change",((t,n)=>{const o=e.getData();this.differ.bufferMarkerChange(e.name,{...o,range:n},o)}))}))}get version(){return this.history.version}set version(t){this.history.version=t}get graveyard(){return this.getRoot(Gl)}createRoot(t="$root",e="main"){if(this.roots.get(e))throw new c("model-document-createroot-name-exists",this,{name:e});const n=new Sl(this,t,e);return this.roots.add(n),n}destroy(){this.selection.destroy(),this.stopListening()}getRoot(t="main"){return this.roots.get(t)}getRootNames(){return Array.from(this.roots,(t=>t.rootName)).filter((t=>t!=Gl))}registerPostFixer(t){this._postFixers.add(t)}toJSON(){const t=Ro(this);return t.selection="[engine.model.DocumentSelection]",t.model="[engine.model.Model]",t}_handleChangeBlock(t){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(t),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",t.batch):this.fire("change",t.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){for(const t of this.roots)if(t!==this.graveyard)return t;return this.graveyard}_getDefaultRange(){const t=this._getDefaultRoot(),e=this.model,n=e.schema,o=e.createPositionFromPath(t,[0]);return n.getNearestSelectionRange(o)||e.createRange(o)}_validateSelectionRange(t){return Kl(t.start)&&Kl(t.end)}_callPostFixers(t){let e=!1;do{for(const n of this._postFixers)if(this.selection.refresh(),e=n(t),e)break}while(e)}}function Kl(t){const e=t.textNode;if(e){const n=e.data,o=t.offset-e.startOffset;return!Hl(n,o)&&!Ul(n,o)}return!0}he(Yl,k);class Ql{constructor(){this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(t){const e=t instanceof $l?t.name:t;return this._markers.has(e)}get(t){return this._markers.get(t)||null}_set(t,e,n=!1,o=!1){const i=t instanceof $l?t.name:t;if(i.includes(","))throw new c("markercollection-incorrect-marker-name",this);const r=this._markers.get(i);if(r){const t=r.getData(),s=r.getRange();let a=!1;return s.isEqual(e)||(r._attachLiveRange(sc.fromRange(e)),a=!0),n!=r.managedUsingOperations&&(r._managedUsingOperations=n,a=!0),"boolean"==typeof o&&o!=r.affectsData&&(r._affectsData=o,a=!0),a&&this.fire("update:"+i,r,s,e,t),r}const s=sc.fromRange(e),a=new $l(i,s,n,o);return this._markers.set(i,a),this.fire("update:"+i,a,null,e,{...a.getData(),range:null}),a}_remove(t){const e=t instanceof $l?t.name:t,n=this._markers.get(e);return!!n&&(this._markers.delete(e),this.fire("update:"+e,n,n.getRange(),null,n.getData()),this._destroyMarker(n),!0)}_refresh(t){const e=t instanceof $l?t.name:t,n=this._markers.get(e);if(!n)throw new c("markercollection-refresh-marker-not-exists",this);const o=n.getRange();this.fire("update:"+e,n,o,o,n.getData())}*getMarkersAtPosition(t){for(const e of this)e.getRange().containsPosition(t)&&(yield e)}*getMarkersIntersectingRange(t){for(const e of this)null!==e.getRange().getIntersection(t)&&(yield e)}destroy(){for(const t of this._markers.values())this._destroyMarker(t);this._markers=null,this.stopListening()}*getMarkersGroup(t){for(const e of this._markers.values())e.name.startsWith(t+":")&&(yield e)}_destroyMarker(t){t.stopListening(),t._detachLiveRange()}}he(Ql,k);class $l{constructor(t,e,n,o){this.name=t,this._liveRange=this._attachLiveRange(e),this._managedUsingOperations=n,this._affectsData=o}get managedUsingOperations(){if(!this._liveRange)throw new c("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new c("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new c("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new c("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new c("marker-destroyed",this);return this._liveRange.toRange()}is(t){return"marker"===t||"model:marker"===t}_attachLiveRange(t){return this._liveRange&&this._detachLiveRange(),t.delegate("change:range").to(this),t.delegate("change:content").to(this),this._liveRange=t,t}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}he($l,k);class Zl extends hl{get type(){return"noop"}clone(){return new Zl(this.baseVersion)}getReversed(){return new Zl(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const Jl={};Jl[Al.className]=Al,Jl[yl.className]=yl,Jl[xl.className]=xl,Jl[vl.className]=vl,Jl[Zl.className]=Zl,Jl[hl.className]=hl,Jl[El.className]=El,Jl[Dl.className]=Dl,Jl[Il.className]=Il,Jl[Ml.className]=Ml;class Xl extends Wa{constructor(t,e,n="toNone"){if(super(t,e,n),!this.root.is("rootElement"))throw new c("model-liveposition-root-not-rootelement",t);td.call(this)}detach(){this.stopListening()}is(t){return"livePosition"===t||"model:livePosition"===t||"position"==t||"model:position"===t}toPosition(){return new Wa(this.root,this.path.slice(),this.stickiness)}static fromPosition(t,e){return new this(t.root,t.path.slice(),e||t.stickiness)}}function td(){this.listenTo(this.root.document.model,"applyOperation",((t,e)=>{const n=e[0];n.isDocumentOperation&&ed.call(this,n)}),{priority:"low"})}function ed(t){const e=this.getTransformedByOperation(t);if(!this.isEqual(e)){const t=this.toPosition();this.path=e.path,this.root=e.root,this.fire("change",t)}}he(Xl,k);class nd{constructor(t,e,n){this.model=t,this.writer=e,this.position=n,this.canMergeWith=new Set([this.position.parent]),this.schema=t.schema,this._documentFragment=e.createDocumentFragment(),this._documentFragmentPosition=e.createPositionAt(this._documentFragment,0),this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(t){for(const e of Array.from(t))this._handleNode(e);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(t){const e=this.writer.createPositionAfter(this._lastNode),n=this.writer.createPositionAfter(t);if(n.isAfter(e)){if(this._lastNode=t,this.position.parent!=t||!this.position.isAtEnd)throw new c("insertcontent-invalid-insertion-position",this);this.position=n,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this.nodeToSelect?Ka._createOn(this.nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new Ka(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(t){if(this.schema.isObject(t))return void this._handleObject(t);let e=this._checkAndAutoParagraphToAllowedPosition(t);e||(e=this._checkAndSplitToAllowedPosition(t),e)?(this._appendToFragment(t),this._firstNode||(this._firstNode=t),this._lastNode=t):this._handleDisallowedNode(t)}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const t=Xl.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=t.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=t.toPosition(),t.detach()}_handleObject(t){this._checkAndSplitToAllowedPosition(t)?this._appendToFragment(t):this._tryAutoparagraphing(t)}_handleDisallowedNode(t){t.is("element")?this.handleNodes(t.getChildren()):this._tryAutoparagraphing(t)}_appendToFragment(t){if(!this.schema.checkChild(this.position,t))throw new c("insertcontent-wrong-position",this,{node:t,position:this.position});this.writer.insert(t,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(t.offsetSize),this.schema.isObject(t)&&!this.schema.checkChild(this.position,"$text")?this.nodeToSelect=t:this.nodeToSelect=null,this._filterAttributesOf.push(t)}_setAffectedBoundaries(t){this._affectedStart||(this._affectedStart=Xl.fromPosition(t,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(t)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=Xl.fromPosition(t,"toNext"))}_mergeOnLeft(){const t=this._firstNode;if(!(t instanceof Va))return;if(!this._canMergeLeft(t))return;const e=Xl._createBefore(t);e.stickiness="toNext";const n=Xl.fromPosition(this.position,"toNext");this._affectedStart.isEqual(e)&&(this._affectedStart.detach(),this._affectedStart=Xl._createAt(e.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=e.nodeBefore,this._lastNode=e.nodeBefore),this.writer.merge(e),e.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=Xl._createAt(e.nodeBefore,"end","toNext")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),e.detach()}_mergeOnRight(){const t=this._lastNode;if(!(t instanceof Va))return;if(!this._canMergeRight(t))return;const e=Xl._createAfter(t);if(e.stickiness="toNext",!this.position.isEqual(e))throw new c("insertcontent-invalid-insertion-position",this);this.position=Wa._createAt(e.nodeBefore,"end");const n=Xl.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(e)&&(this._affectedEnd.detach(),this._affectedEnd=Xl._createAt(e.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=e.nodeBefore,this._lastNode=e.nodeBefore),this.writer.merge(e),e.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=Xl._createAt(e.nodeBefore,0,"toPrevious")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),e.detach()}_canMergeLeft(t){const e=t.previousSibling;return e instanceof Va&&this.canMergeWith.has(e)&&this.model.schema.checkMerge(e,t)}_canMergeRight(t){const e=t.nextSibling;return e instanceof Va&&this.canMergeWith.has(e)&&this.model.schema.checkMerge(t,e)}_tryAutoparagraphing(t){const e=this.writer.createElement("paragraph");this._getAllowedIn(this.position.parent,e)&&this.schema.checkChild(e,t)&&(e._appendChild(t),this._handleNode(e))}_checkAndAutoParagraphToAllowedPosition(t){if(this.schema.checkChild(this.position.parent,t))return!0;if(!this.schema.checkChild(this.position.parent,"paragraph")||!this.schema.checkChild("paragraph",t))return!1;this._insertPartialFragment();const e=this.writer.createElement("paragraph");return this.writer.insert(e,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=e,this.position=this.writer.createPositionAt(e,0),!0}_checkAndSplitToAllowedPosition(t){const e=this._getAllowedIn(this.position.parent,t);if(!e)return!1;for(e!=this.position.parent&&this._insertPartialFragment();e!=this.position.parent;)if(this.position.isAtStart){const t=this.position.parent;this.position=this.writer.createPositionBefore(t),t.isEmpty&&t.parent===e&&this.writer.remove(t)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const t=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=t,this.canMergeWith.add(this.position.nodeAfter)}return!0}_getAllowedIn(t,e){return this.schema.checkChild(t,e)?t:this.schema.isLimit(t)?null:this._getAllowedIn(t.parent,e)}}function od(t,e,n="auto"){const o=t.getSelectedElement();if(o&&e.schema.isObject(o)&&!e.schema.isInline(o))return["before","after"].includes(n)?e.createRange(e.createPositionAt(o,n)):e.createRangeOn(o);const i=Ta(t.getSelectedBlocks());if(!i)return e.createRange(t.focus);if(i.isEmpty)return e.createRange(e.createPositionAt(i,0));const r=e.createPositionAfter(i);return t.focus.isTouching(r)?e.createRange(r):e.createRange(e.createPositionBefore(i))}function id(t,e,n,o,i={}){if(!t.schema.isObject(e))throw new c("insertobject-element-not-an-object",t,{object:e});let r;r=n?n.is("selection")?n:t.createSelection(n,o):t.document.selection;let s=r;i.findOptimalPosition&&t.schema.isBlock(e)&&(s=t.createSelection(od(r,t,i.findOptimalPosition)));const a=Ta(r.getSelectedBlocks()),l={};return a&&Object.assign(l,t.schema.getAttributesWithProperty(a,"copyOnReplace",!0)),t.change((n=>{s.isCollapsed||t.deleteContent(s,{doNotAutoparagraph:!0});let o=e;const r=s.anchor.parent;!t.schema.checkChild(r,e)&&t.schema.checkChild(r,"paragraph")&&t.schema.checkChild("paragraph",e)&&(o=n.createElement("paragraph"),n.insert(e,o)),t.schema.setAllowedAttributes(o,l,n);const a=t.insertContent(o,s);return a.isCollapsed||i.setSelection&&function(t,e,n,o){const i=t.model;if("after"==n){let n=e.nextSibling;!(n&&i.schema.checkChild(n,"$text"))&&i.schema.checkChild(e.parent,"paragraph")&&(n=t.createElement("paragraph"),i.schema.setAllowedAttributes(n,o,t),i.insertContent(n,t.createPositionAfter(e))),n&&t.setSelection(n,0)}else{if("on"!=n)throw new c("insertobject-invalid-place-parameter-value",i);t.setSelection(e,"on")}}(n,e,i.setSelection,l),a}))}function rd(t,e,n={}){if(e.isCollapsed)return;const o=e.getFirstRange();if("$graveyard"==o.root.rootName)return;const i=t.schema;t.change((t=>{if(!n.doNotResetEntireContent&&function(t,e){const n=t.getLimitElement(e);if(!e.containsEntireContent(n))return!1;const o=e.getFirstRange();if(o.start.parent==o.end.parent)return!1;return t.checkChild(n,"paragraph")}(i,e))return void function(t,e){const n=t.model.schema.getLimitElement(e);t.remove(t.createRangeIn(n)),ld(t,t.createPositionAt(n,0),e)}(t,e);const r={};if(!n.doNotAutoparagraph){const t=e.getSelectedElement();t&&Object.assign(r,i.getAttributesWithProperty(t,"copyOnReplace",!0))}const[s,a]=function(t){const e=t.root.document.model,n=t.start;let o=t.end;if(e.hasContent(t,{ignoreMarkers:!0})){const n=function(t){const e=t.parent,n=e.root.document.model.schema,o=e.getAncestors({parentFirst:!0,includeSelf:!0});for(const t of o){if(n.isLimit(t))return null;if(n.isBlock(t))return t}}(o);if(n&&o.isTouching(e.createPositionAt(n,0))){const n=e.createSelection(t);e.modifySelection(n,{direction:"backward"});const i=n.getLastPosition(),r=e.createRange(i,o);e.hasContent(r,{ignoreMarkers:!0})||(o=i)}}return[Xl.fromPosition(n,"toPrevious"),Xl.fromPosition(o,"toNext")]}(o);s.isTouching(a)||t.remove(t.createRange(s,a)),n.leaveUnmerged||(!function(t,e,n){const o=t.model;if(!cd(t.model.schema,e,n))return;const[i,r]=function(t,e){const n=t.getAncestors(),o=e.getAncestors();let i=0;for(;n[i]&&n[i]==o[i];)i++;return[n[i],o[i]]}(e,n);if(!i||!r)return;!o.hasContent(i,{ignoreMarkers:!0})&&o.hasContent(r,{ignoreMarkers:!0})?ad(t,e,n,i.parent):sd(t,e,n,i.parent)}(t,s,a),i.removeDisallowedAttributes(s.parent.getChildren(),t)),dd(t,e,s),!n.doNotAutoparagraph&&function(t,e){const n=t.checkChild(e,"$text"),o=t.checkChild(e,"paragraph");return!n&&o}(i,s)&&ld(t,s,e,r),s.detach(),a.detach()}))}function sd(t,e,n,o){const i=e.parent,r=n.parent;if(i!=o&&r!=o){for(e=t.createPositionAfter(i),(n=t.createPositionBefore(r)).isEqual(e)||t.insert(r,e),t.merge(e);n.parent.isEmpty;){const e=n.parent;n=t.createPositionBefore(e),t.remove(e)}cd(t.model.schema,e,n)&&sd(t,e,n,o)}}function ad(t,e,n,o){const i=e.parent,r=n.parent;if(i!=o&&r!=o){for(e=t.createPositionAfter(i),(n=t.createPositionBefore(r)).isEqual(e)||t.insert(i,n);e.parent.isEmpty;){const n=e.parent;e=t.createPositionBefore(n),t.remove(n)}n=t.createPositionBefore(r),function(t,e){const n=e.nodeBefore,o=e.nodeAfter;n.name!=o.name&&t.rename(n,o.name);t.clearAttributes(n),t.setAttributes(Object.fromEntries(o.getAttributes()),n),t.merge(e)}(t,n),cd(t.model.schema,e,n)&&ad(t,e,n,o)}}function cd(t,e,n){const o=e.parent,i=n.parent;return o!=i&&(!t.isLimit(o)&&!t.isLimit(i)&&function(t,e,n){const o=new Ka(t,e);for(const t of o.getWalker())if(n.isLimit(t.item))return!1;return!0}(e,n,t))}function ld(t,e,n,o={}){const i=t.createElement("paragraph");t.model.schema.setAllowedAttributes(i,o,t),t.insert(i,e),dd(t,n,t.createPositionAt(i,0))}function dd(t,e,n){e instanceof dc?t.setSelection(n):e.setTo(n)}const hd=' ,.?!:;"-()';function ud(t,e){const{isForward:n,walker:o,unit:i,schema:r,treatEmojiAsSingleUnit:s}=t,{type:a,item:c,nextPosition:l}=e;if("text"==a)return"word"===t.unit?function(t,e){let n=t.position.textNode;if(n){let o=t.position.offset-n.startOffset;for(;!md(n.data,o,e)&&!pd(n,o,e);){t.next();const i=e?t.position.nodeAfter:t.position.nodeBefore;if(i&&i.is("$text")){const o=i.data.charAt(e?0:i.data.length-1);hd.includes(o)||(t.next(),n=t.position.textNode)}o=t.position.offset-n.startOffset}}return t.position}(o,n):function(t,e,n){const o=t.position.textNode;if(o){const i=o.data;let r=t.position.offset-o.startOffset;for(;Hl(i,r)||"character"==e&&Ul(i,r)||n&&ql(i,r);)t.next(),r=t.position.offset-o.startOffset}return t.position}(o,i,s);if(a==(n?"elementStart":"elementEnd")){if(r.isSelectable(c))return Wa._createAt(c,n?"after":"before");if(r.checkChild(l,"$text"))return l}else{if(r.isLimit(c))return void o.skip((()=>!0));if(r.checkChild(l,"$text"))return l}}function gd(t,e){const n=t.root,o=Wa._createAt(n,e?"end":0);return e?new Ka(t,o):new Ka(o,t)}function md(t,e,n){const o=e+(n?0:-1);return hd.includes(t.charAt(o))}function pd(t,e,n){return e===(n?t.endOffset:0)}function fd(t,e){const n=[];Array.from(t.getItems({direction:"backward"})).map((t=>e.createRangeOn(t))).filter((e=>(e.start.isAfter(t.start)||e.start.isEqual(t.start))&&(e.end.isBefore(t.end)||e.end.isEqual(t.end)))).forEach((t=>{n.push(t.start.parent),e.remove(t)})),n.forEach((t=>{let n=t;for(;n.parent&&n.isEmpty;){const t=e.createRangeOn(n);n=n.parent,e.remove(t)}}))}function kd(t){t.document.registerPostFixer((e=>function(t,e){const n=e.document.selection,o=e.schema,i=[];let r=!1;for(const t of n.getRanges()){const e=bd(t,o);e&&!e.isEqual(t)?(i.push(e),r=!0):i.push(t)}r&&t.setSelection(function(t){const e=[...t],n=new Set;let o=1;for(;o!n.has(e)))}(i),{backward:n.isBackward})}(e,t)))}function bd(t,e){return t.isCollapsed?function(t,e){const n=t.start,o=e.getNearestSelectionRange(n);if(!o){const t=n.getAncestors().reverse().find((t=>e.isObject(t)));return t?Ka._createOn(t):null}if(!o.isCollapsed)return o;const i=o.start;if(n.isEqual(i))return null;return new Ka(i)}(t,e):function(t,e){const{start:n,end:o}=t,i=e.checkChild(n,"$text"),r=e.checkChild(o,"$text"),s=e.getLimitElement(n),a=e.getLimitElement(o);if(s===a){if(i&&r)return null;if(function(t,e,n){const o=t.nodeAfter&&!n.isLimit(t.nodeAfter)||n.checkChild(t,"$text"),i=e.nodeBefore&&!n.isLimit(e.nodeBefore)||n.checkChild(e,"$text");return o||i}(n,o,e)){const t=n.nodeAfter&&e.isSelectable(n.nodeAfter)?null:e.getNearestSelectionRange(n,"forward"),i=o.nodeBefore&&e.isSelectable(o.nodeBefore)?null:e.getNearestSelectionRange(o,"backward"),r=t?t.start:n,s=i?i.end:o;return new Ka(r,s)}}const c=s&&!s.is("rootElement"),l=a&&!a.is("rootElement");if(c||l){const t=n.nodeAfter&&o.nodeBefore&&n.nodeAfter.parent===o.nodeBefore.parent,i=c&&(!t||!_d(n.nodeAfter,e)),r=l&&(!t||!_d(o.nodeBefore,e));let d=n,h=o;return i&&(d=Wa._createBefore(wd(s,e))),r&&(h=Wa._createAfter(wd(a,e))),new Ka(d,h)}return null}(t,e)}function wd(t,e){let n=t,o=n;for(;e.isLimit(o)&&o.parent;)n=o,o=o.parent;return n}function _d(t,e){return t&&e.isSelectable(t)}class Ad{constructor(){this.markers=new Ql,this.document=new Yl(this),this.schema=new Hc,this._pendingChanges=[],this._currentWriter=null,["insertContent","insertObject","deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach((t=>this.decorate(t))),this.on("applyOperation",((t,e)=>{e[0]._validate()}),{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck(((t,e)=>{if("$marker"===e.name)return!0})),kd(this),this.document.registerPostFixer(Mc)}change(t){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new dl,callback:t}),this._runPendingChanges()[0]):t(this._currentWriter)}catch(t){c.rethrowUnexpectedError(t,this)}}enqueueChange(t,e){try{t?"function"==typeof t?(e=t,t=new dl):t instanceof dl||(t=new dl(t)):t=new dl,this._pendingChanges.push({batch:t,callback:e}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(t){c.rethrowUnexpectedError(t,this)}}applyOperation(t){t._execute()}insertContent(t,e,n){return function(t,e,n,o){return t.change((i=>{let r;r=n?n instanceof ec||n instanceof dc?n:i.createSelection(n,o):t.document.selection,r.isCollapsed||t.deleteContent(r,{doNotAutoparagraph:!0});const s=new nd(t,i,r.anchor);let a;a=e.is("documentFragment")?e.getChildren():[e],s.handleNodes(a);const c=s.getSelectionRange();c&&(r instanceof dc?i.setSelection(c):r.setTo(c));const l=s.getAffectedRange()||t.createRange(r.anchor);return s.destroy(),l}))}(this,t,e,n)}insertObject(t,e,n,o){return id(this,t,e,n,o)}deleteContent(t,e){rd(this,t,e)}modifySelection(t,e){!function(t,e,n={}){const o=t.schema,i="backward"!=n.direction,r=n.unit?n.unit:"character",s=!!n.treatEmojiAsSingleUnit,a=e.focus,c=new Ha({boundaries:gd(a,i),singleCharacters:!0,direction:i?"forward":"backward"}),l={walker:c,schema:o,isForward:i,unit:r,treatEmojiAsSingleUnit:s};let d;for(;d=c.next();){if(d.done)return;const n=ud(l,d.value);if(n)return void(e instanceof dc?t.change((t=>{t.setSelectionFocus(n)})):e.setFocus(n))}}(this,t,e)}getSelectedContent(t){return function(t,e){return t.change((t=>{const n=t.createDocumentFragment(),o=e.getFirstRange();if(!o||o.isCollapsed)return n;const i=o.start.root,r=o.start.getCommonPath(o.end),s=i.getNodeByPath(r);let a;a=o.start.parent==o.end.parent?o:t.createRange(t.createPositionAt(s,o.start.path[r.length]),t.createPositionAt(s,o.end.path[r.length]+1));const c=a.end.offset-a.start.offset;for(const e of a.getItems({shallow:!0}))e.is("$textProxy")?t.appendText(e.data,e.getAttributes(),n):t.append(t.cloneElement(e,!0),n);if(a!=o){const e=o._getTransformedByMove(a.start,t.createPositionAt(n,0),c)[0],i=t.createRange(t.createPositionAt(n,0),e.start);fd(t.createRange(e.end,t.createPositionAt(n,"end")),t),fd(i,t)}return n}))}(this,t)}hasContent(t,e={}){const n=t instanceof Va?Ka._createIn(t):t;if(n.isCollapsed)return!1;const{ignoreWhitespaces:o=!1,ignoreMarkers:i=!1}=e;if(!i)for(const t of this.markers.getMarkersIntersectingRange(n))if(t.affectsData)return!0;for(const t of n.getItems())if(this.schema.isContent(t)){if(!t.is("$textProxy"))return!0;if(!o)return!0;if(-1!==t.data.search(/\S/))return!0}return!1}createPositionFromPath(t,e,n){return new Wa(t,e,n)}createPositionAt(t,e){return Wa._createAt(t,e)}createPositionAfter(t){return Wa._createAfter(t)}createPositionBefore(t){return Wa._createBefore(t)}createRange(t,e){return new Ka(t,e)}createRangeIn(t){return Ka._createIn(t)}createRangeOn(t){return Ka._createOn(t)}createSelection(t,e,n){return new ec(t,e,n)}createBatch(t){return new dl(t)}createOperationFromJSON(t){return class{static fromJSON(t,e){return Jl[t.__className].fromJSON(t,e)}}.fromJSON(t,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const t=[];for(this.fire("_beforeChanges");this._pendingChanges.length;){const e=this._pendingChanges[0].batch;this._currentWriter=new Tl(this,e);const n=this._pendingChanges[0].callback(this._currentWriter);t.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),t}}he(Ad,re);class Cd extends Ba{constructor(t){super(),this.editor=t}set(t,e,n={}){if("string"==typeof e){const t=e;e=(e,n)=>{this.editor.execute(t),n()}}super.set(t,e,n)}}class vd{constructor(t={}){const e=t.language||this.constructor.defaultConfig&&this.constructor.defaultConfig.language;this._context=t.context||new Po({language:e}),this._context._addEditor(this,!t.context);const n=Array.from(this.constructor.builtinPlugins||[]);this.config=new yo(t,this.constructor.defaultConfig),this.config.define("plugins",n),this.config.define(this._context._getEditorConfig()),this.plugins=new Io(this,n,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new jc,this.set("state","initializing"),this.once("ready",(()=>this.state="ready"),{priority:"high"}),this.once("destroy",(()=>this.state="destroyed"),{priority:"high"}),this.model=new Ad;const o=new Di;this.data=new sl(this.model,o),this.editing=new Rc(this.model,o),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new al([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new Cd(this),this.keystrokes.listenTo(this.editing.view.document)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(t){throw new c("editor-isreadonly-has-no-setter")}enableReadOnlyMode(t){if("string"!=typeof t&&"symbol"!=typeof t)throw new c("editor-read-only-lock-id-invalid",null,{lockId:t});this._readOnlyLocks.has(t)||(this._readOnlyLocks.add(t),1===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(t){if("string"!=typeof t&&"symbol"!=typeof t)throw new c("editor-read-only-lock-id-invalid",null,{lockId:t});this._readOnlyLocks.has(t)&&(this._readOnlyLocks.delete(t),0===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}initPlugins(){const t=this.config,e=t.get("plugins"),n=t.get("removePlugins")||[],o=t.get("extraPlugins")||[],i=t.get("substitutePlugins")||[];return this.plugins.init(e.concat(o),n,i)}destroy(){let t=Promise.resolve();return"initializing"==this.state&&(t=new Promise((t=>this.once("ready",t)))),t.then((()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()})).then((()=>this.plugins.destroy())).then((()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()})).then((()=>this._context._removeEditor(this)))}execute(...t){try{return this.commands.execute(...t)}catch(t){c.rethrowUnexpectedError(t,this)}}focus(){this.editing.view.focus()}}he(vd,re);class yd{constructor(t){this.editor=t,this._components=new Map}*names(){for(const t of this._components.values())yield t.originalName}add(t,e){this._components.set(xd(t),{callback:e,originalName:t})}create(t){if(!this.has(t))throw new c("componentfactory-item-missing",this,{name:t});return this._components.get(xd(t)).callback(this.editor.locale)}has(t){return this._components.has(xd(t))}}function xd(t){return String(t).toLowerCase()}class Ed{constructor(t){this.editor=t,this.componentFactory=new yd(t),this.focusTracker=new Na,this.set("viewportOffset",this._readViewportOffsetFromConfig()),this._editableElementsMap=new Map,this.listenTo(t.editing.view.document,"layoutChanged",(()=>this.update()))}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy();for(const t of this._editableElementsMap.values())t.ckeditorInstance=null;this._editableElementsMap=new Map}setEditableElement(t,e){this._editableElementsMap.set(t,e),e.ckeditorInstance||(e.ckeditorInstance=this.editor)}getEditableElement(t="main"){return this._editableElementsMap.get(t)}getEditableElementsNames(){return this._editableElementsMap.keys()}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_readViewportOffsetFromConfig(){const t=this.editor,e=t.config.get("ui.viewportOffset");if(e)return e;const n=t.config.get("toolbar.viewportTopOffset");return n?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:n}):{top:0}}}he(Ed,re);const Dd={setData(t){this.data.set(t)},getData(t){return this.data.get(t)}},Md=Dd,Id={updateSourceElement(){if(!this.sourceElement)throw new c("editor-missing-sourceelement",this);_a(this.sourceElement,this.data.get())}};class Sd extends Lo{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new Mo({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(t){if("string"!=typeof t)throw new c("pendingactions-add-invalid-message",this);const e=Object.create(re);return e.set("message",t),this._actions.add(e),this.hasAny=!0,e}remove(t){this._actions.remove(t),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}const Td='',Nd='',Bd={cancel:'',caption:'',check:'',cog:'',eraser:'',lowVision:'',image:'',alignBottom:'',alignMiddle:'',alignTop:'',alignLeft:'',alignCenter:'',alignRight:'',alignJustify:'',objectLeft:'',objectCenter:'',objectRight:'',objectFullWidth:'',objectInline:'',objectBlockLeft:'',objectBlockRight:'',objectSizeFull:'',objectSizeLarge:'',objectSizeSmall:'',objectSizeMedium:'',pencil:'',pilcrow:Td,quote:'',threeVerticalDots:Nd};function zd({emitter:t,activator:e,callback:n,contextElements:o}){t.listenTo(document,"mousedown",((t,i)=>{if(!e())return;const r="function"==typeof i.composedPath?i.composedPath():[];for(const t of o)if(t.contains(i.target)||r.includes(t))return;n()}))}function Pd(t){t.set("_isCssTransitionsDisabled",!1),t.disableCssTransitions=()=>{t._isCssTransitionsDisabled=!0},t.enableCssTransitions=()=>{t._isCssTransitionsDisabled=!1},t.extendTemplate({attributes:{class:[t.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}function Ld({view:t}){t.listenTo(t.element,"submit",((e,n)=>{n.preventDefault(),t.fire("submit")}),{useCapture:!0})}class Od extends Mo{constructor(t=[]){super(t,{idProperty:"viewUid"}),this.on("add",((t,e,n)=>{this._renderViewIntoCollectionParent(e,n)})),this.on("remove",((t,e)=>{e.element&&this._parentElement&&e.element.remove()})),this._parentElement=null}destroy(){this.map((t=>t.destroy()))}setParent(t){this._parentElement=t;for(const t of this)this._renderViewIntoCollectionParent(t)}delegate(...t){if(!t.length||!t.every((t=>"string"==typeof t)))throw new c("ui-viewcollection-delegate-wrong-events",this);return{to:e=>{for(const n of this)for(const o of t)n.delegate(o).to(e);this.on("add",((n,o)=>{for(const n of t)o.delegate(n).to(e)})),this.on("remove",((n,o)=>{for(const n of t)o.stopDelegating(n,e)}))}}}_renderViewIntoCollectionParent(t,e){t.isRendered||t.render(),t.element&&this._parentElement&&this._parentElement.insertBefore(t.element,this._parentElement.children[e])}}var Rd=n(4793),jd={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Rd.Z,jd);Rd.Z.locals;class Fd{constructor(t){this.element=null,this.isRendered=!1,this.locale=t,this.t=t&&t.t,this._viewCollections=new Mo,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",((e,n)=>{n.locale=t})),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Vd.bind(this,this)}createCollection(t){const e=new Od(t);return this._viewCollections.add(e),e}registerChild(t){Do(t)||(t=[t]);for(const e of t)this._unboundChildren.add(e)}deregisterChild(t){Do(t)||(t=[t]);for(const e of t)this._unboundChildren.remove(e)}setTemplate(t){this.template=new Vd(t)}extendTemplate(t){Vd.extend(this.template,t)}render(){if(this.isRendered)throw new c("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map((t=>t.destroy())),this.template&&this.template._revertData&&this.template.revert(this.element)}}he(Fd,ws),he(Fd,re);class Vd{constructor(t){Object.assign(this,Zd($d(t))),this._isRendered=!1,this._revertData=null}render(){const t=this._renderNode({intoFragment:!0});return this._isRendered=!0,t}apply(t){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:t,isApplying:!0,revertData:this._revertData}),t}revert(t){if(!this._revertData)throw new c("ui-template-revert-not-applied",[this,t]);this._revertTemplateFromNode(t,this._revertData)}*getViews(){yield*function*t(e){if(e.children)for(const n of e.children)oh(n)?yield n:ih(n)&&(yield*t(n))}(this)}static bind(t,e){return{to:(n,o)=>new Ud({eventNameOrFunction:n,attribute:n,observable:t,emitter:e,callback:o}),if:(n,o,i)=>new Wd({observable:t,emitter:e,attribute:n,valueIfTrue:o,callback:i})}}static extend(t,e){if(t._isRendered)throw new c("template-extend-render",[this,t]);eh(t,Zd($d(e)))}_renderNode(t){let e;if(e=t.node?this.tag&&this.text:this.tag?this.text:!this.text,e)throw new c("ui-template-wrong-syntax",this);return this.text?this._renderText(t):this._renderElement(t)}_renderElement(t){let e=t.node;return e||(e=t.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(t),this._renderElementChildren(t),this._setUpListeners(t),e}_renderText(t){let e=t.node;return e?t.revertData.text=e.textContent:e=t.node=document.createTextNode(""),qd(this.text)?this._bindToObservable({schema:this.text,updater:Yd(e),data:t}):e.textContent=this.text.join(""),e}_renderAttributes(t){let e,n,o,i;if(!this.attributes)return;const r=t.node,s=t.revertData;for(e in this.attributes)if(o=r.getAttribute(e),n=this.attributes[e],s&&(s.attributes[e]=o),i=x(n[0])&&n[0].ns?n[0].ns:null,qd(n)){const a=i?n[0].value:n;s&&sh(e)&&a.unshift(o),this._bindToObservable({schema:a,updater:Kd(r,e,i),data:t})}else"style"==e&&"string"!=typeof n[0]?this._renderStyleAttribute(n[0],t):(s&&o&&sh(e)&&n.unshift(o),n=n.map((t=>t&&t.value||t)).reduce(((t,e)=>t.concat(e)),[]).reduce(Xd,""),nh(n)||r.setAttributeNS(i,e,n))}_renderStyleAttribute(t,e){const n=e.node;for(const o in t){const i=t[o];qd(i)?this._bindToObservable({schema:[i],updater:Qd(n,o),data:e}):n.style[o]=i}}_renderElementChildren(t){const e=t.node,n=t.intoFragment?document.createDocumentFragment():e,o=t.isApplying;let i=0;for(const r of this.children)if(rh(r)){if(!o){r.setParent(e);for(const t of r)n.appendChild(t.element)}}else if(oh(r))o||(r.isRendered||r.render(),n.appendChild(r.element));else if(Qr(r))n.appendChild(r);else if(o){const e={children:[],bindings:[],attributes:{}};t.revertData.children.push(e),r._renderNode({node:n.childNodes[i++],isApplying:!0,revertData:e})}else n.appendChild(r.render());t.intoFragment&&e.appendChild(n)}_setUpListeners(t){if(this.eventListeners)for(const e in this.eventListeners){const n=this.eventListeners[e].map((n=>{const[o,i]=e.split("@");return n.activateDomEventListener(o,i,t)}));t.revertData&&t.revertData.bindings.push(n)}}_bindToObservable({schema:t,updater:e,data:n}){const o=n.revertData;Gd(t,e,n);const i=t.filter((t=>!nh(t))).filter((t=>t.observable)).map((o=>o.activateAttributeListener(t,e,n)));o&&o.bindings.push(i)}_revertTemplateFromNode(t,e){for(const t of e.bindings)for(const e of t)e();if(e.text)t.textContent=e.text;else{for(const n in e.attributes){const o=e.attributes[n];null===o?t.removeAttribute(n):t.setAttribute(n,o)}for(let n=0;nGd(t,e,n);return this.emitter.listenTo(this.observable,"change:"+this.attribute,o),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,o)}}}class Ud extends Hd{activateDomEventListener(t,e,n){const o=(t,n)=>{e&&!n.target.matches(e)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(n):this.observable.fire(this.eventNameOrFunction,n))};return this.emitter.listenTo(n.node,t,o),()=>{this.emitter.stopListening(n.node,t,o)}}}class Wd extends Hd{getValue(t){return!nh(super.getValue(t))&&(this.valueIfTrue||!0)}}function qd(t){return!!t&&(t.value&&(t=t.value),Array.isArray(t)?t.some(qd):t instanceof Hd)}function Gd(t,e,{node:n}){let o=function(t,e){return t.map((t=>t instanceof Hd?t.getValue(e):t))}(t,n);o=1==t.length&&t[0]instanceof Wd?o[0]:o.reduce(Xd,""),nh(o)?e.remove():e.set(o)}function Yd(t){return{set(e){t.textContent=e},remove(){t.textContent=""}}}function Kd(t,e,n){return{set(o){t.setAttributeNS(n,e,o)},remove(){t.removeAttributeNS(n,e)}}}function Qd(t,e){return{set(n){t.style[e]=n},remove(){t.style[e]=null}}}function $d(t){return Co(t,(t=>{if(t&&(t instanceof Hd||ih(t)||oh(t)||rh(t)))return t}))}function Zd(t){if("string"==typeof t?t=function(t){return{text:[t]}}(t):t.text&&function(t){t.text=So(t.text)}(t),t.on&&(t.eventListeners=function(t){for(const e in t)Jd(t,e);return t}(t.on),delete t.on),!t.text){t.attributes&&function(t){for(const e in t)t[e].value&&(t[e].value=So(t[e].value)),Jd(t,e)}(t.attributes);const e=[];if(t.children)if(rh(t.children))e.push(t.children);else for(const n of t.children)ih(n)||oh(n)||Qr(n)?e.push(n):e.push(new Vd(n));t.children=e}return t}function Jd(t,e){t[e]=So(t[e])}function Xd(t,e){return nh(e)?t:nh(t)?e:`${t} ${e}`}function th(t,e){for(const n in e)t[n]?t[n].push(...e[n]):t[n]=e[n]}function eh(t,e){if(e.attributes&&(t.attributes||(t.attributes={}),th(t.attributes,e.attributes)),e.eventListeners&&(t.eventListeners||(t.eventListeners={}),th(t.eventListeners,e.eventListeners)),e.text&&t.text.push(...e.text),e.children&&e.children.length){if(t.children.length!=e.children.length)throw new c("ui-template-extend-children-mismatch",t);let n=0;for(const o of e.children)eh(t.children[n++],o)}}function nh(t){return!t&&0!==t}function oh(t){return t instanceof Fd}function ih(t){return t instanceof Vd}function rh(t){return t instanceof Od}function sh(t){return"class"==t||"style"==t}const ah=function(t){return"string"==typeof t||!It(t)&&vt(t)&&"[object String]"==R(t)};class ch extends Od{constructor(t,e=[]){super(e),this.locale=t}attachToDom(){this._bodyCollectionContainer=new Vd({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let t=document.querySelector(".ck-body-wrapper");t||(t=function(t,e,n={},o=[]){const i=n&&n.xmlns,r=i?t.createElementNS(i,e):t.createElement(e);for(const t in n)r.setAttribute(t,n[t]);!ah(o)&&Do(o)||(o=[o]);for(let e of o)ah(e)&&(e=t.createTextNode(e)),r.appendChild(e);return r}(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(t)),t.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const t=document.querySelector(".ck-body-wrapper");t&&0==t.childElementCount&&t.remove()}}var lh=n(6574),dh={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(lh.Z,dh);lh.Z.locals;class hh extends Fd{constructor(){super();const t=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon"],viewBox:t.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",(()=>{this._updateXMLContent(),this._colorFillPaths()})),this.on("change:fillColor",(()=>{this._colorFillPaths()}))}_updateXMLContent(){if(this.content){const t=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),e=t.getAttribute("viewBox");for(e&&(this.viewBox=e),this.element.innerHTML="";t.childNodes.length>0;)this.element.appendChild(t.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach((t=>{t.style.fill=this.fillColor}))}}var uh=n(3332),gh={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(uh.Z,gh);uh.Z.locals;class mh extends Fd{constructor(t){super(t),this.set("text",""),this.set("position","s");const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip",e.to("position",(t=>"ck-tooltip_"+t)),e.if("text","ck-hidden",(t=>!t.trim()))]},children:[{tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:e.to("text")}]}]})}}var ph=n(4906),fh={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(ph.Z,fh);ph.Z.locals;class kh extends Fd{constructor(t){super(t);const e=this.bindTemplate,n=r();this.set("class"),this.set("labelStyle"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.tooltipView=this._createTooltipView(),this.labelView=this._createLabelView(n),this.iconView=new hh,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this)),this.setTemplate({tag:"button",attributes:{class:["ck","ck-button",e.to("class"),e.if("isEnabled","ck-disabled",(t=>!t)),e.if("isVisible","ck-hidden",(t=>!t)),e.to("isOn",(t=>t?"ck-on":"ck-off")),e.if("withText","ck-button_with-text"),e.if("withKeystroke","ck-button_with-keystroke")],type:e.to("type",(t=>t||"button")),tabindex:e.to("tabindex"),"aria-labelledby":`ck-editor__aria-label_${n}`,"aria-disabled":e.if("isEnabled",!0,(t=>!t)),"aria-pressed":e.to("isOn",(t=>!!this.isToggleable&&String(t)))},children:this.children,on:{mousedown:e.to((t=>{t.preventDefault()})),click:e.to((t=>{this.isEnabled?this.fire("execute"):t.preventDefault()}))}})}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.tooltipView),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}_createTooltipView(){const t=new mh;return t.bind("text").to(this,"_tooltipString"),t.bind("position").to(this,"tooltipPosition"),t}_createLabelView(t){const e=new Fd,n=this.bindTemplate;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:n.to("labelStyle"),id:`ck-editor__aria-label_${t}`},children:[{text:this.bindTemplate.to("label")}]}),e}_createKeystrokeView(){const t=new Fd;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",(t=>mr(t)))}]}),t}_getTooltipString(t,e,n){return t?"string"==typeof t?t:(n&&(n=mr(n)),t instanceof Function?t(e,n):`${e}${n?` (${n})`:""}`):""}}var bh=n(5332),wh={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(bh.Z,wh);bh.Z.locals;class _h extends kh{constructor(t){super(t),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const t=new Fd;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),t}}var Ah=n(6781),Ch={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Ah.Z,Ch);Ah.Z.locals;const vh='';class yh extends kh{constructor(t){super(t),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const t=new hh;return t.content=vh,t.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),t}}var xh=n(7686),Eh={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(xh.Z,Eh);xh.Z.locals;class Dh extends Fd{constructor(t){super(t);const e=this.bindTemplate;this.set("class"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(),this.arrowView=this._createArrowView(),this.keystrokes=new Ba,this.focusTracker=new Na,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",e.to("class"),e.if("isVisible","ck-hidden",(t=>!t)),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",((t,e)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),e())})),this.keystrokes.set("arrowleft",((t,e)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),e())}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(){const t=new kh;return t.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),t.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),t.delegate("execute").to(this),t}_createArrowView(){const t=new kh,e=t.bindTemplate;return t.icon=vh,t.extendTemplate({attributes:{class:"ck-splitbutton__arrow","aria-haspopup":!0,"aria-expanded":e.to("isOn",(t=>String(t)))}}),t.bind("isEnabled").to(this),t.delegate("execute").to(this,"open"),t}}class Mh extends Fd{constructor(t){super(t);const e=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",e.to("position",(t=>`ck-dropdown__panel_${t}`)),e.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:e.to((t=>t.preventDefault()))}})}focus(){this.children.length&&this.children.first.focus()}focusLast(){if(this.children.length){const t=this.children.last;"function"==typeof t.focusLast?t.focusLast():t.focus()}}}var Ih=n(5485),Sh={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Ih.Z,Sh);Ih.Z.locals;function Th({element:t,target:e,positions:n,limiter:o,fitInViewport:i,viewportOffsetConfig:r}){j(e)&&(e=e()),j(o)&&(o=o());const s=function(t){return t&&t.parentNode?t.offsetParent===is.document.body?null:t.offsetParent:null}(t),a=new pa(t);let c;const l={targetRect:new pa(e),elementRect:a,positionedElementAncestor:s};if(o||i){const t=o&&new pa(o).getVisible(),e=i&&function(t){t=Object.assign({top:0,bottom:0,left:0,right:0},t);const e=new pa(is.window);return e.top+=t.top,e.height-=t.top,e.bottom-=t.bottom,e.height-=t.bottom,e}(r);Object.assign(l,{limiterRect:t,viewportRect:e}),c=function(t,e){const{elementRect:n}=e,o=n.getArea(),i=t.map((t=>new Bh(t,e))).filter((t=>!!t.name));let r=0,s=null;for(const t of i){const{_limiterIntersectionArea:e,_viewportIntersectionArea:n}=t;if(e===o)return t;const i=n**2+e**2;i>r&&(r=i,s=t)}return s}(n,l)||new Bh(n[0],l)}else c=new Bh(n[0],l);return c}function Nh(t){const{scrollX:e,scrollY:n}=is.window;return t.clone().moveBy(e,n)}class Bh{constructor(t,e){const n=t(e.targetRect,e.elementRect,e.viewportRect);if(!n)return;const{left:o,top:i,name:r,config:s}=n;Object.assign(this,{name:r,config:s}),this._positioningFunctionCorrdinates={left:o,top:i},this._options=e}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get _limiterIntersectionArea(){const t=this._options.limiterRect;if(t){const e=this._options.viewportRect;if(!e)return t.getIntersectionArea(this._rect);{const n=t.getIntersection(e);if(n)return n.getIntersectionArea(this._rect)}}return 0}get _viewportIntersectionArea(){const t=this._options.viewportRect;return t?t.getIntersectionArea(this._rect):0}get _rect(){return this._cachedRect||(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCorrdinates.left,this._positioningFunctionCorrdinates.top)),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||(this._cachedAbsoluteRect=Nh(this._rect),this._options.positionedElementAncestor&&function(t,e){const n=Nh(new pa(e)),o=ga(e);let i=0,r=0;i-=n.left,r-=n.top,i+=e.scrollLeft,r+=e.scrollTop,i-=o.left,r-=o.top,t.moveBy(i,r)}(this._cachedAbsoluteRect,this._options.positionedElementAncestor)),this._cachedAbsoluteRect}}class zh extends Fd{constructor(t,e,n){super(t);const o=this.bindTemplate;this.buttonView=e,this.panelView=n,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("id"),this.set("panelPosition","auto"),this.keystrokes=new Ba,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",o.to("class"),o.if("isEnabled","ck-disabled",(t=>!t))],id:o.to("id"),"aria-describedby":o.to("ariaDescribedById")},children:[e,n]}),e.extendTemplate({attributes:{class:["ck-dropdown__button"]}})}render(){super.render(),this.listenTo(this.buttonView,"open",(()=>{this.isOpen=!this.isOpen})),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",(()=>{this.isOpen&&("auto"===this.panelPosition?this.panelView.position=zh._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions}).name:this.panelView.position=this.panelPosition)})),this.keystrokes.listenTo(this.element);const t=(t,e)=>{this.isOpen&&(this.buttonView.focus(),this.isOpen=!1,e())};this.keystrokes.set("arrowdown",((t,e)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,e())})),this.keystrokes.set("arrowright",((t,e)=>{this.isOpen&&e()})),this.keystrokes.set("arrowleft",t),this.keystrokes.set("esc",t)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:t,north:e,southEast:n,southWest:o,northEast:i,northWest:r,southMiddleEast:s,southMiddleWest:a,northMiddleEast:c,northMiddleWest:l}=zh.defaultPanelPositions;return"rtl"!==this.locale.uiLanguageDirection?[n,o,s,a,t,i,r,c,l,e]:[o,n,a,s,t,r,i,l,c,e]}}function Ph(t){return!!(t&&t.getClientRects&&t.getClientRects().length)}zh.defaultPanelPositions={south:(t,e)=>({top:t.bottom,left:t.left-(e.width-t.width)/2,name:"s"}),southEast:t=>({top:t.bottom,left:t.left,name:"se"}),southWest:(t,e)=>({top:t.bottom,left:t.left-e.width+t.width,name:"sw"}),southMiddleEast:(t,e)=>({top:t.bottom,left:t.left-(e.width-t.width)/4,name:"sme"}),southMiddleWest:(t,e)=>({top:t.bottom,left:t.left-3*(e.width-t.width)/4,name:"smw"}),north:(t,e)=>({top:t.top-e.height,left:t.left-(e.width-t.width)/2,name:"n"}),northEast:(t,e)=>({top:t.top-e.height,left:t.left,name:"ne"}),northWest:(t,e)=>({top:t.top-e.height,left:t.left-e.width+t.width,name:"nw"}),northMiddleEast:(t,e)=>({top:t.top-e.height,left:t.left-(e.width-t.width)/4,name:"nme"}),northMiddleWest:(t,e)=>({top:t.top-e.height,left:t.left-3*(e.width-t.width)/4,name:"nmw"})},zh._getOptimalPosition=Th;class Lh{constructor(t){if(Object.assign(this,t),t.actions&&t.keystrokeHandler)for(const e in t.actions){let n=t.actions[e];"string"==typeof n&&(n=[n]);for(const o of n)t.keystrokeHandler.set(o,((t,n)=>{this[e](),n()}))}}get first(){return this.focusables.find(Oh)||null}get last(){return this.focusables.filter(Oh).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let t=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find(((e,n)=>{const o=e.element===this.focusTracker.focusedElement;return o&&(t=n),o})),t)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(t){t&&t.focus()}_getFocusableItem(t){const e=this.current,n=this.focusables.length;if(!n)return null;if(null===e)return this[1===t?"first":"last"];let o=(e+n+t)%n;do{const e=this.focusables.get(o);if(Oh(e))return e;o=(o+n+t)%n}while(o!==e);return null}}function Oh(t){return!(!t.focus||!Ph(t.element))}class Rh extends Fd{constructor(t){super(t),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class jh extends Fd{constructor(t){super(t),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function Fh(t){return Array.isArray(t)?{items:t,removeItems:[]}:t?Object.assign({items:[],removeItems:[]},t):{items:[],removeItems:[]}}var Vh=n(5542),Hh={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Vh.Z,Hh);Vh.Z.locals;class Uh extends Fd{constructor(t,e){super(t);const n=this.bindTemplate,o=this.t;this.options=e||{},this.set("ariaLabel",o("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new Na,this.keystrokes=new Ba,this.set("class"),this.set("isCompact",!1),this.itemsView=new Wh(t),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const i="rtl"===t.uiLanguageDirection;this._focusCycler=new Lh({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[i?"arrowright":"arrowleft","arrowup"],focusNext:[i?"arrowleft":"arrowright","arrowdown"]}});const r=["ck","ck-toolbar",n.to("class"),n.if("isCompact","ck-toolbar_compact")];var s;this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:"toolbar","aria-label":n.to("ariaLabel"),style:{maxWidth:n.to("maxWidth")}},children:this.children,on:{mousedown:(s=this,s.bindTemplate.to((t=>{t.target===s.element&&t.preventDefault()})))}}),this._behavior=this.options.shouldGroupWhenFull?new Gh(this):new qh(this)}render(){super.render();for(const t of this.items)this.focusTracker.add(t.element);this.items.on("add",((t,e)=>{this.focusTracker.add(e.element)})),this.items.on("remove",((t,e)=>{this.focusTracker.remove(e.element)})),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(t,e){const n=Fh(t),o=n.items.filter(((t,o,i)=>"|"===t||-1===n.removeItems.indexOf(t)&&("-"===t?!this.options.shouldGroupWhenFull||(l("toolbarview-line-break-ignored-when-grouping-items",i),!1):!!e.has(t)||(l("toolbarview-item-unavailable",{name:t}),!1)))),i=this._cleanSeparators(o).map((t=>"|"===t?new Rh:"-"===t?new jh:e.create(t)));this.items.addMany(i)}_cleanSeparators(t){const e=t=>"-"!==t&&"|"!==t,n=t.length,o=t.findIndex(e),i=n-t.slice().reverse().findIndex(e);return t.slice(o,i).filter(((t,n,o)=>{if(e(t))return!0;return!(n>0&&o[n-1]===t)}))}}class Wh extends Fd{constructor(t){super(t),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class qh{constructor(t){const e=t.bindTemplate;t.set("isVertical",!1),t.itemsView.children.bindTo(t.items).using((t=>t)),t.focusables.bindTo(t.items).using((t=>t)),t.extendTemplate({attributes:{class:[e.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Gh{constructor(t){this.view=t,this.viewChildren=t.children,this.viewFocusables=t.focusables,this.viewItemsView=t.itemsView,this.viewFocusTracker=t.focusTracker,this.viewLocale=t.locale,this.ungroupedItems=t.createCollection(),this.groupedItems=t.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,t.itemsView.children.bindTo(this.ungroupedItems).using((t=>t)),this.ungroupedItems.on("add",this._updateFocusCycleableItems.bind(this)),this.ungroupedItems.on("remove",this._updateFocusCycleableItems.bind(this)),t.children.on("add",this._updateFocusCycleableItems.bind(this)),t.children.on("remove",this._updateFocusCycleableItems.bind(this)),t.items.on("change",((t,e)=>{const n=e.index;for(const t of e.removed)n>=this.ungroupedItems.length?this.groupedItems.remove(t):this.ungroupedItems.remove(t);for(let t=n;tthis.ungroupedItems.length?this.groupedItems.add(o,t-this.ungroupedItems.length):this.ungroupedItems.add(o,t)}this._updateGrouping()})),t.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(t){this.viewElement=t.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(t)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!Ph(this.viewElement))return void(this.shouldUpdateGroupingOnNextResize=!0);const t=this.groupedItems.length;let e;for(;this._areItemsOverflowing;)this._groupLastItem(),e=!0;if(!e&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==t&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const t=this.viewElement,e=this.viewLocale.uiLanguageDirection,n=new pa(t.lastChild),o=new pa(t);if(!this.cachedPadding){const n=is.window.getComputedStyle(t),o="ltr"===e?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(n[o])}return"ltr"===e?n.right>o.right-this.cachedPadding:n.left{t&&t===e.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),t=e.contentRect.width)})),this._updateGrouping()}_enableGroupingOnMaxWidthChange(t){t.on("change:maxWidth",(()=>{this._updateGrouping()}))}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new Rh),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const t=this.viewLocale,e=t.t,n=nu(t);return n.class="ck-toolbar__grouped-dropdown",n.panelPosition="ltr"===t.uiLanguageDirection?"sw":"se",ou(n,[]),n.buttonView.set({label:e("Show more items"),tooltip:!0,tooltipPosition:"rtl"===t.uiLanguageDirection?"se":"sw",icon:Nd}),n.toolbarView.items.bindTo(this.groupedItems).using((t=>t)),n}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map((t=>{this.viewFocusables.add(t)})),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}var Yh=n(1046),Kh={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Yh.Z,Kh);Yh.Z.locals;class Qh extends Fd{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new Na,this.keystrokes=new Ba,this._focusCycler=new Lh({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"]},children:this.items})}render(){super.render();for(const t of this.items)this.focusTracker.add(t.element);this.items.on("add",((t,e)=>{this.focusTracker.add(e.element)})),this.items.on("remove",((t,e)=>{this.focusTracker.remove(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class $h extends Fd{constructor(t){super(t),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item"]},children:this.children})}focus(){this.children.first.focus()}}class Zh extends Fd{constructor(t){super(t),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}var Jh=n(7339),Xh={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Jh.Z,Xh);Jh.Z.locals;var tu=n(3949),eu={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(tu.Z,eu);tu.Z.locals;function nu(t,e=yh){const n=new e(t),o=new Mh(t),i=new zh(t,n,o);return n.bind("isEnabled").to(i),n instanceof yh?n.bind("isOn").to(i,"isOpen"):n.arrowView.bind("isOn").to(i,"isOpen"),function(t){(function(t){t.on("render",(()=>{zd({emitter:t,activator:()=>t.isOpen,callback:()=>{t.isOpen=!1},contextElements:[t.element]})}))})(t),function(t){t.on("execute",(e=>{e.source instanceof _h||(t.isOpen=!1)}))}(t),function(t){t.keystrokes.set("arrowdown",((e,n)=>{t.isOpen&&(t.panelView.focus(),n())})),t.keystrokes.set("arrowup",((e,n)=>{t.isOpen&&(t.panelView.focusLast(),n())}))}(t)}(i),i}function ou(t,e){const n=t.locale,o=n.t,i=t.toolbarView=new Uh(n);i.set("ariaLabel",o("Dropdown toolbar")),t.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),e.map((t=>i.items.add(t))),t.panelView.children.add(i),i.items.delegate("execute").to(t)}function iu(t,e){const n=t.locale,o=t.listView=new Qh(n);o.items.bindTo(e).using((({type:t,model:e})=>{if("separator"===t)return new Zh(n);if("button"===t||"switchbutton"===t){const o=new $h(n);let i;return i="button"===t?new kh(n):new _h(n),i.bind(...Object.keys(e)).to(e),i.delegate("execute").to(o),o.children.add(i),o}})),t.panelView.children.add(o),o.items.delegate("execute").to(t)}var ru=n(9688),su={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(ru.Z,su);ru.Z.locals;class au extends Fd{constructor(t){super(t),this.body=new ch(t)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}var cu=n(3662),lu={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(cu.Z,lu);cu.Z.locals;class du extends Fd{constructor(t){super(t),this.set("text"),this.set("for"),this.id=`ck-editor__label_${r()}`;const e=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:e.to("for")},children:[{text:e.to("text")}]})}}class hu extends Fd{constructor(t,e,n){super(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:t.contentLanguage,dir:t.contentLanguageDirection}}),this.name=null,this.set("isFocused",!1),this._editableElement=n,this._hasExternalElement=!!this._editableElement,this._editingView=e}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",(()=>this._updateIsFocusedClasses())),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}_updateIsFocusedClasses(){const t=this._editingView;function e(e){t.change((n=>{const o=t.document.getRoot(e.name);n.addClass(e.isFocused?"ck-focused":"ck-blurred",o),n.removeClass(e.isFocused?"ck-blurred":"ck-focused",o)}))}t.isRenderingInProgress?function n(o){t.once("change:isRenderingInProgress",((t,i,r)=>{r?n(o):e(o)}))}(this):e(this)}}class uu extends hu{constructor(t,e,n){super(t,e,n),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const t=this._editingView,e=this.t;t.change((n=>{const o=t.document.getRoot(this.name);n.setAttribute("aria-label",e("Rich Text Editor, %0",this.name),o)}))}}var gu=n(8847),mu={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(gu.Z,mu);gu.Z.locals;var pu=n(4879),fu={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(pu.Z,fu);pu.Z.locals;class ku extends Fd{constructor(t){super(t),this.set("value"),this.set("id"),this.set("placeholder"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById"),this.focusTracker=new Na,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0),this.set("inputMode","text");const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",e.if("isFocused","ck-input_focused"),e.if("isEmpty","ck-input-text_empty"),e.if("hasError","ck-error")],id:e.to("id"),placeholder:e.to("placeholder"),readonly:e.to("isReadOnly"),inputmode:e.to("inputMode"),"aria-invalid":e.if("hasError",!0),"aria-describedby":e.to("ariaDescribedById")},on:{input:e.to(((...t)=>{this.fire("input",...t),this._updateIsEmpty()})),change:e.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",((t,e,n)=>{this._setDomElementValue(n),this._updateIsEmpty()}))}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(t){this.element.value=t||0===t?t:""}}class bu extends ku{constructor(t){super(t),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}var wu=n(2577),_u={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(wu.Z,_u);wu.Z.locals;class Au extends Fd{constructor(t,e){super(t);const n=`ck-labeled-field-view-${r()}`,o=`ck-labeled-field-view-status-${r()}`;this.fieldView=e(this,n,o),this.set("label"),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class"),this.set("placeholder"),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(o),this.bind("_statusText").to(this,"errorText",this,"infoText",((t,e)=>t||e));const i=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",i.to("class"),i.if("isEnabled","ck-disabled",(t=>!t)),i.if("isEmpty","ck-labeled-field-view_empty"),i.if("isFocused","ck-labeled-field-view_focused"),i.if("placeholder","ck-labeled-field-view_placeholder"),i.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:[this.fieldView,this.labelView]},this.statusView]})}_createLabelView(t){const e=new du(this.locale);return e.for=t,e.bind("text").to(this,"label"),e}_createStatusView(t){const e=new Fd(this.locale),n=this.bindTemplate;return e.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",n.if("errorText","ck-labeled-field-view__status_error"),n.if("_statusText","ck-hidden",(t=>!t))],id:t,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),e}focus(){this.fieldView.focus()}}function Cu(t,e,n){const o=new bu(t.locale);return o.set({id:e,ariaDescribedById:n}),o.bind("isReadOnly").to(t,"isEnabled",(t=>!t)),o.bind("hasError").to(t,"errorText",(t=>!!t)),o.on("input",(()=>{t.errorText=null})),t.bind("isEmpty","isFocused","placeholder").to(o),o}class vu extends Lo{static get pluginName(){return"Notification"}init(){this.on("show:warning",((t,e)=>{window.alert(e.message)}),{priority:"lowest"})}showSuccess(t,e={}){this._showNotification({message:t,type:"success",namespace:e.namespace,title:e.title})}showInfo(t,e={}){this._showNotification({message:t,type:"info",namespace:e.namespace,title:e.title})}showWarning(t,e={}){this._showNotification({message:t,type:"warning",namespace:e.namespace,title:e.title})}_showNotification(t){const e=`show:${t.type}`+(t.namespace?`:${t.namespace}`:"");this.fire(e,{message:t.message,type:t.type,title:t.title||""})}}class yu{constructor(t,e){e&&Jt(this,e),t&&this.set(t)}}function xu(t){return e=>e+t}he(yu,re);var Eu=n(8793),Du={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Eu.Z,Du);Eu.Z.locals;const Mu=xu("px"),Iu=is.document.body;class Su extends Fd{constructor(t){super(t);const e=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class"),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",e.to("position",(t=>`ck-balloon-panel_${t}`)),e.if("isVisible","ck-balloon-panel_visible"),e.if("withArrow","ck-balloon-panel_with-arrow"),e.to("class")],style:{top:e.to("top",Mu),left:e.to("left",Mu)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(t){this.show();const e=Su.defaultPositions,n=Object.assign({},{element:this.element,positions:[e.southArrowNorth,e.southArrowNorthMiddleWest,e.southArrowNorthMiddleEast,e.southArrowNorthWest,e.southArrowNorthEast,e.northArrowSouth,e.northArrowSouthMiddleWest,e.northArrowSouthMiddleEast,e.northArrowSouthWest,e.northArrowSouthEast,e.viewportStickyNorth],limiter:Iu,fitInViewport:!0},t),o=Su._getOptimalPosition(n),i=parseInt(o.left),r=parseInt(o.top),{name:s,config:a={}}=o,{withArrow:c=!0}=a;Object.assign(this,{top:r,left:i,position:s,withArrow:c})}pin(t){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(t):this._stopPinning()},this._startPinning(t),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(t){this.attachTo(t);const e=Tu(t.target),n=t.limiter?Tu(t.limiter):Iu;this.listenTo(is.document,"scroll",((o,i)=>{const r=i.target,s=e&&r.contains(e),a=n&&r.contains(n);!s&&!a&&e&&n||this.attachTo(t)}),{useCapture:!0}),this.listenTo(is.window,"resize",(()=>{this.attachTo(t)}))}_stopPinning(){this.stopListening(is.document,"scroll"),this.stopListening(is.window,"resize")}}function Tu(t){return vo(t)?t:ua(t)?t.commonAncestorContainer:"function"==typeof t?Tu(t()):null}function Nu({horizontalOffset:t=Su.arrowHorizontalOffset,verticalOffset:e=Su.arrowVerticalOffset,stickyVerticalOffset:n=Su.stickyVerticalOffset,config:o}={}){return{northWestArrowSouthWest:(e,n)=>({top:i(e,n),left:e.left-t,name:"arrow_sw",...o&&{config:o}}),northWestArrowSouthMiddleWest:(e,n)=>({top:i(e,n),left:e.left-.25*n.width-t,name:"arrow_smw",...o&&{config:o}}),northWestArrowSouth:(t,e)=>({top:i(t,e),left:t.left-e.width/2,name:"arrow_s",...o&&{config:o}}),northWestArrowSouthMiddleEast:(e,n)=>({top:i(e,n),left:e.left-.75*n.width+t,name:"arrow_sme",...o&&{config:o}}),northWestArrowSouthEast:(e,n)=>({top:i(e,n),left:e.left-n.width+t,name:"arrow_se",...o&&{config:o}}),northArrowSouthWest:(e,n)=>({top:i(e,n),left:e.left+e.width/2-t,name:"arrow_sw",...o&&{config:o}}),northArrowSouthMiddleWest:(e,n)=>({top:i(e,n),left:e.left+e.width/2-.25*n.width-t,name:"arrow_smw",...o&&{config:o}}),northArrowSouth:(t,e)=>({top:i(t,e),left:t.left+t.width/2-e.width/2,name:"arrow_s",...o&&{config:o}}),northArrowSouthMiddleEast:(e,n)=>({top:i(e,n),left:e.left+e.width/2-.75*n.width+t,name:"arrow_sme",...o&&{config:o}}),northArrowSouthEast:(e,n)=>({top:i(e,n),left:e.left+e.width/2-n.width+t,name:"arrow_se",...o&&{config:o}}),northEastArrowSouthWest:(e,n)=>({top:i(e,n),left:e.right-t,name:"arrow_sw",...o&&{config:o}}),northEastArrowSouthMiddleWest:(e,n)=>({top:i(e,n),left:e.right-.25*n.width-t,name:"arrow_smw",...o&&{config:o}}),northEastArrowSouth:(t,e)=>({top:i(t,e),left:t.right-e.width/2,name:"arrow_s",...o&&{config:o}}),northEastArrowSouthMiddleEast:(e,n)=>({top:i(e,n),left:e.right-.75*n.width+t,name:"arrow_sme",...o&&{config:o}}),northEastArrowSouthEast:(e,n)=>({top:i(e,n),left:e.right-n.width+t,name:"arrow_se",...o&&{config:o}}),southWestArrowNorthWest:(e,n)=>({top:r(e),left:e.left-t,name:"arrow_nw",...o&&{config:o}}),southWestArrowNorthMiddleWest:(e,n)=>({top:r(e),left:e.left-.25*n.width-t,name:"arrow_nmw",...o&&{config:o}}),southWestArrowNorth:(t,e)=>({top:r(t),left:t.left-e.width/2,name:"arrow_n",...o&&{config:o}}),southWestArrowNorthMiddleEast:(e,n)=>({top:r(e),left:e.left-.75*n.width+t,name:"arrow_nme",...o&&{config:o}}),southWestArrowNorthEast:(e,n)=>({top:r(e),left:e.left-n.width+t,name:"arrow_ne",...o&&{config:o}}),southArrowNorthWest:(e,n)=>({top:r(e),left:e.left+e.width/2-t,name:"arrow_nw",...o&&{config:o}}),southArrowNorthMiddleWest:(e,n)=>({top:r(e),left:e.left+e.width/2-.25*n.width-t,name:"arrow_nmw",...o&&{config:o}}),southArrowNorth:(t,e)=>({top:r(t),left:t.left+t.width/2-e.width/2,name:"arrow_n",...o&&{config:o}}),southArrowNorthMiddleEast:(e,n)=>({top:r(e),left:e.left+e.width/2-.75*n.width+t,name:"arrow_nme",...o&&{config:o}}),southArrowNorthEast:(e,n)=>({top:r(e),left:e.left+e.width/2-n.width+t,name:"arrow_ne",...o&&{config:o}}),southEastArrowNorthWest:(e,n)=>({top:r(e),left:e.right-t,name:"arrow_nw",...o&&{config:o}}),southEastArrowNorthMiddleWest:(e,n)=>({top:r(e),left:e.right-.25*n.width-t,name:"arrow_nmw",...o&&{config:o}}),southEastArrowNorth:(t,e)=>({top:r(t),left:t.right-e.width/2,name:"arrow_n",...o&&{config:o}}),southEastArrowNorthMiddleEast:(e,n)=>({top:r(e),left:e.right-.75*n.width+t,name:"arrow_nme",...o&&{config:o}}),southEastArrowNorthEast:(e,n)=>({top:r(e),left:e.right-n.width+t,name:"arrow_ne",...o&&{config:o}}),viewportStickyNorth:(t,e,i)=>t.getIntersection(i)?{top:i.top+n,left:t.left+t.width/2-e.width/2,name:"arrowless",config:{withArrow:!1,...o}}:null};function i(t,n){return t.top-n.height-e}function r(t){return t.bottom+e}}Su.arrowHorizontalOffset=25,Su.arrowVerticalOffset=10,Su.stickyVerticalOffset=20,Su._getOptimalPosition=Th,Su.defaultPositions=Nu();var Bu=n(4650),zu={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Bu.Z,zu);Bu.Z.locals;var Pu=n(7676),Lu={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Pu.Z,Lu);Pu.Z.locals;const Ou=xu("px");class Ru extends ue{static get pluginName(){return"ContextualBalloon"}constructor(t){super(t),this.positionLimiter=()=>{const t=this.editor.editing.view,e=t.document.selection.editableElement;return e?t.domConverter.mapViewToDom(e.root):null},this.set("visibleView",null),this.view=new Su(t.locale),t.ui.view.body.add(this.view),t.ui.focusTracker.add(this.view.element),this._viewToStack=new Map,this._idToStack=new Map,this.set("_numberOfStacks",0),this.set("_singleViewMode",!1),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}destroy(){super.destroy(),this.view.destroy(),this._rotatorView.destroy(),this._fakePanelsView.destroy()}hasView(t){return Array.from(this._viewToStack.keys()).includes(t)}add(t){if(this.hasView(t.view))throw new c("contextualballoon-add-view-exist",[this,t]);const e=t.stackId||"main";if(!this._idToStack.has(e))return this._idToStack.set(e,new Map([[t.view,t]])),this._viewToStack.set(t.view,this._idToStack.get(e)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!t.singleViewMode||this.showStack(e));const n=this._idToStack.get(e);t.singleViewMode&&this.showStack(e),n.set(t.view,t),this._viewToStack.set(t.view,n),n===this._visibleStack&&this._showView(t)}remove(t){if(!this.hasView(t))throw new c("contextualballoon-remove-view-not-exist",[this,t]);const e=this._viewToStack.get(t);this._singleViewMode&&this.visibleView===t&&(this._singleViewMode=!1),this.visibleView===t&&(1===e.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(e.values())[e.size-2])),1===e.size?(this._idToStack.delete(this._getStackId(e)),this._numberOfStacks=this._idToStack.size):e.delete(t),this._viewToStack.delete(t)}updatePosition(t){t&&(this._visibleStack.get(this.visibleView).position=t),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(t){this.visibleStack=t;const e=this._idToStack.get(t);if(!e)throw new c("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==e&&this._showView(Array.from(e.values()).pop())}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(t){return Array.from(this._idToStack.entries()).find((e=>e[1]===t))[0]}_showNextStack(){const t=Array.from(this._idToStack.values());let e=t.indexOf(this._visibleStack)+1;t[e]||(e=0),this.showStack(this._getStackId(t[e]))}_showPrevStack(){const t=Array.from(this._idToStack.values());let e=t.indexOf(this._visibleStack)-1;t[e]||(e=t.length-1),this.showStack(this._getStackId(t[e]))}_createRotatorView(){const t=new ju(this.editor.locale),e=this.editor.locale.t;return this.view.content.add(t),t.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",((t,e)=>!e&&t>1)),t.on("change:isNavigationVisible",(()=>this.updatePosition()),{priority:"low"}),t.bind("counter").to(this,"visibleView",this,"_numberOfStacks",((t,n)=>{if(n<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return e("%0 of %1",[o,n])})),t.buttonNextView.on("execute",(()=>{t.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()})),t.buttonPrevView.on("execute",(()=>{t.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()})),t}_createFakePanelsView(){const t=new Fu(this.editor.locale,this.view);return t.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",((t,e)=>!e&&t>=2?Math.min(t-1,2):0)),t.listenTo(this.view,"change:top",(()=>t.updatePosition())),t.listenTo(this.view,"change:left",(()=>t.updatePosition())),this.editor.ui.view.body.add(t),t}_showView({view:t,balloonClassName:e="",withArrow:n=!0,singleViewMode:o=!1}){this.view.class=e,this.view.withArrow=n,this._rotatorView.showView(t),this.visibleView=t,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),o&&(this._singleViewMode=!0)}_getBalloonPosition(){let t=Array.from(this._visibleStack.values()).pop().position;return t&&(t.limiter||(t=Object.assign({},t,{limiter:this.positionLimiter})),t=Object.assign({},t,{viewportOffsetConfig:this.editor.ui.viewportOffset})),t}}class ju extends Fd{constructor(t){super(t);const e=t.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new Na,this.buttonPrevView=this._createButtonView(e("Previous"),''),this.buttonNextView=this._createButtonView(e("Next"),''),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",n.to("isNavigationVisible",(t=>t?"":"ck-hidden"))]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(t){this.hideView(),this.content.add(t)}hideView(){this.content.clear()}_createButtonView(t,e){const n=new kh(this.locale);return n.set({label:t,icon:e,tooltip:!0}),n}}class Fu extends Fd{constructor(t,e){super(t);const n=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=e,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",n.to("numberOfPanels",(t=>t?"":"ck-hidden"))],style:{top:n.to("top",Ou),left:n.to("left",Ou),width:n.to("width",Ou),height:n.to("height",Ou)}},children:this.content}),this.on("change:numberOfPanels",((t,e,n,o)=>{n>o?this._addPanels(n-o):this._removePanels(o-n),this.updatePosition()}))}_addPanels(t){for(;t--;){const t=new Fd;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(t){for(;t--;){const t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:t,left:e}=this._balloonPanelView,{width:n,height:o}=new pa(this._balloonPanelView.element);Object.assign(this,{top:t,left:e,width:n,height:o})}}}var Vu=n(5868),Hu={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Vu.Z,Hu);Vu.Z.locals,xu("px");const Uu=xu("px");class Wu extends ue{static get pluginName(){return"BalloonToolbar"}static get requires(){return[Ru]}constructor(t){super(t),this._balloonConfig=Fh(t.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new Na,t.ui.once("ready",(()=>{this.focusTracker.add(t.ui.getEditableElement()),this.focusTracker.add(this.toolbarView.element)})),this._resizeObserver=null,this._balloon=t.plugins.get(Ru),this._fireSelectionChangeDebounced=sa((()=>this.fire("_selectionChangeDebounced")),200),this.decorate("show")}init(){const t=this.editor,e=t.model.document.selection;this.listenTo(this.focusTracker,"change:isFocused",((t,e,n)=>{const o=this._balloon.visibleView===this.toolbarView;!n&&o?this.hide():n&&this.show()})),this.listenTo(e,"change:range",((t,n)=>{(n.directChange||e.isCollapsed)&&this.hide(),this._fireSelectionChangeDebounced()})),this.listenTo(this,"_selectionChangeDebounced",(()=>{this.editor.editing.view.document.isFocused&&this.show()})),this._balloonConfig.shouldNotGroupWhenFull||this.listenTo(t,"ready",(()=>{const e=t.ui.view.editable.element;this._resizeObserver=new ba(e,(()=>{this.toolbarView.maxWidth=Uu(.9*new pa(e).width)}))})),this.listenTo(this.toolbarView,"groupedItemsUpdate",(()=>{this._updatePosition()}))}afterInit(){const t=this.editor.ui.componentFactory;this.toolbarView.fillFromConfig(this._balloonConfig,t)}_createToolbarView(){const t=!this._balloonConfig.shouldNotGroupWhenFull,e=new Uh(this.editor.locale,{shouldGroupWhenFull:t,isFloating:!0});return e.render(),e}show(){const t=this.editor,e=t.model.document.selection,n=t.model.schema;this._balloon.hasView(this.toolbarView)||e.isCollapsed||function(t,e){if(1===t.rangeCount)return!1;return[...t.getRanges()].every((t=>{const n=t.getContainedElement();return n&&e.isSelectable(n)}))}(e,n)||Array.from(this.toolbarView.items).every((t=>void 0!==t.isEnabled&&!t.isEnabled))||(this.listenTo(this.editor.ui,"update",(()=>{this._updatePosition()})),this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"}))}hide(){this._balloon.hasView(this.toolbarView)&&(this.stopListening(this.editor.ui,"update"),this._balloon.remove(this.toolbarView))}_getBalloonPositionData(){const t=this.editor.editing.view,e=t.document,n=e.selection,o=e.selection.isBackward;return{target:()=>{const e=o?n.getFirstRange():n.getLastRange(),i=pa.getDomRangeRects(t.domConverter.viewRangeToDom(e));return o?i[0]:(i.length>1&&0===i[i.length-1].width&&i.pop(),i[i.length-1])},positions:this._getBalloonPositions(o)}}_updatePosition(){this._balloon.updatePosition(this._getBalloonPositionData())}destroy(){super.destroy(),this.stopListening(),this._fireSelectionChangeDebounced.cancel(),this.toolbarView.destroy(),this.focusTracker.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getBalloonPositions(t){const e=sr.isSafari&&sr.isiOS?Nu({verticalOffset:Math.max(Su.arrowVerticalOffset,Math.round(20/is.window.visualViewport.scale))}):Su.defaultPositions;return t?[e.northWestArrowSouth,e.northWestArrowSouthWest,e.northWestArrowSouthEast,e.northWestArrowSouthMiddleEast,e.northWestArrowSouthMiddleWest,e.southWestArrowNorth,e.southWestArrowNorthWest,e.southWestArrowNorthEast,e.southWestArrowNorthMiddleWest,e.southWestArrowNorthMiddleEast]:[e.southEastArrowNorth,e.southEastArrowNorthEast,e.southEastArrowNorthWest,e.southEastArrowNorthMiddleEast,e.southEastArrowNorthMiddleWest,e.northEastArrowSouth,e.northEastArrowSouthEast,e.northEastArrowSouthWest,e.northEastArrowSouthMiddleEast,e.northEastArrowSouthMiddleWest]}}var qu=n(9695),Gu={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(qu.Z,Gu);qu.Z.locals;const Yu=xu("px");class Ku extends kh{constructor(t){super(t);const e=this.bindTemplate;this.isVisible=!1,this.isToggleable=!0,this.set("top",0),this.set("left",0),this.extendTemplate({attributes:{class:"ck-block-toolbar-button",style:{top:e.to("top",(t=>Yu(t))),left:e.to("left",(t=>Yu(t)))}}})}}const Qu=xu("px");var $u=n(4717),Zu={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()($u.Z,Zu);$u.Z.locals;const Ju=new WeakMap;function Xu(t){const{view:e,element:n,text:o,isDirectHost:i=!0,keepOnFocus:r=!1}=t,s=e.document;Ju.has(s)||(Ju.set(s,new Map),s.registerPostFixer((t=>eg(s,t)))),Ju.get(s).set(n,{text:o,isDirectHost:i,keepOnFocus:r,hostElement:i?n:null}),e.change((t=>eg(s,t)))}function tg(t,e){return!!e.hasClass("ck-placeholder")&&(t.removeClass("ck-placeholder",e),!0)}function eg(t,e){const n=Ju.get(t),o=[];let i=!1;for(const[t,r]of n)r.isDirectHost&&(o.push(t),ng(e,t,r)&&(i=!0));for(const[t,r]of n){if(r.isDirectHost)continue;const n=og(t);n&&(o.includes(n)||(r.hostElement=n,ng(e,t,r)&&(i=!0)))}return i}function ng(t,e,n){const{text:o,isDirectHost:i,hostElement:r}=n;let s=!1;r.getAttribute("data-placeholder")!==o&&(t.setAttribute("data-placeholder",o,r),s=!0);return(i||1==e.childCount)&&function(t,e){if(!t.isAttached())return!1;const n=Array.from(t.getChildren()).some((t=>!t.is("uiElement")));if(n)return!1;if(e)return!0;const o=t.document;if(!o.isFocused)return!0;const i=o.selection.anchor;return i&&i.parent!==t}(r,n.keepOnFocus)?function(t,e){return!e.hasClass("ck-placeholder")&&(t.addClass("ck-placeholder",e),!0)}(t,r)&&(s=!0):tg(t,r)&&(s=!0),s}function og(t){if(t.childCount){const e=t.getChild(0);if(e.is("element")&&!e.is("uiElement")&&!e.is("attributeElement"))return e}return null}const ig=new Map;function rg(t,e,n){let o=ig.get(t);o||(o=new Map,ig.set(t,o)),o.set(e,n)}function sg(t){return[t]}function ag(t,e,n={}){const o=function(t,e){const n=ig.get(t);return n&&n.has(e)?n.get(e):sg}(t.constructor,e.constructor);try{return o(t=t.clone(),e,n)}catch(t){throw t}}function cg(t,e,n){t=t.slice(),e=e.slice();const o=new lg(n.document,n.useRelations,n.forceWeakRemove);o.setOriginalOperations(t),o.setOriginalOperations(e);const i=o.originalOperations;if(0==t.length||0==e.length)return{operationsA:t,operationsB:e,originalOperations:i};const r=new WeakMap;for(const e of t)r.set(e,0);const s={nextBaseVersionA:t[t.length-1].baseVersion+1,nextBaseVersionB:e[e.length-1].baseVersion+1,originalOperationsACount:t.length,originalOperationsBCount:e.length};let a=0;for(;a{if(t.key===e.key&&t.range.start.hasSameParentAs(e.range.start)){const o=t.range.getDifference(e.range).map((e=>new Al(e,t.key,t.oldValue,t.newValue,0))),i=t.range.getIntersection(e.range);return i&&n.aIsStrong&&o.push(new Al(i,e.key,e.newValue,t.newValue,0)),0==o.length?[new Zl(0)]:o}return[t]})),rg(Al,yl,((t,e)=>{if(t.range.start.hasSameParentAs(e.position)&&t.range.containsPosition(e.position)){const n=t.range._getTransformedByInsertion(e.position,e.howMany,!e.shouldReceiveAttributes).map((e=>new Al(e,t.key,t.oldValue,t.newValue,t.baseVersion)));if(e.shouldReceiveAttributes){const o=ug(e,t.key,t.oldValue);o&&n.unshift(o)}return n}return t.range=t.range._getTransformedByInsertion(e.position,e.howMany,!1)[0],[t]})),rg(Al,Ml,((t,e)=>{const n=[];t.range.start.hasSameParentAs(e.deletionPosition)&&(t.range.containsPosition(e.deletionPosition)||t.range.start.isEqual(e.deletionPosition))&&n.push(Ka._createFromPositionAndShift(e.graveyardPosition,1));const o=t.range._getTransformedByMergeOperation(e);return o.isCollapsed||n.push(o),n.map((e=>new Al(e,t.key,t.oldValue,t.newValue,t.baseVersion)))})),rg(Al,vl,((t,e)=>{const n=function(t,e){const n=Ka._createFromPositionAndShift(e.sourcePosition,e.howMany);let o=null,i=[];n.containsRange(t,!0)?o=t:t.start.hasSameParentAs(n.start)?(i=t.getDifference(n),o=t.getIntersection(n)):i=[t];const r=[];for(let t of i){t=t._getTransformedByDeletion(e.sourcePosition,e.howMany);const n=e.getMovedRangeStart(),o=t.start.hasSameParentAs(n);t=t._getTransformedByInsertion(n,e.howMany,o),r.push(...t)}o&&r.push(o._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany,!1)[0]);return r}(t.range,e);return n.map((e=>new Al(e,t.key,t.oldValue,t.newValue,t.baseVersion)))})),rg(Al,Il,((t,e)=>{if(t.range.end.isEqual(e.insertionPosition))return e.graveyardPosition||t.range.end.offset++,[t];if(t.range.start.hasSameParentAs(e.splitPosition)&&t.range.containsPosition(e.splitPosition)){const n=t.clone();return n.range=new Ka(e.moveTargetPosition.clone(),t.range.end._getCombined(e.splitPosition,e.moveTargetPosition)),t.range.end=e.splitPosition.clone(),t.range.end.stickiness="toPrevious",[t,n]}return t.range=t.range._getTransformedBySplitOperation(e),[t]})),rg(yl,Al,((t,e)=>{const n=[t];if(t.shouldReceiveAttributes&&t.position.hasSameParentAs(e.range.start)&&e.range.containsPosition(t.position)){const o=ug(t,e.key,e.newValue);o&&n.push(o)}return n})),rg(yl,yl,((t,e,n)=>(t.position.isEqual(e.position)&&n.aIsStrong||(t.position=t.position._getTransformedByInsertOperation(e)),[t]))),rg(yl,vl,((t,e)=>(t.position=t.position._getTransformedByMoveOperation(e),[t]))),rg(yl,Il,((t,e)=>(t.position=t.position._getTransformedBySplitOperation(e),[t]))),rg(yl,Ml,((t,e)=>(t.position=t.position._getTransformedByMergeOperation(e),[t]))),rg(xl,yl,((t,e)=>(t.oldRange&&(t.oldRange=t.oldRange._getTransformedByInsertOperation(e)[0]),t.newRange&&(t.newRange=t.newRange._getTransformedByInsertOperation(e)[0]),[t]))),rg(xl,xl,((t,e,n)=>{if(t.name==e.name){if(!n.aIsStrong)return[new Zl(0)];t.oldRange=e.newRange?e.newRange.clone():null}return[t]})),rg(xl,Ml,((t,e)=>(t.oldRange&&(t.oldRange=t.oldRange._getTransformedByMergeOperation(e)),t.newRange&&(t.newRange=t.newRange._getTransformedByMergeOperation(e)),[t]))),rg(xl,vl,((t,e,n)=>{if(t.oldRange&&(t.oldRange=Ka._createFromRanges(t.oldRange._getTransformedByMoveOperation(e))),t.newRange){if(n.abRelation){const o=Ka._createFromRanges(t.newRange._getTransformedByMoveOperation(e));if("left"==n.abRelation.side&&e.targetPosition.isEqual(t.newRange.start))return t.newRange.start.path=n.abRelation.path,t.newRange.end=o.end,[t];if("right"==n.abRelation.side&&e.targetPosition.isEqual(t.newRange.end))return t.newRange.start=o.start,t.newRange.end.path=n.abRelation.path,[t]}t.newRange=Ka._createFromRanges(t.newRange._getTransformedByMoveOperation(e))}return[t]})),rg(xl,Il,((t,e,n)=>{if(t.oldRange&&(t.oldRange=t.oldRange._getTransformedBySplitOperation(e)),t.newRange){if(n.abRelation){const o=t.newRange._getTransformedBySplitOperation(e);return t.newRange.start.isEqual(e.splitPosition)&&n.abRelation.wasStartBeforeMergedElement?t.newRange.start=Wa._createAt(e.insertionPosition):t.newRange.start.isEqual(e.splitPosition)&&!n.abRelation.wasInLeftElement&&(t.newRange.start=Wa._createAt(e.moveTargetPosition)),t.newRange.end.isEqual(e.splitPosition)&&n.abRelation.wasInRightElement?t.newRange.end=Wa._createAt(e.moveTargetPosition):t.newRange.end.isEqual(e.splitPosition)&&n.abRelation.wasEndBeforeMergedElement?t.newRange.end=Wa._createAt(e.insertionPosition):t.newRange.end=o.end,[t]}t.newRange=t.newRange._getTransformedBySplitOperation(e)}return[t]})),rg(Ml,yl,((t,e)=>(t.sourcePosition.hasSameParentAs(e.position)&&(t.howMany+=e.howMany),t.sourcePosition=t.sourcePosition._getTransformedByInsertOperation(e),t.targetPosition=t.targetPosition._getTransformedByInsertOperation(e),[t]))),rg(Ml,Ml,((t,e,n)=>{if(t.sourcePosition.isEqual(e.sourcePosition)&&t.targetPosition.isEqual(e.targetPosition)){if(n.bWasUndone){const n=e.graveyardPosition.path.slice();return n.push(0),t.sourcePosition=new Wa(e.graveyardPosition.root,n),t.howMany=0,[t]}return[new Zl(0)]}if(t.sourcePosition.isEqual(e.sourcePosition)&&!t.targetPosition.isEqual(e.targetPosition)&&!n.bWasUndone&&"splitAtSource"!=n.abRelation){const o="$graveyard"==t.targetPosition.root.rootName,i="$graveyard"==e.targetPosition.root.rootName,r=o&&!i;if(i&&!o||!r&&n.aIsStrong){const n=e.targetPosition._getTransformedByMergeOperation(e),o=t.targetPosition._getTransformedByMergeOperation(e);return[new vl(n,t.howMany,o,0)]}return[new Zl(0)]}return t.sourcePosition.hasSameParentAs(e.targetPosition)&&(t.howMany+=e.howMany),t.sourcePosition=t.sourcePosition._getTransformedByMergeOperation(e),t.targetPosition=t.targetPosition._getTransformedByMergeOperation(e),t.graveyardPosition.isEqual(e.graveyardPosition)&&n.aIsStrong||(t.graveyardPosition=t.graveyardPosition._getTransformedByMergeOperation(e)),[t]})),rg(Ml,vl,((t,e,n)=>{const o=Ka._createFromPositionAndShift(e.sourcePosition,e.howMany);return"remove"==e.type&&!n.bWasUndone&&!n.forceWeakRemove&&t.deletionPosition.hasSameParentAs(e.sourcePosition)&&o.containsPosition(t.sourcePosition)?[new Zl(0)]:(t.sourcePosition.hasSameParentAs(e.targetPosition)&&(t.howMany+=e.howMany),t.sourcePosition.hasSameParentAs(e.sourcePosition)&&(t.howMany-=e.howMany),t.sourcePosition=t.sourcePosition._getTransformedByMoveOperation(e),t.targetPosition=t.targetPosition._getTransformedByMoveOperation(e),t.graveyardPosition.isEqual(e.targetPosition)||(t.graveyardPosition=t.graveyardPosition._getTransformedByMoveOperation(e)),[t])})),rg(Ml,Il,((t,e,n)=>{if(e.graveyardPosition&&(t.graveyardPosition=t.graveyardPosition._getTransformedByDeletion(e.graveyardPosition,1),t.deletionPosition.isEqual(e.graveyardPosition)&&(t.howMany=e.howMany)),t.targetPosition.isEqual(e.splitPosition)){const o=0!=e.howMany,i=e.graveyardPosition&&t.deletionPosition.isEqual(e.graveyardPosition);if(o||i||"mergeTargetNotMoved"==n.abRelation)return t.sourcePosition=t.sourcePosition._getTransformedBySplitOperation(e),[t]}if(t.sourcePosition.isEqual(e.splitPosition)){if("mergeSourceNotMoved"==n.abRelation)return t.howMany=0,t.targetPosition=t.targetPosition._getTransformedBySplitOperation(e),[t];if("mergeSameElement"==n.abRelation||t.sourcePosition.offset>0)return t.sourcePosition=e.moveTargetPosition.clone(),t.targetPosition=t.targetPosition._getTransformedBySplitOperation(e),[t]}return t.sourcePosition.hasSameParentAs(e.splitPosition)&&(t.howMany=e.splitPosition.offset),t.sourcePosition=t.sourcePosition._getTransformedBySplitOperation(e),t.targetPosition=t.targetPosition._getTransformedBySplitOperation(e),[t]})),rg(vl,yl,((t,e)=>{const n=Ka._createFromPositionAndShift(t.sourcePosition,t.howMany)._getTransformedByInsertOperation(e,!1)[0];return t.sourcePosition=n.start,t.howMany=n.end.offset-n.start.offset,t.targetPosition.isEqual(e.position)||(t.targetPosition=t.targetPosition._getTransformedByInsertOperation(e)),[t]})),rg(vl,vl,((t,e,n)=>{const o=Ka._createFromPositionAndShift(t.sourcePosition,t.howMany),i=Ka._createFromPositionAndShift(e.sourcePosition,e.howMany);let r,s=n.aIsStrong,a=!n.aIsStrong;if("insertBefore"==n.abRelation||"insertAfter"==n.baRelation?a=!0:"insertAfter"!=n.abRelation&&"insertBefore"!=n.baRelation||(a=!1),r=t.targetPosition.isEqual(e.targetPosition)&&a?t.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany):t.targetPosition._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),gg(t,e)&&gg(e,t))return[e.getReversed()];if(o.containsPosition(e.targetPosition)&&o.containsRange(i,!0))return o.start=o.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),o.end=o.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),mg([o],r);if(i.containsPosition(t.targetPosition)&&i.containsRange(o,!0))return o.start=o.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),o.end=o.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),mg([o],r);const c=Oo(t.sourcePosition.getParentPath(),e.sourcePosition.getParentPath());if("prefix"==c||"extension"==c)return o.start=o.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),o.end=o.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),mg([o],r);"remove"!=t.type||"remove"==e.type||n.aWasUndone||n.forceWeakRemove?"remove"==t.type||"remove"!=e.type||n.bWasUndone||n.forceWeakRemove||(s=!1):s=!0;const l=[],d=o.getDifference(i);for(const t of d){t.start=t.start._getTransformedByDeletion(e.sourcePosition,e.howMany),t.end=t.end._getTransformedByDeletion(e.sourcePosition,e.howMany);const n="same"==Oo(t.start.getParentPath(),e.getMovedRangeStart().getParentPath()),o=t._getTransformedByInsertion(e.getMovedRangeStart(),e.howMany,n);l.push(...o)}const h=o.getIntersection(i);return null!==h&&s&&(h.start=h.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),h.end=h.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),0===l.length?l.push(h):1==l.length?i.start.isBefore(o.start)||i.start.isEqual(o.start)?l.unshift(h):l.push(h):l.splice(1,0,h)),0===l.length?[new Zl(t.baseVersion)]:mg(l,r)})),rg(vl,Il,((t,e,n)=>{let o=t.targetPosition.clone();t.targetPosition.isEqual(e.insertionPosition)&&e.graveyardPosition&&"moveTargetAfter"!=n.abRelation||(o=t.targetPosition._getTransformedBySplitOperation(e));const i=Ka._createFromPositionAndShift(t.sourcePosition,t.howMany);if(i.end.isEqual(e.insertionPosition))return e.graveyardPosition||t.howMany++,t.targetPosition=o,[t];if(i.start.hasSameParentAs(e.splitPosition)&&i.containsPosition(e.splitPosition)){let t=new Ka(e.splitPosition,i.end);t=t._getTransformedBySplitOperation(e);return mg([new Ka(i.start,e.splitPosition),t],o)}t.targetPosition.isEqual(e.splitPosition)&&"insertAtSource"==n.abRelation&&(o=e.moveTargetPosition),t.targetPosition.isEqual(e.insertionPosition)&&"insertBetween"==n.abRelation&&(o=t.targetPosition);const r=[i._getTransformedBySplitOperation(e)];if(e.graveyardPosition){const o=i.start.isEqual(e.graveyardPosition)||i.containsPosition(e.graveyardPosition);t.howMany>1&&o&&!n.aWasUndone&&r.push(Ka._createFromPositionAndShift(e.insertionPosition,1))}return mg(r,o)})),rg(vl,Ml,((t,e,n)=>{const o=Ka._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.deletionPosition.hasSameParentAs(t.sourcePosition)&&o.containsPosition(e.sourcePosition))if("remove"!=t.type||n.forceWeakRemove){if(1==t.howMany)return n.bWasUndone?(t.sourcePosition=e.graveyardPosition.clone(),t.targetPosition=t.targetPosition._getTransformedByMergeOperation(e),[t]):[new Zl(0)]}else if(!n.aWasUndone){const n=[];let o=e.graveyardPosition.clone(),i=e.targetPosition._getTransformedByMergeOperation(e);t.howMany>1&&(n.push(new vl(t.sourcePosition,t.howMany-1,t.targetPosition,0)),o=o._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany-1),i=i._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany-1));const r=e.deletionPosition._getCombined(t.sourcePosition,t.targetPosition),s=new vl(o,1,r,0),a=s.getMovedRangeStart().path.slice();a.push(0);const c=new Wa(s.targetPosition.root,a);i=i._getTransformedByMove(o,r,1);const l=new vl(i,e.howMany,c,0);return n.push(s),n.push(l),n}const i=Ka._createFromPositionAndShift(t.sourcePosition,t.howMany)._getTransformedByMergeOperation(e);return t.sourcePosition=i.start,t.howMany=i.end.offset-i.start.offset,t.targetPosition=t.targetPosition._getTransformedByMergeOperation(e),[t]})),rg(El,yl,((t,e)=>(t.position=t.position._getTransformedByInsertOperation(e),[t]))),rg(El,Ml,((t,e)=>t.position.isEqual(e.deletionPosition)?(t.position=e.graveyardPosition.clone(),t.position.stickiness="toNext",[t]):(t.position=t.position._getTransformedByMergeOperation(e),[t]))),rg(El,vl,((t,e)=>(t.position=t.position._getTransformedByMoveOperation(e),[t]))),rg(El,El,((t,e,n)=>{if(t.position.isEqual(e.position)){if(!n.aIsStrong)return[new Zl(0)];t.oldName=e.newName}return[t]})),rg(El,Il,((t,e)=>{if("same"==Oo(t.position.path,e.splitPosition.getParentPath())&&!e.graveyardPosition){const e=new El(t.position.getShiftedBy(1),t.oldName,t.newName,0);return[t,e]}return t.position=t.position._getTransformedBySplitOperation(e),[t]})),rg(Dl,Dl,((t,e,n)=>{if(t.root===e.root&&t.key===e.key){if(!n.aIsStrong||t.newValue===e.newValue)return[new Zl(0)];t.oldValue=e.newValue}return[t]})),rg(Il,yl,((t,e)=>(t.splitPosition.hasSameParentAs(e.position)&&t.splitPosition.offset{if(!t.graveyardPosition&&!n.bWasUndone&&t.splitPosition.hasSameParentAs(e.sourcePosition)){const n=e.graveyardPosition.path.slice();n.push(0);const o=new Wa(e.graveyardPosition.root,n),i=Il.getInsertionPosition(new Wa(e.graveyardPosition.root,n)),r=new Il(o,0,i,null,0);return t.splitPosition=t.splitPosition._getTransformedByMergeOperation(e),t.insertionPosition=Il.getInsertionPosition(t.splitPosition),t.graveyardPosition=r.insertionPosition.clone(),t.graveyardPosition.stickiness="toNext",[r,t]}return t.splitPosition.hasSameParentAs(e.deletionPosition)&&!t.splitPosition.isAfter(e.deletionPosition)&&t.howMany--,t.splitPosition.hasSameParentAs(e.targetPosition)&&(t.howMany+=e.howMany),t.splitPosition=t.splitPosition._getTransformedByMergeOperation(e),t.insertionPosition=Il.getInsertionPosition(t.splitPosition),t.graveyardPosition&&(t.graveyardPosition=t.graveyardPosition._getTransformedByMergeOperation(e)),[t]})),rg(Il,vl,((t,e,n)=>{const o=Ka._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.graveyardPosition){const i=o.start.isEqual(t.graveyardPosition)||o.containsPosition(t.graveyardPosition);if(!n.bWasUndone&&i){const n=t.splitPosition._getTransformedByMoveOperation(e),o=t.graveyardPosition._getTransformedByMoveOperation(e),i=o.path.slice();i.push(0);const r=new Wa(o.root,i);return[new vl(n,t.howMany,r,0)]}t.graveyardPosition=t.graveyardPosition._getTransformedByMoveOperation(e)}const i=t.splitPosition.isEqual(e.targetPosition);if(i&&("insertAtSource"==n.baRelation||"splitBefore"==n.abRelation))return t.howMany+=e.howMany,t.splitPosition=t.splitPosition._getTransformedByDeletion(e.sourcePosition,e.howMany),t.insertionPosition=Il.getInsertionPosition(t.splitPosition),[t];if(i&&n.abRelation&&n.abRelation.howMany){const{howMany:e,offset:o}=n.abRelation;return t.howMany+=e,t.splitPosition=t.splitPosition.getShiftedBy(o),[t]}if(t.splitPosition.hasSameParentAs(e.sourcePosition)&&o.containsPosition(t.splitPosition)){const n=e.howMany-(t.splitPosition.offset-e.sourcePosition.offset);return t.howMany-=n,t.splitPosition.hasSameParentAs(e.targetPosition)&&t.splitPosition.offset{if(t.splitPosition.isEqual(e.splitPosition)){if(!t.graveyardPosition&&!e.graveyardPosition)return[new Zl(0)];if(t.graveyardPosition&&e.graveyardPosition&&t.graveyardPosition.isEqual(e.graveyardPosition))return[new Zl(0)];if("splitBefore"==n.abRelation)return t.howMany=0,t.graveyardPosition=t.graveyardPosition._getTransformedBySplitOperation(e),[t]}if(t.graveyardPosition&&e.graveyardPosition&&t.graveyardPosition.isEqual(e.graveyardPosition)){const o="$graveyard"==t.splitPosition.root.rootName,i="$graveyard"==e.splitPosition.root.rootName,r=o&&!i;if(i&&!o||!r&&n.aIsStrong){const n=[];return e.howMany&&n.push(new vl(e.moveTargetPosition,e.howMany,e.splitPosition,0)),t.howMany&&n.push(new vl(t.splitPosition,t.howMany,t.moveTargetPosition,0)),n}return[new Zl(0)]}if(t.graveyardPosition&&(t.graveyardPosition=t.graveyardPosition._getTransformedBySplitOperation(e)),t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==n.abRelation)return t.howMany++,[t];if(e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==n.baRelation){const n=e.insertionPosition.path.slice();n.push(0);const o=new Wa(e.insertionPosition.root,n);return[t,new vl(t.insertionPosition,1,o,0)]}return t.splitPosition.hasSameParentAs(e.splitPosition)&&t.splitPosition.offset{n.isFocused&&!o.focusTracker.isFocused&&(i&&i(),o.focus(),e())})),o.keystrokes.set("Esc",((e,n)=>{o.focusTracker.isFocused&&(t.focus(),r&&r(),n())}))}({origin:o,originFocusTracker:this.focusTracker,originKeystrokeHandler:t.keystrokes,toolbar:n.toolbarView,beforeFocus(){n.show()},afterBlur(){n.hide()}}),this._initPlaceholder(),this.fire("ready")}destroy(){const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy(),super.destroy()}_initPlaceholder(){const t=this.editor,e=t.editing.view,n=e.document.getRoot(),o=t.sourceElement,i=t.config.get("placeholder")||o&&"textarea"===o.tagName.toLowerCase()&&o.getAttribute("placeholder");i&&Xu({view:e,element:n,text:i,isDirectHost:!1,keepOnFocus:!0})}}class wg extends au{constructor(t,e,n){super(t),this.editable=new uu(t,e,n)}render(){super.render(),this.registerChild(this.editable)}}class _g extends vd{constructor(t,e={}){if(!vo(t)&&void 0!==e.initialData)throw new c("editor-create-initial-data",null);super(e),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return vo(t)?(e=t,e instanceof HTMLTextAreaElement?e.value:e.innerHTML):t;var e}(t)),vo(t)&&(this.sourceElement=t,function(t){const e=t.sourceElement;if(e){if(e.ckeditorInstance)throw new c("editor-source-element-already-used",t);e.ckeditorInstance=t,t.once("destroy",(()=>{delete e.ckeditorInstance}))}}(this));const n=this.config.get("plugins");n.push(Wu),this.config.set("plugins",n),this.config.define("balloonToolbar",this.config.get("toolbar")),this.model.document.createRoot();const o=new wg(this.locale,this.editing.view,this.sourceElement);this.ui=new bg(this,o),function(t){if(!j(t.updateSourceElement))throw new c("attachtoform-missing-elementapi-interface",t);const e=t.sourceElement;if(e&&"textarea"===e.tagName.toLowerCase()&&e.form){let n;const o=e.form,i=()=>t.updateSourceElement();j(o.submit)&&(n=o.submit,o.submit=()=>{i(),n.apply(o)}),o.addEventListener("submit",i),t.on("destroy",(()=>{o.removeEventListener("submit",i),n&&(o.submit=n)}))}}(this)}destroy(){const t=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&_a(this.sourceElement,t)}))}static create(t,e={}){return new Promise((n=>{if(vo(t)&&"TEXTAREA"===t.tagName)throw new c("editor-wrong-element",null);const o=new this(t,e);n(o.initPlugins().then((()=>o.ui.init())).then((()=>o.data.init(o.config.get("initialData")))).then((()=>o.fire("ready"))).then((()=>o)))}))}}he(_g,Md),he(_g,Id);class Ag{constructor(t){this.files=function(t){const e=Array.from(t.files||[]),n=Array.from(t.items||[]);if(e.length)return e;return n.filter((t=>"file"===t.kind)).map((t=>t.getAsFile()))}(t),this._native=t}get types(){return this._native.types}getData(t){return this._native.getData(t)}setData(t,e){this._native.setData(t,e)}set effectAllowed(t){this._native.effectAllowed=t}get effectAllowed(){return this._native.effectAllowed}set dropEffect(t){this._native.dropEffect=t}get dropEffect(){return this._native.dropEffect}get isCanceled(){return"none"==this._native.dropEffect||!!this._native.mozUserCancelled}}class Cg extends Gs{constructor(t){super(t);const n=this.document;function o(t){return(o,i)=>{i.preventDefault();const r=i.dropRange?[i.dropRange]:null,s=new e(n,t);n.fire(s,{dataTransfer:i.dataTransfer,method:o.name,targetRanges:r,target:i.target}),s.stop.called&&i.stopPropagation()}}this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"],this.listenTo(n,"paste",o("clipboardInput"),{priority:"low"}),this.listenTo(n,"drop",o("clipboardInput"),{priority:"low"}),this.listenTo(n,"dragover",o("dragging"),{priority:"low"})}onDomEvent(t){const e={dataTransfer:new Ag(t.clipboardData?t.clipboardData:t.dataTransfer)};"drop"!=t.type&&"dragover"!=t.type||(e.dropRange=function(t,e){const n=e.target.ownerDocument,o=e.clientX,i=e.clientY;let r;n.caretRangeFromPoint&&n.caretRangeFromPoint(o,i)?r=n.caretRangeFromPoint(o,i):e.rangeParent&&(r=n.createRange(),r.setStart(e.rangeParent,e.rangeOffset),r.collapse(!0));if(r)return t.domConverter.domRangeToView(r);return null}(this.view,t)),this.fire(t.type,t,e)}}const vg=["figcaption","li"];function yg(t){let e="";if(t.is("$text")||t.is("$textProxy"))e=t.data;else if(t.is("element","img")&&t.hasAttribute("alt"))e=t.getAttribute("alt");else if(t.is("element","br"))e="\n";else{let n=null;for(const o of t.getChildren()){const t=yg(o);n&&(n.is("containerElement")||o.is("containerElement"))&&(vg.includes(n.name)||vg.includes(o.name)?e+="\n":e+="\n\n"),e+=t,n=o}}return e}class xg extends ue{static get pluginName(){return"ClipboardPipeline"}init(){this.editor.editing.view.addObserver(Cg),this._setupPasteDrop(),this._setupCopyCut()}_setupPasteDrop(){const t=this.editor,n=t.model,o=t.editing.view,i=o.document;this.listenTo(i,"clipboardInput",(e=>{t.isReadOnly&&e.stop()}),{priority:"highest"}),this.listenTo(i,"clipboardInput",((t,n)=>{const i=n.dataTransfer;let r=n.content||"";var s;r||(i.getData("text/html")?r=function(t){return t.replace(/(\s+)<\/span>/g,((t,e)=>1==e.length?" ":e)).replace(//g,"")}(i.getData("text/html")):i.getData("text/plain")&&(((s=(s=i.getData("text/plain")).replace(//g,">").replace(/\r?\n\r?\n/g,"

").replace(/\r?\n/g,"
").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g,"  ")).includes("

")||s.includes("
"))&&(s=`

${s}

`),r=s),r=this.editor.data.htmlProcessor.toView(r));const a=new e(this,"inputTransformation");this.fire(a,{content:r,dataTransfer:i,targetRanges:n.targetRanges,method:n.method}),a.stop.called&&t.stop(),o.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,e)=>{if(e.content.isEmpty)return;const o=this.editor.data.toModel(e.content,"$clipboardHolder");0!=o.childCount&&(t.stop(),n.change((()=>{this.fire("contentInsertion",{content:o,method:e.method,dataTransfer:e.dataTransfer,targetRanges:e.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,e)=>{e.resultRange=n.insertContent(e.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document;function o(o,i){const r=i.dataTransfer;i.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:o.name})}this.listenTo(n,"copy",o,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.isReadOnly?n.preventDefault():o(e,n)}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",yg(o.content))),"cut"==o.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}function*Eg(t,e){for(const n of e)n&&t.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class Dg extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n,o){const i=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return void(i||s!=a||t.deleteContent(n));if(i){const t=Eg(e.model.schema,n.getAttributes());Mg(e,r.start),e.setSelectionAttribute(t)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd),i=s==a;t.deleteContent(n,{leaveUnmerged:o}),o&&(i?Mg(e,n.focus):e.setSelection(a,0))}}(this.editor.model,n,e.selection,t.schema),this.fire("afterExecute",{writer:n})}))}}function Mg(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}class Ig extends Cs{constructor(t){super(t);const e=this.document;e.on("keydown",((t,n)=>{if(this.isEnabled&&n.keyCode==dr.enter){const o=new Wi(e,"enter",e.selection.getFirstRange());e.fire(o,new qs(e,n.domEvent,{isSoft:n.shiftKey})),o.stop.called&&t.stop()}}))}observe(){}}class Sg extends ue{static get pluginName(){return"Enter"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(Ig),t.commands.add("enter",new Dg(t)),this.listenTo(n,"enter",((n,o)=>{o.preventDefault(),o.isSoft||(t.execute("enter"),e.scrollToTheSelection())}),{priority:"low"})}}class Tg{constructor(t,e=20){this.model=t,this.size=0,this.limit=e,this.isLocked=!1,this._changeCallback=(t,e)=>{e.isLocal&&e.isUndoable&&e!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}input(t){this.size+=t,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(t){this.isLocked&&!t||(this._batch=null,this.size=0)}}class Ng extends me{constructor(t,e){super(t),this.direction=e,this._buffer=new Tg(t.model,t.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(t={}){const e=this.editor.model,n=e.document;e.enqueueChange(this._buffer.batch,(o=>{this._buffer.lock();const i=o.createSelection(t.selection||n.selection),r=t.sequence||1,s=i.isCollapsed;if(i.isCollapsed&&e.modifySelection(i,{direction:this.direction,unit:t.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(o);if(this._shouldReplaceFirstBlockWithParagraph(i,r))return void this.editor.execute("paragraph",{selection:i});if(i.isCollapsed)return;let a=0;i.getFirstRange().getMinimalFlatRanges().forEach((t=>{a+=Vi(t.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),e.deleteContent(i,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),o.setSelection(i),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(t){if(t>1)return!1;const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(o)))return!1;if(!e.schema.checkChild(o,"paragraph"))return!1;const i=o.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(t){const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n),i=t.createElement("paragraph");t.remove(t.createRangeIn(o)),t.insert(i,o),t.setSelection(i,0)}_shouldReplaceFirstBlockWithParagraph(t,e){const n=this.editor.model;if(e>1||"backward"!=this.direction)return!1;if(!t.isCollapsed)return!1;const o=t.getFirstPosition(),i=n.schema.getLimitElement(o),r=i.getChild(0);return o.parent==r&&(!!t.containsEntireContent(r)&&(!!n.schema.checkChild(i,"paragraph")&&"paragraph"!=r.name))}}function Bg(t){if(t.newChildren.length-t.oldChildren.length!=1)return;const e=function(t,e){const n=[];let o,i=0;return t.forEach((t=>{"equal"==t?(r(),i++):"insert"==t?(s("insert")?o.values.push(e[i]):(r(),o={type:"insert",index:i,values:[e[i]]}),i++):s("delete")?o.howMany++:(r(),o={type:"delete",index:i,howMany:1})})),r(),n;function r(){o&&(n.push(o),o=null)}function s(t){return o&&o.type==t}}(qr(t.oldChildren,t.newChildren,zg),t.newChildren);if(e.length>1)return;const n=e[0];return n.values[0]&&n.values[0].is("$text")?n:void 0}function zg(t,e){return t&&t.is("$text")&&e&&e.is("$text")?t.data===e.data:t===e}function Pg(t,e){const n=e.selection,o=t.shiftKey&&t.keyCode===dr.delete,i=!n.isCollapsed;return o&&i}class Lg extends Cs{constructor(t){super(t);const e=t.document;let n=0;function o(t,n,o){const i=new Wi(e,"delete",e.selection.getFirstRange());e.fire(i,new qs(e,n,o)),i.stop.called&&t.stop()}e.on("keyup",((t,e)=>{e.keyCode!=dr.delete&&e.keyCode!=dr.backspace||(n=0)})),e.on("keydown",((t,i)=>{if(sr.isWindows&&Pg(i,e))return;const r={};if(i.keyCode==dr.delete)r.direction="forward",r.unit="character";else{if(i.keyCode!=dr.backspace)return;r.direction="backward",r.unit="codePoint"}const s=sr.isMac?i.altKey:i.ctrlKey;r.unit=s?"word":r.unit,r.sequence=++n,o(t,i.domEvent,r)})),sr.isAndroid&&e.on("beforeinput",((e,n)=>{if("deleteContentBackward"!=n.domEvent.inputType)return;const i={unit:"codepoint",direction:"backward",sequence:1},r=n.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(i.selectionToRemove=t.domConverter.domSelectionToView(r)),o(e,n.domEvent,i)}))}observe(){}}class Og extends ue{static get pluginName(){return"Delete"}init(){const t=this.editor,e=t.editing.view,n=e.document,o=t.model.document;e.addObserver(Lg),this._undoOnBackspace=!1;const i=new Ng(t,"forward");if(t.commands.add("deleteForward",i),t.commands.add("forwardDelete",i),t.commands.add("delete",new Ng(t,"backward")),this.listenTo(n,"delete",((n,o)=>{const i={unit:o.unit,sequence:o.sequence};if(o.selectionToRemove){const e=t.model.createSelection(),n=[];for(const e of o.selectionToRemove.getRanges())n.push(t.editing.mapper.toModelRange(e));e.setTo(n),i.selection=e}t.execute("forward"==o.direction?"deleteForward":"delete",i),o.preventDefault(),e.scrollToTheSelection()}),{priority:"low"}),sr.isAndroid){let t=null;this.listenTo(n,"delete",((e,n)=>{const o=n.domTarget.ownerDocument.defaultView.getSelection();t={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}}),{priority:"lowest"}),this.listenTo(n,"keyup",((e,n)=>{if(t){const e=n.domTarget.ownerDocument.defaultView.getSelection();e.collapse(t.anchorNode,t.anchorOffset),e.extend(t.focusNode,t.focusOffset),t=null}}))}this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",((e,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._undoOnBackspace=!1,t.execute("undo"),n.preventDefault(),e.stop())}),{context:"$capture"}),this.listenTo(o,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class Rg{constructor(){this._stack=[]}add(t,e){const n=this._stack,o=n[0];this._insertDescriptor(t);const i=n[0];o===i||jg(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}remove(t,e){const n=this._stack,o=n[0];this._removeDescriptor(t);const i=n[0];o===i||jg(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(jg(t,e[n]))return;n>-1&&e.splice(n,1);let o=0;for(;e[o]&&Fg(e[o],t);)o++;e.splice(o,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function jg(t,e){return t&&e&&t.priority==e.priority&&Vg(t.classes)==Vg(e.classes)}function Fg(t,e){return t.priority>e.priority||!(t.priorityVg(e.classes)}function Vg(t){return Array.isArray(t)?t.sort().join(","):t}he(Rg,k);const Hg='',Ug="ck-widget_selected";function Wg(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function qg(t,e,n={}){if(!t.is("containerElement"))throw new c("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass("ck-widget",t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=Jg,n.label&&function(t,e,n){n.setCustomProperty("widgetLabel",e,t)}(t,n.label,e),n.hasSelectionHandle&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(t){const e=this.toDomElement(t),n=new hh;return n.set("content",Hg),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),Kg(t,e),t}function Gg(t,e,n){if(e.classes&&n.addClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.setAttribute(o,e.attributes[o],t)}function Yg(t,e,n){if(e.classes&&n.removeClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.removeAttribute(o,t)}function Kg(t,e,n=Gg,o=Yg){const i=new Rg;i.on("change:top",((e,i)=>{i.oldDescriptor&&o(t,i.oldDescriptor,i.writer),i.newDescriptor&&n(t,i.newDescriptor,i.writer)})),e.setCustomProperty("addHighlight",((t,e,n)=>i.add(e,n)),t),e.setCustomProperty("removeHighlight",((t,e,n)=>i.remove(e,n)),t)}function Qg(t){const e=t.getCustomProperty("widgetLabel");return e?"function"==typeof e?e():e:""}function $g(t,e){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",((n,o,i)=>{e.setAttribute("contenteditable",i?"false":"true",t)})),t.on("change:isFocused",((n,o,i)=>{i?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)})),Kg(t,e),t}function Zg(t,e){const n=t.getSelectedElement();if(n){const o=em(t);if(o)return e.createRange(e.createPositionAt(n,o))}return od(t,e)}function Jg(){return null}const Xg="widget-type-around";function tm(t,e,n){return t&&Wg(t)&&!n.isInline(e)}function em(t){return t.getAttribute(Xg)}const nm=[ur("arrowUp"),ur("arrowRight"),ur("arrowDown"),ur("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let t=112;t<=135;t++)nm.push(t);function om(t){return!(!t.ctrlKey&&!t.metaKey)||nm.includes(t.keyCode)}var im=n(4921),rm={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(im.Z,rm);im.Z.locals;const sm=["before","after"],am=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,cm="ck-widget__type-around_disabled";class lm extends ue{static get pluginName(){return"WidgetTypeAround"}static get requires(){return[Sg,Og]}constructor(t){super(t),this._currentFakeCaretModelElement=null}init(){const t=this.editor,e=t.editing.view;this.on("change:isEnabled",((n,o,i)=>{e.change((t=>{for(const n of e.document.roots)i?t.removeClass(cm,n):t.addClass(cm,n)})),i||t.model.change((t=>{t.removeSelectionAttribute(Xg)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(t,e){const n=this.editor,o=n.editing.view,i=n.model.schema.getAttributesWithProperty(t,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(t,e),attributes:i}),o.focus(),o.scrollToTheSelection()}_listenToIfEnabled(t,e,n,o){this.listenTo(t,e,((...t)=>{this.isEnabled&&n(...t)}),o)}_insertParagraphAccordingToFakeCaretPosition(){const t=this.editor.model.document.selection,e=em(t);if(!e)return!1;const n=t.getSelectedElement();return this._insertParagraph(n,e),!0}_enableTypeAroundUIInjection(){const t=this.editor,e=t.model.schema,n=t.locale.t,o={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};t.editing.downcastDispatcher.on("insert",((t,n,i)=>{const r=i.mapper.toViewElement(n.item);tm(r,n.item,e)&&function(t,e,n){const o=t.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(t){const n=this.toDomElement(t);return function(t,e){for(const n of sm){const o=new Vd({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:e[n]},children:[t.ownerDocument.importNode(am,!0)]});t.appendChild(o.render())}}(n,e),function(t){const e=new Vd({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});t.appendChild(e.render())}(n),n}));t.insert(t.createPositionAt(n,"end"),o)}(i.writer,o,r)}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const t=this.editor,e=t.model,n=e.document.selection,o=e.schema,i=t.editing.view;function r(t){return`ck-widget_type-around_show-fake-caret_${t}`}this._listenToIfEnabled(i.document,"arrowKey",((t,e)=>{this._handleArrowKeyPress(t,e)}),{context:[Wg,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(Xg)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();if(e){if(tm(t.editing.mapper.toViewElement(e),e,o))return}t.model.change((t=>{t.removeSelectionAttribute(Xg)}))})),this._listenToIfEnabled(t.editing.downcastDispatcher,"selection",((t,e,n)=>{const i=n.writer;if(this._currentFakeCaretModelElement){const t=n.mapper.toViewElement(this._currentFakeCaretModelElement);t&&(i.removeClass(sm.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!tm(a,s,o))return;const c=em(e.selection);c&&(i.addClass(r(c),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,o)=>{o||t.model.change((t=>{t.removeSelectionAttribute(Xg)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,o=n.model,i=o.document.selection,r=o.schema,s=n.editing.view,a=function(t,e){const n=pr(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;tm(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):i.isCollapsed?l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(l=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),l&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=em(e.document.selection);return e.change((e=>{if(!n)return e.setSelectionAttribute(Xg,t?"after":"before"),!0;if(!(n===(t?"after":"before")))return e.removeSelectionAttribute(Xg),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,o=n.schema,i=e.plugins.get("Widget"),r=i._getObjectElementNextToSelection(t);return!!tm(e.editing.mapper.toViewElement(r),r,o)&&(n.change((e=>{i._setSelectionOverElement(r),e.setSelectionAttribute(Xg,t?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(t){const e=this.editor,n=e.model,o=n.schema,i=e.editing.mapper,r=n.document.selection,s=t?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!tm(i.toViewElement(s),s,o)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(Xg,t?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const t=this.editor,e=t.editing.view;this._listenToIfEnabled(e.document,"mousedown",((n,o)=>{const i=o.domTarget.closest(".ck-widget__type-around__button");if(!i)return;const r=function(t){return t.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(i),s=function(t,e){const n=t.closest(".ck-widget");return e.mapDomToView(n)}(i,e.domConverter),a=t.editing.mapper.toModelElement(s);this._insertParagraph(a,r),o.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const t=this.editor,e=t.model.document.selection,n=t.editing.view;this._listenToIfEnabled(n.document,"enter",((n,o)=>{if("atTarget"!=n.eventPhase)return;const i=e.getSelectedElement(),r=t.editing.mapper.toViewElement(i),s=t.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:tm(r,i,s)&&(this._insertParagraph(i,o.isSoft?"before":"after"),a=!0),a&&(o.preventDefault(),n.stop())}),{context:Wg})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view,e=[dr.enter,dr.delete,dr.backspace];this._listenToIfEnabled(t.document,"keydown",((t,n)=>{e.includes(n.keyCode)||om(n)||this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const t=this.editor,e=t.editing.view,n=t.model,o=n.schema;this._listenToIfEnabled(e.document,"delete",((e,i)=>{if("atTarget"!=e.eventPhase)return;const r=em(n.document.selection);if(!r)return;const s=i.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)t.execute("delete",{selection:n.createSelection(a,"on")});else{const e=o.getNearestSelectionRange(n.createPositionAt(a,r),s);if(e)if(e.isCollapsed){const i=n.createSelection(e.start);if(n.modifySelection(i,{direction:s}),i.focus.isEqual(e.start)){const t=function(t,e){let n=e;for(const o of e.getAncestors({parentFirst:!0})){if(o.childCount>1||t.isLimit(o))break;n=o}return n}(o,e.start.parent);n.deleteContent(n.createSelection(t,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}i.preventDefault(),e.stop()}),{context:Wg})}_enableInsertContentIntegration(){const t=this.editor,e=this.editor.model,n=e.document.selection;this._listenToIfEnabled(t.model,"insertContent",((t,[o,i])=>{if(i&&!i.is("documentSelection"))return;const r=em(n);return r?(t.stop(),e.change((t=>{const i=n.getSelectedElement(),s=e.createPositionAt(i,r),a=t.createSelection(s),c=e.insertContent(o,a);return t.setSelection(a),c}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"insertObject",((t,n)=>{const[,o,,i={}]=n;if(o&&!o.is("documentSelection"))return;const r=em(e);r&&(i.findOptimalPosition=r,n[3]=i)}),{priority:"high"})}_enableDeleteContentIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"deleteContent",((t,[n])=>{if(n&&!n.is("documentSelection"))return;em(e)&&t.stop()}),{priority:"high"})}}function dm(t){const e=t.model;return(n,o)=>{const i=o.keyCode==dr.arrowup,r=o.keyCode==dr.arrowdown,s=o.shiftKey,a=e.document.selection;if(!i&&!r)return;const c=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,c))return;const l=function(t,e,n){const o=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=hm(o,t,"forward");if(!n)return null;const i=o.createRange(t,n),r=um(o.schema,i,"backward");return r?o.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=hm(o,t,"backward");if(!n)return null;const i=o.createRange(n,t),r=um(o.schema,i,"forward");return r?o.createRange(r,t):null}}(t,a,c);if(l){if(l.isCollapsed){if(a.isCollapsed)return;if(s)return}(l.isCollapsed||function(t,e,n){const o=t.model,i=t.view.domConverter;if(n){const t=o.createSelection(e.start);o.modifySelection(t),t.focus.isAtEnd||e.start.isEqual(t.focus)||(e=o.createRange(t.focus,e.end))}const r=t.mapper.toViewRange(e),s=i.viewRangeToDom(r),a=pa.getDomRangeRects(s);let c;for(const t of a)if(void 0!==c){if(Math.round(t.top)>=c)return!1;c=Math.max(c,Math.round(t.bottom))}else c=Math.round(t.bottom);return!0}(t,l,c))&&(e.change((t=>{const n=c?l.end:l.start;if(s){const o=e.createSelection(a.anchor);o.setFocus(n),t.setSelection(o)}else t.setSelection(n)})),n.stop(),o.preventDefault(),o.stopPropagation())}}}function hm(t,e,n){const o=t.schema,i=t.createRangeIn(e.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:t,item:s,type:a}of i.getWalker({startPosition:e,direction:n})){if(o.isLimit(s)&&!o.isInline(s))return t;if(a==r&&o.isBlock(s))return null}return null}function um(t,e,n){const o="backward"==n?e.end:e.start;if(t.checkChild(o,"$text"))return o;for(const{nextPosition:o}of e.getWalker({direction:n}))if(t.checkChild(o,"$text"))return o;return null}var gm=n(3488),mm={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(gm.Z,mm);gm.Z.locals;class pm extends ue{static get pluginName(){return"Widget"}static get requires(){return[lm,Og]}init(){const t=this.editor,e=t.editing.view,n=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",((e,n,o)=>{const i=o.writer,r=n.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=t.editing.mapper.toViewElement(s);Wg(a)&&o.consumable.consume(r,"selection")&&i.setSelection(i.createRangeOn(a),{fake:!0,label:Qg(a)})})),this.editor.editing.downcastDispatcher.on("selection",((t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const o=n.writer,i=o.document.selection;let r=null;for(const t of i.getRanges())for(const e of t){const t=e.item;Wg(t)&&!fm(t,r)&&(o.addClass(Ug,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(fg),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[Wg,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",dm(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"})}_onMousedown(t,e){const n=this.editor,o=n.editing.view,i=o.document;let r=e.target;if(function(t){for(;t;){if(t.is("editableElement")&&!t.is("rootElement"))return!0;if(Wg(t))return!1;t=t.parent}return!1}(r)){if((sr.isSafari||sr.isGecko)&&e.domEvent.detail>=3){const t=n.editing.mapper,o=r.is("attributeElement")?r.findAncestor((t=>!t.is("attributeElement"))):r,i=t.toModelElement(o);e.preventDefault(),this.editor.model.change((t=>{t.setSelection(i,"in")}))}return}if(!Wg(r)&&(r=r.findAncestor(Wg),!r))return;sr.isAndroid&&e.preventDefault(),i.isFocused||o.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,o=this.editor.model,i=o.schema,r=o.document.selection,s=r.getSelectedElement(),a=pr(n,this.editor.locale.contentLanguageDirection),c="down"==a||"right"==a,l="up"==a||"down"==a;if(s&&i.isObject(s)){const n=c?r.getLastPosition():r.getFirstPosition(),s=i.getNearestSelectionRange(n,c?"forward":"backward");return void(s&&(o.change((t=>{t.setSelection(s)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed&&!e.shiftKey){const n=r.getFirstPosition(),s=r.getLastPosition(),a=n.nodeAfter,l=s.nodeBefore;return void((a&&i.isObject(a)||l&&i.isObject(l))&&(o.change((t=>{t.setSelection(c?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&i.isObject(d)){if(i.isInline(d)&&l)return;this._setSelectionOverElement(d),e.preventDefault(),t.stop()}}_preventDefaultOnArrowKeyPress(t,e){const n=this.editor.model,o=n.schema,i=n.document.selection.getSelectedElement();i&&o.isObject(i)&&(e.preventDefault(),t.stop())}_handleDelete(t){if(this.editor.isReadOnly)return;const e=this.editor.model.document.selection;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change((t=>{let o=e.anchor.parent;for(;o.isEmpty;){const e=o;o=e.parent,t.remove(e)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(t){this.editor.model.change((e=>{e.setSelection(e.createRangeOn(t))}))}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,o=e.document.selection,i=e.createSelection(o);if(e.modifySelection(i,{direction:t?"forward":"backward"}),i.isEqual(o))return null;const r=t?i.focus.nodeBefore:i.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(Ug,e);this._previouslySelected.clear()}}function fm(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}const km=function(t,e,n){var o=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return x(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),sa(t,e,{leading:o,maxWait:e,trailing:i})};var bm=n(903),wm={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(bm.Z,wm);bm.Z.locals;class _m extends ue{static get pluginName(){return"DragDrop"}static get requires(){return[xg,pm]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=km((t=>this._updateDropMarker(t)),40),this._removeDropMarkerDelayed=vm((()=>this._removeDropMarker()),40),this._clearDraggableAttributesDelayed=vm((()=>this._clearDraggableAttributes()),40),e.addObserver(Cg),e.addObserver(fg),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((t,e,n)=>{n||this._finalizeDragging(!1)})),sr.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=e.document,o=t.editing.view,i=o.document;this.listenTo(i,"dragstart",((o,s)=>{const a=n.selection;if(s.target&&s.target.is("editableElement"))return void s.preventDefault();const c=s.target?ym(s.target):null;if(c){const n=t.editing.mapper.toModelElement(c);this._draggedRange=sc.fromRange(e.createRangeOn(n)),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!i.selection.isCollapsed){const t=i.selection.getSelectedElement();t&&Wg(t)||(this._draggedRange=sc.fromRange(a.getFirstRange()))}if(!this._draggedRange)return void s.preventDefault();this._draggingUid=r(),s.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",s.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=e.createSelection(this._draggedRange.toRange()),d=t.data.toView(e.getSelectedContent(l));i.fire("clipboardOutput",{dataTransfer:s.dataTransfer,content:d,method:o.name}),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(i,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this.listenTo(i,"dragenter",(()=>{this.isEnabled&&o.focus()})),this.listenTo(i,"dragleave",(()=>{this._removeDropMarkerDelayed()})),this.listenTo(i,"dragging",((e,n)=>{if(!this.isEnabled)return void(n.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const o=Am(t,n.targetRanges,n.target);this._draggedRange||(n.dataTransfer.dropEffect="copy"),sr.isGecko||("copy"==n.dataTransfer.effectAllowed?n.dataTransfer.dropEffect="copy":["all","copyMove"].includes(n.dataTransfer.effectAllowed)&&(n.dataTransfer.dropEffect="move")),o&&this._updateDropMarkerThrottled(o)}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"clipboardInput",((e,n)=>{if("drop"!=n.method)return;const o=Am(t,n.targetRanges,n.target);if(this._removeDropMarker(),!o)return this._finalizeDragging(!1),void e.stop();this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==Cm(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(o,!0))return this._finalizeDragging(!1),void e.stop();n.targetRanges=[t.editing.mapper.toViewRange(o)]}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(xg);t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n=e.targetRanges.map((t=>this.editor.editing.mapper.toModelRange(t)));this.editor.model.change((t=>t.setSelection(n)))}),{priority:"high"}),t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n="move"==Cm(e.dataTransfer),o=!e.resultRange||!e.resultRange.isCollapsed;this._finalizeDragging(o&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const t=this.editor,e=t.editing.view,n=e.document;this.listenTo(n,"mousedown",((o,i)=>{if(sr.isAndroid||!i)return;this._clearDraggableAttributesDelayed.cancel();let r=ym(i.target);if(sr.isBlink&&!t.isReadOnly&&!r&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&Wg(t)||(r=n.selection.editableElement)}r&&(e.change((t=>{t.setAttribute("draggable","true",r)})),this._draggableElement=t.editing.mapper.toModelElement(r))})),this.listenTo(n,"mouseup",(()=>{sr.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const t=this.editor.editing;t.view.change((e=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&e.removeAttribute("draggable",t.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_setupDropMarker(){const t=this.editor;t.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),t.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(e,{writer:n})=>{if(t.model.schema.checkChild(e.markerRange.start,"$text"))return n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.innerHTML="⁠⁠",e}))}})}_updateDropMarker(t){const e=this.editor,n=e.model.markers;e.model.change((e=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(t)||e.updateMarker("drop-target",{range:t}):e.addMarker("drop-target",{range:t,usingOperation:!1,affectsData:!1})}))}_removeDropMarker(){const t=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_finalizeDragging(t){const e=this.editor,n=e.model;this._removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(t&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function Am(t,e,n){const o=t.model,i=t.editing.mapper;let r=null;const s=e?e[0].start:null;if(n.is("uiElement")&&(n=n.parent),r=function(t,e){const n=t.model,o=t.editing.mapper;if(Wg(e))return n.createRangeOn(o.toModelElement(e));if(!e.is("editableElement")){const t=e.findAncestor((t=>Wg(t)||t.is("editableElement")));if(Wg(t))return n.createRangeOn(o.toModelElement(t))}return null}(t,n),r)return r;const a=function(t,e){const n=t.editing.mapper,o=t.editing.view,i=n.toModelElement(e);if(i)return i;const r=o.createPositionBefore(e),s=n.findMappedViewAncestor(r);return n.toModelElement(s)}(t,n),c=s?i.toModelPosition(s):null;return c?(r=function(t,e,n){const o=t.model;if(!o.schema.checkChild(n,"$block"))return null;const i=o.createPositionAt(n,0),r=e.path.slice(0,i.path.length),s=o.createPositionFromPath(e.root,r).nodeAfter;if(s&&o.schema.isObject(s))return o.createRangeOn(s);return null}(t,c,a),r||(r=o.schema.getNearestSelectionRange(c,sr.isGecko?"forward":"backward"),r||function(t,e){const n=t.model;for(;e;){if(n.schema.isObject(e))return n.createRangeOn(e);e=e.parent}}(t,c.parent))):function(t,e){const n=t.model,o=n.schema,i=n.createPositionAt(e,0);return o.getNearestSelectionRange(i,"forward")}(t,a)}function Cm(t){return sr.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function vm(t,e){let n;function o(...i){o.cancel(),n=setTimeout((()=>t(...i)),e)}return o.cancel=()=>{clearTimeout(n)},o}function ym(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(Wg);if(Wg(t))return t;const e=t.findAncestor((t=>Wg(t)||t.is("editableElement")));return Wg(e)?e:null}class xm extends ue{static get pluginName(){return"PastePlainText"}static get requires(){return[xg]}init(){const t=this.editor,e=t.model,n=t.editing.view,o=n.document,i=e.document.selection;let r=!1;n.addObserver(Cg),this.listenTo(o,"keydown",((t,e)=>{r=e.shiftKey})),t.plugins.get(xg).on("contentInsertion",((t,n)=>{(r||function(t,e){if(t.childCount>1)return!1;const n=t.getChild(0);if(e.isObject(n))return!1;return 0==[...n.getAttributeKeys()].length}(n.content,e.schema))&&e.change((t=>{const o=Array.from(i.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));i.isCollapsed||e.deleteContent(i,{doNotAutoparagraph:!0}),o.push(...i.getAttributes());const r=t.createRangeIn(n.content);for(const e of r.getItems())e.is("$textProxy")&&t.setAttributes(o,e)}))}))}}class Em extends ue{static get pluginName(){return"Clipboard"}static get requires(){return[xg,_m,xm]}}class Dm extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n){const o=n.isCollapsed,i=n.getFirstRange(),r=i.start.parent,s=i.end.parent,a=r==s;if(o){const o=Eg(t.schema,n.getAttributes());Mm(t,e,i.end),e.removeSelectionAttribute(n.getAttributeKeys()),e.setSelectionAttribute(o)}else{const o=!(i.start.isAtStart&&i.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:o}),a?Mm(t,e,n.focus):o&&e.setSelection(s,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})}))}refresh(){const t=this.editor.model,e=t.document;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const o=e.getFirstRange(),i=o.start.parent,r=o.end.parent;if((Im(i,t)||Im(r,t))&&i!==r)return!1;return!0}(t.schema,e.selection)}}function Mm(t,e,n){const o=e.createElement("softBreak");t.insertContent(o,n),e.setSelection(o,"after")}function Im(t,e){return!t.is("rootElement")&&(e.isLimit(t)||Im(t.parent,e))}class Sm extends ue{static get pluginName(){return"ShiftEnter"}init(){const t=this.editor,e=t.model.schema,n=t.conversion,o=t.editing.view,i=o.document;e.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(t,{writer:e})=>e.createEmptyElement("br")}),o.addObserver(Ig),t.commands.add("shiftEnter",new Dm(t)),this.listenTo(i,"enter",((e,n)=>{n.preventDefault(),n.isSoft&&(t.execute("shiftEnter"),o.scrollToTheSelection())}),{priority:"low"})}}class Tm extends me{constructor(t){super(t),this.affectsData=!1}execute(){const t=this.editor.model,e=t.document.selection;let n=t.schema.getLimitElement(e);if(e.containsEntireContent(n)||!Nm(t.schema,n))do{if(n=n.parent,!n)return}while(!Nm(t.schema,n));t.change((t=>{t.setSelection(n,"in")}))}}function Nm(t,e){return t.isLimit(e)&&(t.checkChild(e,"$text")||t.checkChild(e,"paragraph"))}const Bm=gr("Ctrl+A");class zm extends ue{static get pluginName(){return"SelectAllEditing"}init(){const t=this.editor,e=t.editing.view.document;t.commands.add("selectAll",new Tm(t)),this.listenTo(e,"keydown",((e,n)=>{ur(n)===Bm&&(t.execute("selectAll"),n.preventDefault())}))}}class Pm extends ue{static get pluginName(){return"SelectAllUI"}init(){const t=this.editor;t.ui.componentFactory.add("selectAll",(e=>{const n=t.commands.get("selectAll"),o=new kh(e),i=e.t;return o.set({label:i("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),o.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),o}))}}class Lm extends ue{static get requires(){return[zm,Pm]}static get pluginName(){return"SelectAll"}}class Om extends me{constructor(t,e){super(t),this._buffer=new Tg(t.model,e)}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,o=t.text||"",i=o.length,r=t.range?e.createSelection(t.range):n.selection,s=t.resultRange;e.enqueueChange(this._buffer.batch,(t=>{this._buffer.lock(),e.deleteContent(r),o&&e.insertContent(t.createText(o,n.selection.getAttributes()),r),s?t.setSelection(s):r.is("documentSelection")||t.setSelection(r),this._buffer.unlock(),this._buffer.input(i)}))}}class Rm{constructor(t){this.editor=t,this.editing=this.editor.editing}handle(t,e){if(function(t){if(0==t.length)return!1;for(const e of t)if("children"===e.type&&!Bg(e))return!0;return!1}(t))this._handleContainerChildrenMutations(t,e);else for(const n of t)this._handleTextMutation(n,e),this._handleTextNodeInsertion(n)}_handleContainerChildrenMutations(t,e){const n=function(t){const e=t.map((t=>t.node)).reduce(((t,e)=>t.getCommonAncestor(e,{includeSelf:!0})));if(!e)return;return e.getAncestors({includeSelf:!0,parentFirst:!0}).find((t=>t.is("containerElement")||t.is("rootElement")))}(t);if(!n)return;const o=this.editor.editing.view.domConverter.mapViewToDom(n),i=new gs(this.editor.editing.view.document),r=this.editor.data.toModel(i.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(n);if(!s)return;const a=Array.from(r.getChildren()),c=Array.from(s.getChildren()),l=a[a.length-1],d=c[c.length-1],h=l&&l.is("element","softBreak"),u=d&&!d.is("element","softBreak");h&&u&&a.pop();const g=this.editor.model.schema;if(!jm(a,g)||!jm(c,g))return;const m=a.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," "),p=c.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," ");if(p===m)return;const f=qr(p,m),{firstChangeAt:k,insertions:b,deletions:w}=Fm(f);let _=null;e&&(_=this.editing.mapper.toModelRange(e.getFirstRange()));const A=m.substr(k,b),C=this.editor.model.createRange(this.editor.model.createPositionAt(s,k),this.editor.model.createPositionAt(s,k+w));this.editor.execute("input",{text:A,range:C,resultRange:_})}_handleTextMutation(t,e){if("text"!=t.type)return;const n=t.newText.replace(/\u00A0/g," "),o=t.oldText.replace(/\u00A0/g," ");if(o===n)return;const i=qr(o,n),{firstChangeAt:r,insertions:s,deletions:a}=Fm(i);let c=null;e&&(c=this.editing.mapper.toModelRange(e.getFirstRange()));const l=this.editing.view.createPositionAt(t.node,r),d=this.editing.mapper.toModelPosition(l),h=this.editor.model.createRange(d,d.getShiftedBy(a)),u=n.substr(r,s);this.editor.execute("input",{text:u,range:h,resultRange:c})}_handleTextNodeInsertion(t){if("children"!=t.type)return;const e=Bg(t),n=this.editing.view.createPositionAt(t.node,e.index),o=this.editing.mapper.toModelPosition(n),i=e.values[0].data;this.editor.execute("input",{text:i.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function jm(t,e){return t.every((t=>e.isInline(t)))}function Fm(t){let e=null,n=null;for(let o=0;o{n.deleteContent(n.document.selection)})),t.unlock()}sr.isAndroid?o.document.on("beforeinput",((t,e)=>r(e)),{priority:"lowest"}):o.document.on("keydown",((t,e)=>r(e)),{priority:"lowest"}),o.document.on("compositionstart",(function(){const t=n.document,e=1!==t.selection.rangeCount||t.selection.getFirstRange().isFlat;t.selection.isCollapsed||e||s()}),{priority:"lowest"}),o.document.on("compositionend",(()=>{e=n.createSelection(n.document.selection)}),{priority:"lowest"})}(t),function(t){t.editing.view.document.on("mutations",((e,n,o)=>{new Rm(t).handle(n,o)}))}(t)}}class Hm extends ue{static get requires(){return[Vm,Og]}static get pluginName(){return"Typing"}}function Um(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>o.is("$text")||o.is("$textProxy")?t+o.data:(n=e.createPositionAfter(o),"")),""),range:e.createRange(n,t.end)}}class Wm{constructor(t,e){this.model=t,this.testCallback=e,this.hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(t.document.selection),this.stopListening(t.document))})),this._startListening()}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",((e,{directChange:n})=>{n&&(t.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))})),this.listenTo(t,"change:data",((t,e)=>{!e.isUndo&&e.isLocal&&this._evaluateTextBeforeSelection("data",{batch:e})}))}_evaluateTextBeforeSelection(t,e={}){const n=this.model,o=n.document.selection,i=n.createRange(n.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=Um(i,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const n=Object.assign(e,{text:r,range:s});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${t}`,n)}}}he(Wm,re);class qm extends ue{static get pluginName(){return"TwoStepCaretMovement"}constructor(t){super(t),this.attributes=new Set,this._overrideUid=null}init(){const t=this.editor,e=t.model,n=t.editing.view,o=t.locale,i=e.document.selection;this.listenTo(n.document,"arrowKey",((t,e)=>{if(!i.isCollapsed)return;if(e.shiftKey||e.altKey||e.ctrlKey)return;const n=e.keyCode==dr.arrowright,r=e.keyCode==dr.arrowleft;if(!n&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&n||"rtl"===s&&r?this._handleForwardMovement(e):this._handleBackwardMovement(e),!0===a&&t.stop()}),{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(i,"change:range",((t,e)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!e.directChange&&Qm(i.getFirstPosition(),this.attributes)||this._restoreGravity())}))}registerAttribute(t){this.attributes.add(t)}_handleForwardMovement(t){const e=this.attributes,n=this.editor.model.document.selection,o=n.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!Gm(n,e))&&(Qm(o,e)?(Km(t),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(t){const e=this.attributes,n=this.editor.model,o=n.document.selection,i=o.getFirstPosition();return this._isGravityOverridden?(Km(t),this._restoreGravity(),Ym(n,e,i),!0):i.isAtStart?!!Gm(o,e)&&(Km(t),Ym(n,e,i),!0):function(t,e){return Qm(t.getShiftedBy(-1),e)}(i,e)?i.isAtEnd&&!Gm(o,e)&&Qm(i,e)?(Km(t),Ym(n,e,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):void 0}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((t=>t.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((t=>{t.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function Gm(t,e){for(const n of e)if(t.hasAttribute(n))return!0;return!1}function Ym(t,e,n){const o=n.nodeBefore;t.change((t=>{o?t.setSelectionAttribute(o.getAttributes()):t.removeSelectionAttribute(e)}))}function Km(t){t.preventDefault()}function Qm(t,e){const{nodeBefore:n,nodeAfter:o}=t;for(const t of e){const e=n?n.getAttribute(t):void 0;if((o?o.getAttribute(t):void 0)!==e)return!0}return!1}var $m=/[\\^$.*+?()[\]{}|]/g,Zm=RegExp($m.source);const Jm=function(t){return(t=si(t))&&Zm.test(t)?t.replace($m,"\\$&"):t},Xm={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:rp('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:rp("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:rp("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:rp('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:rp('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:rp("'"),to:[null,"‚",null,"’"]}},tp={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},ep=["symbols","mathematical","typography","quotes"];function np(t){return"string"==typeof t?new RegExp(`(${Jm(t)})$`):t}function op(t){return"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t}function ip(t){return(t.textNode?t.textNode:t.nodeAfter).getAttributes()}function rp(t){return new RegExp(`(^|\\s)(${t})([^${t}]*)(${t})$`)}function sp(t,e,n,o){return o.createRange(ap(t,e,n,!0,o),ap(t,e,n,!1,o))}function ap(t,e,n,o,i){let r=t.textNode||(o?t.nodeBefore:t.nodeAfter),s=null;for(;r&&r.getAttribute(e)==n;)s=r,r=o?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,o?"before":"after"):t}class cp extends me{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(t.data,"set",((t,e)=>{e[1]={...e[1]};const n=e[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(t.data,"set",((t,e)=>{e[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const o=this.editor.model,i=o.document,r=[],s=t.map((t=>t.getTransformedByOperations(n))),a=s.flat();for(const t of s){const e=t.filter((t=>t.root!=i.graveyard)).filter((t=>!dp(t,a)));e.length&&(lp(e),r.push(e[0]))}r.length&&o.change((t=>{t.setSelection(r,{backward:e})}))}_undo(t,e){const n=this.editor.model,o=n.document;this._createdBatches.add(e);const i=t.operations.slice().filter((t=>t.isDocumentOperation));i.reverse();for(const t of i){const i=t.baseVersion+1,r=Array.from(o.history.getOperations(i)),s=cg([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const i of s)e.addOperation(i),n.applyOperation(i),o.history.setOperationAsUndone(t,i)}}}function lp(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class hp extends cp{execute(t=null){const e=t?this._stack.findIndex((e=>e.batch==t)):this._stack.length-1,n=this._stack.splice(e,1)[0],o=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(o,(()=>{this._undo(n.batch,o);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t),this.fire("revert",n.batch,o)})),this.refresh()}}class up extends cp{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,(()=>{const n=t.batch.operations[t.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(n);this._restoreSelection(t.selection.ranges,t.selection.isBackward,o),this._undo(t.batch,e)})),this.refresh()}}class gp extends ue{static get pluginName(){return"UndoEditing"}constructor(t){super(t),this._batchRegistry=new WeakSet}init(){const t=this.editor;this._undoCommand=new hp(t),this._redoCommand=new up(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",((t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const o=n.batch,i=this._redoCommand._createdBatches.has(o),r=this._undoCommand._createdBatches.has(o);this._batchRegistry.has(o)||(this._batchRegistry.add(o),o.isUndoable&&(i?this._undoCommand.addBatch(o):r||(this._undoCommand.addBatch(o),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((t,e,n)=>{this._redoCommand.addBatch(n)})),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo")}}const mp='',pp='';class fp extends ue{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?mp:pp,i="ltr"==e.uiLanguageDirection?pp:mp;this._addButton("undo",n("Undo"),"CTRL+Z",o),this._addButton("redo",n("Redo"),"CTRL+Y",i)}_addButton(t,e,n,o){const i=this.editor;i.ui.componentFactory.add(t,(r=>{const s=i.commands.get(t),a=new kh(r);return a.set({label:e,icon:o,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",(()=>{i.execute(t),i.editing.view.focus()})),a}))}}class kp extends ue{static get requires(){return[gp,fp]}static get pluginName(){return"Undo"}}class bp{constructor(){const t=new window.FileReader;this._reader=t,this._data=void 0,this.set("loaded",0),t.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(t){const e=this._reader;return this.total=t.size,new Promise(((n,o)=>{e.onload=()=>{const t=e.result;this._data=t,n(t)},e.onerror=()=>{o("error")},e.onabort=()=>{o("aborted")},this._reader.readAsDataURL(t)}))}abort(){this._reader.abort()}}he(bp,re);class wp extends ue{static get pluginName(){return"FileRepository"}static get requires(){return[Sd]}init(){this.loaders=new Mo,this.loaders.on("add",(()=>this._updatePendingAction())),this.loaders.on("remove",(()=>this._updatePendingAction())),this._loadersMap=new Map,this._pendingAction=null,this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0))}getLoader(t){return this._loadersMap.get(t)||null}createLoader(t){if(!this.createUploadAdapter)return l("filerepository-no-upload-adapter"),null;const e=new _p(Promise.resolve(t),this.createUploadAdapter);return this.loaders.add(e),this._loadersMap.set(t,e),t instanceof Promise&&e.file.then((t=>{this._loadersMap.set(t,e)})).catch((()=>{})),e.on("change:uploaded",(()=>{let t=0;for(const e of this.loaders)t+=e.uploaded;this.uploaded=t})),e.on("change:uploadTotal",(()=>{let t=0;for(const e of this.loaders)e.uploadTotal&&(t+=e.uploadTotal);this.uploadTotal=t})),e}destroyLoader(t){const e=t instanceof _p?t:this.getLoader(t);e._destroy(),this.loaders.remove(e),this._loadersMap.forEach(((t,n)=>{t===e&&this._loadersMap.delete(n)}))}_updatePendingAction(){const t=this.editor.plugins.get(Sd);if(this.loaders.length){if(!this._pendingAction){const e=this.editor.t,n=t=>`${e("Upload in progress")} ${parseInt(t)}%.`;this._pendingAction=t.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else t.remove(this._pendingAction),this._pendingAction=null}}he(wp,re);class _p{constructor(t,e){this.id=r(),this._filePromiseWrapper=this._createFilePromiseWrapper(t),this._adapter=e(this),this._reader=new bp,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((t=>this._filePromiseWrapper?t:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new c("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((t=>this._reader.read(t))).then((t=>{if("reading"!==this.status)throw this.status;return this.status="idle",t})).catch((t=>{if("aborted"===t)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:t}))}upload(){if("idle"!=this.status)throw new c("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((t=>(this.uploadResponse=t,this.status="idle",t))).catch((t=>{if("aborted"===this.status)throw"aborted";throw this.status="error",t}))}abort(){const t=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==t?this._reader.abort():"uploading"==t&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(t){const e={};return e.promise=new Promise(((n,o)=>{e.rejecter=o,e.isFulfilled=!1,t.then((t=>{e.isFulfilled=!0,n(t)})).catch((t=>{e.isFulfilled=!0,o(t)}))})),e}}he(_p,re);class Ap extends Fd{constructor(t){super(t),this.buttonView=new kh(t),this._fileInputView=new Cp(t),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",(()=>{this._fileInputView.open()}))}focus(){this.buttonView.focus()}}class Cp extends Fd{constructor(t){super(t),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:e.to("acceptedType"),multiple:e.to("allowMultipleFiles")},on:{change:e.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}const vp="ckCsrfToken",yp="abcdefghijklmnopqrstuvwxyz0123456789";function xp(){let t=function(t){t=t.toLowerCase();const e=document.cookie.split(";");for(const n of e){const e=n.split("=");if(decodeURIComponent(e[0].trim().toLowerCase())===t)return decodeURIComponent(e[1])}return null}(vp);var e,n;return t&&40==t.length||(t=function(t){let e="";const n=new Uint8Array(t);window.crypto.getRandomValues(n);for(let t=0;t.5?o.toUpperCase():o}return e}(40),e=vp,n=t,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(n)+";path=/"),t}class Ep{constructor(t,e,n){this.loader=t,this.url=e,this.t=n}upload(){return this.loader.file.then((t=>new Promise(((e,n)=>{this._initRequest(),this._initListeners(e,n,t),this._sendRequest(t)}))))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const t=this.xhr=new XMLHttpRequest;t.open("POST",this.url,!0),t.responseType="json"}_initListeners(t,e,n){const o=this.xhr,i=this.loader,r=(0,this.t)("Cannot upload file:")+` ${n.name}.`;o.addEventListener("error",(()=>e(r))),o.addEventListener("abort",(()=>e())),o.addEventListener("load",(()=>{const n=o.response;if(!n||!n.uploaded)return e(n&&n.error&&n.error.message?n.error.message:r);t({default:n.url})})),o.upload&&o.upload.addEventListener("progress",(t=>{t.lengthComputable&&(i.uploadTotal=t.total,i.uploaded=t.loaded)}))}_sendRequest(t){const e=new FormData;e.append("upload",t),e.append("ckCsrfToken",xp()),this.xhr.send(e)}}function Dp(t,e,n,o){let i,r=null;"function"==typeof o?i=o:(r=t.commands.get(o),i=()=>{t.execute(o)}),t.model.document.on("change:data",((s,a)=>{if(r&&!r.isEnabled||!e.isEnabled)return;const c=Ta(t.model.document.selection.getRanges());if(!c.isCollapsed)return;if(a.isUndo||!a.isLocal)return;const l=Array.from(t.model.document.differ.getChanges()),d=l[0];if(1!=l.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const h=d.position.parent;if(h.is("element","codeBlock"))return;if(h.is("element","listItem")&&"function"!=typeof o&&!["numberedList","bulletedList","todoList"].includes(o))return;if(r&&!0===r.value)return;const u=h.getChild(0),g=t.model.createRangeOn(u);if(!g.containsRange(c)&&!c.end.isEqual(g.end))return;const m=n.exec(u.data.substr(0,c.end.offset));m&&t.model.enqueueChange((e=>{const n=e.createPositionAt(h,0),o=e.createPositionAt(h,m[0].length),r=new sc(n,o);if(!1!==i({match:m})){e.remove(r);const n=t.model.document.selection.getFirstRange(),o=e.createRangeIn(h);!h.isEmpty||o.isEqual(n)||o.containsRange(n,!0)||e.remove(h)}r.detach(),t.model.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function Mp(t,e,n,o){let i,r;n instanceof RegExp?i=n:r=n,r=r||(t=>{let e;const n=[],o=[];for(;null!==(e=i.exec(t))&&!(e&&e.length<4);){let{index:t,1:i,2:r,3:s}=e;const a=i+r+s;t+=e[0].length-a.length;const c=[t,t+i.length],l=[t+i.length+r.length,t+i.length+r.length+s.length];n.push(c),n.push(l),o.push([t+i.length,t+i.length+r.length])}return{remove:n,format:o}}),t.model.document.on("change:data",((n,i)=>{if(i.isUndo||!i.isLocal||!e.isEnabled)return;const s=t.model,a=s.document.selection;if(!a.isCollapsed)return;const c=Array.from(s.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const d=a.focus,h=d.parent,{text:u,range:g}=function(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>!o.is("$text")&&!o.is("$textProxy")||o.getAttribute("code")?(n=e.createPositionAfter(o),""):t+o.data),""),range:e.createRange(n,t.end)}}(s.createRange(s.createPositionAt(h,0),d),s),m=r(u),p=Ip(g.start,m.format,s),f=Ip(g.start,m.remove,s);p.length&&f.length&&s.enqueueChange((e=>{if(!1!==o(e,p)){for(const t of f.reverse())e.remove(t);s.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function Ip(t,e,n){return e.filter((t=>void 0!==t[0]&&void 0!==t[1])).map((e=>n.createRange(t.getShiftedBy(e[0]),t.getShiftedBy(e[1]))))}function Sp(t,e){return(n,o)=>{if(!t.commands.get(e).isEnabled)return!1;const i=t.model.schema.getValidRanges(o,e);for(const t of i)n.setAttribute(e,!0,t);n.removeSelectionAttribute(e)}}class Tp extends me{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,o=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(n.isCollapsed)o?t.setSelectionAttribute(this.attributeKey,!0):t.removeSelectionAttribute(this.attributeKey);else{const i=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of i)o?t.setAttribute(this.attributeKey,o,e):t.removeAttribute(this.attributeKey,e)}}))}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const t of n.getRanges())for(const n of t.getItems())if(e.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}const Np="bold";class Bp extends ue{static get pluginName(){return"BoldEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Np}),t.model.schema.setAttributeProperties(Np,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Np,view:"strong",upcastAlso:["b",t=>{const e=t.getStyle("font-weight");return e?"bold"==e||Number(e)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),t.commands.add(Np,new Tp(t,Np)),t.keystrokes.set("CTRL+B",Np)}}const zp="bold";class Pp extends ue{static get pluginName(){return"BoldUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(zp,(n=>{const o=t.commands.get(zp),i=new kh(n);return i.set({label:e("Bold"),icon:'',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(zp),t.editing.view.focus()})),i}))}}const Lp="italic";class Op extends ue{static get pluginName(){return"ItalicEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Lp}),t.model.schema.setAttributeProperties(Lp,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Lp,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(Lp,new Tp(t,Lp)),t.keystrokes.set("CTRL+I",Lp)}}const Rp="italic";class jp extends ue{static get pluginName(){return"ItalicUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Rp,(n=>{const o=t.commands.get(Rp),i=new kh(n);return i.set({label:e("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(Rp),t.editing.view.focus()})),i}))}}class Fp extends me{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.schema,o=e.document.selection,i=Array.from(o.getSelectedBlocks()),r=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(r){const e=i.filter((t=>Vp(t)||Up(n,t)));this._applyQuote(t,e)}else this._removeQuote(t,i.filter(Vp))}))}_getValue(){const t=Ta(this.editor.model.document.selection.getSelectedBlocks());return!(!t||!Vp(t))}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.document.selection,e=this.editor.model.schema,n=Ta(t.getSelectedBlocks());return!!n&&Up(e,n)}_removeQuote(t,e){Hp(t,e).reverse().forEach((e=>{if(e.start.isAtStart&&e.end.isAtEnd)return void t.unwrap(e.start.parent);if(e.start.isAtStart){const n=t.createPositionBefore(e.start.parent);return void t.move(e,n)}e.end.isAtEnd||t.split(e.end);const n=t.createPositionAfter(e.end.parent);t.move(e,n)}))}_applyQuote(t,e){const n=[];Hp(t,e).reverse().forEach((e=>{let o=Vp(e.start);o||(o=t.createElement("blockQuote"),t.wrap(e,o)),n.push(o)})),n.reverse().reduce(((e,n)=>e.nextSibling==n?(t.merge(t.createPositionAfter(e)),e):n))}}function Vp(t){return"blockQuote"==t.parent.name?t.parent:null}function Hp(t,e){let n,o=0;const i=[];for(;o{const o=t.model.document.differ.getChanges();for(const t of o)if("insert"==t.type){const o=t.position.nodeAfter;if(!o)continue;if(o.is("element","blockQuote")&&o.isEmpty)return n.remove(o),!0;if(o.is("element","blockQuote")&&!e.checkChild(t.position,o))return n.unwrap(o),!0;if(o.is("element")){const t=n.createRangeIn(o);for(const o of t.getItems())if(o.is("element","blockQuote")&&!e.checkChild(n.createPositionBefore(o),o))return n.unwrap(o),!0}}else if("remove"==t.type){const e=t.position.parent;if(e.is("element","blockQuote")&&e.isEmpty)return n.remove(e),!0}return!1}));const n=this.editor.editing.view.document,o=t.model.document.selection,i=t.commands.get("blockQuote");this.listenTo(n,"enter",((e,n)=>{if(!o.isCollapsed||!i.value)return;o.getLastPosition().parent.isEmpty&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"}),this.listenTo(n,"delete",((e,n)=>{if("backward"!=n.direction||!o.isCollapsed||!i.value)return;const r=o.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"})}}var qp=n(3062),Gp={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(qp.Z,Gp);qp.Z.locals;class Yp extends ue{static get pluginName(){return"BlockQuoteUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("blockQuote",(n=>{const o=t.commands.get("blockQuote"),i=new kh(n);return i.set({label:e("Block quote"),icon:Bd.quote,tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),i}))}}class Kp extends ue{static get pluginName(){return"CKFinderUI"}init(){const t=this.editor,e=t.ui.componentFactory,n=t.t;e.add("ckfinder",(e=>{const o=t.commands.get("ckfinder"),i=new kh(e);return i.set({label:n("Insert image or file"),icon:'',tooltip:!0}),i.bind("isEnabled").to(o),i.on("execute",(()=>{t.execute("ckfinder"),t.editing.view.focus()})),i}))}}class Qp extends me{constructor(t){super(t),this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",(()=>this.refresh()),{priority:"low"})}refresh(){const t=this.editor.commands.get("insertImage"),e=this.editor.commands.get("link");this.isEnabled=t.isEnabled||e.isEnabled}execute(){const t=this.editor,e=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=e&&"modal"!=e)throw new c("ckfinder-unknown-openermethod",t);const n=this.editor.config.get("ckfinder.options")||{};n.chooseFiles=!0;const o=n.onInit;n.language||(n.language=t.locale.uiLanguage),n.onInit=e=>{o&&o(e),e.on("files:choose",(n=>{const o=n.data.files.toArray(),i=o.filter((t=>!t.isImage())),r=o.filter((t=>t.isImage()));for(const e of i)t.execute("link",e.getUrl());const s=[];for(const t of r){const n=t.getUrl();s.push(n||e.request("file:getProxyUrl",{file:t}))}s.length&&$p(t,s)})),e.on("file:choose:resizedImage",(e=>{const n=e.data.resizedUrl;if(n)$p(t,[n]);else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not obtain resized image URL."),{title:n("Selecting resized image failed"),namespace:"ckfinder"})}}))},window.CKFinder[e](n)}}function $p(t,e){if(t.commands.get("insertImage").isEnabled)t.execute("insertImage",{source:e});else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not insert image at the current position."),{title:n("Inserting image failed"),namespace:"ckfinder"})}}class Zp extends ue{static get pluginName(){return"CKFinderEditing"}static get requires(){return[vu,"LinkEditing"]}init(){const t=this.editor;if(!t.plugins.has("ImageBlockEditing")&&!t.plugins.has("ImageInlineEditing"))throw new c("ckfinder-missing-image-plugin",t);t.commands.add("ckfinder",new Qp(t))}}class Jp extends ue{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",wp]}init(){const t=this.editor,e=t.plugins.get("CloudServices"),n=e.token,o=e.uploadUrl;n&&(this._uploadGateway=t.plugins.get("CloudServicesCore").createUploadGateway(n,o),t.plugins.get(wp).createUploadAdapter=t=>new Xp(this._uploadGateway,t))}}class Xp{constructor(t,e){this.uploadGateway=t,this.loader=e}upload(){return this.loader.file.then((t=>(this.fileUploader=this.uploadGateway.upload(t),this.fileUploader.on("progress",((t,e)=>{this.loader.uploadTotal=e.total,this.loader.uploaded=e.uploaded})),this.fileUploader.send())))}abort(){this.fileUploader.abort()}}class tf extends me{refresh(){const t=this.editor.model,e=Ta(t.document.selection.getSelectedBlocks());this.value=!!e&&e.is("element","paragraph"),this.isEnabled=!!e&&ef(e,t.schema)}execute(t={}){const e=this.editor.model,n=e.document;e.change((o=>{const i=(t.selection||n.selection).getSelectedBlocks();for(const t of i)!t.is("element","paragraph")&&ef(t,e.schema)&&o.rename(t,"paragraph")}))}}function ef(t,e){return e.checkChild(t.parent,"paragraph")&&!e.isObject(t)}class nf extends me{execute(t){const e=this.editor.model,n=t.attributes;let o=t.position;e.change((t=>{const i=t.createElement("paragraph");if(n&&e.schema.setAllowedAttributes(i,n,t),!e.schema.checkChild(o.parent,i)){const n=e.schema.findAllowedParent(o,i);if(!n)return;o=t.split(o,n).position}e.insertContent(i,o),t.setSelection(i,"in")}))}}class of extends ue{static get pluginName(){return"Paragraph"}init(){const t=this.editor,e=t.model;t.commands.add("paragraph",new tf(t)),t.commands.add("insertParagraph",new nf(t)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(t,{writer:e})=>of.paragraphLikeElements.has(t.name)?t.isEmpty?null:e.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}of.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class rf extends me{constructor(t,e){super(t),this.modelElements=e}refresh(){const t=Ta(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some((e=>sf(t,e,this.editor.model.schema)))}execute(t){const e=this.editor.model,n=e.document,o=t.value;e.change((t=>{const i=Array.from(n.selection.getSelectedBlocks()).filter((t=>sf(t,o,e.schema)));for(const e of i)e.is("element",o)||t.rename(e,o)}))}}function sf(t,e,n){return n.checkChild(t.parent,e)&&!n.isObject(t)}const af="paragraph";class cf extends ue{static get pluginName(){return"HeadingEditing"}constructor(t){super(t),t.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[of]}init(){const t=this.editor,e=t.config.get("heading.options"),n=[];for(const o of e)o.model!==af&&(t.model.schema.register(o.model,{inheritAllFrom:"$block"}),t.conversion.elementToElement(o),n.push(o.model));this._addDefaultH1Conversion(t),t.commands.add("heading",new rf(t,n))}afterInit(){const t=this.editor,e=t.commands.get("enter"),n=t.config.get("heading.options");e&&this.listenTo(e,"afterExecute",((e,o)=>{const i=t.model.document.selection.getFirstPosition().parent;n.some((t=>i.is("element",t.model)))&&!i.is("element",af)&&0===i.childCount&&o.writer.rename(i,af)}))}_addDefaultH1Conversion(t){t.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:s.get("low")+1})}}var lf=n(8733),df={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(lf.Z,df);lf.Z.locals;class hf extends ue{static get pluginName(){return"HeadingUI"}init(){const t=this.editor,e=t.t,n=function(t){const e=t.t,n={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return t.config.get("heading.options").map((t=>{const e=n[t.title];return e&&e!=t.title&&(t.title=e),t}))}(t),o=e("Choose heading"),i=e("Heading");t.ui.componentFactory.add("heading",(e=>{const r={},s=new Mo,a=t.commands.get("heading"),c=t.commands.get("paragraph"),l=[a];for(const t of n){const e={type:"button",model:new yu({label:t.title,class:t.class,withText:!0})};"paragraph"===t.model?(e.model.bind("isOn").to(c,"value"),e.model.set("commandName","paragraph"),l.push(c)):(e.model.bind("isOn").to(a,"value",(e=>e===t.model)),e.model.set({commandName:"heading",commandValue:t.model})),s.add(e),r[t.model]=t.title}const d=nu(e);return iu(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:i}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(l,"isEnabled",((...t)=>t.some((t=>t)))),d.buttonView.bind("label").to(a,"value",c,"value",((t,e)=>{const n=t||e&&"paragraph";return r[n]?r[n]:o})),this.listenTo(d,"execute",(e=>{t.execute(e.source.commandName,e.source.commandValue?{value:e.source.commandValue}:void 0),t.editing.view.focus()})),d}))}}class uf extends ue{static get requires(){return[Ru]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",(e=>{(function(t){const e=t.getSelectedElement();return!(!e||!Wg(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{ariaLabel:e,items:n,getRelatedElement:o,balloonClassName:i="ck-toolbar-container"}){if(!n.length)return void l("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new Uh(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new c("widget-toolbar-duplicated",this,{toolbarId:t});a.fillFromConfig(n,r.ui.componentFactory),this._toolbarDefinitions.set(t,{view:a,getRelatedElement:o,balloonClassName:i})}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const o of this._toolbarDefinitions.values()){const i=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&i)if(this.editor.ui.focusTracker.isFocused){const r=i.getAncestors().length;r>t&&(t=r,e=i,n=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(t,e){this._isToolbarVisible(t)?gf(this.editor,e):this._isToolbarInBalloon(t)||(this._balloon.add({view:t.view,position:mf(this.editor,e),balloonClassName:t.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const e=t.getRelatedElement(this.editor.editing.view.document.selection);gf(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function gf(t,e){const n=t.plugins.get("ContextualBalloon"),o=mf(t,e);n.updatePosition(o)}function mf(t,e){const n=t.editing.view,o=Su.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast,o.viewportStickyNorth]}}class pf{constructor(t){this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=t,this._referenceCoordinates=null}begin(t,e,n){const o=new pa(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(ff(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new pa(t),o=e.split("-"),i={x:"right"==o[1]?n.right:n.left,y:"bottom"==o[0]?n.bottom:n.top};return i.x+=t.ownerDocument.defaultView.scrollX,i.y+=t.ownerDocument.defaultView.scrollY,i}(e,function(t){const e=t.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[e[0]]}-${n[e[1]]}`}(this.activeHandlePosition)),this.originalWidth=o.width,this.originalHeight=o.height,this.aspectRatio=o.width/o.height;const i=n.style.width;i&&i.match(/^\d+(\.\d*)?%$/)?this.originalWidthPercents=parseFloat(i):this.originalWidthPercents=function(t,e){const n=t.parentElement,o=parseFloat(n.ownerDocument.defaultView.getComputedStyle(n).width);return e.width/o*100}(n,o)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}function ff(t){return`ck-widget__resizer__handle-${t}`}he(pf,re);class kf extends Fd{constructor(){super();const t=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",t.to("_viewPosition",(t=>t?`ck-orientation-${t}`:""))],style:{display:t.if("_isVisible","none",(t=>!t))}},children:[{text:t.to("_label")}]})}_bindToState(t,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",((t,e)=>null!==t&&null!==e)),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",((e,n,o)=>"px"===t.unit?`${e}×${n}`:`${o}%`)),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",((t,e,n)=>e<50||n<50?"above-center":t))}_dismiss(){this.unbind(),this._isVisible=!1}}class bf{constructor(t){this._options=t,this._viewResizerWrapper=null,this.set("isEnabled",!0),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(t=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),t.stop())}),{priority:"high"}),this.on("change:isEnabled",(()=>{this.isEnabled&&this.redraw()}))}attach(){const t=this,e=this._options.viewElement;this._options.editor.editing.view.change((n=>{const o=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(e){const n=this.toDomElement(e);return t._appendHandles(n),t._appendSizeUI(n),t.on("change:isEnabled",((t,e,o)=>{n.style.display=o?"":"none"})),n.style.display=t.isEnabled?"":"none",n}));n.insert(n.createPositionAt(e,"end"),o),n.addClass("ck-widget_with-resizer",e),this._viewResizerWrapper=o}))}begin(t){this.state=new pf(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(t,this._getHandleHost(),this._getResizeHost())}updateSize(t){const e=this._proposeNewSize(t);this._options.editor.editing.view.change((t=>{const n=this._options.unit||"%",o=("%"===n?e.widthPercents:e.width)+n;t.setStyle("width",o,this._options.viewElement)}));const n=this._getHandleHost(),o=new pa(n);e.handleHostWidth=Math.round(o.width),e.handleHostHeight=Math.round(o.height);const i=new pa(n);e.width=Math.round(i.width),e.height=Math.round(i.height),this.redraw(o),this.state.update(e)}commit(){const t=this._options.unit||"%",e=("%"===t?this.state.proposedWidthPercents:this.state.proposedWidth)+t;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(e)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(t){const e=this._domResizerWrapper;if(!((n=e)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const o=e.parentElement,i=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(o.isSameNode(i)){const e=t||new pa(i);a=[e.width+"px",e.height+"px",void 0,void 0]}else a=[i.offsetWidth+"px",i.offsetHeight+"px",i.offsetLeft+"px",i.offsetTop+"px"];"same"!==Oo(s,a)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)}))}containsHandle(t){return this._domResizerWrapper.contains(t)}static isResizeHandle(t){return t.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change((t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(t){const e=this.state,n={x:(o=t).pageX,y:o.pageY};var o;const i=!this._options.isCentered||this._options.isCentered(this),r={x:e._referenceCoordinates.x-(n.x+e.originalWidth),y:n.y-e.originalHeight-e._referenceCoordinates.y};i&&e.activeHandlePosition.endsWith("-right")&&(r.x=n.x-(e._referenceCoordinates.x+e.originalWidth)),i&&(r.x*=2);const s={width:Math.abs(e.originalWidth+r.x),height:Math.abs(e.originalHeight+r.y)};s.dominant=s.width/e.aspectRatio>s.height?"width":"height",s.max=s[s.dominant];const a={width:s.width,height:s.height};return"width"==s.dominant?a.height=a.width/e.aspectRatio:a.width=a.height*e.aspectRatio,{width:Math.round(a.width),height:Math.round(a.height),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*a.width*100)/100,100)}}_getResizeHost(){const t=this._domResizerWrapper.parentElement;return this._options.getResizeHost(t)}_getHandleHost(){const t=this._domResizerWrapper.parentElement;return this._options.getHandleHost(t)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const o of e)t.appendChild(new Vd({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=o,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new kf,this._sizeView.render(),t.appendChild(this._sizeView.element)}}he(bf,re);var wf=n(8506),_f={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(wf.Z,_f);wf.Z.locals;he(class extends ue{static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,e=is.window.document;this.set("visibleResizer",null),this.set("_activeResizer",null),this._resizers=new Map,t.view.addObserver(fg),this._observer=Object.create(ws),this.listenTo(t.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(e,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(e,"mouseup",this._mouseUpListener.bind(this));const n=()=>{this.visibleResizer&&this.visibleResizer.redraw()};this._redrawFocusedResizerThrottled=km(n,200),this.on("change:visibleResizer",n),this.editor.ui.on("update",this._redrawFocusedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[t,e]of this._resizers)t.isAttached()||(this._resizers.delete(t),e.destroy())}),{priority:"lowest"}),this._observer.listenTo(is.window,"resize",this._redrawFocusedResizerThrottled);const o=this.editor.editing.view.document.selection;o.on("change",(()=>{const t=o.getSelectedElement();this.visibleResizer=this.getResizerByViewElement(t)||null}))}destroy(){this._observer.stopListening();for(const t of this._resizers.values())t.destroy();this._redrawFocusedResizerThrottled.cancel()}attachTo(t){const e=new bf(t),n=this.editor.plugins;if(e.attach(),n.has("WidgetToolbarRepository")){const t=n.get("WidgetToolbarRepository");e.on("begin",(()=>{t.forceDisabled("resize")}),{priority:"lowest"}),e.on("cancel",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"}),e.on("commit",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(t.viewElement,e);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==e&&(this.visibleResizer=e),e}getResizerByViewElement(t){return this._resizers.get(t)}_getResizerByHandle(t){for(const e of this._resizers.values())if(e.containsHandle(t))return e}_mouseDownListener(t,e){const n=e.domTarget;bf.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n),this._activeResizer&&(this._activeResizer.begin(n),t.stop(),e.preventDefault()))}_mouseMoveListener(t,e){this._activeResizer&&this._activeResizer.updateSize(e)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}},re);class Af extends me{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(t){const e=this.editor,n=e.plugins.get("ImageUtils"),o=e.model,i=n.getClosestSelectedImageElement(o.document.selection);o.change((e=>{e.setAttribute("alt",t.newValue,i)}))}}function Cf(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot()])}function vf(t,e){const n=t.plugins.get("ImageUtils"),o=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>{if(!n.isInlineImageView(t))return null;if(!o)return i(t);return(t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:i(t)};function i(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function yf(t,e){const n=Ta(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}class xf extends ue{static get pluginName(){return"ImageUtils"}isImage(t){return this.isInlineImage(t)||this.isBlockImage(t)}isInlineImageView(t){return!!t&&t.is("element","img")}isBlockImageView(t){return!!t&&t.is("element","figure")&&t.hasClass("image")}insertImage(t={},e=null,n=null){const o=this.editor,i=o.model,r=i.document.selection;n=Ef(o,e||r,n),t={...Object.fromEntries(r.getAttributes()),...t};for(const e in t)i.schema.checkAttribute(n,e)||delete t[e];return i.change((o=>{const r=o.createElement(n,t);return i.insertObject(r,e,null,{setSelection:"on",findOptimalPosition:!e&&"imageInline"!=n}),r.parent?r:null}))}getClosestSelectedImageWidget(t){const e=t.getSelectedElement();if(e&&this.isImageWidget(e))return e;let n=t.getFirstPosition().parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent}return null}getClosestSelectedImageElement(t){const e=t.getSelectedElement();return this.isImage(e)?e:t.getFirstPosition().findAncestor("imageBlock")}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){if("imageBlock"==Ef(t,e)){const n=function(t,e){const n=Zg(t,e).start.parent;if(n.isEmpty&&!n.is("element","$root"))return n.parent;return n}(e,t.model);if(t.model.schema.checkChild(n,"imageBlock"))return!0}else if(t.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}(this.editor,t)&&function(t){return[...t.focus.getAncestors()].every((t=>!t.is("element","imageBlock")))}(t)}toImageWidget(t,e,n){e.setCustomProperty("image",!0,t);return qg(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&Wg(t)}isBlockImage(t){return!!t&&t.is("element","imageBlock")}isInlineImage(t){return!!t&&t.is("element","imageInline")}findViewImgElement(t){if(this.isInlineImageView(t))return t;const e=this.editor.editing.view;for(const{item:n}of e.createRangeIn(t))if(this.isInlineImageView(n))return n}}function Ef(t,e,n){const o=t.model.schema,i=t.config.get("image.insert.type");return t.plugins.has("ImageBlockEditing")?t.plugins.has("ImageInlineEditing")?n||("inline"===i?"imageInline":"block"===i?"imageBlock":e.is("selection")?yf(o,e):o.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class Df extends ue{static get requires(){return[xf]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new Af(this.editor))}}var Mf=n(1905),If={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Mf.Z,If);Mf.Z.locals;var Sf=n(6764),Tf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Sf.Z,Tf);Sf.Z.locals;class Nf extends Fd{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),Bd.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),Bd.cancel,"ck-button-cancel","cancel"),this._focusables=new Od,this._focusCycler=new Lh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]}),Pd(this)}render(){super.render(),this.keystrokes.listenTo(this.element),Ld({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,o){const i=new kh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createLabeledInputView(){const t=this.locale.t,e=new Au(this.locale,Cu);return e.label=t("Text alternative"),e}}function Bf(t){const e=t.editing.view,n=Su.defaultPositions,o=t.plugins.get("ImageUtils");return{target:e.domConverter.viewToDom(o.getClosestSelectedImageWidget(e.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class zf extends ue{static get requires(){return[Ru]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",(n=>{const o=t.commands.get("imageTextAlternative"),i=new kh(n);return i.set({label:e("Change image text alternative"),icon:Bd.lowVision,tooltip:!0}),i.bind("isEnabled").to(o,"isEnabled"),this.listenTo(i,"execute",(()=>{this._showForm()})),i}))}_createForm(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Nf(t.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{t.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),this.listenTo(t.ui,"update",(()=>{n.getClosestSelectedImageWidget(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=Bf(t);e.updatePosition(n)}}(t):this._hideForm(!0)})),zd({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:Bf(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class Pf extends ue{static get requires(){return[Df,zf]}static get pluginName(){return"ImageTextAlternative"}}function Lf(t,e){return t=>{t.on(`attribute:srcset:${e}`,n)};function n(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);if(null===n.attributeNewValue){const t=n.attributeOldValue;t.data&&(i.removeAttribute("srcset",s),i.removeAttribute("sizes",s),t.width&&i.removeAttribute("width",s))}else{const t=n.attributeNewValue;t.data&&(i.setAttribute("srcset",t.data,s),i.setAttribute("sizes","100vw",s),t.width&&i.setAttribute("width",t.width,s))}}}function Of(t,e,n){return t=>{t.on(`attribute:${n}:${e}`,o)};function o(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);i.setAttribute(n.attributeKey,n.attributeNewValue||"",s)}}class Rf extends Cs{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}class jf extends me{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&l("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&l("image-inline-plugin-required")}refresh(){this.isEnabled=this.editor.plugins.get("ImageUtils").isImageAllowed()}execute(t){const e=So(t.source),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if("string"==typeof t&&(t={src:t}),e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);o.insertImage({...t,...i},e)}else o.insertImage({...t,...i})}))}}class Ff extends ue{static get requires(){return[xf]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(Rf),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:t=>{const e={data:t.getAttribute("srcset")};return t.hasAttribute("width")&&(e.width=t.getAttribute("width")),e}}});const n=new jf(t);t.commands.add("insertImage",n),t.commands.add("imageInsert",n)}}class Vf extends me{constructor(t,e){super(t),this._modelElementName=e}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=t.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=t.isInlineImage(e):this.isEnabled=t.isBlockImage(e)}execute(){const t=this.editor,e=this.editor.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(e.document.selection),i=Object.fromEntries(o.getAttributes());return i.src||i.uploadId?e.change((t=>{const r=Array.from(e.markers).filter((t=>t.getRange().containsItem(o))),s=n.insertImage(i,e.createSelection(o,"on"),this._modelElementName);if(!s)return null;const a=t.createRangeOn(s);for(const e of r){const n=e.getRange(),o="$graveyard"!=n.root.rootName?n.getJoined(a,!0):a;t.updateMarker(e,{range:o})}return{oldElement:o,newElement:s}})):null}}class Hf extends ue{static get requires(){return[Ff,xf,xg]}static get pluginName(){return"ImageBlockEditing"}init(){const t=this.editor;t.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),t.plugins.has("ImageInlineEditing")&&(t.commands.add("imageTypeBlock",new Vf(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:e})=>Cf(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>o.toImageWidget(Cf(n),n,e("image widget"))}),n.for("downcast").add(Of(o,"imageBlock","src")).add(Of(o,"imageBlock","alt")).add(Lf(o,"imageBlock")),n.for("upcast").elementToElement({view:vf(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)}).add(function(t){return t=>{t.on("element:figure",e)};function e(e,n,o){if(!o.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const i=t.findViewImgElement(n.viewItem);if(!i||!o.consumable.test(i,{name:!0}))return;o.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=Ta(o.convertItem(i,n.modelCursor).modelRange.getItems());r?(o.convertChildren(n.viewItem,r),o.updateConversionResult(r,n)):o.consumable.revert(n.viewItem,{name:!0,classes:"image"})}}(o))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isInlineImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageBlock"===yf(e.schema,c)){const t=new kg(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}}))}}var Uf=n(3508),Wf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Uf.Z,Wf);Uf.Z.locals;class qf extends ue{static get requires(){return[Hf,pm,Pf]}static get pluginName(){return"ImageBlock"}}class Gf extends ue{static get requires(){return[Ff,xf,xg]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor,e=t.model.schema;e.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),e.addChildCheck(((t,e)=>{if(t.endsWith("caption")&&"imageInline"===e.name)return!1})),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new Vf(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(t,{writer:e})=>e.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(t,{writer:n})=>o.toImageWidget(function(t){return t.createContainerElement("span",{class:"image-inline"},t.createEmptyElement("img"))}(n),n,e("image widget"))}),n.for("downcast").add(Of(o,"imageInline","src")).add(Of(o,"imageInline","alt")).add(Lf(o,"imageInline")),n.for("upcast").elementToElement({view:vf(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isBlockImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageInline"===yf(e.schema,c)){const t=new kg(n.document),e=s.map((e=>1===e.childCount?(Array.from(e.getAttributes()).forEach((n=>t.setAttribute(...n,o.findViewImgElement(e)))),e.getChild(0)):e));r.content=t.createDocumentFragment(e)}}))}}class Yf extends ue{static get requires(){return[Gf,pm,Pf]}static get pluginName(){return"ImageInline"}}class Kf extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils");if(!t.plugins.has(Hf))return this.isEnabled=!1,void(this.value=!1);const n=t.model.document.selection,o=n.getSelectedElement();if(!o){const t=e.getCaptionFromModelSelection(n);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=this.editor.plugins.get("ImageUtils").isImage(o),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(o):this.value=!1}execute(t={}){const{focusCaptionOnShow:e}=t;this.editor.model.change((t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)}))}_showImageCaption(t,e){const n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing");let i=n.getSelectedElement();const r=o._getSavedCaption(i);this.editor.plugins.get("ImageUtils").isInlineImage(i)&&(this.editor.execute("imageTypeBlock"),i=n.getSelectedElement());const s=r||t.createElement("caption");t.append(s,i),e&&t.setSelection(s,"in")}_hideImageCaption(t){const e=this.editor,n=e.model.document.selection,o=e.plugins.get("ImageCaptionEditing"),i=e.plugins.get("ImageCaptionUtils");let r,s=n.getSelectedElement();s?r=i.getCaptionFromImageModelElement(s):(r=i.getCaptionFromModelSelection(n),s=r.parent),o._saveCaption(s,r),t.setSelection(s,"on"),t.remove(r)}}class Qf extends ue{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[xf]}getCaptionFromImageModelElement(t){for(const e of t.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(t){const e=this.editor.plugins.get("ImageUtils"),n=t.getFirstPosition().findAncestor("caption");return n&&e.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(t){const e=this.editor.plugins.get("ImageUtils");return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}}class $f extends ue{static get requires(){return[xf,Qf]}static get pluginName(){return"ImageCaptionEditing"}constructor(t){super(t),this._savedCaptionsMap=new WeakMap}init(){const t=this.editor,e=t.model.schema;e.isRegistered("caption")?e.extend("caption",{allowIn:"imageBlock"}):e.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleImageCaption",new Kf(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration()}_setupConversion(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils"),o=t.plugins.get("ImageCaptionUtils"),i=t.t;t.conversion.for("upcast").elementToElement({view:t=>o.matchImageCaptionViewElement(t),model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>n.isBlockImage(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:o})=>{if(!n.isBlockImage(t.parent))return null;const r=o.createEditableElement("figcaption");return o.setCustomProperty("imageCaption",!0,r),Xu({view:e,element:r,text:i("Enter image caption"),keepOnFocus:!0}),$g(r,o)}})}_setupImageTypeCommandsIntegration(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.plugins.get("ImageCaptionUtils"),o=t.commands.get("imageTypeInline"),i=t.commands.get("imageTypeBlock"),r=t=>{if(!t.return)return;const{oldElement:o,newElement:i}=t.return;if(!o)return;if(e.isBlockImage(o)){const t=n.getCaptionFromImageModelElement(o);if(t)return void this._saveCaption(i,t)}const r=this._getSavedCaption(o);r&&this._saveCaption(i,r)};o&&this.listenTo(o,"execute",r,{priority:"low"}),i&&this.listenTo(i,"execute",r,{priority:"low"})}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?Va.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}}class Zf extends ue{static get requires(){return[Qf]}static get pluginName(){return"ImageCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageCaptionUtils"),o=t.t;t.ui.componentFactory.add("toggleImageCaption",(i=>{const r=t.commands.get("toggleImageCaption"),s=new kh(i);return s.set({icon:Bd.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(t=>o(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{t.execute("toggleImageCaption",{focusCaptionOnShow:!0});const o=n.getCaptionFromModelSelection(t.model.document.selection);if(o){const n=t.editing.mapper.toViewElement(o);e.scrollToTheSelection(),e.change((t=>{t.addClass("image__caption_highlighted",n)}))}})),s}))}}var Jf=n(2640),Xf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Jf.Z,Xf);Jf.Z.locals;class tk extends me{constructor(t,e){super(t),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(e.map((t=>{if(t.isDefault)for(const e of t.modelElements)this._defaultStyles[e]=t.name;return[t.name,t]})))}refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?t.hasAttribute("imageStyle")?this.value=t.getAttribute("imageStyle"):this.value=this._defaultStyles[t.name]:this.value=!1}execute(t={}){const e=this.editor,n=e.model,o=e.plugins.get("ImageUtils");n.change((e=>{const i=t.value;let r=o.getClosestSelectedImageElement(n.document.selection);i&&this.shouldConvertImageType(i,r)&&(this.editor.execute(o.isBlockImage(r)?"imageTypeInline":"imageTypeBlock"),r=o.getClosestSelectedImageElement(n.document.selection)),!i||this._styles.get(i).isDefault?e.removeAttribute("imageStyle",r):e.setAttribute("imageStyle",i,r)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}const{objectFullWidth:ek,objectInline:nk,objectLeft:ok,objectRight:ik,objectCenter:rk,objectBlockLeft:sk,objectBlockRight:ak}=Bd,ck={get inline(){return{name:"inline",title:"In line",icon:nk,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:ok,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:sk,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:rk,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:ik,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:ak,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:rk,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:ik,modelElements:["imageBlock"],className:"image-style-side"}}},lk={full:ek,left:sk,right:ak,center:rk,inlineLeft:ok,inlineRight:ik,inline:nk},dk=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function hk(t){l("image-style-configuration-definition-invalid",t)}const uk={normalizeStyles:function(t){return(t.configuredStyles.options||[]).map((t=>function(t){t="string"==typeof t?ck[t]?{...ck[t]}:{name:t}:function(t,e){const n={...e};for(const o in t)Object.prototype.hasOwnProperty.call(e,o)||(n[o]=t[o]);return n}(ck[t.name],t);"string"==typeof t.icon&&(t.icon=lk[t.icon]||t.icon);return t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:o,name:i}=t;if(!(o&&o.length&&i))return hk({style:t}),!1;{const i=[e?"imageBlock":null,n?"imageInline":null];if(!o.some((t=>i.includes(t))))return l("image-style-missing-dependency",{style:t,missingPlugins:o.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)))},getDefaultStylesConfiguration:function(t,e){return t&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:t?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(t){return t.has("ImageBlockEditing")&&t.has("ImageInlineEditing")?[...dk]:[]},warnInvalidStyle:hk,DEFAULT_OPTIONS:ck,DEFAULT_ICONS:lk,DEFAULT_DROPDOWN_DEFINITIONS:dk};function gk(t,e){for(const n of e)if(n.name===t)return n}class mk extends ue{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[xf]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=uk,n=this.editor,o=n.plugins.has("ImageBlockEditing"),i=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",e(o,i)),this.normalizedStyles=t({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:o,isInlinePluginLoaded:i}),this._setupConversion(o,i),this._setupPostFixer(),n.commands.add("imageStyle",new tk(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,o=n.model.schema,i=(r=this.normalizedStyles,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const o=gk(e.attributeNewValue,r),i=gk(e.attributeOldValue,r),s=n.mapper.toViewElement(e.item),a=n.writer;i&&a.removeClass(i.className,s),o&&a.addClass(o.className,s)});var r;const s=function(t){const e={imageInline:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageInline"))),imageBlock:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageBlock")))};return(t,n,o)=>{if(!n.modelRange)return;const i=n.viewItem,r=Ta(n.modelRange.getItems());if(r&&o.schema.checkAttribute(r,"imageStyle"))for(const t of e[r.name])o.consumable.consume(i,{classes:t.className})&&o.writer.setAttribute("imageStyle",t.name,r)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",i),n.data.downcastDispatcher.on("attribute:imageStyle",i),t&&(o.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),e&&(o.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(xf),o=new Map(this.normalizedStyles.map((t=>[t.name,t])));e.registerPostFixer((t=>{let i=!1;for(const r of e.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let e="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(e&&e.is("element","paragraph")&&e.childCount>0&&(e=e.getChild(0)),!n.isImage(e))continue;const s=e.getAttribute("imageStyle");if(!s)continue;const a=o.get(s);a&&a.modelElements.includes(e.name)||(t.removeAttribute("imageStyle",e),i=!0)}return i}))}}var pk=n(5083),fk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(pk.Z,fk);pk.Z.locals;class kk extends ue{static get requires(){return[mk]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Wrap text":t("Wrap text"),"Break text":t("Break text"),"In line":t("In line"),"Full size image":t("Full size image"),"Side image":t("Side image"),"Left aligned image":t("Left aligned image"),"Centered image":t("Centered image"),"Right aligned image":t("Right aligned image")}}init(){const t=this.editor.plugins,e=this.editor.config.get("image.toolbar")||[],n=bk(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const o=bk([...e.filter(x),...uk.getDefaultDropdownDefinitions(t)],this.localizedDefaultStylesTitles);for(const t of o)this._createDropdown(t,n)}_createDropdown(t,e){const n=this.editor.ui.componentFactory;n.add(t.name,(o=>{let i;const{defaultItem:r,items:s,title:a}=t,c=s.filter((t=>e.find((({name:e})=>wk(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(i=e),e}));s.length!==c.length&&uk.warnInvalidStyle({dropdown:t});const l=nu(o,Dh),d=l.buttonView;return ou(l,c),d.set({label:_k(a,i.label),class:null,tooltip:!0}),d.bind("icon").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return e<0?i.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return _k(a,e<0?i.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(st))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(st)?"ck-splitbutton_flatten":null)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:i.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(st))),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(wk(e),(n=>{const o=this.editor.commands.get("imageStyle"),i=new kh(n);return i.set({label:t.title,icon:t.icon,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(o,"isEnabled"),i.bind("isOn").to(o,"value",(t=>t===e)),i.on("execute",this._executeCommand.bind(this,e)),i}))}_executeCommand(t){this.editor.execute("imageStyle",{value:t}),this.editor.editing.view.focus()}}function bk(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function wk(t){return`imageStyle:${t}`}function _k(t,e){return(t?t+": ":"")+e}function Ak(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function Ck(t){return new Promise(((e,n)=>{const o=t.getAttribute("src");fetch(o).then((t=>t.blob())).then((t=>{const n=vk(t,o),i=n.replace("image/",""),r=new File([t],`image.${i}`,{type:n});e(r)})).catch((t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise(((e,n)=>{const o=is.document.createElement("img");o.addEventListener("load",(()=>{const t=is.document.createElement("canvas");t.width=o.width,t.height=o.height;t.getContext("2d").drawImage(o,0,0),t.toBlob((t=>t?e(t):n()))})),o.addEventListener("error",(()=>n())),o.src=t}))}(t).then((e=>{const n=vk(e,t),o=n.replace("image/","");return new File([e],`image.${o}`,{type:n})}))}(o).then(e).catch(n):n(t)))}))}function vk(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class yk extends ue{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor,e=t.t,n=n=>{const o=new Ap(n),i=t.commands.get("uploadImage"),r=t.config.get("image.upload.types"),s=Ak(r);return o.set({acceptedType:r.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0}),o.buttonView.set({label:e("Insert image"),icon:Bd.image,tooltip:!0}),o.buttonView.bind("isEnabled").to(i),o.on("done",((e,n)=>{const o=Array.from(n).filter((t=>s.test(t.type)));o.length&&t.execute("uploadImage",{file:o})})),o};t.ui.componentFactory.add("uploadImage",n),t.ui.componentFactory.add("imageUpload",n)}}var xk=n(3689),Ek={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(xk.Z,Ek);xk.Z.locals;var Dk=n(4036),Mk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Dk.Z,Mk);Dk.Z.locals;var Ik=n(3773),Sk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Ik.Z,Sk);Ik.Z.locals;class Tk extends ue{static get pluginName(){return"ImageUploadProgress"}constructor(t){super(t),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",((...t)=>this.uploadStatusChange(...t))),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",((...t)=>this.uploadStatusChange(...t)))}uploadStatusChange(t,e,n){const o=this.editor,i=e.item,r=i.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=o.plugins.get("ImageUtils"),a=o.plugins.get(wp),c=r?e.attributeNewValue:null,l=this.placeholder,d=o.editing.mapper.toViewElement(i),h=n.writer;if("reading"==c)return Nk(d,h),void Bk(s,l,d,h);if("uploading"==c){const t=a.loaders.get(r);return Nk(d,h),void(t?(zk(d,h),function(t,e,n,o){const i=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),i),n.on("change:uploadedPercent",((t,e,n)=>{o.change((t=>{t.setStyle("width",n+"%",i)}))}))}(d,h,t,o.editing.view),function(t,e,n,o){if(o.data){const i=t.findViewImgElement(e);n.setAttribute("src",o.data,i)}}(s,d,h,t)):Bk(s,l,d,h))}"complete"==c&&a.loaders.get(r)&&function(t,e,n){const o=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),o),setTimeout((()=>{n.change((t=>t.remove(t.createRangeOn(o))))}),3e3)}(d,h,o.editing.view),function(t,e){Lk(t,e,"progressBar")}(d,h),zk(d,h),function(t,e){e.removeClass("ck-appear",t)}(d,h)}}function Nk(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function Bk(t,e,n,o){n.hasClass("ck-image-upload-placeholder")||o.addClass("ck-image-upload-placeholder",n);const i=t.findViewImgElement(n);i.getAttribute("src")!==e&&o.setAttribute("src",e,i),Pk(n,"placeholder")||o.insert(o.createPositionAfter(i),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(o))}function zk(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),Lk(t,e,"placeholder")}function Pk(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function Lk(t,e,n){const o=Pk(t,n);o&&e.remove(e.createRangeOn(o))}class Ok extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(n)}execute(t){const e=So(t.file),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if(e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);this._uploadImage(t,i,e)}else this._uploadImage(t,i)}))}_uploadImage(t,e,n){const o=this.editor,i=o.plugins.get(wp).createLoader(t),r=o.plugins.get("ImageUtils");i&&r.insertImage({...e,uploadId:i.id},n)}}class Rk extends ue{static get requires(){return[wp,vu,xg,xf]}static get pluginName(){return"ImageUploadEditing"}constructor(t){super(t),t.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const t=this.editor,e=t.model.document,n=t.conversion,o=t.plugins.get(wp),i=t.plugins.get("ImageUtils"),r=Ak(t.config.get("image.upload.types")),s=new Ok(t);t.commands.add("uploadImage",s),t.commands.add("imageUpload",s),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,n)=>{if(o=n.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const i=Array.from(n.dataTransfer.files).filter((t=>!!t&&r.test(t.type)));i.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.model.enqueueChange((()=>{t.execute("uploadImage",{file:i})}))})))})),this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).filter((t=>function(t,e){return!(!t.isInlineImageView(e)||!e.getAttribute("src"))&&(e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||e.getAttribute("src").match(/^blob:/g))}(i,t.item)&&!t.item.getAttribute("uploadProcessed"))).map((t=>({promise:Ck(t.item),imageElement:t.item})));if(!r.length)return;const s=new kg(t.editing.view.document);for(const t of r){s.setAttribute("uploadProcessed",!0,t.imageElement);const e=o.createLoader(t.promise);e&&(s.setAttribute("src","",t.imageElement),s.setAttribute("uploadId",e.id,t.imageElement))}})),t.editing.view.document.on("dragover",((t,e)=>{e.preventDefault()})),e.on("change",(()=>{const n=e.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),i=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter,r="$graveyard"==e.position.root.rootName;for(const e of jk(t,n)){const t=e.getAttribute("uploadId");if(!t)continue;const n=o.loaders.get(t);n&&(r?i.has(t)||n.abort():(i.add(t),this._uploadImageElements.set(t,e),"idle"==n.status&&this._readAndUpload(n)))}}})),this.on("uploadComplete",((t,{imageElement:e,data:n})=>{const o=n.urls?n.urls:n;this.editor.model.change((t=>{t.setAttribute("src",o.default,e),this._parseAndSetSrcsetAttributeOnImage(o,e,t)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(t){const e=this.editor,n=e.model,o=e.locale.t,i=e.plugins.get(wp),r=e.plugins.get(vu),s=e.plugins.get("ImageUtils"),a=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","reading",a.get(t.id))})),t.read().then((()=>{const o=t.upload(),i=a.get(t.id);if(sr.isSafari){const t=e.editing.mapper.toViewElement(i),n=s.findViewImgElement(t);e.editing.view.once("render",(()=>{if(!n.parent)return;const t=e.editing.view.domConverter.mapViewToDom(n.parent);if(!t)return;const o=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=o}))}return n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",i)})),o})).then((e=>{n.enqueueChange({isUndoable:!1},(n=>{const o=a.get(t.id);n.setAttribute("uploadStatus","complete",o),this.fire("uploadComplete",{data:e,imageElement:o})})),c()})).catch((e=>{if("error"!==t.status&&"aborted"!==t.status)throw e;"error"==t.status&&e&&r.showWarning(e,{title:o("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{e.remove(a.get(t.id))})),c()}));function c(){n.enqueueChange({isUndoable:!1},(e=>{const n=a.get(t.id);e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n),a.delete(t.id)})),i.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let o=0;const i=Object.keys(t).filter((t=>{const e=parseInt(t,10);if(!isNaN(e))return o=Math.max(o,e),!0})).map((e=>`${t[e]} ${e}w`)).join(", ");""!=i&&n.setAttribute("srcset",{data:i,width:o},e)}}function jk(t,e){const n=t.plugins.get("ImageUtils");return Array.from(t.model.createRangeOn(e)).filter((t=>n.isImage(t.item))).map((t=>t.item))}class Fk extends ue{static get pluginName(){return"IndentEditing"}init(){const t=this.editor;t.commands.add("indent",new fe(t)),t.commands.add("outdent",new fe(t))}}const Vk='',Hk='';class Uk extends ue{static get pluginName(){return"IndentUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?Vk:Hk,i="ltr"==e.uiLanguageDirection?Hk:Vk;this._defineButton("indent",n("Increase indent"),o),this._defineButton("outdent",n("Decrease indent"),i)}_defineButton(t,e,n){const o=this.editor;o.ui.componentFactory.add(t,(i=>{const r=o.commands.get(t),s=new kh(i);return s.set({label:e,icon:n,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",(()=>{o.execute(t),o.editing.view.focus()})),s}))}}class Wk{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(t){Array.isArray(t)?t.forEach((t=>this._definitions.add(t))):this._definitions.add(t)}getDispatcher(){return t=>{t.on("attribute:linkHref",((t,e,n)=>{if(!n.consumable.test(e.item,"attribute:linkHref"))return;if(!e.item.is("selection")&&!n.schema.isInline(e.item))return;const o=n.writer,i=o.document.selection;for(const t of this._definitions){const r=o.createAttributeElement("a",t.attributes,{priority:5});t.classes&&o.addClass(t.classes,r);for(const e in t.styles)o.setStyle(e,t.styles[e],r);o.setCustomProperty("link",!0,r),t.callback(e.attributeNewValue)?e.item.is("selection")?o.wrap(i.getFirstRange(),r):o.wrap(n.mapper.toViewRange(e.range),r):o.unwrap(n.mapper.toViewRange(e.range),r)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return t=>{t.on("attribute:linkHref:imageBlock",((t,e,{writer:n,mapper:o})=>{const i=o.toViewElement(e.item),r=Array.from(i.getChildren()).find((t=>"a"===t.name));for(const t of this._definitions){const o=Ho(t.attributes);if(t.callback(e.attributeNewValue)){for(const[t,e]of o)"class"===t?n.addClass(e,r):n.setAttribute(t,e,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r)}else{for(const[t,e]of o)"class"===t?n.removeClass(e,r):n.removeAttribute(t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r)}}}))}}}const qk=function(t,e,n){var o=t.length;return n=void 0===n?o:n,!e&&n>=o?t:hi(t,e,n)};var Gk=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const Yk=function(t){return Gk.test(t)};const Kk=function(t){return t.split("")};var Qk="[\\ud800-\\udfff]",$k="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Zk="\\ud83c[\\udffb-\\udfff]",Jk="[^\\ud800-\\udfff]",Xk="(?:\\ud83c[\\udde6-\\uddff]){2}",tb="[\\ud800-\\udbff][\\udc00-\\udfff]",eb="(?:"+$k+"|"+Zk+")"+"?",nb="[\\ufe0e\\ufe0f]?",ob=nb+eb+("(?:\\u200d(?:"+[Jk,Xk,tb].join("|")+")"+nb+eb+")*"),ib="(?:"+[Jk+$k+"?",$k,Xk,tb,Qk].join("|")+")",rb=RegExp(Zk+"(?="+Zk+")|"+ib+ob,"g");const sb=function(t){return t.match(rb)||[]};const ab=function(t){return Yk(t)?sb(t):Kk(t)};const cb=function(t){return function(e){e=si(e);var n=Yk(e)?ab(e):void 0,o=n?n[0]:e.charAt(0),i=n?qk(n,1).join(""):e.slice(1);return o[t]()+i}}("toUpperCase"),lb=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,db=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,hb=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,ub=/^((\w+:(\/{2,})?)|(\W))/i,gb="Ctrl+K";function mb(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function pb(t){return function(t){return t.replace(lb,"").match(db)}(t=String(t))?t:"#"}function fb(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function kb(t,e){const n=(o=t,hb.test(o)?"mailto:":e);var o;const i=!!n&&!ub.test(t);return t&&i?n+t:t}function bb(t){window.open(t,"_blank","noopener")}class wb extends me{constructor(t){super(t),this.manualDecorators=new Mo,this.automaticDecorators=new Wk}restoreManualDecoratorStates(){for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement()||Ta(e.getSelectedBlocks());fb(n,t.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttribute(n,"linkHref")):(this.value=e.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref"));for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}execute(t,e={}){const n=this.editor.model,o=n.document.selection,i=[],r=[];for(const t in e)e[t]?i.push(t):r.push(t);n.change((e=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=sp(s,"linkHref",o.getAttribute("linkHref"),n);e.setAttribute("linkHref",t,a),i.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)})),e.setSelection(e.createPositionAfter(a.end.nodeBefore))}else if(""!==t){const r=Ho(o.getAttributes());r.set("linkHref",t),i.forEach((t=>{r.set(t,!0)}));const{end:a}=n.insertContent(e.createText(t,r),s);e.setSelection(a)}["linkHref",...i,...r].forEach((t=>{e.removeSelectionAttribute(t)}))}else{const s=n.schema.getValidRanges(o.getRanges(),"linkHref"),a=[];for(const t of o.getSelectedBlocks())n.schema.checkAttribute(t,"linkHref")&&a.push(e.createRangeOn(t));const c=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&c.push(t);for(const n of c)e.setAttribute("linkHref",t,n),i.forEach((t=>{e.setAttribute(t,!0,n)})),r.forEach((t=>{e.removeAttribute(t,n)}))}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,o=n.getSelectedElement();return fb(o,e.schema)?o.getAttribute(t):n.getAttribute(t)}_isRangeToUpdate(t,e){for(const n of e)if(n.containsRange(t))return!1;return!0}}class _b extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();fb(n,t.schema)?this.isEnabled=t.schema.checkAttribute(n,"linkHref"):this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref")}execute(){const t=this.editor,e=this.editor.model,n=e.document.selection,o=t.commands.get("link");e.change((t=>{const i=n.isCollapsed?[sp(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),e)]:e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of i)if(t.removeAttribute("linkHref",e),o)for(const n of o.manualDecorators)t.removeAttribute(n.id,e)}))}}class Ab{constructor({id:t,label:e,attributes:n,classes:o,styles:i,defaultValue:r}){this.id=t,this.set("value"),this.defaultValue=r,this.label=e,this.attributes=n,this.classes=o,this.styles=i}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}he(Ab,re);var Cb=n(9773),vb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Cb.Z,vb);Cb.Z.locals;const yb="automatic",xb=/^(https?:)?\/\//;class Eb extends ue{static get pluginName(){return"LinkEditing"}static get requires(){return[qm,Vm,xg]}constructor(t){super(t),t.config.define("link",{addTargetToExternalLinks:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:mb}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,e)=>mb(pb(t),e)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new wb(t)),t.commands.add("unlink",new _b(t));const e=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>(t.label&&n[t.label]&&(t.label=n[t.label]),t))),e}(t.t,function(t){const e=[];if(t)for(const[n,o]of Object.entries(t)){const t=Object.assign({},o,{id:`link${cb(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(e.filter((t=>t.mode===yb))),this._enableManualDecorators(e.filter((t=>"manual"===t.mode)));t.plugins.get(qm).registerAttribute("linkHref"),function(t,e,n,o){const i=t.editing.view,r=new Set;i.document.registerPostFixer((i=>{const s=t.model.document.selection;let a=!1;if(s.hasAttribute(e)){const c=sp(s.getFirstPosition(),e,s.getAttribute(e),t.model),l=t.editing.mapper.toViewRange(c);for(const t of l.getItems())t.is("element",n)&&!t.hasClass(o)&&(i.addClass(o,t),r.add(t),a=!0)}return a})),t.conversion.for("editingDowncast").add((t=>{function e(){i.change((t=>{for(const e of r.values())t.removeClass(o,e),r.delete(e)}))}t.on("insert",e,{priority:"highest"}),t.on("remove",e,{priority:"highest"}),t.on("attribute",e,{priority:"highest"}),t.on("selection",e,{priority:"highest"})}))}(t,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:yb,callback:t=>xb.test(t),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(t),n.length&&e.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(t){if(!t.length)return;const e=this.editor,n=e.commands.get("link").manualDecorators;t.forEach((t=>{e.model.schema.extend("$text",{allowAttributes:t.id}),t=new Ab(t),n.add(t),e.conversion.for("downcast").attributeToElement({model:t.id,view:(e,{writer:n,schema:o},{item:i})=>{if(o.isInline(i)&&e){const e=n.createAttributeElement("a",t.attributes,{priority:5});t.classes&&n.addClass(t.classes,e);for(const o in t.styles)n.setStyle(o,t.styles[o],e);return n.setCustomProperty("link",!0,e),e}}}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",...t._createPattern()},model:{key:t.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document,n=t.model.document;this.listenTo(e,"click",((t,e)=>{if(!(sr.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const o=n.getAttribute("href");o&&(t.stop(),e.preventDefault(),bb(o))}),{context:"$capture"}),this.listenTo(e,"enter",((t,e)=>{const o=n.selection,i=o.getSelectedElement(),r=i?i.getAttribute("linkHref"):o.getAttribute("linkHref");r&&e.domEvent.altKey&&(t.stop(),bb(r))}),{context:"a"})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(t,"insertContent",(()=>{const n=e.anchor.nodeBefore,o=e.anchor.nodeAfter;e.hasAttribute("linkHref")&&n&&n.hasAttribute("linkHref")&&(o&&o.hasAttribute("linkHref")||t.change((e=>{Db(e,Ib(t.schema))})))}),{priority:"low"})}_enableClickingAfterLink(){const t=this.editor,e=t.model;t.editing.view.addObserver(fg);let n=!1;this.listenTo(t.editing.view.document,"mousedown",(()=>{n=!0})),this.listenTo(t.editing.view.document,"selectionChange",(()=>{if(!n)return;n=!1;const t=e.document.selection;if(!t.isCollapsed)return;if(!t.hasAttribute("linkHref"))return;const o=t.getFirstPosition(),i=sp(o,"linkHref",t.getAttribute("linkHref"),e);(o.isTouching(i.start)||o.isTouching(i.end))&&e.change((t=>{Db(t,Ib(e.schema))}))}))}_enableTypingOverLink(){const t=this.editor,e=t.editing.view;let n,o;this.listenTo(e.document,"delete",(()=>{o=!0}),{priority:"high"}),this.listenTo(t.model,"deleteContent",(()=>{const e=t.model.document.selection;e.isCollapsed||(o?o=!1:Mb(t)&&function(t){const e=t.document.selection,n=e.getFirstPosition(),o=e.getLastPosition(),i=n.nodeAfter;if(!i)return!1;if(!i.is("$text"))return!1;if(!i.hasAttribute("linkHref"))return!1;const r=o.textNode||o.nodeBefore;if(i===r)return!0;return sp(n,"linkHref",i.getAttribute("linkHref"),t).containsRange(t.createRange(n,o),!0)}(t.model)&&(n=e.getAttributes()))}),{priority:"high"}),this.listenTo(t.model,"insertContent",((e,[i])=>{o=!1,Mb(t)&&n&&(t.model.change((t=>{for(const[e,o]of n)t.setAttribute(e,o,i)})),n=null)}),{priority:"high"})}_handleDeleteContentAfterLink(){const t=this.editor,e=t.model,n=e.document.selection,o=t.editing.view;let i=!1,r=!1;this.listenTo(o.document,"delete",((t,e)=>{r=e.domEvent.keyCode===dr.backspace}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{i=!1;const t=n.getFirstPosition(),o=n.getAttribute("linkHref");if(!o)return;const r=sp(t,"linkHref",o,e);i=r.containsPosition(t)||r.end.isEqual(t)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{r&&(r=!1,i||t.model.enqueueChange((t=>{Db(t,Ib(e.schema))})))}),{priority:"low"})}}function Db(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}function Mb(t){return t.model.change((t=>t.batch)).isTyping}function Ib(t){return t.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))}var Sb=n(7754),Tb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Sb.Z,Tb);Sb.Z.locals;class Nb extends Fd{constructor(t,e){super(t);const n=t.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Bd.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),Bd.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusables=new Od,this._focusCycler=new Lh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children}),Pd(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),Ld({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].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()}_createUrlInput(){const t=this.locale.t,e=new Au(this.locale,Cu);return e.label=t("Link URL"),e}_createButton(t,e,n,o){const i=new kh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createManualDecoratorSwitches(t){const e=this.createCollection();for(const n of t.manualDecorators){const o=new _h(this.locale);o.set({name:n.id,label:n.label,withText:!0}),o.bind("isOn").toMany([n,t],"value",((t,e)=>void 0===e&&void 0===t?n.defaultValue:t)),o.on("execute",(()=>{n.set("value",!o.isOn)})),e.add(o)}return e}_createFormChildren(t){const e=this.createCollection();if(e.add(this.urlInputView),t.length){const t=new Fd;t.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((t=>({tag:"li",children:[t],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),e.add(t)}return e.add(this.saveButtonView),e.add(this.cancelButtonView),e}}var Bb=n(2347),zb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Bb.Z,zb);Bb.Z.locals;class Pb extends Fd{constructor(t){super(t);const e=t.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(e("Unlink"),'',"unlink"),this.editButtonView=this._createButton(e("Edit link"),Bd.pencil,"edit"),this.set("href"),this._focusables=new Od,this._focusCycler=new Lh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].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()}_createButton(t,e,n){const o=new kh(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.delegate("execute").to(this,n),o}_createPreviewButton(){const t=new kh(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("Open link in new tab")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&pb(t))),target:"_blank",rel:"noopener noreferrer"}}),t.bind("label").to(this,"href",(t=>t||n("This link has no URL"))),t.bind("isEnabled").to(this,"href",(t=>!!t)),t.template.tag="a",t.template.eventListeners={},t}}const Lb="link-ui";class Ob extends ue{static get requires(){return[Ru]}static get pluginName(){return"LinkUI"}init(){const t=this.editor;t.editing.view.addObserver(pg),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=t.plugins.get(Ru),this._createToolbarLinkButton(),this._enableUserBalloonInteractions(),t.conversion.for("editingDowncast").markerToHighlight({model:Lb,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:Lb,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const t=this.editor,e=new Pb(t.locale),n=t.commands.get("link"),o=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(o),this.listenTo(e,"edit",(()=>{this._addFormView()})),this.listenTo(e,"unlink",(()=>{t.execute("unlink"),this._hideUI()})),e.keystrokes.set("Esc",((t,e)=>{this._hideUI(),e()})),e.keystrokes.set(gb,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),o=new Nb(t.locale,e);return o.urlInputView.fieldView.bind("value").to(e,"value"),o.urlInputView.bind("isReadOnly").to(e,"isEnabled",(t=>!t)),o.saveButtonView.bind("isEnabled").to(e),this.listenTo(o,"submit",(()=>{const{value:e}=o.urlInputView.fieldView.element,i=kb(e,n);t.execute("link",i,o.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(o,"cancel",(()=>{this._closeFormView()})),o.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),o}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link"),n=t.t;t.keystrokes.set(gb,((t,n)=>{n(),e.isEnabled&&this._showUI(!0)})),t.ui.componentFactory.add("link",(t=>{const o=new kh(t);return o.isEnabled=!0,o.label=n("Link"),o.icon='',o.keystroke=gb,o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(e,"isEnabled"),o.bind("isOn").to(e,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}))}_enableUserBalloonInteractions(){const t=this.editor.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),this.editor.keystrokes.set("Tab",((t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((t,e)=>{this._isUIVisible&&(this._hideUI(),e())})),zd({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=t.value||""}_closeFormView(){const t=this.editor.commands.get("link");t.restoreManualDecoratorStates(),void 0!==t.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(t=!1){this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),o=r();const i=()=>{const t=this._getSelectedLinkElement(),e=r();n&&!t||!n&&e!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=t,o=e};function r(){return e.selection.focus.getAncestors().reverse().find((t=>t.is("element")))}this.listenTo(t.ui,"update",i),this.listenTo(this._balloon,"change:visibleView",i)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const t=this.editor.editing.view,e=this.editor.model,n=t.document;let o=null;if(e.markers.has(Lb)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(Lb)),n=t.createRange(t.createPositionBefore(e[0]),t.createPositionAfter(e[e.length-1]));o=t.domConverter.viewRangeToDom(n)}else o=()=>{const e=this._getSelectedLinkElement();return e?t.domConverter.mapViewToDom(e):t.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:o}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection,n=e.getSelectedElement();if(e.isCollapsed||n&&Wg(n))return Rb(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),o=Rb(n.start),i=Rb(n.end);return o&&o==i&&t.createRangeIn(o).getTrimmed().isEqual(n)?o:null}}_showFakeVisualSelection(){const t=this.editor.model;t.change((e=>{const n=t.document.selection.getFirstRange();if(t.markers.has(Lb))e.updateMarker(Lb,{range:n});else if(n.start.isAtEnd){const o=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(Lb,{usingOperation:!1,affectsData:!1,range:e.createRange(o,n.end)})}else e.addMarker(Lb,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(Lb)&&t.change((t=>{t.removeMarker(Lb)}))}}function Rb(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))}const jb=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})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class Fb extends ue{static get requires(){return[Og]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",(()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const t=this.editor,e=new Wm(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=Vb(t.substr(0,t.length-1));return e?{url:e}:void 0}));e.on("matched:data",((e,n)=>{const{batch:o,range:i,url:r}=n;if(!o.isTyping)return;const s=i.end.getShiftedBy(-1),a=s.getShiftedBy(-r.length),c=t.model.createRange(a,s);this._applyAutoLink(r,c)})),e.bind("isEnabled").to(this)}_enableEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("enter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition();if(!t.parent.previousSibling)return;const n=e.createRangeIn(t.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("shiftEnter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition(),n=e.createRange(e.createPositionAt(t.parent,0),t.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(t){const e=this.editor.model,{text:n,range:o}=Um(t,e),i=Vb(n);if(i){const t=e.createRange(o.end.getShiftedBy(-i.length),o.end);this._applyAutoLink(i,t)}}_applyAutoLink(t,e){const n=this.editor.model,o=this.editor.plugins.get("Delete");this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&n.enqueueChange((i=>{const r=this.editor.config.get("link.defaultProtocol"),s=kb(t,r);i.setAttribute("linkHref",s,e),n.enqueueChange((()=>{o.requestUndoOnBackspace()}))}))}}function Vb(t){const e=jb.exec(t);return e?e[2]:null}class Hb extends me{constructor(t,e){super(t),this.type=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,o=Array.from(n.selection.getSelectedBlocks()).filter((t=>Wb(t,e.schema))),i=void 0!==t.forceValue?!t.forceValue:this.value;e.change((t=>{if(i){let e=o[o.length-1].nextSibling,n=Number.POSITIVE_INFINITY,i=[];for(;e&&"listItem"==e.name&&0!==e.getAttribute("listIndent");){const t=e.getAttribute("listIndent");t=n;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&t[e?"unshift":"push"](i),i=i[e?"previousSibling":"nextSibling"]}}function Wb(t,e){return e.checkChild(t.parent,"listItem")&&!e.isObject(t)}class qb extends me{constructor(t,e){super(t),this._indentBy="forward"==e?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=t.document;let n=Array.from(e.selection.getSelectedBlocks());t.change((t=>{const e=n[n.length-1];let o=e.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>e.getAttribute("listIndent");)n.push(o),o=o.nextSibling;this._indentBy<0&&(n=n.reverse());for(const e of n){const n=e.getAttribute("listIndent")+this._indentBy;n<0?t.rename(e,"paragraph"):t.setAttribute("listIndent",n,e)}this.fire("_executeCleanup",n)}))}_checkEnabled(){const t=Ta(this.editor.model.document.selection.getSelectedBlocks());if(!t||!t.is("element","listItem"))return!1;if(this._indentBy>0){const e=t.getAttribute("listIndent"),n=t.getAttribute("listType");let o=t.previousSibling;for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=e;){if(o.getAttribute("listIndent")==e)return o.getAttribute("listType")==n;o=o.previousSibling}return!1}return!0}}function Gb(t,e){const n=e.mapper,o=e.writer,i="numbered"==t.getAttribute("listType")?"ol":"ul",r=function(t){const e=t.createContainerElement("li");return e.getFillerOffset=Jb,e}(o),s=o.createContainerElement(i,null);return o.insert(o.createPositionAt(s,0),r),n.bindElements(t,r),r}function Yb(t,e,n,o){const i=e.parent,r=n.mapper,s=n.writer;let a=r.toViewPosition(o.createPositionBefore(t));const c=$b(t.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:t.getAttribute("listIndent")}),l=t.previousSibling;if(c&&c.getAttribute("listIndent")==t.getAttribute("listIndent")){const t=r.toViewElement(c);a=s.breakContainer(s.createPositionAfter(t))}else if(l&&"listItem"==l.name){a=r.toViewPosition(o.createPositionAt(l,"end"));const t=r.findMappedViewAncestor(a),e=function(t){for(const e of t.getChildren())if("ul"==e.name||"ol"==e.name)return e;return null}(t);a=e?s.createPositionBefore(e):s.createPositionAt(t,"end")}else a=r.toViewPosition(o.createPositionBefore(t));if(a=Qb(a),s.insert(a,i),l&&"listItem"==l.name){const t=r.toViewElement(l),n=s.createRange(s.createPositionAt(t,0),a).getWalker({ignoreElementEnd:!0});for(const t of n)if(t.item.is("element","li")){const o=s.breakContainer(s.createPositionBefore(t.item)),i=t.item.parent,r=s.createPositionAt(e,"end");Kb(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(i),r),n.position=o}}else{const n=i.nextSibling;if(n&&(n.is("element","ul")||n.is("element","ol"))){let o=null;for(const e of n.getChildren()){const n=r.toModelElement(e);if(!(n&&n.getAttribute("listIndent")>t.getAttribute("listIndent")))break;o=e}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(e,"end")))}}Kb(s,i,i.nextSibling),Kb(s,i.previousSibling,i)}function Kb(t,e,n){return!e||!n||"ul"!=e.name&&"ol"!=e.name||e.name!=n.name||e.getAttribute("class")!==n.getAttribute("class")?null:t.mergeContainers(t.createPositionAfter(e))}function Qb(t){return t.getLastMatchingPosition((t=>t.item.is("uiElement")))}function $b(t,e){const n=!!e.sameIndent,o=!!e.smallerIndent,i=e.listIndent;let r=t;for(;r&&"listItem"==r.name;){const t=r.getAttribute("listIndent");if(n&&i==t||o&&i>t)return r;r="forward"===e.direction?r.nextSibling:r.previousSibling}return null}function Zb(t,e,n,o){t.ui.componentFactory.add(e,(i=>{const r=t.commands.get(e),s=new kh(i);return s.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),s}))}function Jb(){const t=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||t?0:Bi.call(this)}function Xb(t){return(e,n,o)=>{const i=o.consumable;if(!i.test(n.item,"insert")||!i.test(n.item,"attribute:listType")||!i.test(n.item,"attribute:listIndent"))return;i.consume(n.item,"insert"),i.consume(n.item,"attribute:listType"),i.consume(n.item,"attribute:listIndent");const r=n.item;Yb(r,Gb(r,o),o,t)}}function tw(t,e,n){if(!n.consumable.test(e.item,t.name))return;const o=n.mapper.toViewElement(e.item),i=n.writer;i.breakContainer(i.createPositionBefore(o)),i.breakContainer(i.createPositionAfter(o));const r=o.parent,s="numbered"==e.attributeNewValue?"ol":"ul";i.rename(s,r)}function ew(t,e,n){n.consumable.consume(e.item,t.name);const o=n.mapper.toViewElement(e.item).parent,i=n.writer;Kb(i,o,o.nextSibling),Kb(i,o.previousSibling,o)}function nw(t,e,n){if(n.consumable.test(e.item,t.name)&&"listItem"!=e.item.name){let t=n.mapper.toViewPosition(e.range.start);const o=n.writer,i=[];for(;("ul"==t.parent.name||"ol"==t.parent.name)&&(t=o.breakContainer(t),"li"==t.parent.name);){const e=t,n=o.createPositionAt(t.parent,"end");if(!e.isEqual(n)){const t=o.remove(o.createRange(e,n));i.push(t)}t=o.createPositionAfter(t.parent)}if(i.length>0){for(let e=0;e0){const e=Kb(o,n,n.nextSibling);e&&e.parent==n&&t.offset--}}Kb(o,t.nodeBefore,t.nodeAfter)}}}function ow(t,e,n){const o=n.mapper.toViewPosition(e.position),i=o.nodeBefore,r=o.nodeAfter;Kb(n.writer,i,r)}function iw(t,e,n){if(n.consumable.consume(e.viewItem,{name:!0})){const t=n.writer,o=t.createElement("listItem"),i=function(t){let e=0,n=t.parent;for(;n;){if(n.is("element","li"))e++;else{const t=n.previousSibling;t&&t.is("element","li")&&e++}n=n.parent}return e}(e.viewItem);t.setAttribute("listIndent",i,o);const r=e.viewItem.parent&&"ol"==e.viewItem.parent.name?"numbered":"bulleted";if(t.setAttribute("listType",r,o),!n.safeInsert(o,e.modelCursor))return;const s=function(t,e,n){const{writer:o,schema:i}=n;let r=o.createPositionAfter(t);for(const s of e)if("ul"==s.name||"ol"==s.name)r=n.convertItem(s,r).modelCursor;else{const e=n.convertItem(s,o.createPositionAt(t,"end")),a=e.modelRange.start.nodeAfter;a&&a.is("element")&&!i.checkChild(t,a.name)&&(t=e.modelCursor.parent.is("element","listItem")?e.modelCursor.parent:lw(e.modelCursor),r=o.createPositionAfter(t))}return r}(o,e.viewItem.getChildren(),n);e.modelRange=t.createRange(e.modelCursor,s),n.updateConversionResult(o,e)}}function rw(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){const t=Array.from(e.viewItem.getChildren());for(const e of t){!(e.is("element","li")||hw(e))&&e._remove()}}}function sw(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){if(0===e.viewItem.childCount)return;const t=[...e.viewItem.getChildren()];let n=!1;for(const e of t)n&&!hw(e)&&e._remove(),hw(e)&&(n=!0)}}function aw(t){return(e,n)=>{if(n.isPhantom)return;const o=n.modelPosition.nodeBefore;if(o&&o.is("element","listItem")){const e=n.mapper.toViewElement(o),i=e.getAncestors().find(hw),r=t.createPositionAt(e,0).getWalker();for(const t of r){if("elementStart"==t.type&&t.item.is("element","li")){n.viewPosition=t.previousPosition;break}if("elementEnd"==t.type&&t.item==i){n.viewPosition=t.nextPosition;break}}}}}function cw(t,[e,n]){let o,i=e.is("documentFragment")?e.getChild(0):e;if(o=n?this.createSelection(n):this.document.selection,i&&i.is("element","listItem")){const t=o.getFirstPosition();let e=null;if(t.parent.is("element","listItem")?e=t.parent:t.nodeBefore&&t.nodeBefore.is("element","listItem")&&(e=t.nodeBefore),e){const t=e.getAttribute("listIndent");if(t>0)for(;i&&i.is("element","listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+t),i=i.nextSibling}}}function lw(t){const e=new Ha({startPosition:t});let n;do{n=e.next()}while(!n.value.item.is("element","listItem"));return n.value.item}function dw(t,e,n,o,i,r){const s=$b(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:t,foo:"b"}),a=i.mapper,c=i.writer,l=s?s.getAttribute("listIndent"):null;let d;if(s)if(l==t){const t=a.toViewElement(s).parent;d=c.createPositionAfter(t)}else{const t=r.createPositionAt(s,"end");d=a.toViewPosition(t)}else d=n;d=Qb(d);for(const t of[...o.getChildren()])hw(t)&&(d=c.move(c.createRangeOn(t),d).end,Kb(c,t,t.nextSibling),Kb(c,t.previousSibling,t))}function hw(t){return t.is("element","ol")||t.is("element","ul")}class uw extends ue{static get pluginName(){return"ListEditing"}static get requires(){return[Sg,Og]}init(){const t=this.editor;t.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const e=t.data,n=t.editing;var o;t.model.document.registerPostFixer((e=>function(t,e){const n=t.document.differ.getChanges(),o=new Map;let i=!1;for(const o of n)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const n=o.position.nodeAfter;n.hasAttribute("listIndent")&&(e.removeAttribute("listIndent",n),i=!0),n.hasAttribute("listType")&&(e.removeAttribute("listType",n),i=!0),n.hasAttribute("listStyle")&&(e.removeAttribute("listStyle",n),i=!0),n.hasAttribute("listReversed")&&(e.removeAttribute("listReversed",n),i=!0),n.hasAttribute("listStart")&&(e.removeAttribute("listStart",n),i=!0);for(const e of Array.from(t.createRangeIn(n)).filter((t=>t.item.is("element","listItem"))))r(e.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const t of o.values())s(t),a(t);return i;function r(t){const e=t.nodeBefore;if(e&&e.is("element","listItem")){let t=e;if(o.has(t))return;for(let e=t.previousSibling;e&&e.is("element","listItem");e=t.previousSibling)if(t=e,o.has(t))return;o.set(e,t)}else{const e=t.nodeAfter;e&&e.is("element","listItem")&&o.set(e,e)}}function s(t){let n=0,o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(r>n){let s;null===o?(o=r-n,s=n):(o>r&&(o=r),s=r-o),e.setAttribute("listIndent",s,t),i=!0}else o=null,n=t.getAttribute("listIndent")+1;t=t.nextSibling}}function a(t){let n=[],o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(n=n.slice(0,r+1)),0!=r)if(n[r]){const o=n[r];t.getAttribute("listType")!=o&&(e.setAttribute("listType",o,t),i=!0)}else n[r]=t.getAttribute("listType");o=t,t=t.nextSibling}}}(t.model,e))),n.mapper.registerViewToModelLength("li",gw),e.mapper.registerViewToModelLength("li",gw),n.mapper.on("modelToViewPosition",aw(n.view)),n.mapper.on("viewToModelPosition",(o=t.model,(t,e)=>{const n=e.viewPosition,i=n.parent,r=e.mapper;if("ul"==i.name||"ol"==i.name){if(n.isAtEnd){const t=r.toModelElement(n.nodeBefore),i=r.getModelLength(n.nodeBefore);e.modelPosition=o.createPositionBefore(t).getShiftedBy(i)}else{const t=r.toModelElement(n.nodeAfter);e.modelPosition=o.createPositionBefore(t)}t.stop()}else if("li"==i.name&&n.nodeBefore&&("ul"==n.nodeBefore.name||"ol"==n.nodeBefore.name)){const s=r.toModelElement(i);let a=1,c=n.nodeBefore;for(;c&&hw(c);)a+=r.getModelLength(c),c=c.previousSibling;e.modelPosition=o.createPositionBefore(s).getShiftedBy(a),t.stop()}})),e.mapper.on("modelToViewPosition",aw(n.view)),t.conversion.for("editingDowncast").add((e=>{e.on("insert",nw,{priority:"high"}),e.on("insert:listItem",Xb(t.model)),e.on("attribute:listType:listItem",tw,{priority:"high"}),e.on("attribute:listType:listItem",ew,{priority:"low"}),e.on("attribute:listIndent:listItem",function(t){return(e,n,o)=>{if(!o.consumable.consume(n.item,"attribute:listIndent"))return;const i=o.mapper.toViewElement(n.item),r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s);r.remove(c),a&&a.nextSibling&&Kb(r,a,a.nextSibling),dw(n.attributeOldValue+1,n.range.start,c.start,i,o,t),Yb(n.item,i,o,t);for(const t of n.item.getChildren())o.consumable.consume(t,"insert")}}(t.model)),e.on("remove:listItem",function(t){return(e,n,o)=>{const i=o.mapper.toViewPosition(n.position).getLastMatchingPosition((t=>!t.item.is("element","li"))).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s),l=r.remove(c);a&&a.nextSibling&&Kb(r,a,a.nextSibling),dw(o.mapper.toModelElement(i).getAttribute("listIndent")+1,n.position,c.start,i,o,t);for(const t of r.createRangeIn(l).getItems())o.mapper.unbindViewElement(t);e.stop()}}(t.model)),e.on("remove",ow,{priority:"low"})})),t.conversion.for("dataDowncast").add((e=>{e.on("insert",nw,{priority:"high"}),e.on("insert:listItem",Xb(t.model))})),t.conversion.for("upcast").add((t=>{t.on("element:ul",rw,{priority:"high"}),t.on("element:ol",rw,{priority:"high"}),t.on("element:li",sw,{priority:"high"}),t.on("element:li",iw)})),t.model.on("insertContent",cw,{priority:"high"}),t.commands.add("numberedList",new Hb(t,"numbered")),t.commands.add("bulletedList",new Hb(t,"bulleted")),t.commands.add("indentList",new qb(t,"forward")),t.commands.add("outdentList",new qb(t,"backward"));const i=n.view.document;this.listenTo(i,"enter",((t,e)=>{const n=this.editor.model.document,o=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(i,"delete",((t,e)=>{if("backward"!==e.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const o=n.getFirstPosition();if(!o.isAtStart)return;const i=o.parent;if("listItem"!==i.name)return;i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(t.editing.view.document,"tab",((e,n)=>{const o=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(o).isEnabled&&(t.execute(o),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"li"})}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList")),n&&n.registerChildCommand(t.get("outdentList"))}}function gw(t){let e=1;for(const n of t.getChildren())if("ul"==n.name||"ol"==n.name)for(const t of n.getChildren())e+=gw(t);return e}class mw extends ue{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;Zb(this.editor,"numberedList",t("Numbered List"),''),Zb(this.editor,"bulletedList",t("Bulleted List"),'')}}function pw(t,e){return t=>{t.on("attribute:url:media",n)};function n(n,o,i){if(!i.consumable.consume(o.item,n.name))return;const r=o.attributeNewValue,s=i.writer,a=i.mapper.toViewElement(o.item),c=[...a.getChildren()].find((t=>t.getCustomProperty("media-content")));s.remove(c);const l=t.getMediaViewElement(s,r,e);s.insert(s.createPositionAt(a,0),l)}}function fw(t,e,n,o){return t.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(t,n,o),t.createSlot()])}function kw(t){const e=t.getSelectedElement();return e&&e.is("element","media")?e:null}function bw(t,e,n,o){t.change((i=>{const r=i.createElement("media",{url:e});t.insertObject(r,n,null,{setSelection:"on",findOptimalPosition:o})}))}class ww extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=kw(e);this.value=n?n.getAttribute("url"):null,this.isEnabled=function(t){const e=t.getSelectedElement();return!!e&&"media"===e.name}(e)||function(t,e){let n=Zg(t,e).start.parent;n.isEmpty&&!e.schema.isLimit(n)&&(n=n.parent);return e.schema.checkChild(n,"media")}(e,t)}execute(t){const e=this.editor.model,n=e.document.selection,o=kw(n);o?e.change((e=>{e.setAttribute("url",t,o)})):bw(e,t,n,!0)}}class _w{constructor(t,e){const n=e.providers,o=e.extraProviders||[],i=new Set(e.removeProviders),r=n.concat(o).filter((t=>{const e=t.name;return e?!i.has(e):(l("media-embed-no-provider-name",{provider:t}),!1)}));this.locale=t,this.providerDefinitions=r}hasMedia(t){return!!this._getMedia(t)}getMediaViewElement(t,e,n){return this._getMedia(e).getViewElement(t,n)}_getMedia(t){if(!t)return new Aw(this.locale);t=t.trim();for(const e of this.providerDefinitions){const n=e.html,o=So(e.url);for(const e of o){const o=this._getUrlMatches(t,e);if(o)return new Aw(this.locale,t,o,n)}}return null}_getUrlMatches(t,e){let n=t.match(e);if(n)return n;let o=t.replace(/^https?:\/\//,"");return n=o.match(e),n||(o=o.replace(/^www\./,""),n=o.match(e),n||null)}}class Aw{constructor(t,e,n,o){this.url=this._getValidUrl(e),this._t=t.t,this._match=n,this._previewRenderer=o}getViewElement(t,e){const n={};let o;if(e.renderForEditingView||e.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),e.renderForEditingView&&(n.class="ck-media__wrapper");const i=this._getPreviewHtml(e);o=t.createRawElement("div",n,((t,e)=>{e.setContentOf(t,i)}))}else this.url&&(n.url=this.url),o=t.createEmptyElement(e.elementName,n);return t.setCustomProperty("media-content",!0,o),o}_getPreviewHtml(t){return this._previewRenderer?this._previewRenderer(this._match):this.url&&t.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const t=new mh,e=new hh;t.text=this._t("Open media in new tab"),e.content='',e.viewBox="0 0 64 42";return new Vd({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]},t]}]}).render().outerHTML}_getValidUrl(t){return t?t.match(/^https?/)?t:"https://"+t:null}}var Cw=n(7442),vw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Cw.Z,vw);Cw.Z.locals;class yw extends ue{static get pluginName(){return"MediaEmbedEditing"}constructor(t){super(t),t.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>`
`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`
`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:t=>`
`},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`
`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new _w(t.locale,t.config.get("mediaEmbed"))}init(){const t=this.editor,e=t.model.schema,n=t.t,o=t.conversion,i=t.config.get("mediaEmbed.previewsInData"),r=t.config.get("mediaEmbed.elementName"),s=this.registry;t.commands.add("mediaEmbed",new ww(t)),e.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),o.for("dataDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const n=t.getAttribute("url");return fw(e,s,n,{elementName:r,renderMediaPreview:n&&i})}}),o.for("dataDowncast").add(pw(s,{elementName:r,renderMediaPreview:i})),o.for("editingDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const o=t.getAttribute("url");return function(t,e,n){return e.setCustomProperty("media",!0,t),qg(t,e,{label:n})}(fw(e,s,o,{elementName:r,renderForEditingView:!0}),e,n("media widget"))}}),o.for("editingDowncast").add(pw(s,{elementName:r,renderForEditingView:!0})),o.for("upcast").elementToElement({view:t=>["oembed",r].includes(t.name)&&t.getAttribute("url")?{name:!0}:null,model:(t,{writer:e})=>{const n=t.getAttribute("url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(t,{writer:e})=>{const n=t.getAttribute("data-oembed-url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).add((t=>{t.on("element:figure",(function(t,e,n){if(!n.consumable.consume(e.viewItem,{name:!0,classes:"media"}))return;const{modelRange:o,modelCursor:i}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=o,e.modelCursor=i;Ta(o.getItems())||n.consumable.revert(e.viewItem,{name:!0,classes:"media"})}))}))}}const xw=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class Ew extends ue{static get requires(){return[Em,Og,kp]}static get pluginName(){return"AutoMediaEmbed"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document;this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=Xl.fromPosition(t.start);n.stickiness="toPrevious";const o=Xl.fromPosition(t.end);o.stickiness="toNext",e.once("change:data",(()=>{this._embedMediaBetweenPositions(n,o),n.detach(),o.detach()}),{priority:"high"})})),t.commands.get("undo").on("execute",(()=>{this._timeoutId&&(is.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedMediaBetweenPositions(t,e){const n=this.editor,o=n.plugins.get(yw).registry,i=new sc(t,e),r=i.getWalker({ignoreElementEnd:!0});let s="";for(const t of r)t.item.is("$textProxy")&&(s+=t.item.data);if(s=s.trim(),!s.match(xw))return void i.detach();if(!o.hasMedia(s))return void i.detach();n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Xl.fromPosition(t),this._timeoutId=is.window.setTimeout((()=>{n.model.change((t=>{let e;this._timeoutId=null,t.remove(i),i.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert),bw(n.model,s,e,!1),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get("Delete").requestUndoOnBackspace()}),100)):i.detach()}}var Dw=n(9292),Mw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Dw.Z,Mw);Dw.Z.locals;class Iw extends Fd{constructor(t,e){super(e);const n=e.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Bd.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",(t=>!!t)),this.cancelButtonView=this._createButton(n("Cancel"),Bd.cancel,"ck-button-cancel","cancel"),this._focusables=new Od,this._focusCycler=new Lh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=t,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]}),Pd(this)}render(){super.render(),Ld({view:this});[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t),this.listenTo(this.urlInputView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(t){this.urlInputView.fieldView.element.value=t.trim()}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.urlInputView.errorText=e,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const t=this.locale.t,e=new Au(this.locale,Cu),n=e.fieldView;return this._urlInputViewInfoDefault=t("Paste the media URL in the input."),this._urlInputViewInfoTip=t("Tip: Paste the URL into the content to embed faster."),e.label=t("Media URL"),e.infoText=this._urlInputViewInfoDefault,n.on("input",(()=>{e.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()})),e}_createButton(t,e,n,o){const i=new kh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}}class Sw extends ue{static get requires(){return[yw]}static get pluginName(){return"MediaEmbedUI"}init(){const t=this.editor,e=t.commands.get("mediaEmbed"),n=t.plugins.get(yw).registry;t.ui.componentFactory.add("mediaEmbed",(o=>{const i=nu(o),r=new Iw(function(t,e){return[e=>{if(!e.url.length)return t("The URL must not be empty.")},n=>{if(!e.hasMedia(n.url))return t("This media URL is not supported.")}]}(t.t,n),t.locale);return this._setUpDropdown(i,r,e,t),this._setUpForm(i,r,e),i}))}_setUpDropdown(t,e,n){const o=this.editor,i=o.t,r=t.buttonView;function s(){o.editing.view.focus(),t.isOpen=!1}t.bind("isEnabled").to(n),t.panelView.children.add(e),r.set({label:i("Insert media"),icon:'',tooltip:!0}),r.on("open",(()=>{e.disableCssTransitions(),e.url=n.value||"",e.urlInputView.fieldView.select(),e.focus(),e.enableCssTransitions()}),{priority:"low"}),t.on("submit",(()=>{e.isValid()&&(o.execute("mediaEmbed",e.url),s())})),t.on("change:isOpen",(()=>e.resetFormStatus())),t.on("cancel",(()=>s()))}_setUpForm(t,e,n){e.delegate("submit","cancel").to(t),e.urlInputView.bind("value").to(n,"value"),e.urlInputView.bind("isReadOnly").to(n,"isEnabled",(t=>!t))}}var Tw=n(4652),Nw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Tw.Z,Nw);Tw.Z.locals;function Bw(t,e){if(!t.childCount)return;const n=new kg(t.document),o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),i=[];for(const t of n)if("elementStart"===t.type&&o.match(t.item)){const e=Lw(t.item);i.push({element:t.item,id:e.id,order:e.order,indent:e.indent})}return i}(t,n);if(!o.length)return;let i=null,r=1;o.forEach(((t,s)=>{const a=function(t,e){if(!t)return!0;if(t.id!==e.id)return e.indent-t.indent!=1;const n=e.element.previousSibling;if(!n)return!0;return o=n,!(o.is("element","ol")||o.is("element","ul"));var o}(o[s-1],t),c=a?null:o[s-1],l=(h=t,(d=c)?h.indent-d.indent:h.indent-1);var d,h;if(a&&(i=null,r=1),!i||0!==l){const o=function(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]{0,100});/gi,i=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=n.exec(e);let s="decimal",a="ol",c=null;if(r&&r[1]){const e=o.exec(r[1]);if(e&&e[1]&&(s=e[1].trim(),a="bullet"!==s&&"image"!==s?"ol":"ul"),"bullet"===s){const e=function(t){const e=function(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);return t.is("$text")?t:t.getChild(0)}}(t);if(!e)return null;const n=e._data;if("o"===n)return"circle";if("·"===n)return"disc";if("§"===n)return"square";return null}(t.element);e&&(s=e)}else{const t=i.exec(r[1]);t&&t[1]&&(c=parseInt(t[1]))}}return{type:a,startIndex:c,style:zw(s)}}(t,e);if(i){if(t.indent>r){const t=i.getChild(i.childCount-1),e=t.getChild(t.childCount-1);i=Pw(o,e,n),r+=1}else if(t.indent1&&n.setAttribute("start",t.startIndex,i),i}function Lw(t){const e={},n=t.getStyle("mso-list");if(n){const t=n.match(/(^|\s{1,100})l(\d+)/i),o=n.match(/\s{0,100}lfo(\d+)/i),i=n.match(/\s{0,100}level(\d+)/i);t&&o&&i&&(e.id=t[2],e.order=o[1],e.indent=i[1])}return e}const Ow=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class Rw{constructor(t){this.document=t}isActive(t){return Ow.test(t)}execute(t){const e=new kg(this.document),{body:n}=t._parsedData;!function(t,e){for(const n of t.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const o=t.getChildIndex(n);e.remove(n),e.insertChild(o,n.getChildren(),t)}}(n,e),function(t,e){for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","li")){const n=t.getChild(0);n&&n.is("element","p")&&e.unwrapElement(n)}}}(n,e),t.content=n}}function jw(t,e){if(!t.childCount)return;const n=new kg,o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n){if("elementStart"!=t.type)continue;const e=t.item,n=e.previousSibling&&e.previousSibling.name||null;o.match(e)&&e.getAttribute("o:gfxdata")&&"v:shapetype"!==n&&i.push(t.item.getAttribute("id"))}return i}(t,n);!function(t,e,n){const o=n.createRangeIn(e),i=new Uo({name:"img"}),r=[];for(const e of o)if(i.match(e.item)){const n=e.item,o=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];o.length&&o.every((e=>t.indexOf(e)>-1))?r.push(n):n.getAttribute("src")||r.push(n)}for(const t of r)n.remove(t)}(o,t,n),function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n)"elementStart"==t.type&&o.match(t.item)&&i.push(t.item);for(const t of i)e.remove(t)}(t,n);const i=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:"img"}),i=[];for(const t of n)o.match(t.item)&&t.item.getAttribute("src").startsWith("file://")&&i.push(t.item);return i}(t,n);i.length&&function(t,e,n){if(t.length===e.length)for(let o=0;oString.fromCharCode(parseInt(t,16)))).join(""))}const Vw=//i,Hw=/xmlns:o="urn:schemas-microsoft-com/i;class Uw{constructor(t){this.document=t}isActive(t){return Vw.test(t)||Hw.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;Bw(e,n),jw(e,t.dataTransfer.getData("text/rtf")),t.content=e}}function Ww(t){return t.replace(/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join("  ").substr(0,e.length)))}function qw(t,e){const n=new DOMParser,o=function(t){return Ww(Ww(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g," <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="",n="",o=t.indexOf(e);if(o<0)return t;const i=t.indexOf(n,o+e.length);return t.substring(0,o+e.length)+(i>=0?t.substring(i):"")}(t=t.replace(//g,"")}(i.getData("text/html")):i.getData("text/plain")&&(((s=(s=i.getData("text/plain")).replace(//g,">").replace(/\r?\n\r?\n/g,"

").replace(/\r?\n/g,"
").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g,"  ")).includes("

")||s.includes("
"))&&(s=`

${s}

`),r=s),r=this.editor.data.htmlProcessor.toView(r));const a=new e(this,"inputTransformation");this.fire(a,{content:r,dataTransfer:i,targetRanges:n.targetRanges,method:n.method}),a.stop.called&&t.stop(),o.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,e)=>{if(e.content.isEmpty)return;const o=this.editor.data.toModel(e.content,"$clipboardHolder");0!=o.childCount&&(t.stop(),n.change((()=>{this.fire("contentInsertion",{content:o,method:e.method,dataTransfer:e.dataTransfer,targetRanges:e.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,e)=>{e.resultRange=n.insertContent(e.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document;function o(o,i){const r=i.dataTransfer;i.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:o.name})}this.listenTo(n,"copy",o,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.isReadOnly?n.preventDefault():o(e,n)}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",_g(o.content))),"cut"==o.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}function*Cg(t,e){for(const n of e)n&&t.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class vg extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n,o){const i=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return void(i||s!=a||t.deleteContent(n));if(i){const t=Cg(e.model.schema,n.getAttributes());yg(e,r.start),e.setSelectionAttribute(t)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd),i=s==a;t.deleteContent(n,{leaveUnmerged:o}),o&&(i?yg(e,n.focus):e.setSelection(a,0))}}(this.editor.model,n,e.selection,t.schema),this.fire("afterExecute",{writer:n})}))}}function yg(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}class xg extends Cs{constructor(t){super(t);const e=this.document;e.on("keydown",((t,n)=>{if(this.isEnabled&&n.keyCode==dr.enter){const o=new Wi(e,"enter",e.selection.getFirstRange());e.fire(o,new qs(e,n.domEvent,{isSoft:n.shiftKey})),o.stop.called&&t.stop()}}))}observe(){}}class Eg extends ue{static get pluginName(){return"Enter"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(xg),t.commands.add("enter",new vg(t)),this.listenTo(n,"enter",((n,o)=>{o.preventDefault(),o.isSoft||(t.execute("enter"),e.scrollToTheSelection())}),{priority:"low"})}}class Dg{constructor(t,e=20){this.model=t,this.size=0,this.limit=e,this.isLocked=!1,this._changeCallback=(t,e)=>{e.isLocal&&e.isUndoable&&e!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}input(t){this.size+=t,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(t){this.isLocked&&!t||(this._batch=null,this.size=0)}}class Mg extends me{constructor(t,e){super(t),this.direction=e,this._buffer=new Dg(t.model,t.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(t={}){const e=this.editor.model,n=e.document;e.enqueueChange(this._buffer.batch,(o=>{this._buffer.lock();const i=o.createSelection(t.selection||n.selection),r=t.sequence||1,s=i.isCollapsed;if(i.isCollapsed&&e.modifySelection(i,{direction:this.direction,unit:t.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(o);if(this._shouldReplaceFirstBlockWithParagraph(i,r))return void this.editor.execute("paragraph",{selection:i});if(i.isCollapsed)return;let a=0;i.getFirstRange().getMinimalFlatRanges().forEach((t=>{a+=Vi(t.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),e.deleteContent(i,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),o.setSelection(i),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(t){if(t>1)return!1;const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(o)))return!1;if(!e.schema.checkChild(o,"paragraph"))return!1;const i=o.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(t){const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n),i=t.createElement("paragraph");t.remove(t.createRangeIn(o)),t.insert(i,o),t.setSelection(i,0)}_shouldReplaceFirstBlockWithParagraph(t,e){const n=this.editor.model;if(e>1||"backward"!=this.direction)return!1;if(!t.isCollapsed)return!1;const o=t.getFirstPosition(),i=n.schema.getLimitElement(o),r=i.getChild(0);return o.parent==r&&(!!t.containsEntireContent(r)&&(!!n.schema.checkChild(i,"paragraph")&&"paragraph"!=r.name))}}function Ig(t){if(t.newChildren.length-t.oldChildren.length!=1)return;const e=function(t,e){const n=[];let o,i=0;return t.forEach((t=>{"equal"==t?(r(),i++):"insert"==t?(s("insert")?o.values.push(e[i]):(r(),o={type:"insert",index:i,values:[e[i]]}),i++):s("delete")?o.howMany++:(r(),o={type:"delete",index:i,howMany:1})})),r(),n;function r(){o&&(n.push(o),o=null)}function s(t){return o&&o.type==t}}(qr(t.oldChildren,t.newChildren,Sg),t.newChildren);if(e.length>1)return;const n=e[0];return n.values[0]&&n.values[0].is("$text")?n:void 0}function Sg(t,e){return t&&t.is("$text")&&e&&e.is("$text")?t.data===e.data:t===e}function Tg(t,e){const n=e.selection,o=t.shiftKey&&t.keyCode===dr.delete,i=!n.isCollapsed;return o&&i}class Ng extends Cs{constructor(t){super(t);const e=t.document;let n=0;function o(t,n,o){const i=new Wi(e,"delete",e.selection.getFirstRange());e.fire(i,new qs(e,n,o)),i.stop.called&&t.stop()}e.on("keyup",((t,e)=>{e.keyCode!=dr.delete&&e.keyCode!=dr.backspace||(n=0)})),e.on("keydown",((t,i)=>{if(sr.isWindows&&Tg(i,e))return;const r={};if(i.keyCode==dr.delete)r.direction="forward",r.unit="character";else{if(i.keyCode!=dr.backspace)return;r.direction="backward",r.unit="codePoint"}const s=sr.isMac?i.altKey:i.ctrlKey;r.unit=s?"word":r.unit,r.sequence=++n,o(t,i.domEvent,r)})),sr.isAndroid&&e.on("beforeinput",((e,n)=>{if("deleteContentBackward"!=n.domEvent.inputType)return;const i={unit:"codepoint",direction:"backward",sequence:1},r=n.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(i.selectionToRemove=t.domConverter.domSelectionToView(r)),o(e,n.domEvent,i)}))}observe(){}}class Bg extends ue{static get pluginName(){return"Delete"}init(){const t=this.editor,e=t.editing.view,n=e.document,o=t.model.document;e.addObserver(Ng),this._undoOnBackspace=!1;const i=new Mg(t,"forward");if(t.commands.add("deleteForward",i),t.commands.add("forwardDelete",i),t.commands.add("delete",new Mg(t,"backward")),this.listenTo(n,"delete",((n,o)=>{const i={unit:o.unit,sequence:o.sequence};if(o.selectionToRemove){const e=t.model.createSelection(),n=[];for(const e of o.selectionToRemove.getRanges())n.push(t.editing.mapper.toModelRange(e));e.setTo(n),i.selection=e}t.execute("forward"==o.direction?"deleteForward":"delete",i),o.preventDefault(),e.scrollToTheSelection()}),{priority:"low"}),sr.isAndroid){let t=null;this.listenTo(n,"delete",((e,n)=>{const o=n.domTarget.ownerDocument.defaultView.getSelection();t={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}}),{priority:"lowest"}),this.listenTo(n,"keyup",((e,n)=>{if(t){const e=n.domTarget.ownerDocument.defaultView.getSelection();e.collapse(t.anchorNode,t.anchorOffset),e.extend(t.focusNode,t.focusOffset),t=null}}))}this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",((e,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._undoOnBackspace=!1,t.execute("undo"),n.preventDefault(),e.stop())}),{context:"$capture"}),this.listenTo(o,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class zg{constructor(){this._stack=[]}add(t,e){const n=this._stack,o=n[0];this._insertDescriptor(t);const i=n[0];o===i||Pg(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}remove(t,e){const n=this._stack,o=n[0];this._removeDescriptor(t);const i=n[0];o===i||Pg(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(Pg(t,e[n]))return;n>-1&&e.splice(n,1);let o=0;for(;e[o]&&Lg(e[o],t);)o++;e.splice(o,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function Pg(t,e){return t&&e&&t.priority==e.priority&&Og(t.classes)==Og(e.classes)}function Lg(t,e){return t.priority>e.priority||!(t.priorityOg(e.classes)}function Og(t){return Array.isArray(t)?t.sort().join(","):t}he(zg,k);const Rg='',jg="ck-widget_selected";function Fg(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function Vg(t,e,n={}){if(!t.is("containerElement"))throw new c("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass("ck-widget",t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=Kg,n.label&&function(t,e,n){n.setCustomProperty("widgetLabel",e,t)}(t,n.label,e),n.hasSelectionHandle&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(t){const e=this.toDomElement(t),n=new dh;return n.set("content",Rg),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),Wg(t,e),t}function Hg(t,e,n){if(e.classes&&n.addClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.setAttribute(o,e.attributes[o],t)}function Ug(t,e,n){if(e.classes&&n.removeClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.removeAttribute(o,t)}function Wg(t,e,n=Hg,o=Ug){const i=new zg;i.on("change:top",((e,i)=>{i.oldDescriptor&&o(t,i.oldDescriptor,i.writer),i.newDescriptor&&n(t,i.newDescriptor,i.writer)})),e.setCustomProperty("addHighlight",((t,e,n)=>i.add(e,n)),t),e.setCustomProperty("removeHighlight",((t,e,n)=>i.remove(e,n)),t)}function qg(t){const e=t.getCustomProperty("widgetLabel");return e?"function"==typeof e?e():e:""}function Gg(t,e){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",((n,o,i)=>{e.setAttribute("contenteditable",i?"false":"true",t)})),t.on("change:isFocused",((n,o,i)=>{i?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)})),Wg(t,e),t}function Yg(t,e){const n=t.getSelectedElement();if(n){const o=Zg(t);if(o)return e.createRange(e.createPositionAt(n,o))}return od(t,e)}function Kg(){return null}const Qg="widget-type-around";function $g(t,e,n){return t&&Fg(t)&&!n.isInline(e)}function Zg(t){return t.getAttribute(Qg)}const Jg=[ur("arrowUp"),ur("arrowRight"),ur("arrowDown"),ur("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let t=112;t<=135;t++)Jg.push(t);function Xg(t){return!(!t.ctrlKey&&!t.metaKey)||Jg.includes(t.keyCode)}var tm=n(4921),em={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(tm.Z,em);tm.Z.locals;const nm=["before","after"],om=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,im="ck-widget__type-around_disabled";class rm extends ue{static get pluginName(){return"WidgetTypeAround"}static get requires(){return[Eg,Bg]}constructor(t){super(t),this._currentFakeCaretModelElement=null}init(){const t=this.editor,e=t.editing.view;this.on("change:isEnabled",((n,o,i)=>{e.change((t=>{for(const n of e.document.roots)i?t.removeClass(im,n):t.addClass(im,n)})),i||t.model.change((t=>{t.removeSelectionAttribute(Qg)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(t,e){const n=this.editor,o=n.editing.view,i=n.model.schema.getAttributesWithProperty(t,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(t,e),attributes:i}),o.focus(),o.scrollToTheSelection()}_listenToIfEnabled(t,e,n,o){this.listenTo(t,e,((...t)=>{this.isEnabled&&n(...t)}),o)}_insertParagraphAccordingToFakeCaretPosition(){const t=this.editor.model.document.selection,e=Zg(t);if(!e)return!1;const n=t.getSelectedElement();return this._insertParagraph(n,e),!0}_enableTypeAroundUIInjection(){const t=this.editor,e=t.model.schema,n=t.locale.t,o={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};t.editing.downcastDispatcher.on("insert",((t,n,i)=>{const r=i.mapper.toViewElement(n.item);$g(r,n.item,e)&&function(t,e,n){const o=t.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(t){const n=this.toDomElement(t);return function(t,e){for(const n of nm){const o=new Fd({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:e[n]},children:[t.ownerDocument.importNode(om,!0)]});t.appendChild(o.render())}}(n,e),function(t){const e=new Fd({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});t.appendChild(e.render())}(n),n}));t.insert(t.createPositionAt(n,"end"),o)}(i.writer,o,r)}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const t=this.editor,e=t.model,n=e.document.selection,o=e.schema,i=t.editing.view;function r(t){return`ck-widget_type-around_show-fake-caret_${t}`}this._listenToIfEnabled(i.document,"arrowKey",((t,e)=>{this._handleArrowKeyPress(t,e)}),{context:[Fg,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(Qg)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();if(e){if($g(t.editing.mapper.toViewElement(e),e,o))return}t.model.change((t=>{t.removeSelectionAttribute(Qg)}))})),this._listenToIfEnabled(t.editing.downcastDispatcher,"selection",((t,e,n)=>{const i=n.writer;if(this._currentFakeCaretModelElement){const t=n.mapper.toViewElement(this._currentFakeCaretModelElement);t&&(i.removeClass(nm.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!$g(a,s,o))return;const c=Zg(e.selection);c&&(i.addClass(r(c),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,o)=>{o||t.model.change((t=>{t.removeSelectionAttribute(Qg)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,o=n.model,i=o.document.selection,r=o.schema,s=n.editing.view,a=function(t,e){const n=pr(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;$g(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):i.isCollapsed?l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(l=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),l&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=Zg(e.document.selection);return e.change((e=>{if(!n)return e.setSelectionAttribute(Qg,t?"after":"before"),!0;if(!(n===(t?"after":"before")))return e.removeSelectionAttribute(Qg),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,o=n.schema,i=e.plugins.get("Widget"),r=i._getObjectElementNextToSelection(t);return!!$g(e.editing.mapper.toViewElement(r),r,o)&&(n.change((e=>{i._setSelectionOverElement(r),e.setSelectionAttribute(Qg,t?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(t){const e=this.editor,n=e.model,o=n.schema,i=e.editing.mapper,r=n.document.selection,s=t?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!$g(i.toViewElement(s),s,o)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(Qg,t?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const t=this.editor,e=t.editing.view;this._listenToIfEnabled(e.document,"mousedown",((n,o)=>{const i=o.domTarget.closest(".ck-widget__type-around__button");if(!i)return;const r=function(t){return t.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(i),s=function(t,e){const n=t.closest(".ck-widget");return e.mapDomToView(n)}(i,e.domConverter),a=t.editing.mapper.toModelElement(s);this._insertParagraph(a,r),o.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const t=this.editor,e=t.model.document.selection,n=t.editing.view;this._listenToIfEnabled(n.document,"enter",((n,o)=>{if("atTarget"!=n.eventPhase)return;const i=e.getSelectedElement(),r=t.editing.mapper.toViewElement(i),s=t.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:$g(r,i,s)&&(this._insertParagraph(i,o.isSoft?"before":"after"),a=!0),a&&(o.preventDefault(),n.stop())}),{context:Fg})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view,e=[dr.enter,dr.delete,dr.backspace];this._listenToIfEnabled(t.document,"keydown",((t,n)=>{e.includes(n.keyCode)||Xg(n)||this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const t=this.editor,e=t.editing.view,n=t.model,o=n.schema;this._listenToIfEnabled(e.document,"delete",((e,i)=>{if("atTarget"!=e.eventPhase)return;const r=Zg(n.document.selection);if(!r)return;const s=i.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)t.execute("delete",{selection:n.createSelection(a,"on")});else{const e=o.getNearestSelectionRange(n.createPositionAt(a,r),s);if(e)if(e.isCollapsed){const i=n.createSelection(e.start);if(n.modifySelection(i,{direction:s}),i.focus.isEqual(e.start)){const t=function(t,e){let n=e;for(const o of e.getAncestors({parentFirst:!0})){if(o.childCount>1||t.isLimit(o))break;n=o}return n}(o,e.start.parent);n.deleteContent(n.createSelection(t,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}i.preventDefault(),e.stop()}),{context:Fg})}_enableInsertContentIntegration(){const t=this.editor,e=this.editor.model,n=e.document.selection;this._listenToIfEnabled(t.model,"insertContent",((t,[o,i])=>{if(i&&!i.is("documentSelection"))return;const r=Zg(n);return r?(t.stop(),e.change((t=>{const i=n.getSelectedElement(),s=e.createPositionAt(i,r),a=t.createSelection(s),c=e.insertContent(o,a);return t.setSelection(a),c}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"insertObject",((t,n)=>{const[,o,,i={}]=n;if(o&&!o.is("documentSelection"))return;const r=Zg(e);r&&(i.findOptimalPosition=r,n[3]=i)}),{priority:"high"})}_enableDeleteContentIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"deleteContent",((t,[n])=>{if(n&&!n.is("documentSelection"))return;Zg(e)&&t.stop()}),{priority:"high"})}}function sm(t){const e=t.model;return(n,o)=>{const i=o.keyCode==dr.arrowup,r=o.keyCode==dr.arrowdown,s=o.shiftKey,a=e.document.selection;if(!i&&!r)return;const c=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,c))return;const l=function(t,e,n){const o=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=am(o,t,"forward");if(!n)return null;const i=o.createRange(t,n),r=cm(o.schema,i,"backward");return r?o.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=am(o,t,"backward");if(!n)return null;const i=o.createRange(n,t),r=cm(o.schema,i,"forward");return r?o.createRange(r,t):null}}(t,a,c);if(l){if(l.isCollapsed){if(a.isCollapsed)return;if(s)return}(l.isCollapsed||function(t,e,n){const o=t.model,i=t.view.domConverter;if(n){const t=o.createSelection(e.start);o.modifySelection(t),t.focus.isAtEnd||e.start.isEqual(t.focus)||(e=o.createRange(t.focus,e.end))}const r=t.mapper.toViewRange(e),s=i.viewRangeToDom(r),a=pa.getDomRangeRects(s);let c;for(const t of a)if(void 0!==c){if(Math.round(t.top)>=c)return!1;c=Math.max(c,Math.round(t.bottom))}else c=Math.round(t.bottom);return!0}(t,l,c))&&(e.change((t=>{const n=c?l.end:l.start;if(s){const o=e.createSelection(a.anchor);o.setFocus(n),t.setSelection(o)}else t.setSelection(n)})),n.stop(),o.preventDefault(),o.stopPropagation())}}}function am(t,e,n){const o=t.schema,i=t.createRangeIn(e.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:t,item:s,type:a}of i.getWalker({startPosition:e,direction:n})){if(o.isLimit(s)&&!o.isInline(s))return t;if(a==r&&o.isBlock(s))return null}return null}function cm(t,e,n){const o="backward"==n?e.end:e.start;if(t.checkChild(o,"$text"))return o;for(const{nextPosition:o}of e.getWalker({direction:n}))if(t.checkChild(o,"$text"))return o;return null}var lm=n(3488),dm={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(lm.Z,dm);lm.Z.locals;class hm extends ue{static get pluginName(){return"Widget"}static get requires(){return[rm,Bg]}init(){const t=this.editor,e=t.editing.view,n=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",((e,n,o)=>{const i=o.writer,r=n.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=t.editing.mapper.toViewElement(s);Fg(a)&&o.consumable.consume(r,"selection")&&i.setSelection(i.createRangeOn(a),{fake:!0,label:qg(a)})})),this.editor.editing.downcastDispatcher.on("selection",((t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const o=n.writer,i=o.document.selection;let r=null;for(const t of i.getRanges())for(const e of t){const t=e.item;Fg(t)&&!um(t,r)&&(o.addClass(jg,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(ug),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[Fg,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",sm(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"})}_onMousedown(t,e){const n=this.editor,o=n.editing.view,i=o.document;let r=e.target;if(function(t){for(;t;){if(t.is("editableElement")&&!t.is("rootElement"))return!0;if(Fg(t))return!1;t=t.parent}return!1}(r)){if((sr.isSafari||sr.isGecko)&&e.domEvent.detail>=3){const t=n.editing.mapper,o=r.is("attributeElement")?r.findAncestor((t=>!t.is("attributeElement"))):r,i=t.toModelElement(o);e.preventDefault(),this.editor.model.change((t=>{t.setSelection(i,"in")}))}return}if(!Fg(r)&&(r=r.findAncestor(Fg),!r))return;sr.isAndroid&&e.preventDefault(),i.isFocused||o.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,o=this.editor.model,i=o.schema,r=o.document.selection,s=r.getSelectedElement(),a=pr(n,this.editor.locale.contentLanguageDirection),c="down"==a||"right"==a,l="up"==a||"down"==a;if(s&&i.isObject(s)){const n=c?r.getLastPosition():r.getFirstPosition(),s=i.getNearestSelectionRange(n,c?"forward":"backward");return void(s&&(o.change((t=>{t.setSelection(s)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed&&!e.shiftKey){const n=r.getFirstPosition(),s=r.getLastPosition(),a=n.nodeAfter,l=s.nodeBefore;return void((a&&i.isObject(a)||l&&i.isObject(l))&&(o.change((t=>{t.setSelection(c?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&i.isObject(d)){if(i.isInline(d)&&l)return;this._setSelectionOverElement(d),e.preventDefault(),t.stop()}}_preventDefaultOnArrowKeyPress(t,e){const n=this.editor.model,o=n.schema,i=n.document.selection.getSelectedElement();i&&o.isObject(i)&&(e.preventDefault(),t.stop())}_handleDelete(t){if(this.editor.isReadOnly)return;const e=this.editor.model.document.selection;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change((t=>{let o=e.anchor.parent;for(;o.isEmpty;){const e=o;o=e.parent,t.remove(e)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(t){this.editor.model.change((e=>{e.setSelection(e.createRangeOn(t))}))}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,o=e.document.selection,i=e.createSelection(o);if(e.modifySelection(i,{direction:t?"forward":"backward"}),i.isEqual(o))return null;const r=t?i.focus.nodeBefore:i.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(jg,e);this._previouslySelected.clear()}}function um(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}const gm=function(t,e,n){var o=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return x(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),sa(t,e,{leading:o,maxWait:e,trailing:i})};var mm=n(903),pm={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(mm.Z,pm);mm.Z.locals;class fm extends ue{static get pluginName(){return"DragDrop"}static get requires(){return[Ag,hm]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=gm((t=>this._updateDropMarker(t)),40),this._removeDropMarkerDelayed=wm((()=>this._removeDropMarker()),40),this._clearDraggableAttributesDelayed=wm((()=>this._clearDraggableAttributes()),40),e.addObserver(bg),e.addObserver(ug),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((t,e,n)=>{n||this._finalizeDragging(!1)})),sr.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=e.document,o=t.editing.view,i=o.document;this.listenTo(i,"dragstart",((o,s)=>{const a=n.selection;if(s.target&&s.target.is("editableElement"))return void s.preventDefault();const c=s.target?_m(s.target):null;if(c){const n=t.editing.mapper.toModelElement(c);this._draggedRange=sc.fromRange(e.createRangeOn(n)),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!i.selection.isCollapsed){const t=i.selection.getSelectedElement();t&&Fg(t)||(this._draggedRange=sc.fromRange(a.getFirstRange()))}if(!this._draggedRange)return void s.preventDefault();this._draggingUid=r(),s.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",s.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=e.createSelection(this._draggedRange.toRange()),d=t.data.toView(e.getSelectedContent(l));i.fire("clipboardOutput",{dataTransfer:s.dataTransfer,content:d,method:o.name}),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(i,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this.listenTo(i,"dragenter",(()=>{this.isEnabled&&o.focus()})),this.listenTo(i,"dragleave",(()=>{this._removeDropMarkerDelayed()})),this.listenTo(i,"dragging",((e,n)=>{if(!this.isEnabled)return void(n.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const o=km(t,n.targetRanges,n.target);this._draggedRange||(n.dataTransfer.dropEffect="copy"),sr.isGecko||("copy"==n.dataTransfer.effectAllowed?n.dataTransfer.dropEffect="copy":["all","copyMove"].includes(n.dataTransfer.effectAllowed)&&(n.dataTransfer.dropEffect="move")),o&&this._updateDropMarkerThrottled(o)}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"clipboardInput",((e,n)=>{if("drop"!=n.method)return;const o=km(t,n.targetRanges,n.target);if(this._removeDropMarker(),!o)return this._finalizeDragging(!1),void e.stop();this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==bm(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(o,!0))return this._finalizeDragging(!1),void e.stop();n.targetRanges=[t.editing.mapper.toViewRange(o)]}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(Ag);t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n=e.targetRanges.map((t=>this.editor.editing.mapper.toModelRange(t)));this.editor.model.change((t=>t.setSelection(n)))}),{priority:"high"}),t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n="move"==bm(e.dataTransfer),o=!e.resultRange||!e.resultRange.isCollapsed;this._finalizeDragging(o&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const t=this.editor,e=t.editing.view,n=e.document;this.listenTo(n,"mousedown",((o,i)=>{if(sr.isAndroid||!i)return;this._clearDraggableAttributesDelayed.cancel();let r=_m(i.target);if(sr.isBlink&&!t.isReadOnly&&!r&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&Fg(t)||(r=n.selection.editableElement)}r&&(e.change((t=>{t.setAttribute("draggable","true",r)})),this._draggableElement=t.editing.mapper.toModelElement(r))})),this.listenTo(n,"mouseup",(()=>{sr.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const t=this.editor.editing;t.view.change((e=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&e.removeAttribute("draggable",t.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_setupDropMarker(){const t=this.editor;t.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),t.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(e,{writer:n})=>{if(t.model.schema.checkChild(e.markerRange.start,"$text"))return n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.innerHTML="⁠⁠",e}))}})}_updateDropMarker(t){const e=this.editor,n=e.model.markers;e.model.change((e=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(t)||e.updateMarker("drop-target",{range:t}):e.addMarker("drop-target",{range:t,usingOperation:!1,affectsData:!1})}))}_removeDropMarker(){const t=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_finalizeDragging(t){const e=this.editor,n=e.model;this._removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(t&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function km(t,e,n){const o=t.model,i=t.editing.mapper;let r=null;const s=e?e[0].start:null;if(n.is("uiElement")&&(n=n.parent),r=function(t,e){const n=t.model,o=t.editing.mapper;if(Fg(e))return n.createRangeOn(o.toModelElement(e));if(!e.is("editableElement")){const t=e.findAncestor((t=>Fg(t)||t.is("editableElement")));if(Fg(t))return n.createRangeOn(o.toModelElement(t))}return null}(t,n),r)return r;const a=function(t,e){const n=t.editing.mapper,o=t.editing.view,i=n.toModelElement(e);if(i)return i;const r=o.createPositionBefore(e),s=n.findMappedViewAncestor(r);return n.toModelElement(s)}(t,n),c=s?i.toModelPosition(s):null;return c?(r=function(t,e,n){const o=t.model;if(!o.schema.checkChild(n,"$block"))return null;const i=o.createPositionAt(n,0),r=e.path.slice(0,i.path.length),s=o.createPositionFromPath(e.root,r).nodeAfter;if(s&&o.schema.isObject(s))return o.createRangeOn(s);return null}(t,c,a),r||(r=o.schema.getNearestSelectionRange(c,sr.isGecko?"forward":"backward"),r||function(t,e){const n=t.model;for(;e;){if(n.schema.isObject(e))return n.createRangeOn(e);e=e.parent}}(t,c.parent))):function(t,e){const n=t.model,o=n.schema,i=n.createPositionAt(e,0);return o.getNearestSelectionRange(i,"forward")}(t,a)}function bm(t){return sr.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function wm(t,e){let n;function o(...i){o.cancel(),n=setTimeout((()=>t(...i)),e)}return o.cancel=()=>{clearTimeout(n)},o}function _m(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(Fg);if(Fg(t))return t;const e=t.findAncestor((t=>Fg(t)||t.is("editableElement")));return Fg(e)?e:null}class Am extends ue{static get pluginName(){return"PastePlainText"}static get requires(){return[Ag]}init(){const t=this.editor,e=t.model,n=t.editing.view,o=n.document,i=e.document.selection;let r=!1;n.addObserver(bg),this.listenTo(o,"keydown",((t,e)=>{r=e.shiftKey})),t.plugins.get(Ag).on("contentInsertion",((t,n)=>{(r||function(t,e){if(t.childCount>1)return!1;const n=t.getChild(0);if(e.isObject(n))return!1;return 0==[...n.getAttributeKeys()].length}(n.content,e.schema))&&e.change((t=>{const o=Array.from(i.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));i.isCollapsed||e.deleteContent(i,{doNotAutoparagraph:!0}),o.push(...i.getAttributes());const r=t.createRangeIn(n.content);for(const e of r.getItems())e.is("$textProxy")&&t.setAttributes(o,e)}))}))}}class Cm extends ue{static get pluginName(){return"Clipboard"}static get requires(){return[Ag,fm,Am]}}class vm extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n){const o=n.isCollapsed,i=n.getFirstRange(),r=i.start.parent,s=i.end.parent,a=r==s;if(o){const o=Cg(t.schema,n.getAttributes());ym(t,e,i.end),e.removeSelectionAttribute(n.getAttributeKeys()),e.setSelectionAttribute(o)}else{const o=!(i.start.isAtStart&&i.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:o}),a?ym(t,e,n.focus):o&&e.setSelection(s,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})}))}refresh(){const t=this.editor.model,e=t.document;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const o=e.getFirstRange(),i=o.start.parent,r=o.end.parent;if((xm(i,t)||xm(r,t))&&i!==r)return!1;return!0}(t.schema,e.selection)}}function ym(t,e,n){const o=e.createElement("softBreak");t.insertContent(o,n),e.setSelection(o,"after")}function xm(t,e){return!t.is("rootElement")&&(e.isLimit(t)||xm(t.parent,e))}class Em extends ue{static get pluginName(){return"ShiftEnter"}init(){const t=this.editor,e=t.model.schema,n=t.conversion,o=t.editing.view,i=o.document;e.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(t,{writer:e})=>e.createEmptyElement("br")}),o.addObserver(xg),t.commands.add("shiftEnter",new vm(t)),this.listenTo(i,"enter",((e,n)=>{n.preventDefault(),n.isSoft&&(t.execute("shiftEnter"),o.scrollToTheSelection())}),{priority:"low"})}}class Dm extends me{constructor(t){super(t),this.affectsData=!1}execute(){const t=this.editor.model,e=t.document.selection;let n=t.schema.getLimitElement(e);if(e.containsEntireContent(n)||!Mm(t.schema,n))do{if(n=n.parent,!n)return}while(!Mm(t.schema,n));t.change((t=>{t.setSelection(n,"in")}))}}function Mm(t,e){return t.isLimit(e)&&(t.checkChild(e,"$text")||t.checkChild(e,"paragraph"))}const Im=gr("Ctrl+A");class Sm extends ue{static get pluginName(){return"SelectAllEditing"}init(){const t=this.editor,e=t.editing.view.document;t.commands.add("selectAll",new Dm(t)),this.listenTo(e,"keydown",((e,n)=>{ur(n)===Im&&(t.execute("selectAll"),n.preventDefault())}))}}class Tm extends ue{static get pluginName(){return"SelectAllUI"}init(){const t=this.editor;t.ui.componentFactory.add("selectAll",(e=>{const n=t.commands.get("selectAll"),o=new fh(e),i=e.t;return o.set({label:i("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),o.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),o}))}}class Nm extends ue{static get requires(){return[Sm,Tm]}static get pluginName(){return"SelectAll"}}class Bm extends me{constructor(t,e){super(t),this._buffer=new Dg(t.model,e)}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,o=t.text||"",i=o.length,r=t.range?e.createSelection(t.range):n.selection,s=t.resultRange;e.enqueueChange(this._buffer.batch,(t=>{this._buffer.lock(),e.deleteContent(r),o&&e.insertContent(t.createText(o,n.selection.getAttributes()),r),s?t.setSelection(s):r.is("documentSelection")||t.setSelection(r),this._buffer.unlock(),this._buffer.input(i)}))}}class zm{constructor(t){this.editor=t,this.editing=this.editor.editing}handle(t,e){if(function(t){if(0==t.length)return!1;for(const e of t)if("children"===e.type&&!Ig(e))return!0;return!1}(t))this._handleContainerChildrenMutations(t,e);else for(const n of t)this._handleTextMutation(n,e),this._handleTextNodeInsertion(n)}_handleContainerChildrenMutations(t,e){const n=function(t){const e=t.map((t=>t.node)).reduce(((t,e)=>t.getCommonAncestor(e,{includeSelf:!0})));if(!e)return;return e.getAncestors({includeSelf:!0,parentFirst:!0}).find((t=>t.is("containerElement")||t.is("rootElement")))}(t);if(!n)return;const o=this.editor.editing.view.domConverter.mapViewToDom(n),i=new gs(this.editor.editing.view.document),r=this.editor.data.toModel(i.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(n);if(!s)return;const a=Array.from(r.getChildren()),c=Array.from(s.getChildren()),l=a[a.length-1],d=c[c.length-1],h=l&&l.is("element","softBreak"),u=d&&!d.is("element","softBreak");h&&u&&a.pop();const g=this.editor.model.schema;if(!Pm(a,g)||!Pm(c,g))return;const m=a.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," "),p=c.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," ");if(p===m)return;const f=qr(p,m),{firstChangeAt:k,insertions:b,deletions:w}=Lm(f);let _=null;e&&(_=this.editing.mapper.toModelRange(e.getFirstRange()));const A=m.substr(k,b),C=this.editor.model.createRange(this.editor.model.createPositionAt(s,k),this.editor.model.createPositionAt(s,k+w));this.editor.execute("input",{text:A,range:C,resultRange:_})}_handleTextMutation(t,e){if("text"!=t.type)return;const n=t.newText.replace(/\u00A0/g," "),o=t.oldText.replace(/\u00A0/g," ");if(o===n)return;const i=qr(o,n),{firstChangeAt:r,insertions:s,deletions:a}=Lm(i);let c=null;e&&(c=this.editing.mapper.toModelRange(e.getFirstRange()));const l=this.editing.view.createPositionAt(t.node,r),d=this.editing.mapper.toModelPosition(l),h=this.editor.model.createRange(d,d.getShiftedBy(a)),u=n.substr(r,s);this.editor.execute("input",{text:u,range:h,resultRange:c})}_handleTextNodeInsertion(t){if("children"!=t.type)return;const e=Ig(t),n=this.editing.view.createPositionAt(t.node,e.index),o=this.editing.mapper.toModelPosition(n),i=e.values[0].data;this.editor.execute("input",{text:i.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function Pm(t,e){return t.every((t=>e.isInline(t)))}function Lm(t){let e=null,n=null;for(let o=0;o{n.deleteContent(n.document.selection)})),t.unlock()}sr.isAndroid?o.document.on("beforeinput",((t,e)=>r(e)),{priority:"lowest"}):o.document.on("keydown",((t,e)=>r(e)),{priority:"lowest"}),o.document.on("compositionstart",(function(){const t=n.document,e=1!==t.selection.rangeCount||t.selection.getFirstRange().isFlat;t.selection.isCollapsed||e||s()}),{priority:"lowest"}),o.document.on("compositionend",(()=>{e=n.createSelection(n.document.selection)}),{priority:"lowest"})}(t),function(t){t.editing.view.document.on("mutations",((e,n,o)=>{new zm(t).handle(n,o)}))}(t)}}class Rm extends ue{static get requires(){return[Om,Bg]}static get pluginName(){return"Typing"}}function jm(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>o.is("$text")||o.is("$textProxy")?t+o.data:(n=e.createPositionAfter(o),"")),""),range:e.createRange(n,t.end)}}class Fm{constructor(t,e){this.model=t,this.testCallback=e,this.hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(t.document.selection),this.stopListening(t.document))})),this._startListening()}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",((e,{directChange:n})=>{n&&(t.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))})),this.listenTo(t,"change:data",((t,e)=>{!e.isUndo&&e.isLocal&&this._evaluateTextBeforeSelection("data",{batch:e})}))}_evaluateTextBeforeSelection(t,e={}){const n=this.model,o=n.document.selection,i=n.createRange(n.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=jm(i,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const n=Object.assign(e,{text:r,range:s});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${t}`,n)}}}he(Fm,re);class Vm extends ue{static get pluginName(){return"TwoStepCaretMovement"}constructor(t){super(t),this.attributes=new Set,this._overrideUid=null}init(){const t=this.editor,e=t.model,n=t.editing.view,o=t.locale,i=e.document.selection;this.listenTo(n.document,"arrowKey",((t,e)=>{if(!i.isCollapsed)return;if(e.shiftKey||e.altKey||e.ctrlKey)return;const n=e.keyCode==dr.arrowright,r=e.keyCode==dr.arrowleft;if(!n&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&n||"rtl"===s&&r?this._handleForwardMovement(e):this._handleBackwardMovement(e),!0===a&&t.stop()}),{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(i,"change:range",((t,e)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!e.directChange&&qm(i.getFirstPosition(),this.attributes)||this._restoreGravity())}))}registerAttribute(t){this.attributes.add(t)}_handleForwardMovement(t){const e=this.attributes,n=this.editor.model.document.selection,o=n.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!Hm(n,e))&&(qm(o,e)?(Wm(t),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(t){const e=this.attributes,n=this.editor.model,o=n.document.selection,i=o.getFirstPosition();return this._isGravityOverridden?(Wm(t),this._restoreGravity(),Um(n,e,i),!0):i.isAtStart?!!Hm(o,e)&&(Wm(t),Um(n,e,i),!0):function(t,e){return qm(t.getShiftedBy(-1),e)}(i,e)?i.isAtEnd&&!Hm(o,e)&&qm(i,e)?(Wm(t),Um(n,e,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):void 0}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((t=>t.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((t=>{t.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function Hm(t,e){for(const n of e)if(t.hasAttribute(n))return!0;return!1}function Um(t,e,n){const o=n.nodeBefore;t.change((t=>{o?t.setSelectionAttribute(o.getAttributes()):t.removeSelectionAttribute(e)}))}function Wm(t){t.preventDefault()}function qm(t,e){const{nodeBefore:n,nodeAfter:o}=t;for(const t of e){const e=n?n.getAttribute(t):void 0;if((o?o.getAttribute(t):void 0)!==e)return!0}return!1}var Gm=/[\\^$.*+?()[\]{}|]/g,Ym=RegExp(Gm.source);const Km=function(t){return(t=si(t))&&Ym.test(t)?t.replace(Gm,"\\$&"):t},Qm={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:ep('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:ep("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:ep("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:ep('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:ep('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:ep("'"),to:[null,"‚",null,"’"]}},$m={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Zm=["symbols","mathematical","typography","quotes"];function Jm(t){return"string"==typeof t?new RegExp(`(${Km(t)})$`):t}function Xm(t){return"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t}function tp(t){return(t.textNode?t.textNode:t.nodeAfter).getAttributes()}function ep(t){return new RegExp(`(^|\\s)(${t})([^${t}]*)(${t})$`)}function np(t,e,n,o){return o.createRange(op(t,e,n,!0,o),op(t,e,n,!1,o))}function op(t,e,n,o,i){let r=t.textNode||(o?t.nodeBefore:t.nodeAfter),s=null;for(;r&&r.getAttribute(e)==n;)s=r,r=o?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,o?"before":"after"):t}class ip extends me{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(t.data,"set",((t,e)=>{e[1]={...e[1]};const n=e[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(t.data,"set",((t,e)=>{e[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const o=this.editor.model,i=o.document,r=[],s=t.map((t=>t.getTransformedByOperations(n))),a=s.flat();for(const t of s){const e=t.filter((t=>t.root!=i.graveyard)).filter((t=>!sp(t,a)));e.length&&(rp(e),r.push(e[0]))}r.length&&o.change((t=>{t.setSelection(r,{backward:e})}))}_undo(t,e){const n=this.editor.model,o=n.document;this._createdBatches.add(e);const i=t.operations.slice().filter((t=>t.isDocumentOperation));i.reverse();for(const t of i){const i=t.baseVersion+1,r=Array.from(o.history.getOperations(i)),s=ig([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const i of s)e.addOperation(i),n.applyOperation(i),o.history.setOperationAsUndone(t,i)}}}function rp(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class ap extends ip{execute(t=null){const e=t?this._stack.findIndex((e=>e.batch==t)):this._stack.length-1,n=this._stack.splice(e,1)[0],o=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(o,(()=>{this._undo(n.batch,o);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t),this.fire("revert",n.batch,o)})),this.refresh()}}class cp extends ip{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,(()=>{const n=t.batch.operations[t.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(n);this._restoreSelection(t.selection.ranges,t.selection.isBackward,o),this._undo(t.batch,e)})),this.refresh()}}class lp extends ue{static get pluginName(){return"UndoEditing"}constructor(t){super(t),this._batchRegistry=new WeakSet}init(){const t=this.editor;this._undoCommand=new ap(t),this._redoCommand=new cp(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",((t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const o=n.batch,i=this._redoCommand._createdBatches.has(o),r=this._undoCommand._createdBatches.has(o);this._batchRegistry.has(o)||(this._batchRegistry.add(o),o.isUndoable&&(i?this._undoCommand.addBatch(o):r||(this._undoCommand.addBatch(o),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((t,e,n)=>{this._redoCommand.addBatch(n)})),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo")}}const dp='',hp='';class up extends ue{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?dp:hp,i="ltr"==e.uiLanguageDirection?hp:dp;this._addButton("undo",n("Undo"),"CTRL+Z",o),this._addButton("redo",n("Redo"),"CTRL+Y",i)}_addButton(t,e,n,o){const i=this.editor;i.ui.componentFactory.add(t,(r=>{const s=i.commands.get(t),a=new fh(r);return a.set({label:e,icon:o,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",(()=>{i.execute(t),i.editing.view.focus()})),a}))}}class gp extends ue{static get requires(){return[lp,up]}static get pluginName(){return"Undo"}}class mp{constructor(){const t=new window.FileReader;this._reader=t,this._data=void 0,this.set("loaded",0),t.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(t){const e=this._reader;return this.total=t.size,new Promise(((n,o)=>{e.onload=()=>{const t=e.result;this._data=t,n(t)},e.onerror=()=>{o("error")},e.onabort=()=>{o("aborted")},this._reader.readAsDataURL(t)}))}abort(){this._reader.abort()}}he(mp,re);class pp extends ue{static get pluginName(){return"FileRepository"}static get requires(){return[Sd]}init(){this.loaders=new Mo,this.loaders.on("add",(()=>this._updatePendingAction())),this.loaders.on("remove",(()=>this._updatePendingAction())),this._loadersMap=new Map,this._pendingAction=null,this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0))}getLoader(t){return this._loadersMap.get(t)||null}createLoader(t){if(!this.createUploadAdapter)return l("filerepository-no-upload-adapter"),null;const e=new fp(Promise.resolve(t),this.createUploadAdapter);return this.loaders.add(e),this._loadersMap.set(t,e),t instanceof Promise&&e.file.then((t=>{this._loadersMap.set(t,e)})).catch((()=>{})),e.on("change:uploaded",(()=>{let t=0;for(const e of this.loaders)t+=e.uploaded;this.uploaded=t})),e.on("change:uploadTotal",(()=>{let t=0;for(const e of this.loaders)e.uploadTotal&&(t+=e.uploadTotal);this.uploadTotal=t})),e}destroyLoader(t){const e=t instanceof fp?t:this.getLoader(t);e._destroy(),this.loaders.remove(e),this._loadersMap.forEach(((t,n)=>{t===e&&this._loadersMap.delete(n)}))}_updatePendingAction(){const t=this.editor.plugins.get(Sd);if(this.loaders.length){if(!this._pendingAction){const e=this.editor.t,n=t=>`${e("Upload in progress")} ${parseInt(t)}%.`;this._pendingAction=t.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else t.remove(this._pendingAction),this._pendingAction=null}}he(pp,re);class fp{constructor(t,e){this.id=r(),this._filePromiseWrapper=this._createFilePromiseWrapper(t),this._adapter=e(this),this._reader=new mp,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((t=>this._filePromiseWrapper?t:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new c("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((t=>this._reader.read(t))).then((t=>{if("reading"!==this.status)throw this.status;return this.status="idle",t})).catch((t=>{if("aborted"===t)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:t}))}upload(){if("idle"!=this.status)throw new c("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((t=>(this.uploadResponse=t,this.status="idle",t))).catch((t=>{if("aborted"===this.status)throw"aborted";throw this.status="error",t}))}abort(){const t=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==t?this._reader.abort():"uploading"==t&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(t){const e={};return e.promise=new Promise(((n,o)=>{e.rejecter=o,e.isFulfilled=!1,t.then((t=>{e.isFulfilled=!0,n(t)})).catch((t=>{e.isFulfilled=!0,o(t)}))})),e}}he(fp,re);class kp extends jd{constructor(t){super(t),this.buttonView=new fh(t),this._fileInputView=new bp(t),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",(()=>{this._fileInputView.open()}))}focus(){this.buttonView.focus()}}class bp extends jd{constructor(t){super(t),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:e.to("acceptedType"),multiple:e.to("allowMultipleFiles")},on:{change:e.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}const wp="ckCsrfToken",_p="abcdefghijklmnopqrstuvwxyz0123456789";function Ap(){let t=function(t){t=t.toLowerCase();const e=document.cookie.split(";");for(const n of e){const e=n.split("=");if(decodeURIComponent(e[0].trim().toLowerCase())===t)return decodeURIComponent(e[1])}return null}(wp);var e,n;return t&&40==t.length||(t=function(t){let e="";const n=new Uint8Array(t);window.crypto.getRandomValues(n);for(let t=0;t.5?o.toUpperCase():o}return e}(40),e=wp,n=t,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(n)+";path=/"),t}class Cp{constructor(t,e,n){this.loader=t,this.url=e,this.t=n}upload(){return this.loader.file.then((t=>new Promise(((e,n)=>{this._initRequest(),this._initListeners(e,n,t),this._sendRequest(t)}))))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const t=this.xhr=new XMLHttpRequest;t.open("POST",this.url,!0),t.responseType="json"}_initListeners(t,e,n){const o=this.xhr,i=this.loader,r=(0,this.t)("Cannot upload file:")+` ${n.name}.`;o.addEventListener("error",(()=>e(r))),o.addEventListener("abort",(()=>e())),o.addEventListener("load",(()=>{const n=o.response;if(!n||!n.uploaded)return e(n&&n.error&&n.error.message?n.error.message:r);t({default:n.url})})),o.upload&&o.upload.addEventListener("progress",(t=>{t.lengthComputable&&(i.uploadTotal=t.total,i.uploaded=t.loaded)}))}_sendRequest(t){const e=new FormData;e.append("upload",t),e.append("ckCsrfToken",Ap()),this.xhr.send(e)}}function vp(t,e,n,o){let i,r=null;"function"==typeof o?i=o:(r=t.commands.get(o),i=()=>{t.execute(o)}),t.model.document.on("change:data",((s,a)=>{if(r&&!r.isEnabled||!e.isEnabled)return;const c=Ta(t.model.document.selection.getRanges());if(!c.isCollapsed)return;if(a.isUndo||!a.isLocal)return;const l=Array.from(t.model.document.differ.getChanges()),d=l[0];if(1!=l.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const h=d.position.parent;if(h.is("element","codeBlock"))return;if(h.is("element","listItem")&&"function"!=typeof o&&!["numberedList","bulletedList","todoList"].includes(o))return;if(r&&!0===r.value)return;const u=h.getChild(0),g=t.model.createRangeOn(u);if(!g.containsRange(c)&&!c.end.isEqual(g.end))return;const m=n.exec(u.data.substr(0,c.end.offset));m&&t.model.enqueueChange((e=>{const n=e.createPositionAt(h,0),o=e.createPositionAt(h,m[0].length),r=new sc(n,o);if(!1!==i({match:m})){e.remove(r);const n=t.model.document.selection.getFirstRange(),o=e.createRangeIn(h);!h.isEmpty||o.isEqual(n)||o.containsRange(n,!0)||e.remove(h)}r.detach(),t.model.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function yp(t,e,n,o){let i,r;n instanceof RegExp?i=n:r=n,r=r||(t=>{let e;const n=[],o=[];for(;null!==(e=i.exec(t))&&!(e&&e.length<4);){let{index:t,1:i,2:r,3:s}=e;const a=i+r+s;t+=e[0].length-a.length;const c=[t,t+i.length],l=[t+i.length+r.length,t+i.length+r.length+s.length];n.push(c),n.push(l),o.push([t+i.length,t+i.length+r.length])}return{remove:n,format:o}}),t.model.document.on("change:data",((n,i)=>{if(i.isUndo||!i.isLocal||!e.isEnabled)return;const s=t.model,a=s.document.selection;if(!a.isCollapsed)return;const c=Array.from(s.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const d=a.focus,h=d.parent,{text:u,range:g}=function(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>!o.is("$text")&&!o.is("$textProxy")||o.getAttribute("code")?(n=e.createPositionAfter(o),""):t+o.data),""),range:e.createRange(n,t.end)}}(s.createRange(s.createPositionAt(h,0),d),s),m=r(u),p=xp(g.start,m.format,s),f=xp(g.start,m.remove,s);p.length&&f.length&&s.enqueueChange((e=>{if(!1!==o(e,p)){for(const t of f.reverse())e.remove(t);s.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function xp(t,e,n){return e.filter((t=>void 0!==t[0]&&void 0!==t[1])).map((e=>n.createRange(t.getShiftedBy(e[0]),t.getShiftedBy(e[1]))))}function Ep(t,e){return(n,o)=>{if(!t.commands.get(e).isEnabled)return!1;const i=t.model.schema.getValidRanges(o,e);for(const t of i)n.setAttribute(e,!0,t);n.removeSelectionAttribute(e)}}class Dp extends me{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,o=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(n.isCollapsed)o?t.setSelectionAttribute(this.attributeKey,!0):t.removeSelectionAttribute(this.attributeKey);else{const i=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of i)o?t.setAttribute(this.attributeKey,o,e):t.removeAttribute(this.attributeKey,e)}}))}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const t of n.getRanges())for(const n of t.getItems())if(e.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}const Mp="bold";class Ip extends ue{static get pluginName(){return"BoldEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Mp}),t.model.schema.setAttributeProperties(Mp,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Mp,view:"strong",upcastAlso:["b",t=>{const e=t.getStyle("font-weight");return e?"bold"==e||Number(e)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),t.commands.add(Mp,new Dp(t,Mp)),t.keystrokes.set("CTRL+B",Mp)}}const Sp="bold";class Tp extends ue{static get pluginName(){return"BoldUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Sp,(n=>{const o=t.commands.get(Sp),i=new fh(n);return i.set({label:e("Bold"),icon:'',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(Sp),t.editing.view.focus()})),i}))}}const Np="italic";class Bp extends ue{static get pluginName(){return"ItalicEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Np}),t.model.schema.setAttributeProperties(Np,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Np,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(Np,new Dp(t,Np)),t.keystrokes.set("CTRL+I",Np)}}const zp="italic";class Pp extends ue{static get pluginName(){return"ItalicUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(zp,(n=>{const o=t.commands.get(zp),i=new fh(n);return i.set({label:e("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(zp),t.editing.view.focus()})),i}))}}class Lp extends me{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.schema,o=e.document.selection,i=Array.from(o.getSelectedBlocks()),r=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(r){const e=i.filter((t=>Op(t)||jp(n,t)));this._applyQuote(t,e)}else this._removeQuote(t,i.filter(Op))}))}_getValue(){const t=Ta(this.editor.model.document.selection.getSelectedBlocks());return!(!t||!Op(t))}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.document.selection,e=this.editor.model.schema,n=Ta(t.getSelectedBlocks());return!!n&&jp(e,n)}_removeQuote(t,e){Rp(t,e).reverse().forEach((e=>{if(e.start.isAtStart&&e.end.isAtEnd)return void t.unwrap(e.start.parent);if(e.start.isAtStart){const n=t.createPositionBefore(e.start.parent);return void t.move(e,n)}e.end.isAtEnd||t.split(e.end);const n=t.createPositionAfter(e.end.parent);t.move(e,n)}))}_applyQuote(t,e){const n=[];Rp(t,e).reverse().forEach((e=>{let o=Op(e.start);o||(o=t.createElement("blockQuote"),t.wrap(e,o)),n.push(o)})),n.reverse().reduce(((e,n)=>e.nextSibling==n?(t.merge(t.createPositionAfter(e)),e):n))}}function Op(t){return"blockQuote"==t.parent.name?t.parent:null}function Rp(t,e){let n,o=0;const i=[];for(;o{const o=t.model.document.differ.getChanges();for(const t of o)if("insert"==t.type){const o=t.position.nodeAfter;if(!o)continue;if(o.is("element","blockQuote")&&o.isEmpty)return n.remove(o),!0;if(o.is("element","blockQuote")&&!e.checkChild(t.position,o))return n.unwrap(o),!0;if(o.is("element")){const t=n.createRangeIn(o);for(const o of t.getItems())if(o.is("element","blockQuote")&&!e.checkChild(n.createPositionBefore(o),o))return n.unwrap(o),!0}}else if("remove"==t.type){const e=t.position.parent;if(e.is("element","blockQuote")&&e.isEmpty)return n.remove(e),!0}return!1}));const n=this.editor.editing.view.document,o=t.model.document.selection,i=t.commands.get("blockQuote");this.listenTo(n,"enter",((e,n)=>{if(!o.isCollapsed||!i.value)return;o.getLastPosition().parent.isEmpty&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"}),this.listenTo(n,"delete",((e,n)=>{if("backward"!=n.direction||!o.isCollapsed||!i.value)return;const r=o.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"})}}var Vp=n(3062),Hp={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Vp.Z,Hp);Vp.Z.locals;class Up extends ue{static get pluginName(){return"BlockQuoteUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("blockQuote",(n=>{const o=t.commands.get("blockQuote"),i=new fh(n);return i.set({label:e("Block quote"),icon:Nd.quote,tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),i}))}}class Wp extends ue{static get pluginName(){return"CKFinderUI"}init(){const t=this.editor,e=t.ui.componentFactory,n=t.t;e.add("ckfinder",(e=>{const o=t.commands.get("ckfinder"),i=new fh(e);return i.set({label:n("Insert image or file"),icon:'',tooltip:!0}),i.bind("isEnabled").to(o),i.on("execute",(()=>{t.execute("ckfinder"),t.editing.view.focus()})),i}))}}class qp extends me{constructor(t){super(t),this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",(()=>this.refresh()),{priority:"low"})}refresh(){const t=this.editor.commands.get("insertImage"),e=this.editor.commands.get("link");this.isEnabled=t.isEnabled||e.isEnabled}execute(){const t=this.editor,e=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=e&&"modal"!=e)throw new c("ckfinder-unknown-openermethod",t);const n=this.editor.config.get("ckfinder.options")||{};n.chooseFiles=!0;const o=n.onInit;n.language||(n.language=t.locale.uiLanguage),n.onInit=e=>{o&&o(e),e.on("files:choose",(n=>{const o=n.data.files.toArray(),i=o.filter((t=>!t.isImage())),r=o.filter((t=>t.isImage()));for(const e of i)t.execute("link",e.getUrl());const s=[];for(const t of r){const n=t.getUrl();s.push(n||e.request("file:getProxyUrl",{file:t}))}s.length&&Gp(t,s)})),e.on("file:choose:resizedImage",(e=>{const n=e.data.resizedUrl;if(n)Gp(t,[n]);else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not obtain resized image URL."),{title:n("Selecting resized image failed"),namespace:"ckfinder"})}}))},window.CKFinder[e](n)}}function Gp(t,e){if(t.commands.get("insertImage").isEnabled)t.execute("insertImage",{source:e});else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not insert image at the current position."),{title:n("Inserting image failed"),namespace:"ckfinder"})}}class Yp extends ue{static get pluginName(){return"CKFinderEditing"}static get requires(){return[Cu,"LinkEditing"]}init(){const t=this.editor;if(!t.plugins.has("ImageBlockEditing")&&!t.plugins.has("ImageInlineEditing"))throw new c("ckfinder-missing-image-plugin",t);t.commands.add("ckfinder",new qp(t))}}class Kp extends ue{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",pp]}init(){const t=this.editor,e=t.plugins.get("CloudServices"),n=e.token,o=e.uploadUrl;n&&(this._uploadGateway=t.plugins.get("CloudServicesCore").createUploadGateway(n,o),t.plugins.get(pp).createUploadAdapter=t=>new Qp(this._uploadGateway,t))}}class Qp{constructor(t,e){this.uploadGateway=t,this.loader=e}upload(){return this.loader.file.then((t=>(this.fileUploader=this.uploadGateway.upload(t),this.fileUploader.on("progress",((t,e)=>{this.loader.uploadTotal=e.total,this.loader.uploaded=e.uploaded})),this.fileUploader.send())))}abort(){this.fileUploader.abort()}}class $p extends me{refresh(){const t=this.editor.model,e=Ta(t.document.selection.getSelectedBlocks());this.value=!!e&&e.is("element","paragraph"),this.isEnabled=!!e&&Zp(e,t.schema)}execute(t={}){const e=this.editor.model,n=e.document;e.change((o=>{const i=(t.selection||n.selection).getSelectedBlocks();for(const t of i)!t.is("element","paragraph")&&Zp(t,e.schema)&&o.rename(t,"paragraph")}))}}function Zp(t,e){return e.checkChild(t.parent,"paragraph")&&!e.isObject(t)}class Jp extends me{execute(t){const e=this.editor.model,n=t.attributes;let o=t.position;e.change((t=>{const i=t.createElement("paragraph");if(n&&e.schema.setAllowedAttributes(i,n,t),!e.schema.checkChild(o.parent,i)){const n=e.schema.findAllowedParent(o,i);if(!n)return;o=t.split(o,n).position}e.insertContent(i,o),t.setSelection(i,"in")}))}}class Xp extends ue{static get pluginName(){return"Paragraph"}init(){const t=this.editor,e=t.model;t.commands.add("paragraph",new $p(t)),t.commands.add("insertParagraph",new Jp(t)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(t,{writer:e})=>Xp.paragraphLikeElements.has(t.name)?t.isEmpty?null:e.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}Xp.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class tf extends me{constructor(t,e){super(t),this.modelElements=e}refresh(){const t=Ta(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some((e=>ef(t,e,this.editor.model.schema)))}execute(t){const e=this.editor.model,n=e.document,o=t.value;e.change((t=>{const i=Array.from(n.selection.getSelectedBlocks()).filter((t=>ef(t,o,e.schema)));for(const e of i)e.is("element",o)||t.rename(e,o)}))}}function ef(t,e,n){return n.checkChild(t.parent,e)&&!n.isObject(t)}const nf="paragraph";class of extends ue{static get pluginName(){return"HeadingEditing"}constructor(t){super(t),t.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[Xp]}init(){const t=this.editor,e=t.config.get("heading.options"),n=[];for(const o of e)o.model!==nf&&(t.model.schema.register(o.model,{inheritAllFrom:"$block"}),t.conversion.elementToElement(o),n.push(o.model));this._addDefaultH1Conversion(t),t.commands.add("heading",new tf(t,n))}afterInit(){const t=this.editor,e=t.commands.get("enter"),n=t.config.get("heading.options");e&&this.listenTo(e,"afterExecute",((e,o)=>{const i=t.model.document.selection.getFirstPosition().parent;n.some((t=>i.is("element",t.model)))&&!i.is("element",nf)&&0===i.childCount&&o.writer.rename(i,nf)}))}_addDefaultH1Conversion(t){t.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:s.get("low")+1})}}var rf=n(8733),sf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(rf.Z,sf);rf.Z.locals;class af extends ue{static get pluginName(){return"HeadingUI"}init(){const t=this.editor,e=t.t,n=function(t){const e=t.t,n={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return t.config.get("heading.options").map((t=>{const e=n[t.title];return e&&e!=t.title&&(t.title=e),t}))}(t),o=e("Choose heading"),i=e("Heading");t.ui.componentFactory.add("heading",(e=>{const r={},s=new Mo,a=t.commands.get("heading"),c=t.commands.get("paragraph"),l=[a];for(const t of n){const e={type:"button",model:new vu({label:t.title,class:t.class,withText:!0})};"paragraph"===t.model?(e.model.bind("isOn").to(c,"value"),e.model.set("commandName","paragraph"),l.push(c)):(e.model.bind("isOn").to(a,"value",(e=>e===t.model)),e.model.set({commandName:"heading",commandValue:t.model})),s.add(e),r[t.model]=t.title}const d=eu(e);return ou(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:i}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(l,"isEnabled",((...t)=>t.some((t=>t)))),d.buttonView.bind("label").to(a,"value",c,"value",((t,e)=>{const n=t||e&&"paragraph";return r[n]?r[n]:o})),this.listenTo(d,"execute",(e=>{t.execute(e.source.commandName,e.source.commandValue?{value:e.source.commandValue}:void 0),t.editing.view.focus()})),d}))}}class cf extends ue{static get requires(){return[Ou]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",(e=>{(function(t){const e=t.getSelectedElement();return!(!e||!Fg(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{ariaLabel:e,items:n,getRelatedElement:o,balloonClassName:i="ck-toolbar-container"}){if(!n.length)return void l("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new Hh(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new c("widget-toolbar-duplicated",this,{toolbarId:t});a.fillFromConfig(n,r.ui.componentFactory),this._toolbarDefinitions.set(t,{view:a,getRelatedElement:o,balloonClassName:i})}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const o of this._toolbarDefinitions.values()){const i=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&i)if(this.editor.ui.focusTracker.isFocused){const r=i.getAncestors().length;r>t&&(t=r,e=i,n=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(t,e){this._isToolbarVisible(t)?lf(this.editor,e):this._isToolbarInBalloon(t)||(this._balloon.add({view:t.view,position:df(this.editor,e),balloonClassName:t.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const e=t.getRelatedElement(this.editor.editing.view.document.selection);lf(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function lf(t,e){const n=t.plugins.get("ContextualBalloon"),o=df(t,e);n.updatePosition(o)}function df(t,e){const n=t.editing.view,o=Iu.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast,o.viewportStickyNorth]}}class hf{constructor(t){this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=t,this._referenceCoordinates=null}begin(t,e,n){const o=new pa(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(uf(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new pa(t),o=e.split("-"),i={x:"right"==o[1]?n.right:n.left,y:"bottom"==o[0]?n.bottom:n.top};return i.x+=t.ownerDocument.defaultView.scrollX,i.y+=t.ownerDocument.defaultView.scrollY,i}(e,function(t){const e=t.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[e[0]]}-${n[e[1]]}`}(this.activeHandlePosition)),this.originalWidth=o.width,this.originalHeight=o.height,this.aspectRatio=o.width/o.height;const i=n.style.width;i&&i.match(/^\d+(\.\d*)?%$/)?this.originalWidthPercents=parseFloat(i):this.originalWidthPercents=function(t,e){const n=t.parentElement,o=parseFloat(n.ownerDocument.defaultView.getComputedStyle(n).width);return e.width/o*100}(n,o)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}function uf(t){return`ck-widget__resizer__handle-${t}`}he(hf,re);class gf extends jd{constructor(){super();const t=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",t.to("_viewPosition",(t=>t?`ck-orientation-${t}`:""))],style:{display:t.if("_isVisible","none",(t=>!t))}},children:[{text:t.to("_label")}]})}_bindToState(t,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",((t,e)=>null!==t&&null!==e)),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",((e,n,o)=>"px"===t.unit?`${e}×${n}`:`${o}%`)),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",((t,e,n)=>e<50||n<50?"above-center":t))}_dismiss(){this.unbind(),this._isVisible=!1}}class mf{constructor(t){this._options=t,this._viewResizerWrapper=null,this.set("isEnabled",!0),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(t=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),t.stop())}),{priority:"high"}),this.on("change:isEnabled",(()=>{this.isEnabled&&this.redraw()}))}attach(){const t=this,e=this._options.viewElement;this._options.editor.editing.view.change((n=>{const o=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(e){const n=this.toDomElement(e);return t._appendHandles(n),t._appendSizeUI(n),t.on("change:isEnabled",((t,e,o)=>{n.style.display=o?"":"none"})),n.style.display=t.isEnabled?"":"none",n}));n.insert(n.createPositionAt(e,"end"),o),n.addClass("ck-widget_with-resizer",e),this._viewResizerWrapper=o}))}begin(t){this.state=new hf(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(t,this._getHandleHost(),this._getResizeHost())}updateSize(t){const e=this._proposeNewSize(t);this._options.editor.editing.view.change((t=>{const n=this._options.unit||"%",o=("%"===n?e.widthPercents:e.width)+n;t.setStyle("width",o,this._options.viewElement)}));const n=this._getHandleHost(),o=new pa(n);e.handleHostWidth=Math.round(o.width),e.handleHostHeight=Math.round(o.height);const i=new pa(n);e.width=Math.round(i.width),e.height=Math.round(i.height),this.redraw(o),this.state.update(e)}commit(){const t=this._options.unit||"%",e=("%"===t?this.state.proposedWidthPercents:this.state.proposedWidth)+t;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(e)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(t){const e=this._domResizerWrapper;if(!((n=e)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const o=e.parentElement,i=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(o.isSameNode(i)){const e=t||new pa(i);a=[e.width+"px",e.height+"px",void 0,void 0]}else a=[i.offsetWidth+"px",i.offsetHeight+"px",i.offsetLeft+"px",i.offsetTop+"px"];"same"!==Oo(s,a)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)}))}containsHandle(t){return this._domResizerWrapper.contains(t)}static isResizeHandle(t){return t.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change((t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(t){const e=this.state,n={x:(o=t).pageX,y:o.pageY};var o;const i=!this._options.isCentered||this._options.isCentered(this),r={x:e._referenceCoordinates.x-(n.x+e.originalWidth),y:n.y-e.originalHeight-e._referenceCoordinates.y};i&&e.activeHandlePosition.endsWith("-right")&&(r.x=n.x-(e._referenceCoordinates.x+e.originalWidth)),i&&(r.x*=2);const s={width:Math.abs(e.originalWidth+r.x),height:Math.abs(e.originalHeight+r.y)};s.dominant=s.width/e.aspectRatio>s.height?"width":"height",s.max=s[s.dominant];const a={width:s.width,height:s.height};return"width"==s.dominant?a.height=a.width/e.aspectRatio:a.width=a.height*e.aspectRatio,{width:Math.round(a.width),height:Math.round(a.height),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*a.width*100)/100,100)}}_getResizeHost(){const t=this._domResizerWrapper.parentElement;return this._options.getResizeHost(t)}_getHandleHost(){const t=this._domResizerWrapper.parentElement;return this._options.getHandleHost(t)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const o of e)t.appendChild(new Fd({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=o,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new gf,this._sizeView.render(),t.appendChild(this._sizeView.element)}}he(mf,re);var pf=n(8506),ff={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(pf.Z,ff);pf.Z.locals;he(class extends ue{static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,e=is.window.document;this.set("visibleResizer",null),this.set("_activeResizer",null),this._resizers=new Map,t.view.addObserver(ug),this._observer=Object.create(ws),this.listenTo(t.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(e,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(e,"mouseup",this._mouseUpListener.bind(this));const n=()=>{this.visibleResizer&&this.visibleResizer.redraw()};this._redrawFocusedResizerThrottled=gm(n,200),this.on("change:visibleResizer",n),this.editor.ui.on("update",this._redrawFocusedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[t,e]of this._resizers)t.isAttached()||(this._resizers.delete(t),e.destroy())}),{priority:"lowest"}),this._observer.listenTo(is.window,"resize",this._redrawFocusedResizerThrottled);const o=this.editor.editing.view.document.selection;o.on("change",(()=>{const t=o.getSelectedElement();this.visibleResizer=this.getResizerByViewElement(t)||null}))}destroy(){this._observer.stopListening();for(const t of this._resizers.values())t.destroy();this._redrawFocusedResizerThrottled.cancel()}attachTo(t){const e=new mf(t),n=this.editor.plugins;if(e.attach(),n.has("WidgetToolbarRepository")){const t=n.get("WidgetToolbarRepository");e.on("begin",(()=>{t.forceDisabled("resize")}),{priority:"lowest"}),e.on("cancel",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"}),e.on("commit",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(t.viewElement,e);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==e&&(this.visibleResizer=e),e}getResizerByViewElement(t){return this._resizers.get(t)}_getResizerByHandle(t){for(const e of this._resizers.values())if(e.containsHandle(t))return e}_mouseDownListener(t,e){const n=e.domTarget;mf.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n),this._activeResizer&&(this._activeResizer.begin(n),t.stop(),e.preventDefault()))}_mouseMoveListener(t,e){this._activeResizer&&this._activeResizer.updateSize(e)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}},re);class kf extends me{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(t){const e=this.editor,n=e.plugins.get("ImageUtils"),o=e.model,i=n.getClosestSelectedImageElement(o.document.selection);o.change((e=>{e.setAttribute("alt",t.newValue,i)}))}}function bf(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot()])}function wf(t,e){const n=t.plugins.get("ImageUtils"),o=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>{if(!n.isInlineImageView(t))return null;if(!o)return i(t);return(t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:i(t)};function i(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function _f(t,e){const n=Ta(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}class Af extends ue{static get pluginName(){return"ImageUtils"}isImage(t){return this.isInlineImage(t)||this.isBlockImage(t)}isInlineImageView(t){return!!t&&t.is("element","img")}isBlockImageView(t){return!!t&&t.is("element","figure")&&t.hasClass("image")}insertImage(t={},e=null,n=null){const o=this.editor,i=o.model,r=i.document.selection;n=Cf(o,e||r,n),t={...Object.fromEntries(r.getAttributes()),...t};for(const e in t)i.schema.checkAttribute(n,e)||delete t[e];return i.change((o=>{const r=o.createElement(n,t);return i.insertObject(r,e,null,{setSelection:"on",findOptimalPosition:!e&&"imageInline"!=n}),r.parent?r:null}))}getClosestSelectedImageWidget(t){const e=t.getSelectedElement();if(e&&this.isImageWidget(e))return e;let n=t.getFirstPosition().parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent}return null}getClosestSelectedImageElement(t){const e=t.getSelectedElement();return this.isImage(e)?e:t.getFirstPosition().findAncestor("imageBlock")}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){if("imageBlock"==Cf(t,e)){const n=function(t,e){const n=Yg(t,e).start.parent;if(n.isEmpty&&!n.is("element","$root"))return n.parent;return n}(e,t.model);if(t.model.schema.checkChild(n,"imageBlock"))return!0}else if(t.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}(this.editor,t)&&function(t){return[...t.focus.getAncestors()].every((t=>!t.is("element","imageBlock")))}(t)}toImageWidget(t,e,n){e.setCustomProperty("image",!0,t);return Vg(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&Fg(t)}isBlockImage(t){return!!t&&t.is("element","imageBlock")}isInlineImage(t){return!!t&&t.is("element","imageInline")}findViewImgElement(t){if(this.isInlineImageView(t))return t;const e=this.editor.editing.view;for(const{item:n}of e.createRangeIn(t))if(this.isInlineImageView(n))return n}}function Cf(t,e,n){const o=t.model.schema,i=t.config.get("image.insert.type");return t.plugins.has("ImageBlockEditing")?t.plugins.has("ImageInlineEditing")?n||("inline"===i?"imageInline":"block"===i?"imageBlock":e.is("selection")?_f(o,e):o.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class vf extends ue{static get requires(){return[Af]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new kf(this.editor))}}var yf=n(1905),xf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(yf.Z,xf);yf.Z.locals;var Ef=n(6764),Df={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Ef.Z,Df);Ef.Z.locals;class Mf extends jd{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),Nd.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),Nd.cancel,"ck-button-cancel","cancel"),this._focusables=new Ld,this._focusCycler=new Ph({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]}),zd(this)}render(){super.render(),this.keystrokes.listenTo(this.element),Pd({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,o){const i=new fh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createLabeledInputView(){const t=this.locale.t,e=new _u(this.locale,Au);return e.label=t("Text alternative"),e}}function If(t){const e=t.editing.view,n=Iu.defaultPositions,o=t.plugins.get("ImageUtils");return{target:e.domConverter.viewToDom(o.getClosestSelectedImageWidget(e.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class Sf extends ue{static get requires(){return[Ou]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",(n=>{const o=t.commands.get("imageTextAlternative"),i=new fh(n);return i.set({label:e("Change image text alternative"),icon:Nd.lowVision,tooltip:!0}),i.bind("isEnabled").to(o,"isEnabled"),this.listenTo(i,"execute",(()=>{this._showForm()})),i}))}_createForm(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Mf(t.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{t.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),this.listenTo(t.ui,"update",(()=>{n.getClosestSelectedImageWidget(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=If(t);e.updatePosition(n)}}(t):this._hideForm(!0)})),Bd({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:If(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class Tf extends ue{static get requires(){return[vf,Sf]}static get pluginName(){return"ImageTextAlternative"}}function Nf(t,e){return t=>{t.on(`attribute:srcset:${e}`,n)};function n(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);if(null===n.attributeNewValue){const t=n.attributeOldValue;t.data&&(i.removeAttribute("srcset",s),i.removeAttribute("sizes",s),t.width&&i.removeAttribute("width",s))}else{const t=n.attributeNewValue;t.data&&(i.setAttribute("srcset",t.data,s),i.setAttribute("sizes","100vw",s),t.width&&i.setAttribute("width",t.width,s))}}}function Bf(t,e,n){return t=>{t.on(`attribute:${n}:${e}`,o)};function o(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);i.setAttribute(n.attributeKey,n.attributeNewValue||"",s)}}class zf extends Cs{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}class Pf extends me{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&l("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&l("image-inline-plugin-required")}refresh(){this.isEnabled=this.editor.plugins.get("ImageUtils").isImageAllowed()}execute(t){const e=So(t.source),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if("string"==typeof t&&(t={src:t}),e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);o.insertImage({...t,...i},e)}else o.insertImage({...t,...i})}))}}class Lf extends ue{static get requires(){return[Af]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(zf),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:t=>{const e={data:t.getAttribute("srcset")};return t.hasAttribute("width")&&(e.width=t.getAttribute("width")),e}}});const n=new Pf(t);t.commands.add("insertImage",n),t.commands.add("imageInsert",n)}}class Of extends me{constructor(t,e){super(t),this._modelElementName=e}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=t.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=t.isInlineImage(e):this.isEnabled=t.isBlockImage(e)}execute(){const t=this.editor,e=this.editor.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(e.document.selection),i=Object.fromEntries(o.getAttributes());return i.src||i.uploadId?e.change((t=>{const r=Array.from(e.markers).filter((t=>t.getRange().containsItem(o))),s=n.insertImage(i,e.createSelection(o,"on"),this._modelElementName);if(!s)return null;const a=t.createRangeOn(s);for(const e of r){const n=e.getRange(),o="$graveyard"!=n.root.rootName?n.getJoined(a,!0):a;t.updateMarker(e,{range:o})}return{oldElement:o,newElement:s}})):null}}class Rf extends ue{static get requires(){return[Lf,Af,Ag]}static get pluginName(){return"ImageBlockEditing"}init(){const t=this.editor;t.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),t.plugins.has("ImageInlineEditing")&&(t.commands.add("imageTypeBlock",new Of(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:e})=>bf(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>o.toImageWidget(bf(n),n,e("image widget"))}),n.for("downcast").add(Bf(o,"imageBlock","src")).add(Bf(o,"imageBlock","alt")).add(Nf(o,"imageBlock")),n.for("upcast").elementToElement({view:wf(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)}).add(function(t){return t=>{t.on("element:figure",e)};function e(e,n,o){if(!o.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const i=t.findViewImgElement(n.viewItem);if(!i||!o.consumable.test(i,{name:!0}))return;o.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=Ta(o.convertItem(i,n.modelCursor).modelRange.getItems());r?(o.convertChildren(n.viewItem,r),o.updateConversionResult(r,n)):o.consumable.revert(n.viewItem,{name:!0,classes:"image"})}}(o))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isInlineImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageBlock"===_f(e.schema,c)){const t=new gg(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}}))}}var jf=n(3508),Ff={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(jf.Z,Ff);jf.Z.locals;class Vf extends ue{static get requires(){return[Rf,hm,Tf]}static get pluginName(){return"ImageBlock"}}class Hf extends ue{static get requires(){return[Lf,Af,Ag]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor,e=t.model.schema;e.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),e.addChildCheck(((t,e)=>{if(t.endsWith("caption")&&"imageInline"===e.name)return!1})),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new Of(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(t,{writer:e})=>e.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(t,{writer:n})=>o.toImageWidget(function(t){return t.createContainerElement("span",{class:"image-inline"},t.createEmptyElement("img"))}(n),n,e("image widget"))}),n.for("downcast").add(Bf(o,"imageInline","src")).add(Bf(o,"imageInline","alt")).add(Nf(o,"imageInline")),n.for("upcast").elementToElement({view:wf(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isBlockImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageInline"===_f(e.schema,c)){const t=new gg(n.document),e=s.map((e=>1===e.childCount?(Array.from(e.getAttributes()).forEach((n=>t.setAttribute(...n,o.findViewImgElement(e)))),e.getChild(0)):e));r.content=t.createDocumentFragment(e)}}))}}class Uf extends ue{static get requires(){return[Hf,hm,Tf]}static get pluginName(){return"ImageInline"}}class Wf extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils");if(!t.plugins.has(Rf))return this.isEnabled=!1,void(this.value=!1);const n=t.model.document.selection,o=n.getSelectedElement();if(!o){const t=e.getCaptionFromModelSelection(n);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=this.editor.plugins.get("ImageUtils").isImage(o),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(o):this.value=!1}execute(t={}){const{focusCaptionOnShow:e}=t;this.editor.model.change((t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)}))}_showImageCaption(t,e){const n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing");let i=n.getSelectedElement();const r=o._getSavedCaption(i);this.editor.plugins.get("ImageUtils").isInlineImage(i)&&(this.editor.execute("imageTypeBlock"),i=n.getSelectedElement());const s=r||t.createElement("caption");t.append(s,i),e&&t.setSelection(s,"in")}_hideImageCaption(t){const e=this.editor,n=e.model.document.selection,o=e.plugins.get("ImageCaptionEditing"),i=e.plugins.get("ImageCaptionUtils");let r,s=n.getSelectedElement();s?r=i.getCaptionFromImageModelElement(s):(r=i.getCaptionFromModelSelection(n),s=r.parent),o._saveCaption(s,r),t.setSelection(s,"on"),t.remove(r)}}class qf extends ue{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[Af]}getCaptionFromImageModelElement(t){for(const e of t.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(t){const e=this.editor.plugins.get("ImageUtils"),n=t.getFirstPosition().findAncestor("caption");return n&&e.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(t){const e=this.editor.plugins.get("ImageUtils");return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}}class Gf extends ue{static get requires(){return[Af,qf]}static get pluginName(){return"ImageCaptionEditing"}constructor(t){super(t),this._savedCaptionsMap=new WeakMap}init(){const t=this.editor,e=t.model.schema;e.isRegistered("caption")?e.extend("caption",{allowIn:"imageBlock"}):e.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleImageCaption",new Wf(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration()}_setupConversion(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils"),o=t.plugins.get("ImageCaptionUtils"),i=t.t;t.conversion.for("upcast").elementToElement({view:t=>o.matchImageCaptionViewElement(t),model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>n.isBlockImage(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:o})=>{if(!n.isBlockImage(t.parent))return null;const r=o.createEditableElement("figcaption");return o.setCustomProperty("imageCaption",!0,r),Qu({view:e,element:r,text:i("Enter image caption"),keepOnFocus:!0}),Gg(r,o)}})}_setupImageTypeCommandsIntegration(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.plugins.get("ImageCaptionUtils"),o=t.commands.get("imageTypeInline"),i=t.commands.get("imageTypeBlock"),r=t=>{if(!t.return)return;const{oldElement:o,newElement:i}=t.return;if(!o)return;if(e.isBlockImage(o)){const t=n.getCaptionFromImageModelElement(o);if(t)return void this._saveCaption(i,t)}const r=this._getSavedCaption(o);r&&this._saveCaption(i,r)};o&&this.listenTo(o,"execute",r,{priority:"low"}),i&&this.listenTo(i,"execute",r,{priority:"low"})}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?Va.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}}class Yf extends ue{static get requires(){return[qf]}static get pluginName(){return"ImageCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageCaptionUtils"),o=t.t;t.ui.componentFactory.add("toggleImageCaption",(i=>{const r=t.commands.get("toggleImageCaption"),s=new fh(i);return s.set({icon:Nd.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(t=>o(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{t.execute("toggleImageCaption",{focusCaptionOnShow:!0});const o=n.getCaptionFromModelSelection(t.model.document.selection);if(o){const n=t.editing.mapper.toViewElement(o);e.scrollToTheSelection(),e.change((t=>{t.addClass("image__caption_highlighted",n)}))}})),s}))}}var Kf=n(2640),Qf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Kf.Z,Qf);Kf.Z.locals;class $f extends me{constructor(t,e){super(t),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(e.map((t=>{if(t.isDefault)for(const e of t.modelElements)this._defaultStyles[e]=t.name;return[t.name,t]})))}refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?t.hasAttribute("imageStyle")?this.value=t.getAttribute("imageStyle"):this.value=this._defaultStyles[t.name]:this.value=!1}execute(t={}){const e=this.editor,n=e.model,o=e.plugins.get("ImageUtils");n.change((e=>{const i=t.value;let r=o.getClosestSelectedImageElement(n.document.selection);i&&this.shouldConvertImageType(i,r)&&(this.editor.execute(o.isBlockImage(r)?"imageTypeInline":"imageTypeBlock"),r=o.getClosestSelectedImageElement(n.document.selection)),!i||this._styles.get(i).isDefault?e.removeAttribute("imageStyle",r):e.setAttribute("imageStyle",i,r)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}const{objectFullWidth:Zf,objectInline:Jf,objectLeft:Xf,objectRight:tk,objectCenter:ek,objectBlockLeft:nk,objectBlockRight:ok}=Nd,ik={get inline(){return{name:"inline",title:"In line",icon:Jf,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Xf,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:nk,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:ek,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:tk,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:ok,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:ek,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:tk,modelElements:["imageBlock"],className:"image-style-side"}}},rk={full:Zf,left:nk,right:ok,center:ek,inlineLeft:Xf,inlineRight:tk,inline:Jf},sk=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function ak(t){l("image-style-configuration-definition-invalid",t)}const ck={normalizeStyles:function(t){return(t.configuredStyles.options||[]).map((t=>function(t){t="string"==typeof t?ik[t]?{...ik[t]}:{name:t}:function(t,e){const n={...e};for(const o in t)Object.prototype.hasOwnProperty.call(e,o)||(n[o]=t[o]);return n}(ik[t.name],t);"string"==typeof t.icon&&(t.icon=rk[t.icon]||t.icon);return t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:o,name:i}=t;if(!(o&&o.length&&i))return ak({style:t}),!1;{const i=[e?"imageBlock":null,n?"imageInline":null];if(!o.some((t=>i.includes(t))))return l("image-style-missing-dependency",{style:t,missingPlugins:o.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)))},getDefaultStylesConfiguration:function(t,e){return t&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:t?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(t){return t.has("ImageBlockEditing")&&t.has("ImageInlineEditing")?[...sk]:[]},warnInvalidStyle:ak,DEFAULT_OPTIONS:ik,DEFAULT_ICONS:rk,DEFAULT_DROPDOWN_DEFINITIONS:sk};function lk(t,e){for(const n of e)if(n.name===t)return n}class dk extends ue{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[Af]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=ck,n=this.editor,o=n.plugins.has("ImageBlockEditing"),i=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",e(o,i)),this.normalizedStyles=t({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:o,isInlinePluginLoaded:i}),this._setupConversion(o,i),this._setupPostFixer(),n.commands.add("imageStyle",new $f(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,o=n.model.schema,i=(r=this.normalizedStyles,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const o=lk(e.attributeNewValue,r),i=lk(e.attributeOldValue,r),s=n.mapper.toViewElement(e.item),a=n.writer;i&&a.removeClass(i.className,s),o&&a.addClass(o.className,s)});var r;const s=function(t){const e={imageInline:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageInline"))),imageBlock:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageBlock")))};return(t,n,o)=>{if(!n.modelRange)return;const i=n.viewItem,r=Ta(n.modelRange.getItems());if(r&&o.schema.checkAttribute(r,"imageStyle"))for(const t of e[r.name])o.consumable.consume(i,{classes:t.className})&&o.writer.setAttribute("imageStyle",t.name,r)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",i),n.data.downcastDispatcher.on("attribute:imageStyle",i),t&&(o.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),e&&(o.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(Af),o=new Map(this.normalizedStyles.map((t=>[t.name,t])));e.registerPostFixer((t=>{let i=!1;for(const r of e.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let e="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(e&&e.is("element","paragraph")&&e.childCount>0&&(e=e.getChild(0)),!n.isImage(e))continue;const s=e.getAttribute("imageStyle");if(!s)continue;const a=o.get(s);a&&a.modelElements.includes(e.name)||(t.removeAttribute("imageStyle",e),i=!0)}return i}))}}var hk=n(5083),uk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(hk.Z,uk);hk.Z.locals;class gk extends ue{static get requires(){return[dk]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Wrap text":t("Wrap text"),"Break text":t("Break text"),"In line":t("In line"),"Full size image":t("Full size image"),"Side image":t("Side image"),"Left aligned image":t("Left aligned image"),"Centered image":t("Centered image"),"Right aligned image":t("Right aligned image")}}init(){const t=this.editor.plugins,e=this.editor.config.get("image.toolbar")||[],n=mk(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const o=mk([...e.filter(x),...ck.getDefaultDropdownDefinitions(t)],this.localizedDefaultStylesTitles);for(const t of o)this._createDropdown(t,n)}_createDropdown(t,e){const n=this.editor.ui.componentFactory;n.add(t.name,(o=>{let i;const{defaultItem:r,items:s,title:a}=t,c=s.filter((t=>e.find((({name:e})=>pk(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(i=e),e}));s.length!==c.length&&ck.warnInvalidStyle({dropdown:t});const l=eu(o,Eh),d=l.buttonView;return nu(l,c),d.set({label:fk(a,i.label),class:null,tooltip:!0}),d.bind("icon").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return e<0?i.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return fk(a,e<0?i.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(st))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(st)?"ck-splitbutton_flatten":null)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:i.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(st))),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(pk(e),(n=>{const o=this.editor.commands.get("imageStyle"),i=new fh(n);return i.set({label:t.title,icon:t.icon,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(o,"isEnabled"),i.bind("isOn").to(o,"value",(t=>t===e)),i.on("execute",this._executeCommand.bind(this,e)),i}))}_executeCommand(t){this.editor.execute("imageStyle",{value:t}),this.editor.editing.view.focus()}}function mk(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function pk(t){return`imageStyle:${t}`}function fk(t,e){return(t?t+": ":"")+e}function kk(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function bk(t){return new Promise(((e,n)=>{const o=t.getAttribute("src");fetch(o).then((t=>t.blob())).then((t=>{const n=wk(t,o),i=n.replace("image/",""),r=new File([t],`image.${i}`,{type:n});e(r)})).catch((t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise(((e,n)=>{const o=is.document.createElement("img");o.addEventListener("load",(()=>{const t=is.document.createElement("canvas");t.width=o.width,t.height=o.height;t.getContext("2d").drawImage(o,0,0),t.toBlob((t=>t?e(t):n()))})),o.addEventListener("error",(()=>n())),o.src=t}))}(t).then((e=>{const n=wk(e,t),o=n.replace("image/","");return new File([e],`image.${o}`,{type:n})}))}(o).then(e).catch(n):n(t)))}))}function wk(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class _k extends ue{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor,e=t.t,n=n=>{const o=new kp(n),i=t.commands.get("uploadImage"),r=t.config.get("image.upload.types"),s=kk(r);return o.set({acceptedType:r.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0}),o.buttonView.set({label:e("Insert image"),icon:Nd.image,tooltip:!0}),o.buttonView.bind("isEnabled").to(i),o.on("done",((e,n)=>{const o=Array.from(n).filter((t=>s.test(t.type)));o.length&&t.execute("uploadImage",{file:o})})),o};t.ui.componentFactory.add("uploadImage",n),t.ui.componentFactory.add("imageUpload",n)}}var Ak=n(3689),Ck={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Ak.Z,Ck);Ak.Z.locals;var vk=n(4036),yk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(vk.Z,yk);vk.Z.locals;var xk=n(3773),Ek={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(xk.Z,Ek);xk.Z.locals;class Dk extends ue{static get pluginName(){return"ImageUploadProgress"}constructor(t){super(t),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",((...t)=>this.uploadStatusChange(...t))),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",((...t)=>this.uploadStatusChange(...t)))}uploadStatusChange(t,e,n){const o=this.editor,i=e.item,r=i.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=o.plugins.get("ImageUtils"),a=o.plugins.get(pp),c=r?e.attributeNewValue:null,l=this.placeholder,d=o.editing.mapper.toViewElement(i),h=n.writer;if("reading"==c)return Mk(d,h),void Ik(s,l,d,h);if("uploading"==c){const t=a.loaders.get(r);return Mk(d,h),void(t?(Sk(d,h),function(t,e,n,o){const i=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),i),n.on("change:uploadedPercent",((t,e,n)=>{o.change((t=>{t.setStyle("width",n+"%",i)}))}))}(d,h,t,o.editing.view),function(t,e,n,o){if(o.data){const i=t.findViewImgElement(e);n.setAttribute("src",o.data,i)}}(s,d,h,t)):Ik(s,l,d,h))}"complete"==c&&a.loaders.get(r)&&function(t,e,n){const o=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),o),setTimeout((()=>{n.change((t=>t.remove(t.createRangeOn(o))))}),3e3)}(d,h,o.editing.view),function(t,e){Nk(t,e,"progressBar")}(d,h),Sk(d,h),function(t,e){e.removeClass("ck-appear",t)}(d,h)}}function Mk(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function Ik(t,e,n,o){n.hasClass("ck-image-upload-placeholder")||o.addClass("ck-image-upload-placeholder",n);const i=t.findViewImgElement(n);i.getAttribute("src")!==e&&o.setAttribute("src",e,i),Tk(n,"placeholder")||o.insert(o.createPositionAfter(i),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(o))}function Sk(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),Nk(t,e,"placeholder")}function Tk(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function Nk(t,e,n){const o=Tk(t,n);o&&e.remove(e.createRangeOn(o))}class Bk extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(n)}execute(t){const e=So(t.file),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if(e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);this._uploadImage(t,i,e)}else this._uploadImage(t,i)}))}_uploadImage(t,e,n){const o=this.editor,i=o.plugins.get(pp).createLoader(t),r=o.plugins.get("ImageUtils");i&&r.insertImage({...e,uploadId:i.id},n)}}class zk extends ue{static get requires(){return[pp,Cu,Ag,Af]}static get pluginName(){return"ImageUploadEditing"}constructor(t){super(t),t.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const t=this.editor,e=t.model.document,n=t.conversion,o=t.plugins.get(pp),i=t.plugins.get("ImageUtils"),r=kk(t.config.get("image.upload.types")),s=new Bk(t);t.commands.add("uploadImage",s),t.commands.add("imageUpload",s),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,n)=>{if(o=n.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const i=Array.from(n.dataTransfer.files).filter((t=>!!t&&r.test(t.type)));i.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.model.enqueueChange((()=>{t.execute("uploadImage",{file:i})}))})))})),this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).filter((t=>function(t,e){return!(!t.isInlineImageView(e)||!e.getAttribute("src"))&&(e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||e.getAttribute("src").match(/^blob:/g))}(i,t.item)&&!t.item.getAttribute("uploadProcessed"))).map((t=>({promise:bk(t.item),imageElement:t.item})));if(!r.length)return;const s=new gg(t.editing.view.document);for(const t of r){s.setAttribute("uploadProcessed",!0,t.imageElement);const e=o.createLoader(t.promise);e&&(s.setAttribute("src","",t.imageElement),s.setAttribute("uploadId",e.id,t.imageElement))}})),t.editing.view.document.on("dragover",((t,e)=>{e.preventDefault()})),e.on("change",(()=>{const n=e.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),i=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter,r="$graveyard"==e.position.root.rootName;for(const e of Pk(t,n)){const t=e.getAttribute("uploadId");if(!t)continue;const n=o.loaders.get(t);n&&(r?i.has(t)||n.abort():(i.add(t),this._uploadImageElements.set(t,e),"idle"==n.status&&this._readAndUpload(n)))}}})),this.on("uploadComplete",((t,{imageElement:e,data:n})=>{const o=n.urls?n.urls:n;this.editor.model.change((t=>{t.setAttribute("src",o.default,e),this._parseAndSetSrcsetAttributeOnImage(o,e,t)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(t){const e=this.editor,n=e.model,o=e.locale.t,i=e.plugins.get(pp),r=e.plugins.get(Cu),s=e.plugins.get("ImageUtils"),a=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","reading",a.get(t.id))})),t.read().then((()=>{const o=t.upload(),i=a.get(t.id);if(sr.isSafari){const t=e.editing.mapper.toViewElement(i),n=s.findViewImgElement(t);e.editing.view.once("render",(()=>{if(!n.parent)return;const t=e.editing.view.domConverter.mapViewToDom(n.parent);if(!t)return;const o=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=o}))}return n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",i)})),o})).then((e=>{n.enqueueChange({isUndoable:!1},(n=>{const o=a.get(t.id);n.setAttribute("uploadStatus","complete",o),this.fire("uploadComplete",{data:e,imageElement:o})})),c()})).catch((e=>{if("error"!==t.status&&"aborted"!==t.status)throw e;"error"==t.status&&e&&r.showWarning(e,{title:o("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{e.remove(a.get(t.id))})),c()}));function c(){n.enqueueChange({isUndoable:!1},(e=>{const n=a.get(t.id);e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n),a.delete(t.id)})),i.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let o=0;const i=Object.keys(t).filter((t=>{const e=parseInt(t,10);if(!isNaN(e))return o=Math.max(o,e),!0})).map((e=>`${t[e]} ${e}w`)).join(", ");""!=i&&n.setAttribute("srcset",{data:i,width:o},e)}}function Pk(t,e){const n=t.plugins.get("ImageUtils");return Array.from(t.model.createRangeOn(e)).filter((t=>n.isImage(t.item))).map((t=>t.item))}class Lk extends ue{static get pluginName(){return"IndentEditing"}init(){const t=this.editor;t.commands.add("indent",new fe(t)),t.commands.add("outdent",new fe(t))}}const Ok='',Rk='';class jk extends ue{static get pluginName(){return"IndentUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?Ok:Rk,i="ltr"==e.uiLanguageDirection?Rk:Ok;this._defineButton("indent",n("Increase indent"),o),this._defineButton("outdent",n("Decrease indent"),i)}_defineButton(t,e,n){const o=this.editor;o.ui.componentFactory.add(t,(i=>{const r=o.commands.get(t),s=new fh(i);return s.set({label:e,icon:n,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",(()=>{o.execute(t),o.editing.view.focus()})),s}))}}class Fk{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(t){Array.isArray(t)?t.forEach((t=>this._definitions.add(t))):this._definitions.add(t)}getDispatcher(){return t=>{t.on("attribute:linkHref",((t,e,n)=>{if(!n.consumable.test(e.item,"attribute:linkHref"))return;if(!e.item.is("selection")&&!n.schema.isInline(e.item))return;const o=n.writer,i=o.document.selection;for(const t of this._definitions){const r=o.createAttributeElement("a",t.attributes,{priority:5});t.classes&&o.addClass(t.classes,r);for(const e in t.styles)o.setStyle(e,t.styles[e],r);o.setCustomProperty("link",!0,r),t.callback(e.attributeNewValue)?e.item.is("selection")?o.wrap(i.getFirstRange(),r):o.wrap(n.mapper.toViewRange(e.range),r):o.unwrap(n.mapper.toViewRange(e.range),r)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return t=>{t.on("attribute:linkHref:imageBlock",((t,e,{writer:n,mapper:o})=>{const i=o.toViewElement(e.item),r=Array.from(i.getChildren()).find((t=>"a"===t.name));for(const t of this._definitions){const o=Ho(t.attributes);if(t.callback(e.attributeNewValue)){for(const[t,e]of o)"class"===t?n.addClass(e,r):n.setAttribute(t,e,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r)}else{for(const[t,e]of o)"class"===t?n.removeClass(e,r):n.removeAttribute(t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r)}}}))}}}const Vk=function(t,e,n){var o=t.length;return n=void 0===n?o:n,!e&&n>=o?t:hi(t,e,n)};var Hk=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const Uk=function(t){return Hk.test(t)};const Wk=function(t){return t.split("")};var qk="[\\ud800-\\udfff]",Gk="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Yk="\\ud83c[\\udffb-\\udfff]",Kk="[^\\ud800-\\udfff]",Qk="(?:\\ud83c[\\udde6-\\uddff]){2}",$k="[\\ud800-\\udbff][\\udc00-\\udfff]",Zk="(?:"+Gk+"|"+Yk+")"+"?",Jk="[\\ufe0e\\ufe0f]?",Xk=Jk+Zk+("(?:\\u200d(?:"+[Kk,Qk,$k].join("|")+")"+Jk+Zk+")*"),tb="(?:"+[Kk+Gk+"?",Gk,Qk,$k,qk].join("|")+")",eb=RegExp(Yk+"(?="+Yk+")|"+tb+Xk,"g");const nb=function(t){return t.match(eb)||[]};const ob=function(t){return Uk(t)?nb(t):Wk(t)};const ib=function(t){return function(e){e=si(e);var n=Uk(e)?ob(e):void 0,o=n?n[0]:e.charAt(0),i=n?Vk(n,1).join(""):e.slice(1);return o[t]()+i}}("toUpperCase"),rb=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,sb=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,ab=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,cb=/^((\w+:(\/{2,})?)|(\W))/i,lb="Ctrl+K";function db(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function hb(t){return function(t){return t.replace(rb,"").match(sb)}(t=String(t))?t:"#"}function ub(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function gb(t,e){const n=(o=t,ab.test(o)?"mailto:":e);var o;const i=!!n&&!cb.test(t);return t&&i?n+t:t}function mb(t){window.open(t,"_blank","noopener")}class pb extends me{constructor(t){super(t),this.manualDecorators=new Mo,this.automaticDecorators=new Fk}restoreManualDecoratorStates(){for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement()||Ta(e.getSelectedBlocks());ub(n,t.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttribute(n,"linkHref")):(this.value=e.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref"));for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}execute(t,e={}){const n=this.editor.model,o=n.document.selection,i=[],r=[];for(const t in e)e[t]?i.push(t):r.push(t);n.change((e=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=np(s,"linkHref",o.getAttribute("linkHref"),n);e.setAttribute("linkHref",t,a),i.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)})),e.setSelection(e.createPositionAfter(a.end.nodeBefore))}else if(""!==t){const r=Ho(o.getAttributes());r.set("linkHref",t),i.forEach((t=>{r.set(t,!0)}));const{end:a}=n.insertContent(e.createText(t,r),s);e.setSelection(a)}["linkHref",...i,...r].forEach((t=>{e.removeSelectionAttribute(t)}))}else{const s=n.schema.getValidRanges(o.getRanges(),"linkHref"),a=[];for(const t of o.getSelectedBlocks())n.schema.checkAttribute(t,"linkHref")&&a.push(e.createRangeOn(t));const c=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&c.push(t);for(const n of c)e.setAttribute("linkHref",t,n),i.forEach((t=>{e.setAttribute(t,!0,n)})),r.forEach((t=>{e.removeAttribute(t,n)}))}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,o=n.getSelectedElement();return ub(o,e.schema)?o.getAttribute(t):n.getAttribute(t)}_isRangeToUpdate(t,e){for(const n of e)if(n.containsRange(t))return!1;return!0}}class fb extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();ub(n,t.schema)?this.isEnabled=t.schema.checkAttribute(n,"linkHref"):this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref")}execute(){const t=this.editor,e=this.editor.model,n=e.document.selection,o=t.commands.get("link");e.change((t=>{const i=n.isCollapsed?[np(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),e)]:e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of i)if(t.removeAttribute("linkHref",e),o)for(const n of o.manualDecorators)t.removeAttribute(n.id,e)}))}}class kb{constructor({id:t,label:e,attributes:n,classes:o,styles:i,defaultValue:r}){this.id=t,this.set("value"),this.defaultValue=r,this.label=e,this.attributes=n,this.classes=o,this.styles=i}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}he(kb,re);var bb=n(9773),wb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(bb.Z,wb);bb.Z.locals;const _b="automatic",Ab=/^(https?:)?\/\//;class Cb extends ue{static get pluginName(){return"LinkEditing"}static get requires(){return[Vm,Om,Ag]}constructor(t){super(t),t.config.define("link",{addTargetToExternalLinks:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:db}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,e)=>db(hb(t),e)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new pb(t)),t.commands.add("unlink",new fb(t));const e=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>(t.label&&n[t.label]&&(t.label=n[t.label]),t))),e}(t.t,function(t){const e=[];if(t)for(const[n,o]of Object.entries(t)){const t=Object.assign({},o,{id:`link${ib(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(e.filter((t=>t.mode===_b))),this._enableManualDecorators(e.filter((t=>"manual"===t.mode)));t.plugins.get(Vm).registerAttribute("linkHref"),function(t,e,n,o){const i=t.editing.view,r=new Set;i.document.registerPostFixer((i=>{const s=t.model.document.selection;let a=!1;if(s.hasAttribute(e)){const c=np(s.getFirstPosition(),e,s.getAttribute(e),t.model),l=t.editing.mapper.toViewRange(c);for(const t of l.getItems())t.is("element",n)&&!t.hasClass(o)&&(i.addClass(o,t),r.add(t),a=!0)}return a})),t.conversion.for("editingDowncast").add((t=>{function e(){i.change((t=>{for(const e of r.values())t.removeClass(o,e),r.delete(e)}))}t.on("insert",e,{priority:"highest"}),t.on("remove",e,{priority:"highest"}),t.on("attribute",e,{priority:"highest"}),t.on("selection",e,{priority:"highest"})}))}(t,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:_b,callback:t=>Ab.test(t),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(t),n.length&&e.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(t){if(!t.length)return;const e=this.editor,n=e.commands.get("link").manualDecorators;t.forEach((t=>{e.model.schema.extend("$text",{allowAttributes:t.id}),t=new kb(t),n.add(t),e.conversion.for("downcast").attributeToElement({model:t.id,view:(e,{writer:n,schema:o},{item:i})=>{if(o.isInline(i)&&e){const e=n.createAttributeElement("a",t.attributes,{priority:5});t.classes&&n.addClass(t.classes,e);for(const o in t.styles)n.setStyle(o,t.styles[o],e);return n.setCustomProperty("link",!0,e),e}}}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",...t._createPattern()},model:{key:t.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document,n=t.model.document;this.listenTo(e,"click",((t,e)=>{if(!(sr.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const o=n.getAttribute("href");o&&(t.stop(),e.preventDefault(),mb(o))}),{context:"$capture"}),this.listenTo(e,"enter",((t,e)=>{const o=n.selection,i=o.getSelectedElement(),r=i?i.getAttribute("linkHref"):o.getAttribute("linkHref");r&&e.domEvent.altKey&&(t.stop(),mb(r))}),{context:"a"})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(t,"insertContent",(()=>{const n=e.anchor.nodeBefore,o=e.anchor.nodeAfter;e.hasAttribute("linkHref")&&n&&n.hasAttribute("linkHref")&&(o&&o.hasAttribute("linkHref")||t.change((e=>{vb(e,xb(t.schema))})))}),{priority:"low"})}_enableClickingAfterLink(){const t=this.editor,e=t.model;t.editing.view.addObserver(ug);let n=!1;this.listenTo(t.editing.view.document,"mousedown",(()=>{n=!0})),this.listenTo(t.editing.view.document,"selectionChange",(()=>{if(!n)return;n=!1;const t=e.document.selection;if(!t.isCollapsed)return;if(!t.hasAttribute("linkHref"))return;const o=t.getFirstPosition(),i=np(o,"linkHref",t.getAttribute("linkHref"),e);(o.isTouching(i.start)||o.isTouching(i.end))&&e.change((t=>{vb(t,xb(e.schema))}))}))}_enableTypingOverLink(){const t=this.editor,e=t.editing.view;let n,o;this.listenTo(e.document,"delete",(()=>{o=!0}),{priority:"high"}),this.listenTo(t.model,"deleteContent",(()=>{const e=t.model.document.selection;e.isCollapsed||(o?o=!1:yb(t)&&function(t){const e=t.document.selection,n=e.getFirstPosition(),o=e.getLastPosition(),i=n.nodeAfter;if(!i)return!1;if(!i.is("$text"))return!1;if(!i.hasAttribute("linkHref"))return!1;const r=o.textNode||o.nodeBefore;if(i===r)return!0;return np(n,"linkHref",i.getAttribute("linkHref"),t).containsRange(t.createRange(n,o),!0)}(t.model)&&(n=e.getAttributes()))}),{priority:"high"}),this.listenTo(t.model,"insertContent",((e,[i])=>{o=!1,yb(t)&&n&&(t.model.change((t=>{for(const[e,o]of n)t.setAttribute(e,o,i)})),n=null)}),{priority:"high"})}_handleDeleteContentAfterLink(){const t=this.editor,e=t.model,n=e.document.selection,o=t.editing.view;let i=!1,r=!1;this.listenTo(o.document,"delete",((t,e)=>{r=e.domEvent.keyCode===dr.backspace}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{i=!1;const t=n.getFirstPosition(),o=n.getAttribute("linkHref");if(!o)return;const r=np(t,"linkHref",o,e);i=r.containsPosition(t)||r.end.isEqual(t)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{r&&(r=!1,i||t.model.enqueueChange((t=>{vb(t,xb(e.schema))})))}),{priority:"low"})}}function vb(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}function yb(t){return t.model.change((t=>t.batch)).isTyping}function xb(t){return t.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))}var Eb=n(7754),Db={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Eb.Z,Db);Eb.Z.locals;class Mb extends jd{constructor(t,e){super(t);const n=t.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Nd.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),Nd.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusables=new Ld,this._focusCycler=new Ph({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children}),zd(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),Pd({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].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()}_createUrlInput(){const t=this.locale.t,e=new _u(this.locale,Au);return e.label=t("Link URL"),e}_createButton(t,e,n,o){const i=new fh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createManualDecoratorSwitches(t){const e=this.createCollection();for(const n of t.manualDecorators){const o=new wh(this.locale);o.set({name:n.id,label:n.label,withText:!0}),o.bind("isOn").toMany([n,t],"value",((t,e)=>void 0===e&&void 0===t?n.defaultValue:t)),o.on("execute",(()=>{n.set("value",!o.isOn)})),e.add(o)}return e}_createFormChildren(t){const e=this.createCollection();if(e.add(this.urlInputView),t.length){const t=new jd;t.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((t=>({tag:"li",children:[t],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),e.add(t)}return e.add(this.saveButtonView),e.add(this.cancelButtonView),e}}var Ib=n(2347),Sb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Ib.Z,Sb);Ib.Z.locals;class Tb extends jd{constructor(t){super(t);const e=t.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(e("Unlink"),'',"unlink"),this.editButtonView=this._createButton(e("Edit link"),Nd.pencil,"edit"),this.set("href"),this._focusables=new Ld,this._focusCycler=new Ph({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].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()}_createButton(t,e,n){const o=new fh(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.delegate("execute").to(this,n),o}_createPreviewButton(){const t=new fh(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("Open link in new tab")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&hb(t))),target:"_blank",rel:"noopener noreferrer"}}),t.bind("label").to(this,"href",(t=>t||n("This link has no URL"))),t.bind("isEnabled").to(this,"href",(t=>!!t)),t.template.tag="a",t.template.eventListeners={},t}}const Nb="link-ui";class Bb extends ue{static get requires(){return[Ou]}static get pluginName(){return"LinkUI"}init(){const t=this.editor;t.editing.view.addObserver(hg),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=t.plugins.get(Ou),this._createToolbarLinkButton(),this._enableUserBalloonInteractions(),t.conversion.for("editingDowncast").markerToHighlight({model:Nb,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:Nb,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const t=this.editor,e=new Tb(t.locale),n=t.commands.get("link"),o=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(o),this.listenTo(e,"edit",(()=>{this._addFormView()})),this.listenTo(e,"unlink",(()=>{t.execute("unlink"),this._hideUI()})),e.keystrokes.set("Esc",((t,e)=>{this._hideUI(),e()})),e.keystrokes.set(lb,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),o=new Mb(t.locale,e);return o.urlInputView.fieldView.bind("value").to(e,"value"),o.urlInputView.bind("isReadOnly").to(e,"isEnabled",(t=>!t)),o.saveButtonView.bind("isEnabled").to(e),this.listenTo(o,"submit",(()=>{const{value:e}=o.urlInputView.fieldView.element,i=gb(e,n);t.execute("link",i,o.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(o,"cancel",(()=>{this._closeFormView()})),o.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),o}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link"),n=t.t;t.keystrokes.set(lb,((t,n)=>{n(),e.isEnabled&&this._showUI(!0)})),t.ui.componentFactory.add("link",(t=>{const o=new fh(t);return o.isEnabled=!0,o.label=n("Link"),o.icon='',o.keystroke=lb,o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(e,"isEnabled"),o.bind("isOn").to(e,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}))}_enableUserBalloonInteractions(){const t=this.editor.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),this.editor.keystrokes.set("Tab",((t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((t,e)=>{this._isUIVisible&&(this._hideUI(),e())})),Bd({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=t.value||""}_closeFormView(){const t=this.editor.commands.get("link");t.restoreManualDecoratorStates(),void 0!==t.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(t=!1){this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),o=r();const i=()=>{const t=this._getSelectedLinkElement(),e=r();n&&!t||!n&&e!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=t,o=e};function r(){return e.selection.focus.getAncestors().reverse().find((t=>t.is("element")))}this.listenTo(t.ui,"update",i),this.listenTo(this._balloon,"change:visibleView",i)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const t=this.editor.editing.view,e=this.editor.model,n=t.document;let o=null;if(e.markers.has(Nb)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(Nb)),n=t.createRange(t.createPositionBefore(e[0]),t.createPositionAfter(e[e.length-1]));o=t.domConverter.viewRangeToDom(n)}else o=()=>{const e=this._getSelectedLinkElement();return e?t.domConverter.mapViewToDom(e):t.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:o}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection,n=e.getSelectedElement();if(e.isCollapsed||n&&Fg(n))return zb(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),o=zb(n.start),i=zb(n.end);return o&&o==i&&t.createRangeIn(o).getTrimmed().isEqual(n)?o:null}}_showFakeVisualSelection(){const t=this.editor.model;t.change((e=>{const n=t.document.selection.getFirstRange();if(t.markers.has(Nb))e.updateMarker(Nb,{range:n});else if(n.start.isAtEnd){const o=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(Nb,{usingOperation:!1,affectsData:!1,range:e.createRange(o,n.end)})}else e.addMarker(Nb,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(Nb)&&t.change((t=>{t.removeMarker(Nb)}))}}function zb(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))}const Pb=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})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class Lb extends ue{static get requires(){return[Bg]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",(()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const t=this.editor,e=new Fm(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=Ob(t.substr(0,t.length-1));return e?{url:e}:void 0}));e.on("matched:data",((e,n)=>{const{batch:o,range:i,url:r}=n;if(!o.isTyping)return;const s=i.end.getShiftedBy(-1),a=s.getShiftedBy(-r.length),c=t.model.createRange(a,s);this._applyAutoLink(r,c)})),e.bind("isEnabled").to(this)}_enableEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("enter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition();if(!t.parent.previousSibling)return;const n=e.createRangeIn(t.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("shiftEnter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition(),n=e.createRange(e.createPositionAt(t.parent,0),t.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(t){const e=this.editor.model,{text:n,range:o}=jm(t,e),i=Ob(n);if(i){const t=e.createRange(o.end.getShiftedBy(-i.length),o.end);this._applyAutoLink(i,t)}}_applyAutoLink(t,e){const n=this.editor.model,o=this.editor.plugins.get("Delete");this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&n.enqueueChange((i=>{const r=this.editor.config.get("link.defaultProtocol"),s=gb(t,r);i.setAttribute("linkHref",s,e),n.enqueueChange((()=>{o.requestUndoOnBackspace()}))}))}}function Ob(t){const e=Pb.exec(t);return e?e[2]:null}class Rb extends me{constructor(t,e){super(t),this.type=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,o=Array.from(n.selection.getSelectedBlocks()).filter((t=>Fb(t,e.schema))),i=void 0!==t.forceValue?!t.forceValue:this.value;e.change((t=>{if(i){let e=o[o.length-1].nextSibling,n=Number.POSITIVE_INFINITY,i=[];for(;e&&"listItem"==e.name&&0!==e.getAttribute("listIndent");){const t=e.getAttribute("listIndent");t=n;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&t[e?"unshift":"push"](i),i=i[e?"previousSibling":"nextSibling"]}}function Fb(t,e){return e.checkChild(t.parent,"listItem")&&!e.isObject(t)}class Vb extends me{constructor(t,e){super(t),this._indentBy="forward"==e?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=t.document;let n=Array.from(e.selection.getSelectedBlocks());t.change((t=>{const e=n[n.length-1];let o=e.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>e.getAttribute("listIndent");)n.push(o),o=o.nextSibling;this._indentBy<0&&(n=n.reverse());for(const e of n){const n=e.getAttribute("listIndent")+this._indentBy;n<0?t.rename(e,"paragraph"):t.setAttribute("listIndent",n,e)}this.fire("_executeCleanup",n)}))}_checkEnabled(){const t=Ta(this.editor.model.document.selection.getSelectedBlocks());if(!t||!t.is("element","listItem"))return!1;if(this._indentBy>0){const e=t.getAttribute("listIndent"),n=t.getAttribute("listType");let o=t.previousSibling;for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=e;){if(o.getAttribute("listIndent")==e)return o.getAttribute("listType")==n;o=o.previousSibling}return!1}return!0}}function Hb(t,e){const n=e.mapper,o=e.writer,i="numbered"==t.getAttribute("listType")?"ol":"ul",r=function(t){const e=t.createContainerElement("li");return e.getFillerOffset=Kb,e}(o),s=o.createContainerElement(i,null);return o.insert(o.createPositionAt(s,0),r),n.bindElements(t,r),r}function Ub(t,e,n,o){const i=e.parent,r=n.mapper,s=n.writer;let a=r.toViewPosition(o.createPositionBefore(t));const c=Gb(t.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:t.getAttribute("listIndent")}),l=t.previousSibling;if(c&&c.getAttribute("listIndent")==t.getAttribute("listIndent")){const t=r.toViewElement(c);a=s.breakContainer(s.createPositionAfter(t))}else if(l&&"listItem"==l.name){a=r.toViewPosition(o.createPositionAt(l,"end"));const t=r.findMappedViewAncestor(a),e=function(t){for(const e of t.getChildren())if("ul"==e.name||"ol"==e.name)return e;return null}(t);a=e?s.createPositionBefore(e):s.createPositionAt(t,"end")}else a=r.toViewPosition(o.createPositionBefore(t));if(a=qb(a),s.insert(a,i),l&&"listItem"==l.name){const t=r.toViewElement(l),n=s.createRange(s.createPositionAt(t,0),a).getWalker({ignoreElementEnd:!0});for(const t of n)if(t.item.is("element","li")){const o=s.breakContainer(s.createPositionBefore(t.item)),i=t.item.parent,r=s.createPositionAt(e,"end");Wb(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(i),r),n.position=o}}else{const n=i.nextSibling;if(n&&(n.is("element","ul")||n.is("element","ol"))){let o=null;for(const e of n.getChildren()){const n=r.toModelElement(e);if(!(n&&n.getAttribute("listIndent")>t.getAttribute("listIndent")))break;o=e}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(e,"end")))}}Wb(s,i,i.nextSibling),Wb(s,i.previousSibling,i)}function Wb(t,e,n){return!e||!n||"ul"!=e.name&&"ol"!=e.name||e.name!=n.name||e.getAttribute("class")!==n.getAttribute("class")?null:t.mergeContainers(t.createPositionAfter(e))}function qb(t){return t.getLastMatchingPosition((t=>t.item.is("uiElement")))}function Gb(t,e){const n=!!e.sameIndent,o=!!e.smallerIndent,i=e.listIndent;let r=t;for(;r&&"listItem"==r.name;){const t=r.getAttribute("listIndent");if(n&&i==t||o&&i>t)return r;r="forward"===e.direction?r.nextSibling:r.previousSibling}return null}function Yb(t,e,n,o){t.ui.componentFactory.add(e,(i=>{const r=t.commands.get(e),s=new fh(i);return s.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),s}))}function Kb(){const t=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||t?0:Bi.call(this)}function Qb(t){return(e,n,o)=>{const i=o.consumable;if(!i.test(n.item,"insert")||!i.test(n.item,"attribute:listType")||!i.test(n.item,"attribute:listIndent"))return;i.consume(n.item,"insert"),i.consume(n.item,"attribute:listType"),i.consume(n.item,"attribute:listIndent");const r=n.item;Ub(r,Hb(r,o),o,t)}}function $b(t,e,n){if(!n.consumable.test(e.item,t.name))return;const o=n.mapper.toViewElement(e.item),i=n.writer;i.breakContainer(i.createPositionBefore(o)),i.breakContainer(i.createPositionAfter(o));const r=o.parent,s="numbered"==e.attributeNewValue?"ol":"ul";i.rename(s,r)}function Zb(t,e,n){n.consumable.consume(e.item,t.name);const o=n.mapper.toViewElement(e.item).parent,i=n.writer;Wb(i,o,o.nextSibling),Wb(i,o.previousSibling,o)}function Jb(t,e,n){if(n.consumable.test(e.item,t.name)&&"listItem"!=e.item.name){let t=n.mapper.toViewPosition(e.range.start);const o=n.writer,i=[];for(;("ul"==t.parent.name||"ol"==t.parent.name)&&(t=o.breakContainer(t),"li"==t.parent.name);){const e=t,n=o.createPositionAt(t.parent,"end");if(!e.isEqual(n)){const t=o.remove(o.createRange(e,n));i.push(t)}t=o.createPositionAfter(t.parent)}if(i.length>0){for(let e=0;e0){const e=Wb(o,n,n.nextSibling);e&&e.parent==n&&t.offset--}}Wb(o,t.nodeBefore,t.nodeAfter)}}}function Xb(t,e,n){const o=n.mapper.toViewPosition(e.position),i=o.nodeBefore,r=o.nodeAfter;Wb(n.writer,i,r)}function tw(t,e,n){if(n.consumable.consume(e.viewItem,{name:!0})){const t=n.writer,o=t.createElement("listItem"),i=function(t){let e=0,n=t.parent;for(;n;){if(n.is("element","li"))e++;else{const t=n.previousSibling;t&&t.is("element","li")&&e++}n=n.parent}return e}(e.viewItem);t.setAttribute("listIndent",i,o);const r=e.viewItem.parent&&"ol"==e.viewItem.parent.name?"numbered":"bulleted";if(t.setAttribute("listType",r,o),!n.safeInsert(o,e.modelCursor))return;const s=function(t,e,n){const{writer:o,schema:i}=n;let r=o.createPositionAfter(t);for(const s of e)if("ul"==s.name||"ol"==s.name)r=n.convertItem(s,r).modelCursor;else{const e=n.convertItem(s,o.createPositionAt(t,"end")),a=e.modelRange.start.nodeAfter;a&&a.is("element")&&!i.checkChild(t,a.name)&&(t=e.modelCursor.parent.is("element","listItem")?e.modelCursor.parent:rw(e.modelCursor),r=o.createPositionAfter(t))}return r}(o,e.viewItem.getChildren(),n);e.modelRange=t.createRange(e.modelCursor,s),n.updateConversionResult(o,e)}}function ew(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){const t=Array.from(e.viewItem.getChildren());for(const e of t){!(e.is("element","li")||aw(e))&&e._remove()}}}function nw(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){if(0===e.viewItem.childCount)return;const t=[...e.viewItem.getChildren()];let n=!1;for(const e of t)n&&!aw(e)&&e._remove(),aw(e)&&(n=!0)}}function ow(t){return(e,n)=>{if(n.isPhantom)return;const o=n.modelPosition.nodeBefore;if(o&&o.is("element","listItem")){const e=n.mapper.toViewElement(o),i=e.getAncestors().find(aw),r=t.createPositionAt(e,0).getWalker();for(const t of r){if("elementStart"==t.type&&t.item.is("element","li")){n.viewPosition=t.previousPosition;break}if("elementEnd"==t.type&&t.item==i){n.viewPosition=t.nextPosition;break}}}}}function iw(t,[e,n]){let o,i=e.is("documentFragment")?e.getChild(0):e;if(o=n?this.createSelection(n):this.document.selection,i&&i.is("element","listItem")){const t=o.getFirstPosition();let e=null;if(t.parent.is("element","listItem")?e=t.parent:t.nodeBefore&&t.nodeBefore.is("element","listItem")&&(e=t.nodeBefore),e){const t=e.getAttribute("listIndent");if(t>0)for(;i&&i.is("element","listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+t),i=i.nextSibling}}}function rw(t){const e=new Ha({startPosition:t});let n;do{n=e.next()}while(!n.value.item.is("element","listItem"));return n.value.item}function sw(t,e,n,o,i,r){const s=Gb(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:t,foo:"b"}),a=i.mapper,c=i.writer,l=s?s.getAttribute("listIndent"):null;let d;if(s)if(l==t){const t=a.toViewElement(s).parent;d=c.createPositionAfter(t)}else{const t=r.createPositionAt(s,"end");d=a.toViewPosition(t)}else d=n;d=qb(d);for(const t of[...o.getChildren()])aw(t)&&(d=c.move(c.createRangeOn(t),d).end,Wb(c,t,t.nextSibling),Wb(c,t.previousSibling,t))}function aw(t){return t.is("element","ol")||t.is("element","ul")}class cw extends ue{static get pluginName(){return"ListEditing"}static get requires(){return[Eg,Bg]}init(){const t=this.editor;t.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const e=t.data,n=t.editing;var o;t.model.document.registerPostFixer((e=>function(t,e){const n=t.document.differ.getChanges(),o=new Map;let i=!1;for(const o of n)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const n=o.position.nodeAfter;n.hasAttribute("listIndent")&&(e.removeAttribute("listIndent",n),i=!0),n.hasAttribute("listType")&&(e.removeAttribute("listType",n),i=!0),n.hasAttribute("listStyle")&&(e.removeAttribute("listStyle",n),i=!0),n.hasAttribute("listReversed")&&(e.removeAttribute("listReversed",n),i=!0),n.hasAttribute("listStart")&&(e.removeAttribute("listStart",n),i=!0);for(const e of Array.from(t.createRangeIn(n)).filter((t=>t.item.is("element","listItem"))))r(e.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const t of o.values())s(t),a(t);return i;function r(t){const e=t.nodeBefore;if(e&&e.is("element","listItem")){let t=e;if(o.has(t))return;for(let e=t.previousSibling;e&&e.is("element","listItem");e=t.previousSibling)if(t=e,o.has(t))return;o.set(e,t)}else{const e=t.nodeAfter;e&&e.is("element","listItem")&&o.set(e,e)}}function s(t){let n=0,o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(r>n){let s;null===o?(o=r-n,s=n):(o>r&&(o=r),s=r-o),e.setAttribute("listIndent",s,t),i=!0}else o=null,n=t.getAttribute("listIndent")+1;t=t.nextSibling}}function a(t){let n=[],o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(n=n.slice(0,r+1)),0!=r)if(n[r]){const o=n[r];t.getAttribute("listType")!=o&&(e.setAttribute("listType",o,t),i=!0)}else n[r]=t.getAttribute("listType");o=t,t=t.nextSibling}}}(t.model,e))),n.mapper.registerViewToModelLength("li",lw),e.mapper.registerViewToModelLength("li",lw),n.mapper.on("modelToViewPosition",ow(n.view)),n.mapper.on("viewToModelPosition",(o=t.model,(t,e)=>{const n=e.viewPosition,i=n.parent,r=e.mapper;if("ul"==i.name||"ol"==i.name){if(n.isAtEnd){const t=r.toModelElement(n.nodeBefore),i=r.getModelLength(n.nodeBefore);e.modelPosition=o.createPositionBefore(t).getShiftedBy(i)}else{const t=r.toModelElement(n.nodeAfter);e.modelPosition=o.createPositionBefore(t)}t.stop()}else if("li"==i.name&&n.nodeBefore&&("ul"==n.nodeBefore.name||"ol"==n.nodeBefore.name)){const s=r.toModelElement(i);let a=1,c=n.nodeBefore;for(;c&&aw(c);)a+=r.getModelLength(c),c=c.previousSibling;e.modelPosition=o.createPositionBefore(s).getShiftedBy(a),t.stop()}})),e.mapper.on("modelToViewPosition",ow(n.view)),t.conversion.for("editingDowncast").add((e=>{e.on("insert",Jb,{priority:"high"}),e.on("insert:listItem",Qb(t.model)),e.on("attribute:listType:listItem",$b,{priority:"high"}),e.on("attribute:listType:listItem",Zb,{priority:"low"}),e.on("attribute:listIndent:listItem",function(t){return(e,n,o)=>{if(!o.consumable.consume(n.item,"attribute:listIndent"))return;const i=o.mapper.toViewElement(n.item),r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s);r.remove(c),a&&a.nextSibling&&Wb(r,a,a.nextSibling),sw(n.attributeOldValue+1,n.range.start,c.start,i,o,t),Ub(n.item,i,o,t);for(const t of n.item.getChildren())o.consumable.consume(t,"insert")}}(t.model)),e.on("remove:listItem",function(t){return(e,n,o)=>{const i=o.mapper.toViewPosition(n.position).getLastMatchingPosition((t=>!t.item.is("element","li"))).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s),l=r.remove(c);a&&a.nextSibling&&Wb(r,a,a.nextSibling),sw(o.mapper.toModelElement(i).getAttribute("listIndent")+1,n.position,c.start,i,o,t);for(const t of r.createRangeIn(l).getItems())o.mapper.unbindViewElement(t);e.stop()}}(t.model)),e.on("remove",Xb,{priority:"low"})})),t.conversion.for("dataDowncast").add((e=>{e.on("insert",Jb,{priority:"high"}),e.on("insert:listItem",Qb(t.model))})),t.conversion.for("upcast").add((t=>{t.on("element:ul",ew,{priority:"high"}),t.on("element:ol",ew,{priority:"high"}),t.on("element:li",nw,{priority:"high"}),t.on("element:li",tw)})),t.model.on("insertContent",iw,{priority:"high"}),t.commands.add("numberedList",new Rb(t,"numbered")),t.commands.add("bulletedList",new Rb(t,"bulleted")),t.commands.add("indentList",new Vb(t,"forward")),t.commands.add("outdentList",new Vb(t,"backward"));const i=n.view.document;this.listenTo(i,"enter",((t,e)=>{const n=this.editor.model.document,o=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(i,"delete",((t,e)=>{if("backward"!==e.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const o=n.getFirstPosition();if(!o.isAtStart)return;const i=o.parent;if("listItem"!==i.name)return;i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(t.editing.view.document,"tab",((e,n)=>{const o=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(o).isEnabled&&(t.execute(o),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"li"})}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList")),n&&n.registerChildCommand(t.get("outdentList"))}}function lw(t){let e=1;for(const n of t.getChildren())if("ul"==n.name||"ol"==n.name)for(const t of n.getChildren())e+=lw(t);return e}class dw extends ue{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;Yb(this.editor,"numberedList",t("Numbered List"),''),Yb(this.editor,"bulletedList",t("Bulleted List"),'')}}function hw(t,e){return t=>{t.on("attribute:url:media",n)};function n(n,o,i){if(!i.consumable.consume(o.item,n.name))return;const r=o.attributeNewValue,s=i.writer,a=i.mapper.toViewElement(o.item),c=[...a.getChildren()].find((t=>t.getCustomProperty("media-content")));s.remove(c);const l=t.getMediaViewElement(s,r,e);s.insert(s.createPositionAt(a,0),l)}}function uw(t,e,n,o){return t.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(t,n,o),t.createSlot()])}function gw(t){const e=t.getSelectedElement();return e&&e.is("element","media")?e:null}function mw(t,e,n,o){t.change((i=>{const r=i.createElement("media",{url:e});t.insertObject(r,n,null,{setSelection:"on",findOptimalPosition:o})}))}class pw extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=gw(e);this.value=n?n.getAttribute("url"):null,this.isEnabled=function(t){const e=t.getSelectedElement();return!!e&&"media"===e.name}(e)||function(t,e){let n=Yg(t,e).start.parent;n.isEmpty&&!e.schema.isLimit(n)&&(n=n.parent);return e.schema.checkChild(n,"media")}(e,t)}execute(t){const e=this.editor.model,n=e.document.selection,o=gw(n);o?e.change((e=>{e.setAttribute("url",t,o)})):mw(e,t,n,!0)}}class fw{constructor(t,e){const n=e.providers,o=e.extraProviders||[],i=new Set(e.removeProviders),r=n.concat(o).filter((t=>{const e=t.name;return e?!i.has(e):(l("media-embed-no-provider-name",{provider:t}),!1)}));this.locale=t,this.providerDefinitions=r}hasMedia(t){return!!this._getMedia(t)}getMediaViewElement(t,e,n){return this._getMedia(e).getViewElement(t,n)}_getMedia(t){if(!t)return new kw(this.locale);t=t.trim();for(const e of this.providerDefinitions){const n=e.html,o=So(e.url);for(const e of o){const o=this._getUrlMatches(t,e);if(o)return new kw(this.locale,t,o,n)}}return null}_getUrlMatches(t,e){let n=t.match(e);if(n)return n;let o=t.replace(/^https?:\/\//,"");return n=o.match(e),n||(o=o.replace(/^www\./,""),n=o.match(e),n||null)}}class kw{constructor(t,e,n,o){this.url=this._getValidUrl(e),this._t=t.t,this._match=n,this._previewRenderer=o}getViewElement(t,e){const n={};let o;if(e.renderForEditingView||e.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),e.renderForEditingView&&(n.class="ck-media__wrapper");const i=this._getPreviewHtml(e);o=t.createRawElement("div",n,((t,e)=>{e.setContentOf(t,i)}))}else this.url&&(n.url=this.url),o=t.createEmptyElement(e.elementName,n);return t.setCustomProperty("media-content",!0,o),o}_getPreviewHtml(t){return this._previewRenderer?this._previewRenderer(this._match):this.url&&t.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const t=new gh,e=new dh;t.text=this._t("Open media in new tab"),e.content='',e.viewBox="0 0 64 42";return new Fd({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]},t]}]}).render().outerHTML}_getValidUrl(t){return t?t.match(/^https?/)?t:"https://"+t:null}}var bw=n(7442),ww={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(bw.Z,ww);bw.Z.locals;class _w extends ue{static get pluginName(){return"MediaEmbedEditing"}constructor(t){super(t),t.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>`
`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`
`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:t=>`
`},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`
`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new fw(t.locale,t.config.get("mediaEmbed"))}init(){const t=this.editor,e=t.model.schema,n=t.t,o=t.conversion,i=t.config.get("mediaEmbed.previewsInData"),r=t.config.get("mediaEmbed.elementName"),s=this.registry;t.commands.add("mediaEmbed",new pw(t)),e.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),o.for("dataDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const n=t.getAttribute("url");return uw(e,s,n,{elementName:r,renderMediaPreview:n&&i})}}),o.for("dataDowncast").add(hw(s,{elementName:r,renderMediaPreview:i})),o.for("editingDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const o=t.getAttribute("url");return function(t,e,n){return e.setCustomProperty("media",!0,t),Vg(t,e,{label:n})}(uw(e,s,o,{elementName:r,renderForEditingView:!0}),e,n("media widget"))}}),o.for("editingDowncast").add(hw(s,{elementName:r,renderForEditingView:!0})),o.for("upcast").elementToElement({view:t=>["oembed",r].includes(t.name)&&t.getAttribute("url")?{name:!0}:null,model:(t,{writer:e})=>{const n=t.getAttribute("url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(t,{writer:e})=>{const n=t.getAttribute("data-oembed-url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).add((t=>{t.on("element:figure",(function(t,e,n){if(!n.consumable.consume(e.viewItem,{name:!0,classes:"media"}))return;const{modelRange:o,modelCursor:i}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=o,e.modelCursor=i;Ta(o.getItems())||n.consumable.revert(e.viewItem,{name:!0,classes:"media"})}))}))}}const Aw=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class Cw extends ue{static get requires(){return[Cm,Bg,gp]}static get pluginName(){return"AutoMediaEmbed"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document;this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=Xl.fromPosition(t.start);n.stickiness="toPrevious";const o=Xl.fromPosition(t.end);o.stickiness="toNext",e.once("change:data",(()=>{this._embedMediaBetweenPositions(n,o),n.detach(),o.detach()}),{priority:"high"})})),t.commands.get("undo").on("execute",(()=>{this._timeoutId&&(is.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedMediaBetweenPositions(t,e){const n=this.editor,o=n.plugins.get(_w).registry,i=new sc(t,e),r=i.getWalker({ignoreElementEnd:!0});let s="";for(const t of r)t.item.is("$textProxy")&&(s+=t.item.data);if(s=s.trim(),!s.match(Aw))return void i.detach();if(!o.hasMedia(s))return void i.detach();n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Xl.fromPosition(t),this._timeoutId=is.window.setTimeout((()=>{n.model.change((t=>{let e;this._timeoutId=null,t.remove(i),i.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert),mw(n.model,s,e,!1),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get("Delete").requestUndoOnBackspace()}),100)):i.detach()}}var vw=n(9292),yw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(vw.Z,yw);vw.Z.locals;class xw extends jd{constructor(t,e){super(e);const n=e.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Nd.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",(t=>!!t)),this.cancelButtonView=this._createButton(n("Cancel"),Nd.cancel,"ck-button-cancel","cancel"),this._focusables=new Ld,this._focusCycler=new Ph({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=t,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]}),zd(this)}render(){super.render(),Pd({view:this});[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t),this.listenTo(this.urlInputView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(t){this.urlInputView.fieldView.element.value=t.trim()}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.urlInputView.errorText=e,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const t=this.locale.t,e=new _u(this.locale,Au),n=e.fieldView;return this._urlInputViewInfoDefault=t("Paste the media URL in the input."),this._urlInputViewInfoTip=t("Tip: Paste the URL into the content to embed faster."),e.label=t("Media URL"),e.infoText=this._urlInputViewInfoDefault,n.on("input",(()=>{e.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()})),e}_createButton(t,e,n,o){const i=new fh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}}class Ew extends ue{static get requires(){return[_w]}static get pluginName(){return"MediaEmbedUI"}init(){const t=this.editor,e=t.commands.get("mediaEmbed"),n=t.plugins.get(_w).registry;t.ui.componentFactory.add("mediaEmbed",(o=>{const i=eu(o),r=new xw(function(t,e){return[e=>{if(!e.url.length)return t("The URL must not be empty.")},n=>{if(!e.hasMedia(n.url))return t("This media URL is not supported.")}]}(t.t,n),t.locale);return this._setUpDropdown(i,r,e,t),this._setUpForm(i,r,e),i}))}_setUpDropdown(t,e,n){const o=this.editor,i=o.t,r=t.buttonView;function s(){o.editing.view.focus(),t.isOpen=!1}t.bind("isEnabled").to(n),t.panelView.children.add(e),r.set({label:i("Insert media"),icon:'',tooltip:!0}),r.on("open",(()=>{e.disableCssTransitions(),e.url=n.value||"",e.urlInputView.fieldView.select(),e.focus(),e.enableCssTransitions()}),{priority:"low"}),t.on("submit",(()=>{e.isValid()&&(o.execute("mediaEmbed",e.url),s())})),t.on("change:isOpen",(()=>e.resetFormStatus())),t.on("cancel",(()=>s()))}_setUpForm(t,e,n){e.delegate("submit","cancel").to(t),e.urlInputView.bind("value").to(n,"value"),e.urlInputView.bind("isReadOnly").to(n,"isEnabled",(t=>!t))}}var Dw=n(4652),Mw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Dw.Z,Mw);Dw.Z.locals;function Iw(t,e){if(!t.childCount)return;const n=new gg(t.document),o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),i=[];for(const t of n)if("elementStart"===t.type&&o.match(t.item)){const e=Nw(t.item);i.push({element:t.item,id:e.id,order:e.order,indent:e.indent})}return i}(t,n);if(!o.length)return;let i=null,r=1;o.forEach(((t,s)=>{const a=function(t,e){if(!t)return!0;if(t.id!==e.id)return e.indent-t.indent!=1;const n=e.element.previousSibling;if(!n)return!0;return o=n,!(o.is("element","ol")||o.is("element","ul"));var o}(o[s-1],t),c=a?null:o[s-1],l=(h=t,(d=c)?h.indent-d.indent:h.indent-1);var d,h;if(a&&(i=null,r=1),!i||0!==l){const o=function(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]{0,100});/gi,i=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=n.exec(e);let s="decimal",a="ol",c=null;if(r&&r[1]){const e=o.exec(r[1]);if(e&&e[1]&&(s=e[1].trim(),a="bullet"!==s&&"image"!==s?"ol":"ul"),"bullet"===s){const e=function(t){const e=function(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);return t.is("$text")?t:t.getChild(0)}}(t);if(!e)return null;const n=e._data;if("o"===n)return"circle";if("·"===n)return"disc";if("§"===n)return"square";return null}(t.element);e&&(s=e)}else{const t=i.exec(r[1]);t&&t[1]&&(c=parseInt(t[1]))}}return{type:a,startIndex:c,style:Sw(s)}}(t,e);if(i){if(t.indent>r){const t=i.getChild(i.childCount-1),e=t.getChild(t.childCount-1);i=Tw(o,e,n),r+=1}else if(t.indent1&&n.setAttribute("start",t.startIndex,i),i}function Nw(t){const e={},n=t.getStyle("mso-list");if(n){const t=n.match(/(^|\s{1,100})l(\d+)/i),o=n.match(/\s{0,100}lfo(\d+)/i),i=n.match(/\s{0,100}level(\d+)/i);t&&o&&i&&(e.id=t[2],e.order=o[1],e.indent=i[1])}return e}const Bw=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class zw{constructor(t){this.document=t}isActive(t){return Bw.test(t)}execute(t){const e=new gg(this.document),{body:n}=t._parsedData;!function(t,e){for(const n of t.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const o=t.getChildIndex(n);e.remove(n),e.insertChild(o,n.getChildren(),t)}}(n,e),function(t,e){for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","li")){const n=t.getChild(0);n&&n.is("element","p")&&e.unwrapElement(n)}}}(n,e),t.content=n}}function Pw(t,e){if(!t.childCount)return;const n=new gg,o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n){if("elementStart"!=t.type)continue;const e=t.item,n=e.previousSibling&&e.previousSibling.name||null;o.match(e)&&e.getAttribute("o:gfxdata")&&"v:shapetype"!==n&&i.push(t.item.getAttribute("id"))}return i}(t,n);!function(t,e,n){const o=n.createRangeIn(e),i=new Uo({name:"img"}),r=[];for(const e of o)if(i.match(e.item)){const n=e.item,o=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];o.length&&o.every((e=>t.indexOf(e)>-1))?r.push(n):n.getAttribute("src")||r.push(n)}for(const t of r)n.remove(t)}(o,t,n),function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n)"elementStart"==t.type&&o.match(t.item)&&i.push(t.item);for(const t of i)e.remove(t)}(t,n);const i=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:"img"}),i=[];for(const t of n)o.match(t.item)&&t.item.getAttribute("src").startsWith("file://")&&i.push(t.item);return i}(t,n);i.length&&function(t,e,n){if(t.length===e.length)for(let o=0;oString.fromCharCode(parseInt(t,16)))).join(""))}const Ow=//i,Rw=/xmlns:o="urn:schemas-microsoft-com/i;class jw{constructor(t){this.document=t}isActive(t){return Ow.test(t)||Rw.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;Iw(e,n),Pw(e,t.dataTransfer.getData("text/rtf")),t.content=e}}function Fw(t){return t.replace(/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join("  ").substr(0,e.length)))}function Vw(t,e){const n=new DOMParser,o=function(t){return Fw(Fw(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g," <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="",n="",o=t.indexOf(e);if(o<0)return t;const i=t.indexOf(n,o+e.length);return t.substring(0,o+e.length)+(i>=0?t.substring(i):"")}(t=t.replace(//g,"")}(i.getData("text/html")):i.getData("text/plain")&&(((s=(s=i.getData("text/plain")).replace(//g,">").replace(/\r?\n\r?\n/g,"

").replace(/\r?\n/g,"
").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g,"  ")).includes("

")||s.includes("
"))&&(s=`

${s}

`),r=s),r=this.editor.data.htmlProcessor.toView(r));const a=new e(this,"inputTransformation");this.fire(a,{content:r,dataTransfer:i,targetRanges:n.targetRanges,method:n.method}),a.stop.called&&t.stop(),o.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,e)=>{if(e.content.isEmpty)return;const o=this.editor.data.toModel(e.content,"$clipboardHolder");0!=o.childCount&&(t.stop(),n.change((()=>{this.fire("contentInsertion",{content:o,method:e.method,dataTransfer:e.dataTransfer,targetRanges:e.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,e)=>{e.resultRange=n.insertContent(e.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document;function o(o,i){const r=i.dataTransfer;i.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:o.name})}this.listenTo(n,"copy",o,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.isReadOnly?n.preventDefault():o(e,n)}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",Cg(o.content))),"cut"==o.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}function*yg(t,e){for(const n of e)n&&t.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class xg extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n,o){const i=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return void(i||s!=a||t.deleteContent(n));if(i){const t=yg(e.model.schema,n.getAttributes());Dg(e,r.start),e.setSelectionAttribute(t)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd),i=s==a;t.deleteContent(n,{leaveUnmerged:o}),o&&(i?Dg(e,n.focus):e.setSelection(a,0))}}(this.editor.model,n,e.selection,t.schema),this.fire("afterExecute",{writer:n})}))}}function Dg(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}class Eg extends Cs{constructor(t){super(t);const e=this.document;e.on("keydown",((t,n)=>{if(this.isEnabled&&n.keyCode==dr.enter){const o=new qi(e,"enter",e.selection.getFirstRange());e.fire(o,new Gs(e,n.domEvent,{isSoft:n.shiftKey})),o.stop.called&&t.stop()}}))}observe(){}}class Mg extends ue{static get pluginName(){return"Enter"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(Eg),t.commands.add("enter",new xg(t)),this.listenTo(n,"enter",((n,o)=>{o.preventDefault(),o.isSoft||(t.execute("enter"),e.scrollToTheSelection())}),{priority:"low"})}}class Ig{constructor(t,e=20){this.model=t,this.size=0,this.limit=e,this.isLocked=!1,this._changeCallback=(t,e)=>{e.isLocal&&e.isUndoable&&e!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}input(t){this.size+=t,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(t){this.isLocked&&!t||(this._batch=null,this.size=0)}}class Sg extends me{constructor(t,e){super(t),this.direction=e,this._buffer=new Ig(t.model,t.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(t={}){const e=this.editor.model,n=e.document;e.enqueueChange(this._buffer.batch,(o=>{this._buffer.lock();const i=o.createSelection(t.selection||n.selection),r=t.sequence||1,s=i.isCollapsed;if(i.isCollapsed&&e.modifySelection(i,{direction:this.direction,unit:t.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(o);if(this._shouldReplaceFirstBlockWithParagraph(i,r))return void this.editor.execute("paragraph",{selection:i});if(i.isCollapsed)return;let a=0;i.getFirstRange().getMinimalFlatRanges().forEach((t=>{a+=Vi(t.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),e.deleteContent(i,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),o.setSelection(i),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(t){if(t>1)return!1;const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(o)))return!1;if(!e.schema.checkChild(o,"paragraph"))return!1;const i=o.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(t){const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n),i=t.createElement("paragraph");t.remove(t.createRangeIn(o)),t.insert(i,o),t.setSelection(i,0)}_shouldReplaceFirstBlockWithParagraph(t,e){const n=this.editor.model;if(e>1||"backward"!=this.direction)return!1;if(!t.isCollapsed)return!1;const o=t.getFirstPosition(),i=n.schema.getLimitElement(o),r=i.getChild(0);return o.parent==r&&(!!t.containsEntireContent(r)&&(!!n.schema.checkChild(i,"paragraph")&&"paragraph"!=r.name))}}function Tg(t){if(t.newChildren.length-t.oldChildren.length!=1)return;const e=function(t,e){const n=[];let o,i=0;return t.forEach((t=>{"equal"==t?(r(),i++):"insert"==t?(s("insert")?o.values.push(e[i]):(r(),o={type:"insert",index:i,values:[e[i]]}),i++):s("delete")?o.howMany++:(r(),o={type:"delete",index:i,howMany:1})})),r(),n;function r(){o&&(n.push(o),o=null)}function s(t){return o&&o.type==t}}(Gr(t.oldChildren,t.newChildren,Ng),t.newChildren);if(e.length>1)return;const n=e[0];return n.values[0]&&n.values[0].is("$text")?n:void 0}function Ng(t,e){return t&&t.is("$text")&&e&&e.is("$text")?t.data===e.data:t===e}function Bg(t,e){const n=e.selection,o=t.shiftKey&&t.keyCode===dr.delete,i=!n.isCollapsed;return o&&i}class zg extends Cs{constructor(t){super(t);const e=t.document;let n=0;function o(t,n,o){const i=new qi(e,"delete",e.selection.getFirstRange());e.fire(i,new Gs(e,n,o)),i.stop.called&&t.stop()}e.on("keyup",((t,e)=>{e.keyCode!=dr.delete&&e.keyCode!=dr.backspace||(n=0)})),e.on("keydown",((t,i)=>{if(sr.isWindows&&Bg(i,e))return;const r={};if(i.keyCode==dr.delete)r.direction="forward",r.unit="character";else{if(i.keyCode!=dr.backspace)return;r.direction="backward",r.unit="codePoint"}const s=sr.isMac?i.altKey:i.ctrlKey;r.unit=s?"word":r.unit,r.sequence=++n,o(t,i.domEvent,r)})),sr.isAndroid&&e.on("beforeinput",((e,n)=>{if("deleteContentBackward"!=n.domEvent.inputType)return;const i={unit:"codepoint",direction:"backward",sequence:1},r=n.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(i.selectionToRemove=t.domConverter.domSelectionToView(r)),o(e,n.domEvent,i)}))}observe(){}}class Pg extends ue{static get pluginName(){return"Delete"}init(){const t=this.editor,e=t.editing.view,n=e.document,o=t.model.document;e.addObserver(zg),this._undoOnBackspace=!1;const i=new Sg(t,"forward");if(t.commands.add("deleteForward",i),t.commands.add("forwardDelete",i),t.commands.add("delete",new Sg(t,"backward")),this.listenTo(n,"delete",((n,o)=>{const i={unit:o.unit,sequence:o.sequence};if(o.selectionToRemove){const e=t.model.createSelection(),n=[];for(const e of o.selectionToRemove.getRanges())n.push(t.editing.mapper.toModelRange(e));e.setTo(n),i.selection=e}t.execute("forward"==o.direction?"deleteForward":"delete",i),o.preventDefault(),e.scrollToTheSelection()}),{priority:"low"}),sr.isAndroid){let t=null;this.listenTo(n,"delete",((e,n)=>{const o=n.domTarget.ownerDocument.defaultView.getSelection();t={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}}),{priority:"lowest"}),this.listenTo(n,"keyup",((e,n)=>{if(t){const e=n.domTarget.ownerDocument.defaultView.getSelection();e.collapse(t.anchorNode,t.anchorOffset),e.extend(t.focusNode,t.focusOffset),t=null}}))}this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",((e,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._undoOnBackspace=!1,t.execute("undo"),n.preventDefault(),e.stop())}),{context:"$capture"}),this.listenTo(o,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class Lg{constructor(){this._stack=[]}add(t,e){const n=this._stack,o=n[0];this._insertDescriptor(t);const i=n[0];o===i||Og(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}remove(t,e){const n=this._stack,o=n[0];this._removeDescriptor(t);const i=n[0];o===i||Og(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(Og(t,e[n]))return;n>-1&&e.splice(n,1);let o=0;for(;e[o]&&Rg(e[o],t);)o++;e.splice(o,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function Og(t,e){return t&&e&&t.priority==e.priority&&jg(t.classes)==jg(e.classes)}function Rg(t,e){return t.priority>e.priority||!(t.priorityjg(e.classes)}function jg(t){return Array.isArray(t)?t.sort().join(","):t}he(Lg,k);const Fg='',Vg="ck-widget_selected";function Hg(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function Ug(t,e,n={}){if(!t.is("containerElement"))throw new c("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass("ck-widget",t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=$g,n.label&&function(t,e,n){n.setCustomProperty("widgetLabel",e,t)}(t,n.label,e),n.hasSelectionHandle&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(t){const e=this.toDomElement(t),n=new dh;return n.set("content",Fg),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),Wg(t,e),t}function qg(t,e,n){if(e.classes&&n.addClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.setAttribute(o,e.attributes[o],t)}function Gg(t,e,n){if(e.classes&&n.removeClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.removeAttribute(o,t)}function Wg(t,e,n=qg,o=Gg){const i=new Lg;i.on("change:top",((e,i)=>{i.oldDescriptor&&o(t,i.oldDescriptor,i.writer),i.newDescriptor&&n(t,i.newDescriptor,i.writer)})),e.setCustomProperty("addHighlight",((t,e,n)=>i.add(e,n)),t),e.setCustomProperty("removeHighlight",((t,e,n)=>i.remove(e,n)),t)}function Yg(t){const e=t.getCustomProperty("widgetLabel");return e?"function"==typeof e?e():e:""}function Kg(t,e){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",((n,o,i)=>{e.setAttribute("contenteditable",i?"false":"true",t)})),t.on("change:isFocused",((n,o,i)=>{i?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)})),Wg(t,e),t}function Qg(t,e){const n=t.getSelectedElement();if(n){const o=Xg(t);if(o)return e.createRange(e.createPositionAt(n,o))}return od(t,e)}function $g(){return null}const Zg="widget-type-around";function Jg(t,e,n){return t&&Hg(t)&&!n.isInline(e)}function Xg(t){return t.getAttribute(Zg)}const tm=[ur("arrowUp"),ur("arrowRight"),ur("arrowDown"),ur("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let t=112;t<=135;t++)tm.push(t);function em(t){return!(!t.ctrlKey&&!t.metaKey)||tm.includes(t.keyCode)}var nm=n(4921),om={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(nm.Z,om);nm.Z.locals;const im=["before","after"],rm=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,sm="ck-widget__type-around_disabled";class am extends ue{static get pluginName(){return"WidgetTypeAround"}static get requires(){return[Mg,Pg]}constructor(t){super(t),this._currentFakeCaretModelElement=null}init(){const t=this.editor,e=t.editing.view;this.on("change:isEnabled",((n,o,i)=>{e.change((t=>{for(const n of e.document.roots)i?t.removeClass(sm,n):t.addClass(sm,n)})),i||t.model.change((t=>{t.removeSelectionAttribute(Zg)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(t,e){const n=this.editor,o=n.editing.view,i=n.model.schema.getAttributesWithProperty(t,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(t,e),attributes:i}),o.focus(),o.scrollToTheSelection()}_listenToIfEnabled(t,e,n,o){this.listenTo(t,e,((...t)=>{this.isEnabled&&n(...t)}),o)}_insertParagraphAccordingToFakeCaretPosition(){const t=this.editor.model.document.selection,e=Xg(t);if(!e)return!1;const n=t.getSelectedElement();return this._insertParagraph(n,e),!0}_enableTypeAroundUIInjection(){const t=this.editor,e=t.model.schema,n=t.locale.t,o={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};t.editing.downcastDispatcher.on("insert",((t,n,i)=>{const r=i.mapper.toViewElement(n.item);Jg(r,n.item,e)&&function(t,e,n){const o=t.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(t){const n=this.toDomElement(t);return function(t,e){for(const n of im){const o=new Fd({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:e[n]},children:[t.ownerDocument.importNode(rm,!0)]});t.appendChild(o.render())}}(n,e),function(t){const e=new Fd({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});t.appendChild(e.render())}(n),n}));t.insert(t.createPositionAt(n,"end"),o)}(i.writer,o,r)}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const t=this.editor,e=t.model,n=e.document.selection,o=e.schema,i=t.editing.view;function r(t){return`ck-widget_type-around_show-fake-caret_${t}`}this._listenToIfEnabled(i.document,"arrowKey",((t,e)=>{this._handleArrowKeyPress(t,e)}),{context:[Hg,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(Zg)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();if(e){if(Jg(t.editing.mapper.toViewElement(e),e,o))return}t.model.change((t=>{t.removeSelectionAttribute(Zg)}))})),this._listenToIfEnabled(t.editing.downcastDispatcher,"selection",((t,e,n)=>{const i=n.writer;if(this._currentFakeCaretModelElement){const t=n.mapper.toViewElement(this._currentFakeCaretModelElement);t&&(i.removeClass(im.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!Jg(a,s,o))return;const c=Xg(e.selection);c&&(i.addClass(r(c),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,o)=>{o||t.model.change((t=>{t.removeSelectionAttribute(Zg)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,o=n.model,i=o.document.selection,r=o.schema,s=n.editing.view,a=function(t,e){const n=pr(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;Jg(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):i.isCollapsed?l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(l=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),l&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=Xg(e.document.selection);return e.change((e=>{if(!n)return e.setSelectionAttribute(Zg,t?"after":"before"),!0;if(!(n===(t?"after":"before")))return e.removeSelectionAttribute(Zg),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,o=n.schema,i=e.plugins.get("Widget"),r=i._getObjectElementNextToSelection(t);return!!Jg(e.editing.mapper.toViewElement(r),r,o)&&(n.change((e=>{i._setSelectionOverElement(r),e.setSelectionAttribute(Zg,t?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(t){const e=this.editor,n=e.model,o=n.schema,i=e.editing.mapper,r=n.document.selection,s=t?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!Jg(i.toViewElement(s),s,o)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(Zg,t?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const t=this.editor,e=t.editing.view;this._listenToIfEnabled(e.document,"mousedown",((n,o)=>{const i=o.domTarget.closest(".ck-widget__type-around__button");if(!i)return;const r=function(t){return t.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(i),s=function(t,e){const n=t.closest(".ck-widget");return e.mapDomToView(n)}(i,e.domConverter),a=t.editing.mapper.toModelElement(s);this._insertParagraph(a,r),o.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const t=this.editor,e=t.model.document.selection,n=t.editing.view;this._listenToIfEnabled(n.document,"enter",((n,o)=>{if("atTarget"!=n.eventPhase)return;const i=e.getSelectedElement(),r=t.editing.mapper.toViewElement(i),s=t.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Jg(r,i,s)&&(this._insertParagraph(i,o.isSoft?"before":"after"),a=!0),a&&(o.preventDefault(),n.stop())}),{context:Hg})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view,e=[dr.enter,dr.delete,dr.backspace];this._listenToIfEnabled(t.document,"keydown",((t,n)=>{e.includes(n.keyCode)||em(n)||this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const t=this.editor,e=t.editing.view,n=t.model,o=n.schema;this._listenToIfEnabled(e.document,"delete",((e,i)=>{if("atTarget"!=e.eventPhase)return;const r=Xg(n.document.selection);if(!r)return;const s=i.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)t.execute("delete",{selection:n.createSelection(a,"on")});else{const e=o.getNearestSelectionRange(n.createPositionAt(a,r),s);if(e)if(e.isCollapsed){const i=n.createSelection(e.start);if(n.modifySelection(i,{direction:s}),i.focus.isEqual(e.start)){const t=function(t,e){let n=e;for(const o of e.getAncestors({parentFirst:!0})){if(o.childCount>1||t.isLimit(o))break;n=o}return n}(o,e.start.parent);n.deleteContent(n.createSelection(t,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}i.preventDefault(),e.stop()}),{context:Hg})}_enableInsertContentIntegration(){const t=this.editor,e=this.editor.model,n=e.document.selection;this._listenToIfEnabled(t.model,"insertContent",((t,[o,i])=>{if(i&&!i.is("documentSelection"))return;const r=Xg(n);return r?(t.stop(),e.change((t=>{const i=n.getSelectedElement(),s=e.createPositionAt(i,r),a=t.createSelection(s),c=e.insertContent(o,a);return t.setSelection(a),c}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"insertObject",((t,n)=>{const[,o,,i={}]=n;if(o&&!o.is("documentSelection"))return;const r=Xg(e);r&&(i.findOptimalPosition=r,n[3]=i)}),{priority:"high"})}_enableDeleteContentIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"deleteContent",((t,[n])=>{if(n&&!n.is("documentSelection"))return;Xg(e)&&t.stop()}),{priority:"high"})}}function cm(t){const e=t.model;return(n,o)=>{const i=o.keyCode==dr.arrowup,r=o.keyCode==dr.arrowdown,s=o.shiftKey,a=e.document.selection;if(!i&&!r)return;const c=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,c))return;const l=function(t,e,n){const o=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=lm(o,t,"forward");if(!n)return null;const i=o.createRange(t,n),r=dm(o.schema,i,"backward");return r?o.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=lm(o,t,"backward");if(!n)return null;const i=o.createRange(n,t),r=dm(o.schema,i,"forward");return r?o.createRange(r,t):null}}(t,a,c);if(l){if(l.isCollapsed){if(a.isCollapsed)return;if(s)return}(l.isCollapsed||function(t,e,n){const o=t.model,i=t.view.domConverter;if(n){const t=o.createSelection(e.start);o.modifySelection(t),t.focus.isAtEnd||e.start.isEqual(t.focus)||(e=o.createRange(t.focus,e.end))}const r=t.mapper.toViewRange(e),s=i.viewRangeToDom(r),a=fa.getDomRangeRects(s);let c;for(const t of a)if(void 0!==c){if(Math.round(t.top)>=c)return!1;c=Math.max(c,Math.round(t.bottom))}else c=Math.round(t.bottom);return!0}(t,l,c))&&(e.change((t=>{const n=c?l.end:l.start;if(s){const o=e.createSelection(a.anchor);o.setFocus(n),t.setSelection(o)}else t.setSelection(n)})),n.stop(),o.preventDefault(),o.stopPropagation())}}}function lm(t,e,n){const o=t.schema,i=t.createRangeIn(e.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:t,item:s,type:a}of i.getWalker({startPosition:e,direction:n})){if(o.isLimit(s)&&!o.isInline(s))return t;if(a==r&&o.isBlock(s))return null}return null}function dm(t,e,n){const o="backward"==n?e.end:e.start;if(t.checkChild(o,"$text"))return o;for(const{nextPosition:o}of e.getWalker({direction:n}))if(t.checkChild(o,"$text"))return o;return null}var hm=n(3488),um={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(hm.Z,um);hm.Z.locals;class gm extends ue{static get pluginName(){return"Widget"}static get requires(){return[am,Pg]}init(){const t=this.editor,e=t.editing.view,n=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",((e,n,o)=>{const i=o.writer,r=n.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=t.editing.mapper.toViewElement(s);Hg(a)&&o.consumable.consume(r,"selection")&&i.setSelection(i.createRangeOn(a),{fake:!0,label:Yg(a)})})),this.editor.editing.downcastDispatcher.on("selection",((t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const o=n.writer,i=o.document.selection;let r=null;for(const t of i.getRanges())for(const e of t){const t=e.item;Hg(t)&&!mm(t,r)&&(o.addClass(Vg,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(ug),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[Hg,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",cm(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"})}_onMousedown(t,e){const n=this.editor,o=n.editing.view,i=o.document;let r=e.target;if(function(t){for(;t;){if(t.is("editableElement")&&!t.is("rootElement"))return!0;if(Hg(t))return!1;t=t.parent}return!1}(r)){if((sr.isSafari||sr.isGecko)&&e.domEvent.detail>=3){const t=n.editing.mapper,o=r.is("attributeElement")?r.findAncestor((t=>!t.is("attributeElement"))):r,i=t.toModelElement(o);e.preventDefault(),this.editor.model.change((t=>{t.setSelection(i,"in")}))}return}if(!Hg(r)&&(r=r.findAncestor(Hg),!r))return;sr.isAndroid&&e.preventDefault(),i.isFocused||o.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,o=this.editor.model,i=o.schema,r=o.document.selection,s=r.getSelectedElement(),a=pr(n,this.editor.locale.contentLanguageDirection),c="down"==a||"right"==a,l="up"==a||"down"==a;if(s&&i.isObject(s)){const n=c?r.getLastPosition():r.getFirstPosition(),s=i.getNearestSelectionRange(n,c?"forward":"backward");return void(s&&(o.change((t=>{t.setSelection(s)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed&&!e.shiftKey){const n=r.getFirstPosition(),s=r.getLastPosition(),a=n.nodeAfter,l=s.nodeBefore;return void((a&&i.isObject(a)||l&&i.isObject(l))&&(o.change((t=>{t.setSelection(c?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&i.isObject(d)){if(i.isInline(d)&&l)return;this._setSelectionOverElement(d),e.preventDefault(),t.stop()}}_preventDefaultOnArrowKeyPress(t,e){const n=this.editor.model,o=n.schema,i=n.document.selection.getSelectedElement();i&&o.isObject(i)&&(e.preventDefault(),t.stop())}_handleDelete(t){if(this.editor.isReadOnly)return;const e=this.editor.model.document.selection;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change((t=>{let o=e.anchor.parent;for(;o.isEmpty;){const e=o;o=e.parent,t.remove(e)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(t){this.editor.model.change((e=>{e.setSelection(e.createRangeOn(t))}))}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,o=e.document.selection,i=e.createSelection(o);if(e.modifySelection(i,{direction:t?"forward":"backward"}),i.isEqual(o))return null;const r=t?i.focus.nodeBefore:i.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(Vg,e);this._previouslySelected.clear()}}function mm(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}const pm=function(t,e,n){var o=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return x(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),sa(t,e,{leading:o,maxWait:e,trailing:i})};var fm=n(903),km={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(fm.Z,km);fm.Z.locals;class bm extends ue{static get pluginName(){return"DragDrop"}static get requires(){return[vg,gm]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=pm((t=>this._updateDropMarker(t)),40),this._removeDropMarkerDelayed=Am((()=>this._removeDropMarker()),40),this._clearDraggableAttributesDelayed=Am((()=>this._clearDraggableAttributes()),40),e.addObserver(_g),e.addObserver(ug),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((t,e,n)=>{n||this._finalizeDragging(!1)})),sr.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=e.document,o=t.editing.view,i=o.document;this.listenTo(i,"dragstart",((o,s)=>{const a=n.selection;if(s.target&&s.target.is("editableElement"))return void s.preventDefault();const c=s.target?Cm(s.target):null;if(c){const n=t.editing.mapper.toModelElement(c);this._draggedRange=sc.fromRange(e.createRangeOn(n)),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!i.selection.isCollapsed){const t=i.selection.getSelectedElement();t&&Hg(t)||(this._draggedRange=sc.fromRange(a.getFirstRange()))}if(!this._draggedRange)return void s.preventDefault();this._draggingUid=r(),s.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",s.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=e.createSelection(this._draggedRange.toRange()),d=t.data.toView(e.getSelectedContent(l));i.fire("clipboardOutput",{dataTransfer:s.dataTransfer,content:d,method:o.name}),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(i,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this.listenTo(i,"dragenter",(()=>{this.isEnabled&&o.focus()})),this.listenTo(i,"dragleave",(()=>{this._removeDropMarkerDelayed()})),this.listenTo(i,"dragging",((e,n)=>{if(!this.isEnabled)return void(n.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const o=wm(t,n.targetRanges,n.target);this._draggedRange||(n.dataTransfer.dropEffect="copy"),sr.isGecko||("copy"==n.dataTransfer.effectAllowed?n.dataTransfer.dropEffect="copy":["all","copyMove"].includes(n.dataTransfer.effectAllowed)&&(n.dataTransfer.dropEffect="move")),o&&this._updateDropMarkerThrottled(o)}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"clipboardInput",((e,n)=>{if("drop"!=n.method)return;const o=wm(t,n.targetRanges,n.target);if(this._removeDropMarker(),!o)return this._finalizeDragging(!1),void e.stop();this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==_m(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(o,!0))return this._finalizeDragging(!1),void e.stop();n.targetRanges=[t.editing.mapper.toViewRange(o)]}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(vg);t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n=e.targetRanges.map((t=>this.editor.editing.mapper.toModelRange(t)));this.editor.model.change((t=>t.setSelection(n)))}),{priority:"high"}),t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n="move"==_m(e.dataTransfer),o=!e.resultRange||!e.resultRange.isCollapsed;this._finalizeDragging(o&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const t=this.editor,e=t.editing.view,n=e.document;this.listenTo(n,"mousedown",((o,i)=>{if(sr.isAndroid||!i)return;this._clearDraggableAttributesDelayed.cancel();let r=Cm(i.target);if(sr.isBlink&&!t.isReadOnly&&!r&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&Hg(t)||(r=n.selection.editableElement)}r&&(e.change((t=>{t.setAttribute("draggable","true",r)})),this._draggableElement=t.editing.mapper.toModelElement(r))})),this.listenTo(n,"mouseup",(()=>{sr.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const t=this.editor.editing;t.view.change((e=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&e.removeAttribute("draggable",t.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_setupDropMarker(){const t=this.editor;t.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),t.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(e,{writer:n})=>{if(t.model.schema.checkChild(e.markerRange.start,"$text"))return n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.innerHTML="⁠⁠",e}))}})}_updateDropMarker(t){const e=this.editor,n=e.model.markers;e.model.change((e=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(t)||e.updateMarker("drop-target",{range:t}):e.addMarker("drop-target",{range:t,usingOperation:!1,affectsData:!1})}))}_removeDropMarker(){const t=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_finalizeDragging(t){const e=this.editor,n=e.model;this._removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(t&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function wm(t,e,n){const o=t.model,i=t.editing.mapper;let r=null;const s=e?e[0].start:null;if(n.is("uiElement")&&(n=n.parent),r=function(t,e){const n=t.model,o=t.editing.mapper;if(Hg(e))return n.createRangeOn(o.toModelElement(e));if(!e.is("editableElement")){const t=e.findAncestor((t=>Hg(t)||t.is("editableElement")));if(Hg(t))return n.createRangeOn(o.toModelElement(t))}return null}(t,n),r)return r;const a=function(t,e){const n=t.editing.mapper,o=t.editing.view,i=n.toModelElement(e);if(i)return i;const r=o.createPositionBefore(e),s=n.findMappedViewAncestor(r);return n.toModelElement(s)}(t,n),c=s?i.toModelPosition(s):null;return c?(r=function(t,e,n){const o=t.model;if(!o.schema.checkChild(n,"$block"))return null;const i=o.createPositionAt(n,0),r=e.path.slice(0,i.path.length),s=o.createPositionFromPath(e.root,r).nodeAfter;if(s&&o.schema.isObject(s))return o.createRangeOn(s);return null}(t,c,a),r||(r=o.schema.getNearestSelectionRange(c,sr.isGecko?"forward":"backward"),r||function(t,e){const n=t.model;for(;e;){if(n.schema.isObject(e))return n.createRangeOn(e);e=e.parent}}(t,c.parent))):function(t,e){const n=t.model,o=n.schema,i=n.createPositionAt(e,0);return o.getNearestSelectionRange(i,"forward")}(t,a)}function _m(t){return sr.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function Am(t,e){let n;function o(...i){o.cancel(),n=setTimeout((()=>t(...i)),e)}return o.cancel=()=>{clearTimeout(n)},o}function Cm(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(Hg);if(Hg(t))return t;const e=t.findAncestor((t=>Hg(t)||t.is("editableElement")));return Hg(e)?e:null}class vm extends ue{static get pluginName(){return"PastePlainText"}static get requires(){return[vg]}init(){const t=this.editor,e=t.model,n=t.editing.view,o=n.document,i=e.document.selection;let r=!1;n.addObserver(_g),this.listenTo(o,"keydown",((t,e)=>{r=e.shiftKey})),t.plugins.get(vg).on("contentInsertion",((t,n)=>{(r||function(t,e){if(t.childCount>1)return!1;const n=t.getChild(0);if(e.isObject(n))return!1;return 0==[...n.getAttributeKeys()].length}(n.content,e.schema))&&e.change((t=>{const o=Array.from(i.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));i.isCollapsed||e.deleteContent(i,{doNotAutoparagraph:!0}),o.push(...i.getAttributes());const r=t.createRangeIn(n.content);for(const e of r.getItems())e.is("$textProxy")&&t.setAttributes(o,e)}))}))}}class ym extends ue{static get pluginName(){return"Clipboard"}static get requires(){return[vg,bm,vm]}}class xm extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n){const o=n.isCollapsed,i=n.getFirstRange(),r=i.start.parent,s=i.end.parent,a=r==s;if(o){const o=yg(t.schema,n.getAttributes());Dm(t,e,i.end),e.removeSelectionAttribute(n.getAttributeKeys()),e.setSelectionAttribute(o)}else{const o=!(i.start.isAtStart&&i.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:o}),a?Dm(t,e,n.focus):o&&e.setSelection(s,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})}))}refresh(){const t=this.editor.model,e=t.document;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const o=e.getFirstRange(),i=o.start.parent,r=o.end.parent;if((Em(i,t)||Em(r,t))&&i!==r)return!1;return!0}(t.schema,e.selection)}}function Dm(t,e,n){const o=e.createElement("softBreak");t.insertContent(o,n),e.setSelection(o,"after")}function Em(t,e){return!t.is("rootElement")&&(e.isLimit(t)||Em(t.parent,e))}class Mm extends ue{static get pluginName(){return"ShiftEnter"}init(){const t=this.editor,e=t.model.schema,n=t.conversion,o=t.editing.view,i=o.document;e.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(t,{writer:e})=>e.createEmptyElement("br")}),o.addObserver(Eg),t.commands.add("shiftEnter",new xm(t)),this.listenTo(i,"enter",((e,n)=>{n.preventDefault(),n.isSoft&&(t.execute("shiftEnter"),o.scrollToTheSelection())}),{priority:"low"})}}class Im extends me{constructor(t){super(t),this.affectsData=!1}execute(){const t=this.editor.model,e=t.document.selection;let n=t.schema.getLimitElement(e);if(e.containsEntireContent(n)||!Sm(t.schema,n))do{if(n=n.parent,!n)return}while(!Sm(t.schema,n));t.change((t=>{t.setSelection(n,"in")}))}}function Sm(t,e){return t.isLimit(e)&&(t.checkChild(e,"$text")||t.checkChild(e,"paragraph"))}const Tm=gr("Ctrl+A");class Nm extends ue{static get pluginName(){return"SelectAllEditing"}init(){const t=this.editor,e=t.editing.view.document;t.commands.add("selectAll",new Im(t)),this.listenTo(e,"keydown",((e,n)=>{ur(n)===Tm&&(t.execute("selectAll"),n.preventDefault())}))}}class Bm extends ue{static get pluginName(){return"SelectAllUI"}init(){const t=this.editor;t.ui.componentFactory.add("selectAll",(e=>{const n=t.commands.get("selectAll"),o=new fh(e),i=e.t;return o.set({label:i("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),o.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),o}))}}class zm extends ue{static get requires(){return[Nm,Bm]}static get pluginName(){return"SelectAll"}}class Pm extends me{constructor(t,e){super(t),this._buffer=new Ig(t.model,e)}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,o=t.text||"",i=o.length,r=t.range?e.createSelection(t.range):n.selection,s=t.resultRange;e.enqueueChange(this._buffer.batch,(t=>{this._buffer.lock(),e.deleteContent(r),o&&e.insertContent(t.createText(o,n.selection.getAttributes()),r),s?t.setSelection(s):r.is("documentSelection")||t.setSelection(r),this._buffer.unlock(),this._buffer.input(i)}))}}class Lm{constructor(t){this.editor=t,this.editing=this.editor.editing}handle(t,e){if(function(t){if(0==t.length)return!1;for(const e of t)if("children"===e.type&&!Tg(e))return!0;return!1}(t))this._handleContainerChildrenMutations(t,e);else for(const n of t)this._handleTextMutation(n,e),this._handleTextNodeInsertion(n)}_handleContainerChildrenMutations(t,e){const n=function(t){const e=t.map((t=>t.node)).reduce(((t,e)=>t.getCommonAncestor(e,{includeSelf:!0})));if(!e)return;return e.getAncestors({includeSelf:!0,parentFirst:!0}).find((t=>t.is("containerElement")||t.is("rootElement")))}(t);if(!n)return;const o=this.editor.editing.view.domConverter.mapViewToDom(n),i=new gs(this.editor.editing.view.document),r=this.editor.data.toModel(i.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(n);if(!s)return;const a=Array.from(r.getChildren()),c=Array.from(s.getChildren()),l=a[a.length-1],d=c[c.length-1],h=l&&l.is("element","softBreak"),u=d&&!d.is("element","softBreak");h&&u&&a.pop();const g=this.editor.model.schema;if(!Om(a,g)||!Om(c,g))return;const m=a.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," "),p=c.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," ");if(p===m)return;const f=Gr(p,m),{firstChangeAt:k,insertions:b,deletions:w}=Rm(f);let _=null;e&&(_=this.editing.mapper.toModelRange(e.getFirstRange()));const A=m.substr(k,b),C=this.editor.model.createRange(this.editor.model.createPositionAt(s,k),this.editor.model.createPositionAt(s,k+w));this.editor.execute("input",{text:A,range:C,resultRange:_})}_handleTextMutation(t,e){if("text"!=t.type)return;const n=t.newText.replace(/\u00A0/g," "),o=t.oldText.replace(/\u00A0/g," ");if(o===n)return;const i=Gr(o,n),{firstChangeAt:r,insertions:s,deletions:a}=Rm(i);let c=null;e&&(c=this.editing.mapper.toModelRange(e.getFirstRange()));const l=this.editing.view.createPositionAt(t.node,r),d=this.editing.mapper.toModelPosition(l),h=this.editor.model.createRange(d,d.getShiftedBy(a)),u=n.substr(r,s);this.editor.execute("input",{text:u,range:h,resultRange:c})}_handleTextNodeInsertion(t){if("children"!=t.type)return;const e=Tg(t),n=this.editing.view.createPositionAt(t.node,e.index),o=this.editing.mapper.toModelPosition(n),i=e.values[0].data;this.editor.execute("input",{text:i.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function Om(t,e){return t.every((t=>e.isInline(t)))}function Rm(t){let e=null,n=null;for(let o=0;o{n.deleteContent(n.document.selection)})),t.unlock()}sr.isAndroid?o.document.on("beforeinput",((t,e)=>r(e)),{priority:"lowest"}):o.document.on("keydown",((t,e)=>r(e)),{priority:"lowest"}),o.document.on("compositionstart",(function(){const t=n.document,e=1!==t.selection.rangeCount||t.selection.getFirstRange().isFlat;t.selection.isCollapsed||e||s()}),{priority:"lowest"}),o.document.on("compositionend",(()=>{e=n.createSelection(n.document.selection)}),{priority:"lowest"})}(t),function(t){t.editing.view.document.on("mutations",((e,n,o)=>{new Lm(t).handle(n,o)}))}(t)}}class Fm extends ue{static get requires(){return[jm,Pg]}static get pluginName(){return"Typing"}}function Vm(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>o.is("$text")||o.is("$textProxy")?t+o.data:(n=e.createPositionAfter(o),"")),""),range:e.createRange(n,t.end)}}class Hm{constructor(t,e){this.model=t,this.testCallback=e,this.hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(t.document.selection),this.stopListening(t.document))})),this._startListening()}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",((e,{directChange:n})=>{n&&(t.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))})),this.listenTo(t,"change:data",((t,e)=>{!e.isUndo&&e.isLocal&&this._evaluateTextBeforeSelection("data",{batch:e})}))}_evaluateTextBeforeSelection(t,e={}){const n=this.model,o=n.document.selection,i=n.createRange(n.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=Vm(i,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const n=Object.assign(e,{text:r,range:s});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${t}`,n)}}}he(Hm,re);class Um extends ue{static get pluginName(){return"TwoStepCaretMovement"}constructor(t){super(t),this.attributes=new Set,this._overrideUid=null}init(){const t=this.editor,e=t.model,n=t.editing.view,o=t.locale,i=e.document.selection;this.listenTo(n.document,"arrowKey",((t,e)=>{if(!i.isCollapsed)return;if(e.shiftKey||e.altKey||e.ctrlKey)return;const n=e.keyCode==dr.arrowright,r=e.keyCode==dr.arrowleft;if(!n&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&n||"rtl"===s&&r?this._handleForwardMovement(e):this._handleBackwardMovement(e),!0===a&&t.stop()}),{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(i,"change:range",((t,e)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!e.directChange&&Ym(i.getFirstPosition(),this.attributes)||this._restoreGravity())}))}registerAttribute(t){this.attributes.add(t)}_handleForwardMovement(t){const e=this.attributes,n=this.editor.model.document.selection,o=n.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!qm(n,e))&&(Ym(o,e)?(Wm(t),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(t){const e=this.attributes,n=this.editor.model,o=n.document.selection,i=o.getFirstPosition();return this._isGravityOverridden?(Wm(t),this._restoreGravity(),Gm(n,e,i),!0):i.isAtStart?!!qm(o,e)&&(Wm(t),Gm(n,e,i),!0):function(t,e){return Ym(t.getShiftedBy(-1),e)}(i,e)?i.isAtEnd&&!qm(o,e)&&Ym(i,e)?(Wm(t),Gm(n,e,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):void 0}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((t=>t.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((t=>{t.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function qm(t,e){for(const n of e)if(t.hasAttribute(n))return!0;return!1}function Gm(t,e,n){const o=n.nodeBefore;t.change((t=>{o?t.setSelectionAttribute(o.getAttributes()):t.removeSelectionAttribute(e)}))}function Wm(t){t.preventDefault()}function Ym(t,e){const{nodeBefore:n,nodeAfter:o}=t;for(const t of e){const e=n?n.getAttribute(t):void 0;if((o?o.getAttribute(t):void 0)!==e)return!0}return!1}var Km=/[\\^$.*+?()[\]{}|]/g,Qm=RegExp(Km.source);const $m=function(t){return(t=si(t))&&Qm.test(t)?t.replace(Km,"\\$&"):t},Zm={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:op('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:op("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:op("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:op('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:op('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:op("'"),to:[null,"‚",null,"’"]}},Jm={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Xm=["symbols","mathematical","typography","quotes"];function tp(t){return"string"==typeof t?new RegExp(`(${$m(t)})$`):t}function ep(t){return"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t}function np(t){return(t.textNode?t.textNode:t.nodeAfter).getAttributes()}function op(t){return new RegExp(`(^|\\s)(${t})([^${t}]*)(${t})$`)}function ip(t,e,n,o){return o.createRange(rp(t,e,n,!0,o),rp(t,e,n,!1,o))}function rp(t,e,n,o,i){let r=t.textNode||(o?t.nodeBefore:t.nodeAfter),s=null;for(;r&&r.getAttribute(e)==n;)s=r,r=o?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,o?"before":"after"):t}class sp extends me{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(t.data,"set",((t,e)=>{e[1]={...e[1]};const n=e[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(t.data,"set",((t,e)=>{e[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const o=this.editor.model,i=o.document,r=[],s=t.map((t=>t.getTransformedByOperations(n))),a=s.flat();for(const t of s){const e=t.filter((t=>t.root!=i.graveyard)).filter((t=>!cp(t,a)));e.length&&(ap(e),r.push(e[0]))}r.length&&o.change((t=>{t.setSelection(r,{backward:e})}))}_undo(t,e){const n=this.editor.model,o=n.document;this._createdBatches.add(e);const i=t.operations.slice().filter((t=>t.isDocumentOperation));i.reverse();for(const t of i){const i=t.baseVersion+1,r=Array.from(o.history.getOperations(i)),s=ig([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const i of s)e.addOperation(i),n.applyOperation(i),o.history.setOperationAsUndone(t,i)}}}function ap(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class lp extends sp{execute(t=null){const e=t?this._stack.findIndex((e=>e.batch==t)):this._stack.length-1,n=this._stack.splice(e,1)[0],o=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(o,(()=>{this._undo(n.batch,o);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t),this.fire("revert",n.batch,o)})),this.refresh()}}class dp extends sp{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,(()=>{const n=t.batch.operations[t.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(n);this._restoreSelection(t.selection.ranges,t.selection.isBackward,o),this._undo(t.batch,e)})),this.refresh()}}class hp extends ue{static get pluginName(){return"UndoEditing"}constructor(t){super(t),this._batchRegistry=new WeakSet}init(){const t=this.editor;this._undoCommand=new lp(t),this._redoCommand=new dp(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",((t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const o=n.batch,i=this._redoCommand._createdBatches.has(o),r=this._undoCommand._createdBatches.has(o);this._batchRegistry.has(o)||(this._batchRegistry.add(o),o.isUndoable&&(i?this._undoCommand.addBatch(o):r||(this._undoCommand.addBatch(o),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((t,e,n)=>{this._redoCommand.addBatch(n)})),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo")}}const up='',gp='';class mp extends ue{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?up:gp,i="ltr"==e.uiLanguageDirection?gp:up;this._addButton("undo",n("Undo"),"CTRL+Z",o),this._addButton("redo",n("Redo"),"CTRL+Y",i)}_addButton(t,e,n,o){const i=this.editor;i.ui.componentFactory.add(t,(r=>{const s=i.commands.get(t),a=new fh(r);return a.set({label:e,icon:o,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",(()=>{i.execute(t),i.editing.view.focus()})),a}))}}class pp extends ue{static get requires(){return[hp,mp]}static get pluginName(){return"Undo"}}class fp{constructor(){const t=new window.FileReader;this._reader=t,this._data=void 0,this.set("loaded",0),t.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(t){const e=this._reader;return this.total=t.size,new Promise(((n,o)=>{e.onload=()=>{const t=e.result;this._data=t,n(t)},e.onerror=()=>{o("error")},e.onabort=()=>{o("aborted")},this._reader.readAsDataURL(t)}))}abort(){this._reader.abort()}}he(fp,re);class kp extends ue{static get pluginName(){return"FileRepository"}static get requires(){return[Sd]}init(){this.loaders=new Mo,this.loaders.on("add",(()=>this._updatePendingAction())),this.loaders.on("remove",(()=>this._updatePendingAction())),this._loadersMap=new Map,this._pendingAction=null,this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0))}getLoader(t){return this._loadersMap.get(t)||null}createLoader(t){if(!this.createUploadAdapter)return l("filerepository-no-upload-adapter"),null;const e=new bp(Promise.resolve(t),this.createUploadAdapter);return this.loaders.add(e),this._loadersMap.set(t,e),t instanceof Promise&&e.file.then((t=>{this._loadersMap.set(t,e)})).catch((()=>{})),e.on("change:uploaded",(()=>{let t=0;for(const e of this.loaders)t+=e.uploaded;this.uploaded=t})),e.on("change:uploadTotal",(()=>{let t=0;for(const e of this.loaders)e.uploadTotal&&(t+=e.uploadTotal);this.uploadTotal=t})),e}destroyLoader(t){const e=t instanceof bp?t:this.getLoader(t);e._destroy(),this.loaders.remove(e),this._loadersMap.forEach(((t,n)=>{t===e&&this._loadersMap.delete(n)}))}_updatePendingAction(){const t=this.editor.plugins.get(Sd);if(this.loaders.length){if(!this._pendingAction){const e=this.editor.t,n=t=>`${e("Upload in progress")} ${parseInt(t)}%.`;this._pendingAction=t.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else t.remove(this._pendingAction),this._pendingAction=null}}he(kp,re);class bp{constructor(t,e){this.id=r(),this._filePromiseWrapper=this._createFilePromiseWrapper(t),this._adapter=e(this),this._reader=new fp,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((t=>this._filePromiseWrapper?t:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new c("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((t=>this._reader.read(t))).then((t=>{if("reading"!==this.status)throw this.status;return this.status="idle",t})).catch((t=>{if("aborted"===t)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:t}))}upload(){if("idle"!=this.status)throw new c("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((t=>(this.uploadResponse=t,this.status="idle",t))).catch((t=>{if("aborted"===this.status)throw"aborted";throw this.status="error",t}))}abort(){const t=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==t?this._reader.abort():"uploading"==t&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(t){const e={};return e.promise=new Promise(((n,o)=>{e.rejecter=o,e.isFulfilled=!1,t.then((t=>{e.isFulfilled=!0,n(t)})).catch((t=>{e.isFulfilled=!0,o(t)}))})),e}}he(bp,re);class wp extends jd{constructor(t){super(t),this.buttonView=new fh(t),this._fileInputView=new _p(t),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",(()=>{this._fileInputView.open()}))}focus(){this.buttonView.focus()}}class _p extends jd{constructor(t){super(t),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:e.to("acceptedType"),multiple:e.to("allowMultipleFiles")},on:{change:e.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}const Ap="ckCsrfToken",Cp="abcdefghijklmnopqrstuvwxyz0123456789";function vp(){let t=function(t){t=t.toLowerCase();const e=document.cookie.split(";");for(const n of e){const e=n.split("=");if(decodeURIComponent(e[0].trim().toLowerCase())===t)return decodeURIComponent(e[1])}return null}(Ap);var e,n;return t&&40==t.length||(t=function(t){let e="";const n=new Uint8Array(t);window.crypto.getRandomValues(n);for(let t=0;t.5?o.toUpperCase():o}return e}(40),e=Ap,n=t,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(n)+";path=/"),t}class yp{constructor(t,e,n){this.loader=t,this.url=e,this.t=n}upload(){return this.loader.file.then((t=>new Promise(((e,n)=>{this._initRequest(),this._initListeners(e,n,t),this._sendRequest(t)}))))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const t=this.xhr=new XMLHttpRequest;t.open("POST",this.url,!0),t.responseType="json"}_initListeners(t,e,n){const o=this.xhr,i=this.loader,r=(0,this.t)("Cannot upload file:")+` ${n.name}.`;o.addEventListener("error",(()=>e(r))),o.addEventListener("abort",(()=>e())),o.addEventListener("load",(()=>{const n=o.response;if(!n||!n.uploaded)return e(n&&n.error&&n.error.message?n.error.message:r);t({default:n.url})})),o.upload&&o.upload.addEventListener("progress",(t=>{t.lengthComputable&&(i.uploadTotal=t.total,i.uploaded=t.loaded)}))}_sendRequest(t){const e=new FormData;e.append("upload",t),e.append("ckCsrfToken",vp()),this.xhr.send(e)}}function xp(t,e,n,o){let i,r=null;"function"==typeof o?i=o:(r=t.commands.get(o),i=()=>{t.execute(o)}),t.model.document.on("change:data",((s,a)=>{if(r&&!r.isEnabled||!e.isEnabled)return;const c=Ta(t.model.document.selection.getRanges());if(!c.isCollapsed)return;if(a.isUndo||!a.isLocal)return;const l=Array.from(t.model.document.differ.getChanges()),d=l[0];if(1!=l.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const h=d.position.parent;if(h.is("element","codeBlock"))return;if(h.is("element","listItem")&&"function"!=typeof o&&!["numberedList","bulletedList","todoList"].includes(o))return;if(r&&!0===r.value)return;const u=h.getChild(0),g=t.model.createRangeOn(u);if(!g.containsRange(c)&&!c.end.isEqual(g.end))return;const m=n.exec(u.data.substr(0,c.end.offset));m&&t.model.enqueueChange((e=>{const n=e.createPositionAt(h,0),o=e.createPositionAt(h,m[0].length),r=new sc(n,o);if(!1!==i({match:m})){e.remove(r);const n=t.model.document.selection.getFirstRange(),o=e.createRangeIn(h);!h.isEmpty||o.isEqual(n)||o.containsRange(n,!0)||e.remove(h)}r.detach(),t.model.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function Dp(t,e,n,o){let i,r;n instanceof RegExp?i=n:r=n,r=r||(t=>{let e;const n=[],o=[];for(;null!==(e=i.exec(t))&&!(e&&e.length<4);){let{index:t,1:i,2:r,3:s}=e;const a=i+r+s;t+=e[0].length-a.length;const c=[t,t+i.length],l=[t+i.length+r.length,t+i.length+r.length+s.length];n.push(c),n.push(l),o.push([t+i.length,t+i.length+r.length])}return{remove:n,format:o}}),t.model.document.on("change:data",((n,i)=>{if(i.isUndo||!i.isLocal||!e.isEnabled)return;const s=t.model,a=s.document.selection;if(!a.isCollapsed)return;const c=Array.from(s.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const d=a.focus,h=d.parent,{text:u,range:g}=function(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>!o.is("$text")&&!o.is("$textProxy")||o.getAttribute("code")?(n=e.createPositionAfter(o),""):t+o.data),""),range:e.createRange(n,t.end)}}(s.createRange(s.createPositionAt(h,0),d),s),m=r(u),p=Ep(g.start,m.format,s),f=Ep(g.start,m.remove,s);p.length&&f.length&&s.enqueueChange((e=>{if(!1!==o(e,p)){for(const t of f.reverse())e.remove(t);s.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function Ep(t,e,n){return e.filter((t=>void 0!==t[0]&&void 0!==t[1])).map((e=>n.createRange(t.getShiftedBy(e[0]),t.getShiftedBy(e[1]))))}function Mp(t,e){return(n,o)=>{if(!t.commands.get(e).isEnabled)return!1;const i=t.model.schema.getValidRanges(o,e);for(const t of i)n.setAttribute(e,!0,t);n.removeSelectionAttribute(e)}}class Ip extends me{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,o=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(n.isCollapsed)o?t.setSelectionAttribute(this.attributeKey,!0):t.removeSelectionAttribute(this.attributeKey);else{const i=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of i)o?t.setAttribute(this.attributeKey,o,e):t.removeAttribute(this.attributeKey,e)}}))}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const t of n.getRanges())for(const n of t.getItems())if(e.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}const Sp="bold";class Tp extends ue{static get pluginName(){return"BoldEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Sp}),t.model.schema.setAttributeProperties(Sp,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Sp,view:"strong",upcastAlso:["b",t=>{const e=t.getStyle("font-weight");return e?"bold"==e||Number(e)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),t.commands.add(Sp,new Ip(t,Sp)),t.keystrokes.set("CTRL+B",Sp)}}const Np="bold";class Bp extends ue{static get pluginName(){return"BoldUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Np,(n=>{const o=t.commands.get(Np),i=new fh(n);return i.set({label:e("Bold"),icon:'',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(Np),t.editing.view.focus()})),i}))}}const zp="italic";class Pp extends ue{static get pluginName(){return"ItalicEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:zp}),t.model.schema.setAttributeProperties(zp,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:zp,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(zp,new Ip(t,zp)),t.keystrokes.set("CTRL+I",zp)}}const Lp="italic";class Op extends ue{static get pluginName(){return"ItalicUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Lp,(n=>{const o=t.commands.get(Lp),i=new fh(n);return i.set({label:e("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(Lp),t.editing.view.focus()})),i}))}}class Rp extends me{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.schema,o=e.document.selection,i=Array.from(o.getSelectedBlocks()),r=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(r){const e=i.filter((t=>jp(t)||Vp(n,t)));this._applyQuote(t,e)}else this._removeQuote(t,i.filter(jp))}))}_getValue(){const t=Ta(this.editor.model.document.selection.getSelectedBlocks());return!(!t||!jp(t))}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.document.selection,e=this.editor.model.schema,n=Ta(t.getSelectedBlocks());return!!n&&Vp(e,n)}_removeQuote(t,e){Fp(t,e).reverse().forEach((e=>{if(e.start.isAtStart&&e.end.isAtEnd)return void t.unwrap(e.start.parent);if(e.start.isAtStart){const n=t.createPositionBefore(e.start.parent);return void t.move(e,n)}e.end.isAtEnd||t.split(e.end);const n=t.createPositionAfter(e.end.parent);t.move(e,n)}))}_applyQuote(t,e){const n=[];Fp(t,e).reverse().forEach((e=>{let o=jp(e.start);o||(o=t.createElement("blockQuote"),t.wrap(e,o)),n.push(o)})),n.reverse().reduce(((e,n)=>e.nextSibling==n?(t.merge(t.createPositionAfter(e)),e):n))}}function jp(t){return"blockQuote"==t.parent.name?t.parent:null}function Fp(t,e){let n,o=0;const i=[];for(;o{const o=t.model.document.differ.getChanges();for(const t of o)if("insert"==t.type){const o=t.position.nodeAfter;if(!o)continue;if(o.is("element","blockQuote")&&o.isEmpty)return n.remove(o),!0;if(o.is("element","blockQuote")&&!e.checkChild(t.position,o))return n.unwrap(o),!0;if(o.is("element")){const t=n.createRangeIn(o);for(const o of t.getItems())if(o.is("element","blockQuote")&&!e.checkChild(n.createPositionBefore(o),o))return n.unwrap(o),!0}}else if("remove"==t.type){const e=t.position.parent;if(e.is("element","blockQuote")&&e.isEmpty)return n.remove(e),!0}return!1}));const n=this.editor.editing.view.document,o=t.model.document.selection,i=t.commands.get("blockQuote");this.listenTo(n,"enter",((e,n)=>{if(!o.isCollapsed||!i.value)return;o.getLastPosition().parent.isEmpty&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"}),this.listenTo(n,"delete",((e,n)=>{if("backward"!=n.direction||!o.isCollapsed||!i.value)return;const r=o.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"})}}var Up=n(3062),qp={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Up.Z,qp);Up.Z.locals;class Gp extends ue{static get pluginName(){return"BlockQuoteUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("blockQuote",(n=>{const o=t.commands.get("blockQuote"),i=new fh(n);return i.set({label:e("Block quote"),icon:Nd.quote,tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),i}))}}class Wp extends ue{static get pluginName(){return"CKFinderUI"}init(){const t=this.editor,e=t.ui.componentFactory,n=t.t;e.add("ckfinder",(e=>{const o=t.commands.get("ckfinder"),i=new fh(e);return i.set({label:n("Insert image or file"),icon:'',tooltip:!0}),i.bind("isEnabled").to(o),i.on("execute",(()=>{t.execute("ckfinder"),t.editing.view.focus()})),i}))}}class Yp extends me{constructor(t){super(t),this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",(()=>this.refresh()),{priority:"low"})}refresh(){const t=this.editor.commands.get("insertImage"),e=this.editor.commands.get("link");this.isEnabled=t.isEnabled||e.isEnabled}execute(){const t=this.editor,e=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=e&&"modal"!=e)throw new c("ckfinder-unknown-openermethod",t);const n=this.editor.config.get("ckfinder.options")||{};n.chooseFiles=!0;const o=n.onInit;n.language||(n.language=t.locale.uiLanguage),n.onInit=e=>{o&&o(e),e.on("files:choose",(n=>{const o=n.data.files.toArray(),i=o.filter((t=>!t.isImage())),r=o.filter((t=>t.isImage()));for(const e of i)t.execute("link",e.getUrl());const s=[];for(const t of r){const n=t.getUrl();s.push(n||e.request("file:getProxyUrl",{file:t}))}s.length&&Kp(t,s)})),e.on("file:choose:resizedImage",(e=>{const n=e.data.resizedUrl;if(n)Kp(t,[n]);else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not obtain resized image URL."),{title:n("Selecting resized image failed"),namespace:"ckfinder"})}}))},window.CKFinder[e](n)}}function Kp(t,e){if(t.commands.get("insertImage").isEnabled)t.execute("insertImage",{source:e});else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not insert image at the current position."),{title:n("Inserting image failed"),namespace:"ckfinder"})}}class Qp extends ue{static get pluginName(){return"CKFinderEditing"}static get requires(){return[vu,"LinkEditing"]}init(){const t=this.editor;if(!t.plugins.has("ImageBlockEditing")&&!t.plugins.has("ImageInlineEditing"))throw new c("ckfinder-missing-image-plugin",t);t.commands.add("ckfinder",new Yp(t))}}class $p extends ue{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",kp]}init(){const t=this.editor,e=t.plugins.get("CloudServices"),n=e.token,o=e.uploadUrl;n&&(this._uploadGateway=t.plugins.get("CloudServicesCore").createUploadGateway(n,o),t.plugins.get(kp).createUploadAdapter=t=>new Zp(this._uploadGateway,t))}}class Zp{constructor(t,e){this.uploadGateway=t,this.loader=e}upload(){return this.loader.file.then((t=>(this.fileUploader=this.uploadGateway.upload(t),this.fileUploader.on("progress",((t,e)=>{this.loader.uploadTotal=e.total,this.loader.uploaded=e.uploaded})),this.fileUploader.send())))}abort(){this.fileUploader.abort()}}class Jp extends me{refresh(){const t=this.editor.model,e=Ta(t.document.selection.getSelectedBlocks());this.value=!!e&&e.is("element","paragraph"),this.isEnabled=!!e&&Xp(e,t.schema)}execute(t={}){const e=this.editor.model,n=e.document;e.change((o=>{const i=(t.selection||n.selection).getSelectedBlocks();for(const t of i)!t.is("element","paragraph")&&Xp(t,e.schema)&&o.rename(t,"paragraph")}))}}function Xp(t,e){return e.checkChild(t.parent,"paragraph")&&!e.isObject(t)}class tf extends me{execute(t){const e=this.editor.model,n=t.attributes;let o=t.position;e.change((t=>{const i=t.createElement("paragraph");if(n&&e.schema.setAllowedAttributes(i,n,t),!e.schema.checkChild(o.parent,i)){const n=e.schema.findAllowedParent(o,i);if(!n)return;o=t.split(o,n).position}e.insertContent(i,o),t.setSelection(i,"in")}))}}class ef extends ue{static get pluginName(){return"Paragraph"}init(){const t=this.editor,e=t.model;t.commands.add("paragraph",new Jp(t)),t.commands.add("insertParagraph",new tf(t)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(t,{writer:e})=>ef.paragraphLikeElements.has(t.name)?t.isEmpty?null:e.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}ef.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class nf extends me{constructor(t,e){super(t),this.modelElements=e}refresh(){const t=Ta(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some((e=>of(t,e,this.editor.model.schema)))}execute(t){const e=this.editor.model,n=e.document,o=t.value;e.change((t=>{const i=Array.from(n.selection.getSelectedBlocks()).filter((t=>of(t,o,e.schema)));for(const e of i)e.is("element",o)||t.rename(e,o)}))}}function of(t,e,n){return n.checkChild(t.parent,e)&&!n.isObject(t)}const rf="paragraph";class sf extends ue{static get pluginName(){return"HeadingEditing"}constructor(t){super(t),t.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[ef]}init(){const t=this.editor,e=t.config.get("heading.options"),n=[];for(const o of e)o.model!==rf&&(t.model.schema.register(o.model,{inheritAllFrom:"$block"}),t.conversion.elementToElement(o),n.push(o.model));this._addDefaultH1Conversion(t),t.commands.add("heading",new nf(t,n))}afterInit(){const t=this.editor,e=t.commands.get("enter"),n=t.config.get("heading.options");e&&this.listenTo(e,"afterExecute",((e,o)=>{const i=t.model.document.selection.getFirstPosition().parent;n.some((t=>i.is("element",t.model)))&&!i.is("element",rf)&&0===i.childCount&&o.writer.rename(i,rf)}))}_addDefaultH1Conversion(t){t.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:s.get("low")+1})}}var af=n(8733),cf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(af.Z,cf);af.Z.locals;class lf extends ue{static get pluginName(){return"HeadingUI"}init(){const t=this.editor,e=t.t,n=function(t){const e=t.t,n={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return t.config.get("heading.options").map((t=>{const e=n[t.title];return e&&e!=t.title&&(t.title=e),t}))}(t),o=e("Choose heading"),i=e("Heading");t.ui.componentFactory.add("heading",(e=>{const r={},s=new Mo,a=t.commands.get("heading"),c=t.commands.get("paragraph"),l=[a];for(const t of n){const e={type:"button",model:new yu({label:t.title,class:t.class,withText:!0})};"paragraph"===t.model?(e.model.bind("isOn").to(c,"value"),e.model.set("commandName","paragraph"),l.push(c)):(e.model.bind("isOn").to(a,"value",(e=>e===t.model)),e.model.set({commandName:"heading",commandValue:t.model})),s.add(e),r[t.model]=t.title}const d=eu(e);return ou(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:i}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(l,"isEnabled",((...t)=>t.some((t=>t)))),d.buttonView.bind("label").to(a,"value",c,"value",((t,e)=>{const n=t||e&&"paragraph";return r[n]?r[n]:o})),this.listenTo(d,"execute",(e=>{t.execute(e.source.commandName,e.source.commandValue?{value:e.source.commandValue}:void 0),t.editing.view.focus()})),d}))}}class df extends ue{static get requires(){return[Ou]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",(e=>{(function(t){const e=t.getSelectedElement();return!(!e||!Hg(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{ariaLabel:e,items:n,getRelatedElement:o,balloonClassName:i="ck-toolbar-container"}){if(!n.length)return void l("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new Hh(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new c("widget-toolbar-duplicated",this,{toolbarId:t});a.fillFromConfig(n,r.ui.componentFactory),this._toolbarDefinitions.set(t,{view:a,getRelatedElement:o,balloonClassName:i})}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const o of this._toolbarDefinitions.values()){const i=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&i)if(this.editor.ui.focusTracker.isFocused){const r=i.getAncestors().length;r>t&&(t=r,e=i,n=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(t,e){this._isToolbarVisible(t)?hf(this.editor,e):this._isToolbarInBalloon(t)||(this._balloon.add({view:t.view,position:uf(this.editor,e),balloonClassName:t.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const e=t.getRelatedElement(this.editor.editing.view.document.selection);hf(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function hf(t,e){const n=t.plugins.get("ContextualBalloon"),o=uf(t,e);n.updatePosition(o)}function uf(t,e){const n=t.editing.view,o=Su.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast,o.viewportStickyNorth]}}class gf{constructor(t){this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=t,this._referenceCoordinates=null}begin(t,e,n){const o=new fa(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(mf(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new fa(t),o=e.split("-"),i={x:"right"==o[1]?n.right:n.left,y:"bottom"==o[0]?n.bottom:n.top};return i.x+=t.ownerDocument.defaultView.scrollX,i.y+=t.ownerDocument.defaultView.scrollY,i}(e,function(t){const e=t.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[e[0]]}-${n[e[1]]}`}(this.activeHandlePosition)),this.originalWidth=o.width,this.originalHeight=o.height,this.aspectRatio=o.width/o.height;const i=n.style.width;i&&i.match(/^\d+(\.\d*)?%$/)?this.originalWidthPercents=parseFloat(i):this.originalWidthPercents=function(t,e){const n=t.parentElement,o=parseFloat(n.ownerDocument.defaultView.getComputedStyle(n).width);return e.width/o*100}(n,o)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}function mf(t){return`ck-widget__resizer__handle-${t}`}he(gf,re);class pf extends jd{constructor(){super();const t=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",t.to("_viewPosition",(t=>t?`ck-orientation-${t}`:""))],style:{display:t.if("_isVisible","none",(t=>!t))}},children:[{text:t.to("_label")}]})}_bindToState(t,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",((t,e)=>null!==t&&null!==e)),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",((e,n,o)=>"px"===t.unit?`${e}×${n}`:`${o}%`)),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",((t,e,n)=>e<50||n<50?"above-center":t))}_dismiss(){this.unbind(),this._isVisible=!1}}class ff{constructor(t){this._options=t,this._viewResizerWrapper=null,this.set("isEnabled",!0),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(t=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),t.stop())}),{priority:"high"}),this.on("change:isEnabled",(()=>{this.isEnabled&&this.redraw()}))}attach(){const t=this,e=this._options.viewElement;this._options.editor.editing.view.change((n=>{const o=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(e){const n=this.toDomElement(e);return t._appendHandles(n),t._appendSizeUI(n),t.on("change:isEnabled",((t,e,o)=>{n.style.display=o?"":"none"})),n.style.display=t.isEnabled?"":"none",n}));n.insert(n.createPositionAt(e,"end"),o),n.addClass("ck-widget_with-resizer",e),this._viewResizerWrapper=o}))}begin(t){this.state=new gf(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(t,this._getHandleHost(),this._getResizeHost())}updateSize(t){const e=this._proposeNewSize(t);this._options.editor.editing.view.change((t=>{const n=this._options.unit||"%",o=("%"===n?e.widthPercents:e.width)+n;t.setStyle("width",o,this._options.viewElement)}));const n=this._getHandleHost(),o=new fa(n);e.handleHostWidth=Math.round(o.width),e.handleHostHeight=Math.round(o.height);const i=new fa(n);e.width=Math.round(i.width),e.height=Math.round(i.height),this.redraw(o),this.state.update(e)}commit(){const t=this._options.unit||"%",e=("%"===t?this.state.proposedWidthPercents:this.state.proposedWidth)+t;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(e)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(t){const e=this._domResizerWrapper;if(!((n=e)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const o=e.parentElement,i=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(o.isSameNode(i)){const e=t||new fa(i);a=[e.width+"px",e.height+"px",void 0,void 0]}else a=[i.offsetWidth+"px",i.offsetHeight+"px",i.offsetLeft+"px",i.offsetTop+"px"];"same"!==Oo(s,a)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)}))}containsHandle(t){return this._domResizerWrapper.contains(t)}static isResizeHandle(t){return t.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change((t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(t){const e=this.state,n={x:(o=t).pageX,y:o.pageY};var o;const i=!this._options.isCentered||this._options.isCentered(this),r={x:e._referenceCoordinates.x-(n.x+e.originalWidth),y:n.y-e.originalHeight-e._referenceCoordinates.y};i&&e.activeHandlePosition.endsWith("-right")&&(r.x=n.x-(e._referenceCoordinates.x+e.originalWidth)),i&&(r.x*=2);const s={width:Math.abs(e.originalWidth+r.x),height:Math.abs(e.originalHeight+r.y)};s.dominant=s.width/e.aspectRatio>s.height?"width":"height",s.max=s[s.dominant];const a={width:s.width,height:s.height};return"width"==s.dominant?a.height=a.width/e.aspectRatio:a.width=a.height*e.aspectRatio,{width:Math.round(a.width),height:Math.round(a.height),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*a.width*100)/100,100)}}_getResizeHost(){const t=this._domResizerWrapper.parentElement;return this._options.getResizeHost(t)}_getHandleHost(){const t=this._domResizerWrapper.parentElement;return this._options.getHandleHost(t)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const o of e)t.appendChild(new Fd({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=o,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new pf,this._sizeView.render(),t.appendChild(this._sizeView.element)}}he(ff,re);var kf=n(8506),bf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(kf.Z,bf);kf.Z.locals;he(class extends ue{static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,e=is.window.document;this.set("visibleResizer",null),this.set("_activeResizer",null),this._resizers=new Map,t.view.addObserver(ug),this._observer=Object.create(ws),this.listenTo(t.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(e,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(e,"mouseup",this._mouseUpListener.bind(this));const n=()=>{this.visibleResizer&&this.visibleResizer.redraw()};this._redrawFocusedResizerThrottled=pm(n,200),this.on("change:visibleResizer",n),this.editor.ui.on("update",this._redrawFocusedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[t,e]of this._resizers)t.isAttached()||(this._resizers.delete(t),e.destroy())}),{priority:"lowest"}),this._observer.listenTo(is.window,"resize",this._redrawFocusedResizerThrottled);const o=this.editor.editing.view.document.selection;o.on("change",(()=>{const t=o.getSelectedElement();this.visibleResizer=this.getResizerByViewElement(t)||null}))}destroy(){this._observer.stopListening();for(const t of this._resizers.values())t.destroy();this._redrawFocusedResizerThrottled.cancel()}attachTo(t){const e=new ff(t),n=this.editor.plugins;if(e.attach(),n.has("WidgetToolbarRepository")){const t=n.get("WidgetToolbarRepository");e.on("begin",(()=>{t.forceDisabled("resize")}),{priority:"lowest"}),e.on("cancel",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"}),e.on("commit",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(t.viewElement,e);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==e&&(this.visibleResizer=e),e}getResizerByViewElement(t){return this._resizers.get(t)}_getResizerByHandle(t){for(const e of this._resizers.values())if(e.containsHandle(t))return e}_mouseDownListener(t,e){const n=e.domTarget;ff.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n),this._activeResizer&&(this._activeResizer.begin(n),t.stop(),e.preventDefault()))}_mouseMoveListener(t,e){this._activeResizer&&this._activeResizer.updateSize(e)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}},re);class wf extends me{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(t){const e=this.editor,n=e.plugins.get("ImageUtils"),o=e.model,i=n.getClosestSelectedImageElement(o.document.selection);o.change((e=>{e.setAttribute("alt",t.newValue,i)}))}}function _f(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot()])}function Af(t,e){const n=t.plugins.get("ImageUtils"),o=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>{if(!n.isInlineImageView(t))return null;if(!o)return i(t);return(t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:i(t)};function i(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function Cf(t,e){const n=Ta(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}class vf extends ue{static get pluginName(){return"ImageUtils"}isImage(t){return this.isInlineImage(t)||this.isBlockImage(t)}isInlineImageView(t){return!!t&&t.is("element","img")}isBlockImageView(t){return!!t&&t.is("element","figure")&&t.hasClass("image")}insertImage(t={},e=null,n=null){const o=this.editor,i=o.model,r=i.document.selection;n=yf(o,e||r,n),t={...Object.fromEntries(r.getAttributes()),...t};for(const e in t)i.schema.checkAttribute(n,e)||delete t[e];return i.change((o=>{const r=o.createElement(n,t);return i.insertObject(r,e,null,{setSelection:"on",findOptimalPosition:!e&&"imageInline"!=n}),r.parent?r:null}))}getClosestSelectedImageWidget(t){const e=t.getSelectedElement();if(e&&this.isImageWidget(e))return e;let n=t.getFirstPosition().parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent}return null}getClosestSelectedImageElement(t){const e=t.getSelectedElement();return this.isImage(e)?e:t.getFirstPosition().findAncestor("imageBlock")}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){if("imageBlock"==yf(t,e)){const n=function(t,e){const n=Qg(t,e).start.parent;if(n.isEmpty&&!n.is("element","$root"))return n.parent;return n}(e,t.model);if(t.model.schema.checkChild(n,"imageBlock"))return!0}else if(t.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}(this.editor,t)&&function(t){return[...t.focus.getAncestors()].every((t=>!t.is("element","imageBlock")))}(t)}toImageWidget(t,e,n){e.setCustomProperty("image",!0,t);return Ug(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&Hg(t)}isBlockImage(t){return!!t&&t.is("element","imageBlock")}isInlineImage(t){return!!t&&t.is("element","imageInline")}findViewImgElement(t){if(this.isInlineImageView(t))return t;const e=this.editor.editing.view;for(const{item:n}of e.createRangeIn(t))if(this.isInlineImageView(n))return n}}function yf(t,e,n){const o=t.model.schema,i=t.config.get("image.insert.type");return t.plugins.has("ImageBlockEditing")?t.plugins.has("ImageInlineEditing")?n||("inline"===i?"imageInline":"block"===i?"imageBlock":e.is("selection")?Cf(o,e):o.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class xf extends ue{static get requires(){return[vf]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new wf(this.editor))}}var Df=n(1905),Ef={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Df.Z,Ef);Df.Z.locals;var Mf=n(6764),If={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Mf.Z,If);Mf.Z.locals;class Sf extends jd{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),Nd.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),Nd.cancel,"ck-button-cancel","cancel"),this._focusables=new Ld,this._focusCycler=new Ph({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]}),zd(this)}render(){super.render(),this.keystrokes.listenTo(this.element),Pd({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,o){const i=new fh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createLabeledInputView(){const t=this.locale.t,e=new Au(this.locale,Cu);return e.label=t("Text alternative"),e}}function Tf(t){const e=t.editing.view,n=Su.defaultPositions,o=t.plugins.get("ImageUtils");return{target:e.domConverter.viewToDom(o.getClosestSelectedImageWidget(e.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class Nf extends ue{static get requires(){return[Ou]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",(n=>{const o=t.commands.get("imageTextAlternative"),i=new fh(n);return i.set({label:e("Change image text alternative"),icon:Nd.lowVision,tooltip:!0}),i.bind("isEnabled").to(o,"isEnabled"),this.listenTo(i,"execute",(()=>{this._showForm()})),i}))}_createForm(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Sf(t.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{t.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),this.listenTo(t.ui,"update",(()=>{n.getClosestSelectedImageWidget(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=Tf(t);e.updatePosition(n)}}(t):this._hideForm(!0)})),Bd({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:Tf(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class Bf extends ue{static get requires(){return[xf,Nf]}static get pluginName(){return"ImageTextAlternative"}}function zf(t,e){return t=>{t.on(`attribute:srcset:${e}`,n)};function n(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);if(null===n.attributeNewValue){const t=n.attributeOldValue;t.data&&(i.removeAttribute("srcset",s),i.removeAttribute("sizes",s),t.width&&i.removeAttribute("width",s))}else{const t=n.attributeNewValue;t.data&&(i.setAttribute("srcset",t.data,s),i.setAttribute("sizes","100vw",s),t.width&&i.setAttribute("width",t.width,s))}}}function Pf(t,e,n){return t=>{t.on(`attribute:${n}:${e}`,o)};function o(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);i.setAttribute(n.attributeKey,n.attributeNewValue||"",s)}}class Lf extends Cs{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}class Of extends me{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&l("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&l("image-inline-plugin-required")}refresh(){this.isEnabled=this.editor.plugins.get("ImageUtils").isImageAllowed()}execute(t){const e=So(t.source),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if("string"==typeof t&&(t={src:t}),e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);o.insertImage({...t,...i},e)}else o.insertImage({...t,...i})}))}}class Rf extends ue{static get requires(){return[vf]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(Lf),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:t=>{const e={data:t.getAttribute("srcset")};return t.hasAttribute("width")&&(e.width=t.getAttribute("width")),e}}});const n=new Of(t);t.commands.add("insertImage",n),t.commands.add("imageInsert",n)}}class jf extends me{constructor(t,e){super(t),this._modelElementName=e}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=t.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=t.isInlineImage(e):this.isEnabled=t.isBlockImage(e)}execute(){const t=this.editor,e=this.editor.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(e.document.selection),i=Object.fromEntries(o.getAttributes());return i.src||i.uploadId?e.change((t=>{const r=Array.from(e.markers).filter((t=>t.getRange().containsItem(o))),s=n.insertImage(i,e.createSelection(o,"on"),this._modelElementName);if(!s)return null;const a=t.createRangeOn(s);for(const e of r){const n=e.getRange(),o="$graveyard"!=n.root.rootName?n.getJoined(a,!0):a;t.updateMarker(e,{range:o})}return{oldElement:o,newElement:s}})):null}}class Ff extends ue{static get requires(){return[Rf,vf,vg]}static get pluginName(){return"ImageBlockEditing"}init(){const t=this.editor;t.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),t.plugins.has("ImageInlineEditing")&&(t.commands.add("imageTypeBlock",new jf(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:e})=>_f(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>o.toImageWidget(_f(n),n,e("image widget"))}),n.for("downcast").add(Pf(o,"imageBlock","src")).add(Pf(o,"imageBlock","alt")).add(zf(o,"imageBlock")),n.for("upcast").elementToElement({view:Af(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)}).add(function(t){return t=>{t.on("element:figure",e)};function e(e,n,o){if(!o.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const i=t.findViewImgElement(n.viewItem);if(!i||!o.consumable.test(i,{name:!0}))return;o.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=Ta(o.convertItem(i,n.modelCursor).modelRange.getItems());r?(o.convertChildren(n.viewItem,r),o.updateConversionResult(r,n)):o.consumable.revert(n.viewItem,{name:!0,classes:"image"})}}(o))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isInlineImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageBlock"===Cf(e.schema,c)){const t=new gg(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}}))}}var Vf=n(3508),Hf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Vf.Z,Hf);Vf.Z.locals;class Uf extends ue{static get requires(){return[Ff,gm,Bf]}static get pluginName(){return"ImageBlock"}}class qf extends ue{static get requires(){return[Rf,vf,vg]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor,e=t.model.schema;e.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),e.addChildCheck(((t,e)=>{if(t.endsWith("caption")&&"imageInline"===e.name)return!1})),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new jf(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(t,{writer:e})=>e.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(t,{writer:n})=>o.toImageWidget(function(t){return t.createContainerElement("span",{class:"image-inline"},t.createEmptyElement("img"))}(n),n,e("image widget"))}),n.for("downcast").add(Pf(o,"imageInline","src")).add(Pf(o,"imageInline","alt")).add(zf(o,"imageInline")),n.for("upcast").elementToElement({view:Af(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isBlockImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageInline"===Cf(e.schema,c)){const t=new gg(n.document),e=s.map((e=>1===e.childCount?(Array.from(e.getAttributes()).forEach((n=>t.setAttribute(...n,o.findViewImgElement(e)))),e.getChild(0)):e));r.content=t.createDocumentFragment(e)}}))}}class Gf extends ue{static get requires(){return[qf,gm,Bf]}static get pluginName(){return"ImageInline"}}class Wf extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils");if(!t.plugins.has(Ff))return this.isEnabled=!1,void(this.value=!1);const n=t.model.document.selection,o=n.getSelectedElement();if(!o){const t=e.getCaptionFromModelSelection(n);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=this.editor.plugins.get("ImageUtils").isImage(o),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(o):this.value=!1}execute(t={}){const{focusCaptionOnShow:e}=t;this.editor.model.change((t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)}))}_showImageCaption(t,e){const n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing");let i=n.getSelectedElement();const r=o._getSavedCaption(i);this.editor.plugins.get("ImageUtils").isInlineImage(i)&&(this.editor.execute("imageTypeBlock"),i=n.getSelectedElement());const s=r||t.createElement("caption");t.append(s,i),e&&t.setSelection(s,"in")}_hideImageCaption(t){const e=this.editor,n=e.model.document.selection,o=e.plugins.get("ImageCaptionEditing"),i=e.plugins.get("ImageCaptionUtils");let r,s=n.getSelectedElement();s?r=i.getCaptionFromImageModelElement(s):(r=i.getCaptionFromModelSelection(n),s=r.parent),o._saveCaption(s,r),t.setSelection(s,"on"),t.remove(r)}}class Yf extends ue{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[vf]}getCaptionFromImageModelElement(t){for(const e of t.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(t){const e=this.editor.plugins.get("ImageUtils"),n=t.getFirstPosition().findAncestor("caption");return n&&e.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(t){const e=this.editor.plugins.get("ImageUtils");return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}}class Kf extends ue{static get requires(){return[vf,Yf]}static get pluginName(){return"ImageCaptionEditing"}constructor(t){super(t),this._savedCaptionsMap=new WeakMap}init(){const t=this.editor,e=t.model.schema;e.isRegistered("caption")?e.extend("caption",{allowIn:"imageBlock"}):e.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleImageCaption",new Wf(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration()}_setupConversion(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils"),o=t.plugins.get("ImageCaptionUtils"),i=t.t;t.conversion.for("upcast").elementToElement({view:t=>o.matchImageCaptionViewElement(t),model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>n.isBlockImage(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:o})=>{if(!n.isBlockImage(t.parent))return null;const r=o.createEditableElement("figcaption");return o.setCustomProperty("imageCaption",!0,r),Qu({view:e,element:r,text:i("Enter image caption"),keepOnFocus:!0}),Kg(r,o)}})}_setupImageTypeCommandsIntegration(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.plugins.get("ImageCaptionUtils"),o=t.commands.get("imageTypeInline"),i=t.commands.get("imageTypeBlock"),r=t=>{if(!t.return)return;const{oldElement:o,newElement:i}=t.return;if(!o)return;if(e.isBlockImage(o)){const t=n.getCaptionFromImageModelElement(o);if(t)return void this._saveCaption(i,t)}const r=this._getSavedCaption(o);r&&this._saveCaption(i,r)};o&&this.listenTo(o,"execute",r,{priority:"low"}),i&&this.listenTo(i,"execute",r,{priority:"low"})}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?Va.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}}class Qf extends ue{static get requires(){return[Yf]}static get pluginName(){return"ImageCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageCaptionUtils"),o=t.t;t.ui.componentFactory.add("toggleImageCaption",(i=>{const r=t.commands.get("toggleImageCaption"),s=new fh(i);return s.set({icon:Nd.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(t=>o(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{t.execute("toggleImageCaption",{focusCaptionOnShow:!0});const o=n.getCaptionFromModelSelection(t.model.document.selection);if(o){const n=t.editing.mapper.toViewElement(o);e.scrollToTheSelection(),e.change((t=>{t.addClass("image__caption_highlighted",n)}))}})),s}))}}var $f=n(2640),Zf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()($f.Z,Zf);$f.Z.locals;class Jf extends me{constructor(t,e){super(t),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(e.map((t=>{if(t.isDefault)for(const e of t.modelElements)this._defaultStyles[e]=t.name;return[t.name,t]})))}refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?t.hasAttribute("imageStyle")?this.value=t.getAttribute("imageStyle"):this.value=this._defaultStyles[t.name]:this.value=!1}execute(t={}){const e=this.editor,n=e.model,o=e.plugins.get("ImageUtils");n.change((e=>{const i=t.value;let r=o.getClosestSelectedImageElement(n.document.selection);i&&this.shouldConvertImageType(i,r)&&(this.editor.execute(o.isBlockImage(r)?"imageTypeInline":"imageTypeBlock"),r=o.getClosestSelectedImageElement(n.document.selection)),!i||this._styles.get(i).isDefault?e.removeAttribute("imageStyle",r):e.setAttribute("imageStyle",i,r)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}const{objectFullWidth:Xf,objectInline:tk,objectLeft:ek,objectRight:nk,objectCenter:ok,objectBlockLeft:ik,objectBlockRight:rk}=Nd,sk={get inline(){return{name:"inline",title:"In line",icon:tk,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:ek,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:ik,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:ok,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:nk,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:rk,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:ok,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:nk,modelElements:["imageBlock"],className:"image-style-side"}}},ak={full:Xf,left:ik,right:rk,center:ok,inlineLeft:ek,inlineRight:nk,inline:tk},ck=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function lk(t){l("image-style-configuration-definition-invalid",t)}const dk={normalizeStyles:function(t){return(t.configuredStyles.options||[]).map((t=>function(t){t="string"==typeof t?sk[t]?{...sk[t]}:{name:t}:function(t,e){const n={...e};for(const o in t)Object.prototype.hasOwnProperty.call(e,o)||(n[o]=t[o]);return n}(sk[t.name],t);"string"==typeof t.icon&&(t.icon=ak[t.icon]||t.icon);return t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:o,name:i}=t;if(!(o&&o.length&&i))return lk({style:t}),!1;{const i=[e?"imageBlock":null,n?"imageInline":null];if(!o.some((t=>i.includes(t))))return l("image-style-missing-dependency",{style:t,missingPlugins:o.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)))},getDefaultStylesConfiguration:function(t,e){return t&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:t?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(t){return t.has("ImageBlockEditing")&&t.has("ImageInlineEditing")?[...ck]:[]},warnInvalidStyle:lk,DEFAULT_OPTIONS:sk,DEFAULT_ICONS:ak,DEFAULT_DROPDOWN_DEFINITIONS:ck};function hk(t,e){for(const n of e)if(n.name===t)return n}class uk extends ue{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[vf]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=dk,n=this.editor,o=n.plugins.has("ImageBlockEditing"),i=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",e(o,i)),this.normalizedStyles=t({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:o,isInlinePluginLoaded:i}),this._setupConversion(o,i),this._setupPostFixer(),n.commands.add("imageStyle",new Jf(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,o=n.model.schema,i=(r=this.normalizedStyles,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const o=hk(e.attributeNewValue,r),i=hk(e.attributeOldValue,r),s=n.mapper.toViewElement(e.item),a=n.writer;i&&a.removeClass(i.className,s),o&&a.addClass(o.className,s)});var r;const s=function(t){const e={imageInline:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageInline"))),imageBlock:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageBlock")))};return(t,n,o)=>{if(!n.modelRange)return;const i=n.viewItem,r=Ta(n.modelRange.getItems());if(r&&o.schema.checkAttribute(r,"imageStyle"))for(const t of e[r.name])o.consumable.consume(i,{classes:t.className})&&o.writer.setAttribute("imageStyle",t.name,r)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",i),n.data.downcastDispatcher.on("attribute:imageStyle",i),t&&(o.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),e&&(o.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(vf),o=new Map(this.normalizedStyles.map((t=>[t.name,t])));e.registerPostFixer((t=>{let i=!1;for(const r of e.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let e="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(e&&e.is("element","paragraph")&&e.childCount>0&&(e=e.getChild(0)),!n.isImage(e))continue;const s=e.getAttribute("imageStyle");if(!s)continue;const a=o.get(s);a&&a.modelElements.includes(e.name)||(t.removeAttribute("imageStyle",e),i=!0)}return i}))}}var gk=n(5083),mk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(gk.Z,mk);gk.Z.locals;class pk extends ue{static get requires(){return[uk]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Wrap text":t("Wrap text"),"Break text":t("Break text"),"In line":t("In line"),"Full size image":t("Full size image"),"Side image":t("Side image"),"Left aligned image":t("Left aligned image"),"Centered image":t("Centered image"),"Right aligned image":t("Right aligned image")}}init(){const t=this.editor.plugins,e=this.editor.config.get("image.toolbar")||[],n=fk(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const o=fk([...e.filter(x),...dk.getDefaultDropdownDefinitions(t)],this.localizedDefaultStylesTitles);for(const t of o)this._createDropdown(t,n)}_createDropdown(t,e){const n=this.editor.ui.componentFactory;n.add(t.name,(o=>{let i;const{defaultItem:r,items:s,title:a}=t,c=s.filter((t=>e.find((({name:e})=>kk(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(i=e),e}));s.length!==c.length&&dk.warnInvalidStyle({dropdown:t});const l=eu(o,Dh),d=l.buttonView;return nu(l,c),d.set({label:bk(a,i.label),class:null,tooltip:!0}),d.bind("icon").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return e<0?i.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return bk(a,e<0?i.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(st))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(st)?"ck-splitbutton_flatten":null)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:i.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(st))),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(kk(e),(n=>{const o=this.editor.commands.get("imageStyle"),i=new fh(n);return i.set({label:t.title,icon:t.icon,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(o,"isEnabled"),i.bind("isOn").to(o,"value",(t=>t===e)),i.on("execute",this._executeCommand.bind(this,e)),i}))}_executeCommand(t){this.editor.execute("imageStyle",{value:t}),this.editor.editing.view.focus()}}function fk(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function kk(t){return`imageStyle:${t}`}function bk(t,e){return(t?t+": ":"")+e}function wk(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function _k(t){return new Promise(((e,n)=>{const o=t.getAttribute("src");fetch(o).then((t=>t.blob())).then((t=>{const n=Ak(t,o),i=n.replace("image/",""),r=new File([t],`image.${i}`,{type:n});e(r)})).catch((t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise(((e,n)=>{const o=is.document.createElement("img");o.addEventListener("load",(()=>{const t=is.document.createElement("canvas");t.width=o.width,t.height=o.height;t.getContext("2d").drawImage(o,0,0),t.toBlob((t=>t?e(t):n()))})),o.addEventListener("error",(()=>n())),o.src=t}))}(t).then((e=>{const n=Ak(e,t),o=n.replace("image/","");return new File([e],`image.${o}`,{type:n})}))}(o).then(e).catch(n):n(t)))}))}function Ak(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class Ck extends ue{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor,e=t.t,n=n=>{const o=new wp(n),i=t.commands.get("uploadImage"),r=t.config.get("image.upload.types"),s=wk(r);return o.set({acceptedType:r.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0}),o.buttonView.set({label:e("Insert image"),icon:Nd.image,tooltip:!0}),o.buttonView.bind("isEnabled").to(i),o.on("done",((e,n)=>{const o=Array.from(n).filter((t=>s.test(t.type)));o.length&&t.execute("uploadImage",{file:o})})),o};t.ui.componentFactory.add("uploadImage",n),t.ui.componentFactory.add("imageUpload",n)}}var vk=n(3689),yk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(vk.Z,yk);vk.Z.locals;var xk=n(4036),Dk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(xk.Z,Dk);xk.Z.locals;var Ek=n(3773),Mk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Ek.Z,Mk);Ek.Z.locals;class Ik extends ue{static get pluginName(){return"ImageUploadProgress"}constructor(t){super(t),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",((...t)=>this.uploadStatusChange(...t))),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",((...t)=>this.uploadStatusChange(...t)))}uploadStatusChange(t,e,n){const o=this.editor,i=e.item,r=i.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=o.plugins.get("ImageUtils"),a=o.plugins.get(kp),c=r?e.attributeNewValue:null,l=this.placeholder,d=o.editing.mapper.toViewElement(i),h=n.writer;if("reading"==c)return Sk(d,h),void Tk(s,l,d,h);if("uploading"==c){const t=a.loaders.get(r);return Sk(d,h),void(t?(Nk(d,h),function(t,e,n,o){const i=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),i),n.on("change:uploadedPercent",((t,e,n)=>{o.change((t=>{t.setStyle("width",n+"%",i)}))}))}(d,h,t,o.editing.view),function(t,e,n,o){if(o.data){const i=t.findViewImgElement(e);n.setAttribute("src",o.data,i)}}(s,d,h,t)):Tk(s,l,d,h))}"complete"==c&&a.loaders.get(r)&&function(t,e,n){const o=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),o),setTimeout((()=>{n.change((t=>t.remove(t.createRangeOn(o))))}),3e3)}(d,h,o.editing.view),function(t,e){zk(t,e,"progressBar")}(d,h),Nk(d,h),function(t,e){e.removeClass("ck-appear",t)}(d,h)}}function Sk(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function Tk(t,e,n,o){n.hasClass("ck-image-upload-placeholder")||o.addClass("ck-image-upload-placeholder",n);const i=t.findViewImgElement(n);i.getAttribute("src")!==e&&o.setAttribute("src",e,i),Bk(n,"placeholder")||o.insert(o.createPositionAfter(i),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(o))}function Nk(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),zk(t,e,"placeholder")}function Bk(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function zk(t,e,n){const o=Bk(t,n);o&&e.remove(e.createRangeOn(o))}class Pk extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(n)}execute(t){const e=So(t.file),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if(e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);this._uploadImage(t,i,e)}else this._uploadImage(t,i)}))}_uploadImage(t,e,n){const o=this.editor,i=o.plugins.get(kp).createLoader(t),r=o.plugins.get("ImageUtils");i&&r.insertImage({...e,uploadId:i.id},n)}}class Lk extends ue{static get requires(){return[kp,vu,vg,vf]}static get pluginName(){return"ImageUploadEditing"}constructor(t){super(t),t.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const t=this.editor,e=t.model.document,n=t.conversion,o=t.plugins.get(kp),i=t.plugins.get("ImageUtils"),r=wk(t.config.get("image.upload.types")),s=new Pk(t);t.commands.add("uploadImage",s),t.commands.add("imageUpload",s),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,n)=>{if(o=n.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const i=Array.from(n.dataTransfer.files).filter((t=>!!t&&r.test(t.type)));i.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.model.enqueueChange((()=>{t.execute("uploadImage",{file:i})}))})))})),this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).filter((t=>function(t,e){return!(!t.isInlineImageView(e)||!e.getAttribute("src"))&&(e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||e.getAttribute("src").match(/^blob:/g))}(i,t.item)&&!t.item.getAttribute("uploadProcessed"))).map((t=>({promise:_k(t.item),imageElement:t.item})));if(!r.length)return;const s=new gg(t.editing.view.document);for(const t of r){s.setAttribute("uploadProcessed",!0,t.imageElement);const e=o.createLoader(t.promise);e&&(s.setAttribute("src","",t.imageElement),s.setAttribute("uploadId",e.id,t.imageElement))}})),t.editing.view.document.on("dragover",((t,e)=>{e.preventDefault()})),e.on("change",(()=>{const n=e.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),i=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter,r="$graveyard"==e.position.root.rootName;for(const e of Ok(t,n)){const t=e.getAttribute("uploadId");if(!t)continue;const n=o.loaders.get(t);n&&(r?i.has(t)||n.abort():(i.add(t),this._uploadImageElements.set(t,e),"idle"==n.status&&this._readAndUpload(n)))}}})),this.on("uploadComplete",((t,{imageElement:e,data:n})=>{const o=n.urls?n.urls:n;this.editor.model.change((t=>{t.setAttribute("src",o.default,e),this._parseAndSetSrcsetAttributeOnImage(o,e,t)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(t){const e=this.editor,n=e.model,o=e.locale.t,i=e.plugins.get(kp),r=e.plugins.get(vu),s=e.plugins.get("ImageUtils"),a=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","reading",a.get(t.id))})),t.read().then((()=>{const o=t.upload(),i=a.get(t.id);if(sr.isSafari){const t=e.editing.mapper.toViewElement(i),n=s.findViewImgElement(t);e.editing.view.once("render",(()=>{if(!n.parent)return;const t=e.editing.view.domConverter.mapViewToDom(n.parent);if(!t)return;const o=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=o}))}return n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",i)})),o})).then((e=>{n.enqueueChange({isUndoable:!1},(n=>{const o=a.get(t.id);n.setAttribute("uploadStatus","complete",o),this.fire("uploadComplete",{data:e,imageElement:o})})),c()})).catch((e=>{if("error"!==t.status&&"aborted"!==t.status)throw e;"error"==t.status&&e&&r.showWarning(e,{title:o("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{e.remove(a.get(t.id))})),c()}));function c(){n.enqueueChange({isUndoable:!1},(e=>{const n=a.get(t.id);e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n),a.delete(t.id)})),i.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let o=0;const i=Object.keys(t).filter((t=>{const e=parseInt(t,10);if(!isNaN(e))return o=Math.max(o,e),!0})).map((e=>`${t[e]} ${e}w`)).join(", ");""!=i&&n.setAttribute("srcset",{data:i,width:o},e)}}function Ok(t,e){const n=t.plugins.get("ImageUtils");return Array.from(t.model.createRangeOn(e)).filter((t=>n.isImage(t.item))).map((t=>t.item))}class Rk extends ue{static get pluginName(){return"IndentEditing"}init(){const t=this.editor;t.commands.add("indent",new fe(t)),t.commands.add("outdent",new fe(t))}}const jk='',Fk='';class Vk extends ue{static get pluginName(){return"IndentUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?jk:Fk,i="ltr"==e.uiLanguageDirection?Fk:jk;this._defineButton("indent",n("Increase indent"),o),this._defineButton("outdent",n("Decrease indent"),i)}_defineButton(t,e,n){const o=this.editor;o.ui.componentFactory.add(t,(i=>{const r=o.commands.get(t),s=new fh(i);return s.set({label:e,icon:n,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",(()=>{o.execute(t),o.editing.view.focus()})),s}))}}class Hk{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(t){Array.isArray(t)?t.forEach((t=>this._definitions.add(t))):this._definitions.add(t)}getDispatcher(){return t=>{t.on("attribute:linkHref",((t,e,n)=>{if(!n.consumable.test(e.item,"attribute:linkHref"))return;if(!e.item.is("selection")&&!n.schema.isInline(e.item))return;const o=n.writer,i=o.document.selection;for(const t of this._definitions){const r=o.createAttributeElement("a",t.attributes,{priority:5});t.classes&&o.addClass(t.classes,r);for(const e in t.styles)o.setStyle(e,t.styles[e],r);o.setCustomProperty("link",!0,r),t.callback(e.attributeNewValue)?e.item.is("selection")?o.wrap(i.getFirstRange(),r):o.wrap(n.mapper.toViewRange(e.range),r):o.unwrap(n.mapper.toViewRange(e.range),r)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return t=>{t.on("attribute:linkHref:imageBlock",((t,e,{writer:n,mapper:o})=>{const i=o.toViewElement(e.item),r=Array.from(i.getChildren()).find((t=>"a"===t.name));for(const t of this._definitions){const o=Ho(t.attributes);if(t.callback(e.attributeNewValue)){for(const[t,e]of o)"class"===t?n.addClass(e,r):n.setAttribute(t,e,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r)}else{for(const[t,e]of o)"class"===t?n.removeClass(e,r):n.removeAttribute(t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r)}}}))}}}const Uk=function(t,e,n){var o=t.length;return n=void 0===n?o:n,!e&&n>=o?t:hi(t,e,n)};var qk=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const Gk=function(t){return qk.test(t)};const Wk=function(t){return t.split("")};var Yk="[\\ud800-\\udfff]",Kk="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Qk="\\ud83c[\\udffb-\\udfff]",$k="[^\\ud800-\\udfff]",Zk="(?:\\ud83c[\\udde6-\\uddff]){2}",Jk="[\\ud800-\\udbff][\\udc00-\\udfff]",Xk="(?:"+Kk+"|"+Qk+")"+"?",tb="[\\ufe0e\\ufe0f]?",eb=tb+Xk+("(?:\\u200d(?:"+[$k,Zk,Jk].join("|")+")"+tb+Xk+")*"),nb="(?:"+[$k+Kk+"?",Kk,Zk,Jk,Yk].join("|")+")",ob=RegExp(Qk+"(?="+Qk+")|"+nb+eb,"g");const ib=function(t){return t.match(ob)||[]};const rb=function(t){return Gk(t)?ib(t):Wk(t)};const sb=function(t){return function(e){e=si(e);var n=Gk(e)?rb(e):void 0,o=n?n[0]:e.charAt(0),i=n?Uk(n,1).join(""):e.slice(1);return o[t]()+i}}("toUpperCase"),ab=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,cb=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,lb=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,db=/^((\w+:(\/{2,})?)|(\W))/i,hb="Ctrl+K";function ub(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function gb(t){return function(t){return t.replace(ab,"").match(cb)}(t=String(t))?t:"#"}function mb(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function pb(t,e){const n=(o=t,lb.test(o)?"mailto:":e);var o;const i=!!n&&!db.test(t);return t&&i?n+t:t}function fb(t){window.open(t,"_blank","noopener")}class kb extends me{constructor(t){super(t),this.manualDecorators=new Mo,this.automaticDecorators=new Hk}restoreManualDecoratorStates(){for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement()||Ta(e.getSelectedBlocks());mb(n,t.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttribute(n,"linkHref")):(this.value=e.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref"));for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}execute(t,e={}){const n=this.editor.model,o=n.document.selection,i=[],r=[];for(const t in e)e[t]?i.push(t):r.push(t);n.change((e=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=ip(s,"linkHref",o.getAttribute("linkHref"),n);e.setAttribute("linkHref",t,a),i.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)})),e.setSelection(e.createPositionAfter(a.end.nodeBefore))}else if(""!==t){const r=Ho(o.getAttributes());r.set("linkHref",t),i.forEach((t=>{r.set(t,!0)}));const{end:a}=n.insertContent(e.createText(t,r),s);e.setSelection(a)}["linkHref",...i,...r].forEach((t=>{e.removeSelectionAttribute(t)}))}else{const s=n.schema.getValidRanges(o.getRanges(),"linkHref"),a=[];for(const t of o.getSelectedBlocks())n.schema.checkAttribute(t,"linkHref")&&a.push(e.createRangeOn(t));const c=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&c.push(t);for(const n of c)e.setAttribute("linkHref",t,n),i.forEach((t=>{e.setAttribute(t,!0,n)})),r.forEach((t=>{e.removeAttribute(t,n)}))}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,o=n.getSelectedElement();return mb(o,e.schema)?o.getAttribute(t):n.getAttribute(t)}_isRangeToUpdate(t,e){for(const n of e)if(n.containsRange(t))return!1;return!0}}class bb extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();mb(n,t.schema)?this.isEnabled=t.schema.checkAttribute(n,"linkHref"):this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref")}execute(){const t=this.editor,e=this.editor.model,n=e.document.selection,o=t.commands.get("link");e.change((t=>{const i=n.isCollapsed?[ip(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),e)]:e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of i)if(t.removeAttribute("linkHref",e),o)for(const n of o.manualDecorators)t.removeAttribute(n.id,e)}))}}class wb{constructor({id:t,label:e,attributes:n,classes:o,styles:i,defaultValue:r}){this.id=t,this.set("value"),this.defaultValue=r,this.label=e,this.attributes=n,this.classes=o,this.styles=i}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}he(wb,re);var _b=n(9773),Ab={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(_b.Z,Ab);_b.Z.locals;const Cb="automatic",vb=/^(https?:)?\/\//;class yb extends ue{static get pluginName(){return"LinkEditing"}static get requires(){return[Um,jm,vg]}constructor(t){super(t),t.config.define("link",{addTargetToExternalLinks:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:ub}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,e)=>ub(gb(t),e)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new kb(t)),t.commands.add("unlink",new bb(t));const e=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>(t.label&&n[t.label]&&(t.label=n[t.label]),t))),e}(t.t,function(t){const e=[];if(t)for(const[n,o]of Object.entries(t)){const t=Object.assign({},o,{id:`link${sb(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(e.filter((t=>t.mode===Cb))),this._enableManualDecorators(e.filter((t=>"manual"===t.mode)));t.plugins.get(Um).registerAttribute("linkHref"),function(t,e,n,o){const i=t.editing.view,r=new Set;i.document.registerPostFixer((i=>{const s=t.model.document.selection;let a=!1;if(s.hasAttribute(e)){const c=ip(s.getFirstPosition(),e,s.getAttribute(e),t.model),l=t.editing.mapper.toViewRange(c);for(const t of l.getItems())t.is("element",n)&&!t.hasClass(o)&&(i.addClass(o,t),r.add(t),a=!0)}return a})),t.conversion.for("editingDowncast").add((t=>{function e(){i.change((t=>{for(const e of r.values())t.removeClass(o,e),r.delete(e)}))}t.on("insert",e,{priority:"highest"}),t.on("remove",e,{priority:"highest"}),t.on("attribute",e,{priority:"highest"}),t.on("selection",e,{priority:"highest"})}))}(t,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:Cb,callback:t=>vb.test(t),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(t),n.length&&e.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(t){if(!t.length)return;const e=this.editor,n=e.commands.get("link").manualDecorators;t.forEach((t=>{e.model.schema.extend("$text",{allowAttributes:t.id}),t=new wb(t),n.add(t),e.conversion.for("downcast").attributeToElement({model:t.id,view:(e,{writer:n,schema:o},{item:i})=>{if(o.isInline(i)&&e){const e=n.createAttributeElement("a",t.attributes,{priority:5});t.classes&&n.addClass(t.classes,e);for(const o in t.styles)n.setStyle(o,t.styles[o],e);return n.setCustomProperty("link",!0,e),e}}}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",...t._createPattern()},model:{key:t.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document,n=t.model.document;this.listenTo(e,"click",((t,e)=>{if(!(sr.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const o=n.getAttribute("href");o&&(t.stop(),e.preventDefault(),fb(o))}),{context:"$capture"}),this.listenTo(e,"enter",((t,e)=>{const o=n.selection,i=o.getSelectedElement(),r=i?i.getAttribute("linkHref"):o.getAttribute("linkHref");r&&e.domEvent.altKey&&(t.stop(),fb(r))}),{context:"a"})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(t,"insertContent",(()=>{const n=e.anchor.nodeBefore,o=e.anchor.nodeAfter;e.hasAttribute("linkHref")&&n&&n.hasAttribute("linkHref")&&(o&&o.hasAttribute("linkHref")||t.change((e=>{xb(e,Eb(t.schema))})))}),{priority:"low"})}_enableClickingAfterLink(){const t=this.editor,e=t.model;t.editing.view.addObserver(ug);let n=!1;this.listenTo(t.editing.view.document,"mousedown",(()=>{n=!0})),this.listenTo(t.editing.view.document,"selectionChange",(()=>{if(!n)return;n=!1;const t=e.document.selection;if(!t.isCollapsed)return;if(!t.hasAttribute("linkHref"))return;const o=t.getFirstPosition(),i=ip(o,"linkHref",t.getAttribute("linkHref"),e);(o.isTouching(i.start)||o.isTouching(i.end))&&e.change((t=>{xb(t,Eb(e.schema))}))}))}_enableTypingOverLink(){const t=this.editor,e=t.editing.view;let n,o;this.listenTo(e.document,"delete",(()=>{o=!0}),{priority:"high"}),this.listenTo(t.model,"deleteContent",(()=>{const e=t.model.document.selection;e.isCollapsed||(o?o=!1:Db(t)&&function(t){const e=t.document.selection,n=e.getFirstPosition(),o=e.getLastPosition(),i=n.nodeAfter;if(!i)return!1;if(!i.is("$text"))return!1;if(!i.hasAttribute("linkHref"))return!1;const r=o.textNode||o.nodeBefore;if(i===r)return!0;return ip(n,"linkHref",i.getAttribute("linkHref"),t).containsRange(t.createRange(n,o),!0)}(t.model)&&(n=e.getAttributes()))}),{priority:"high"}),this.listenTo(t.model,"insertContent",((e,[i])=>{o=!1,Db(t)&&n&&(t.model.change((t=>{for(const[e,o]of n)t.setAttribute(e,o,i)})),n=null)}),{priority:"high"})}_handleDeleteContentAfterLink(){const t=this.editor,e=t.model,n=e.document.selection,o=t.editing.view;let i=!1,r=!1;this.listenTo(o.document,"delete",((t,e)=>{r=e.domEvent.keyCode===dr.backspace}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{i=!1;const t=n.getFirstPosition(),o=n.getAttribute("linkHref");if(!o)return;const r=ip(t,"linkHref",o,e);i=r.containsPosition(t)||r.end.isEqual(t)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{r&&(r=!1,i||t.model.enqueueChange((t=>{xb(t,Eb(e.schema))})))}),{priority:"low"})}}function xb(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}function Db(t){return t.model.change((t=>t.batch)).isTyping}function Eb(t){return t.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))}var Mb=n(7754),Ib={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Mb.Z,Ib);Mb.Z.locals;class Sb extends jd{constructor(t,e){super(t);const n=t.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Nd.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),Nd.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusables=new Ld,this._focusCycler=new Ph({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children}),zd(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),Pd({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].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()}_createUrlInput(){const t=this.locale.t,e=new Au(this.locale,Cu);return e.label=t("Link URL"),e}_createButton(t,e,n,o){const i=new fh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createManualDecoratorSwitches(t){const e=this.createCollection();for(const n of t.manualDecorators){const o=new wh(this.locale);o.set({name:n.id,label:n.label,withText:!0}),o.bind("isOn").toMany([n,t],"value",((t,e)=>void 0===e&&void 0===t?n.defaultValue:t)),o.on("execute",(()=>{n.set("value",!o.isOn)})),e.add(o)}return e}_createFormChildren(t){const e=this.createCollection();if(e.add(this.urlInputView),t.length){const t=new jd;t.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((t=>({tag:"li",children:[t],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),e.add(t)}return e.add(this.saveButtonView),e.add(this.cancelButtonView),e}}var Tb=n(2347),Nb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Tb.Z,Nb);Tb.Z.locals;class Bb extends jd{constructor(t){super(t);const e=t.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(e("Unlink"),'',"unlink"),this.editButtonView=this._createButton(e("Edit link"),Nd.pencil,"edit"),this.set("href"),this._focusables=new Ld,this._focusCycler=new Ph({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].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()}_createButton(t,e,n){const o=new fh(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.delegate("execute").to(this,n),o}_createPreviewButton(){const t=new fh(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("Open link in new tab")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&gb(t))),target:"_blank",rel:"noopener noreferrer"}}),t.bind("label").to(this,"href",(t=>t||n("This link has no URL"))),t.bind("isEnabled").to(this,"href",(t=>!!t)),t.template.tag="a",t.template.eventListeners={},t}}const zb="link-ui";class Pb extends ue{static get requires(){return[Ou]}static get pluginName(){return"LinkUI"}init(){const t=this.editor;t.editing.view.addObserver(hg),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=t.plugins.get(Ou),this._createToolbarLinkButton(),this._enableUserBalloonInteractions(),t.conversion.for("editingDowncast").markerToHighlight({model:zb,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:zb,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const t=this.editor,e=new Bb(t.locale),n=t.commands.get("link"),o=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(o),this.listenTo(e,"edit",(()=>{this._addFormView()})),this.listenTo(e,"unlink",(()=>{t.execute("unlink"),this._hideUI()})),e.keystrokes.set("Esc",((t,e)=>{this._hideUI(),e()})),e.keystrokes.set(hb,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),o=new Sb(t.locale,e);return o.urlInputView.fieldView.bind("value").to(e,"value"),o.urlInputView.bind("isReadOnly").to(e,"isEnabled",(t=>!t)),o.saveButtonView.bind("isEnabled").to(e),this.listenTo(o,"submit",(()=>{const{value:e}=o.urlInputView.fieldView.element,i=pb(e,n);t.execute("link",i,o.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(o,"cancel",(()=>{this._closeFormView()})),o.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),o}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link"),n=t.t;t.keystrokes.set(hb,((t,n)=>{n(),e.isEnabled&&this._showUI(!0)})),t.ui.componentFactory.add("link",(t=>{const o=new fh(t);return o.isEnabled=!0,o.label=n("Link"),o.icon='',o.keystroke=hb,o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(e,"isEnabled"),o.bind("isOn").to(e,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}))}_enableUserBalloonInteractions(){const t=this.editor.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),this.editor.keystrokes.set("Tab",((t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((t,e)=>{this._isUIVisible&&(this._hideUI(),e())})),Bd({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=t.value||""}_closeFormView(){const t=this.editor.commands.get("link");t.restoreManualDecoratorStates(),void 0!==t.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(t=!1){this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),o=r();const i=()=>{const t=this._getSelectedLinkElement(),e=r();n&&!t||!n&&e!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=t,o=e};function r(){return e.selection.focus.getAncestors().reverse().find((t=>t.is("element")))}this.listenTo(t.ui,"update",i),this.listenTo(this._balloon,"change:visibleView",i)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const t=this.editor.editing.view,e=this.editor.model,n=t.document;let o=null;if(e.markers.has(zb)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(zb)),n=t.createRange(t.createPositionBefore(e[0]),t.createPositionAfter(e[e.length-1]));o=t.domConverter.viewRangeToDom(n)}else o=()=>{const e=this._getSelectedLinkElement();return e?t.domConverter.mapViewToDom(e):t.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:o}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection,n=e.getSelectedElement();if(e.isCollapsed||n&&Hg(n))return Lb(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),o=Lb(n.start),i=Lb(n.end);return o&&o==i&&t.createRangeIn(o).getTrimmed().isEqual(n)?o:null}}_showFakeVisualSelection(){const t=this.editor.model;t.change((e=>{const n=t.document.selection.getFirstRange();if(t.markers.has(zb))e.updateMarker(zb,{range:n});else if(n.start.isAtEnd){const o=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(zb,{usingOperation:!1,affectsData:!1,range:e.createRange(o,n.end)})}else e.addMarker(zb,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(zb)&&t.change((t=>{t.removeMarker(zb)}))}}function Lb(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))}const Ob=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})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class Rb extends ue{static get requires(){return[Pg]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",(()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const t=this.editor,e=new Hm(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=jb(t.substr(0,t.length-1));return e?{url:e}:void 0}));e.on("matched:data",((e,n)=>{const{batch:o,range:i,url:r}=n;if(!o.isTyping)return;const s=i.end.getShiftedBy(-1),a=s.getShiftedBy(-r.length),c=t.model.createRange(a,s);this._applyAutoLink(r,c)})),e.bind("isEnabled").to(this)}_enableEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("enter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition();if(!t.parent.previousSibling)return;const n=e.createRangeIn(t.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("shiftEnter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition(),n=e.createRange(e.createPositionAt(t.parent,0),t.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(t){const e=this.editor.model,{text:n,range:o}=Vm(t,e),i=jb(n);if(i){const t=e.createRange(o.end.getShiftedBy(-i.length),o.end);this._applyAutoLink(i,t)}}_applyAutoLink(t,e){const n=this.editor.model,o=this.editor.plugins.get("Delete");this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&n.enqueueChange((i=>{const r=this.editor.config.get("link.defaultProtocol"),s=pb(t,r);i.setAttribute("linkHref",s,e),n.enqueueChange((()=>{o.requestUndoOnBackspace()}))}))}}function jb(t){const e=Ob.exec(t);return e?e[2]:null}class Fb extends me{constructor(t,e){super(t),this.type=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,o=Array.from(n.selection.getSelectedBlocks()).filter((t=>Hb(t,e.schema))),i=void 0!==t.forceValue?!t.forceValue:this.value;e.change((t=>{if(i){let e=o[o.length-1].nextSibling,n=Number.POSITIVE_INFINITY,i=[];for(;e&&"listItem"==e.name&&0!==e.getAttribute("listIndent");){const t=e.getAttribute("listIndent");t=n;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&t[e?"unshift":"push"](i),i=i[e?"previousSibling":"nextSibling"]}}function Hb(t,e){return e.checkChild(t.parent,"listItem")&&!e.isObject(t)}class Ub extends me{constructor(t,e){super(t),this._indentBy="forward"==e?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=t.document;let n=Array.from(e.selection.getSelectedBlocks());t.change((t=>{const e=n[n.length-1];let o=e.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>e.getAttribute("listIndent");)n.push(o),o=o.nextSibling;this._indentBy<0&&(n=n.reverse());for(const e of n){const n=e.getAttribute("listIndent")+this._indentBy;n<0?t.rename(e,"paragraph"):t.setAttribute("listIndent",n,e)}this.fire("_executeCleanup",n)}))}_checkEnabled(){const t=Ta(this.editor.model.document.selection.getSelectedBlocks());if(!t||!t.is("element","listItem"))return!1;if(this._indentBy>0){const e=t.getAttribute("listIndent"),n=t.getAttribute("listType");let o=t.previousSibling;for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=e;){if(o.getAttribute("listIndent")==e)return o.getAttribute("listType")==n;o=o.previousSibling}return!1}return!0}}function qb(t,e){const n=e.mapper,o=e.writer,i="numbered"==t.getAttribute("listType")?"ol":"ul",r=function(t){const e=t.createContainerElement("li");return e.getFillerOffset=$b,e}(o),s=o.createContainerElement(i,null);return o.insert(o.createPositionAt(s,0),r),n.bindElements(t,r),r}function Gb(t,e,n,o){const i=e.parent,r=n.mapper,s=n.writer;let a=r.toViewPosition(o.createPositionBefore(t));const c=Kb(t.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:t.getAttribute("listIndent")}),l=t.previousSibling;if(c&&c.getAttribute("listIndent")==t.getAttribute("listIndent")){const t=r.toViewElement(c);a=s.breakContainer(s.createPositionAfter(t))}else if(l&&"listItem"==l.name){a=r.toViewPosition(o.createPositionAt(l,"end"));const t=r.findMappedViewAncestor(a),e=function(t){for(const e of t.getChildren())if("ul"==e.name||"ol"==e.name)return e;return null}(t);a=e?s.createPositionBefore(e):s.createPositionAt(t,"end")}else a=r.toViewPosition(o.createPositionBefore(t));if(a=Yb(a),s.insert(a,i),l&&"listItem"==l.name){const t=r.toViewElement(l),n=s.createRange(s.createPositionAt(t,0),a).getWalker({ignoreElementEnd:!0});for(const t of n)if(t.item.is("element","li")){const o=s.breakContainer(s.createPositionBefore(t.item)),i=t.item.parent,r=s.createPositionAt(e,"end");Wb(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(i),r),n.position=o}}else{const n=i.nextSibling;if(n&&(n.is("element","ul")||n.is("element","ol"))){let o=null;for(const e of n.getChildren()){const n=r.toModelElement(e);if(!(n&&n.getAttribute("listIndent")>t.getAttribute("listIndent")))break;o=e}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(e,"end")))}}Wb(s,i,i.nextSibling),Wb(s,i.previousSibling,i)}function Wb(t,e,n){return!e||!n||"ul"!=e.name&&"ol"!=e.name||e.name!=n.name||e.getAttribute("class")!==n.getAttribute("class")?null:t.mergeContainers(t.createPositionAfter(e))}function Yb(t){return t.getLastMatchingPosition((t=>t.item.is("uiElement")))}function Kb(t,e){const n=!!e.sameIndent,o=!!e.smallerIndent,i=e.listIndent;let r=t;for(;r&&"listItem"==r.name;){const t=r.getAttribute("listIndent");if(n&&i==t||o&&i>t)return r;r="forward"===e.direction?r.nextSibling:r.previousSibling}return null}function Qb(t,e,n,o){t.ui.componentFactory.add(e,(i=>{const r=t.commands.get(e),s=new fh(i);return s.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),s}))}function $b(){const t=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||t?0:Bi.call(this)}function Zb(t){return(e,n,o)=>{const i=o.consumable;if(!i.test(n.item,"insert")||!i.test(n.item,"attribute:listType")||!i.test(n.item,"attribute:listIndent"))return;i.consume(n.item,"insert"),i.consume(n.item,"attribute:listType"),i.consume(n.item,"attribute:listIndent");const r=n.item;Gb(r,qb(r,o),o,t)}}function Jb(t,e,n){if(!n.consumable.test(e.item,t.name))return;const o=n.mapper.toViewElement(e.item),i=n.writer;i.breakContainer(i.createPositionBefore(o)),i.breakContainer(i.createPositionAfter(o));const r=o.parent,s="numbered"==e.attributeNewValue?"ol":"ul";i.rename(s,r)}function Xb(t,e,n){n.consumable.consume(e.item,t.name);const o=n.mapper.toViewElement(e.item).parent,i=n.writer;Wb(i,o,o.nextSibling),Wb(i,o.previousSibling,o)}function tw(t,e,n){if(n.consumable.test(e.item,t.name)&&"listItem"!=e.item.name){let t=n.mapper.toViewPosition(e.range.start);const o=n.writer,i=[];for(;("ul"==t.parent.name||"ol"==t.parent.name)&&(t=o.breakContainer(t),"li"==t.parent.name);){const e=t,n=o.createPositionAt(t.parent,"end");if(!e.isEqual(n)){const t=o.remove(o.createRange(e,n));i.push(t)}t=o.createPositionAfter(t.parent)}if(i.length>0){for(let e=0;e0){const e=Wb(o,n,n.nextSibling);e&&e.parent==n&&t.offset--}}Wb(o,t.nodeBefore,t.nodeAfter)}}}function ew(t,e,n){const o=n.mapper.toViewPosition(e.position),i=o.nodeBefore,r=o.nodeAfter;Wb(n.writer,i,r)}function nw(t,e,n){if(n.consumable.consume(e.viewItem,{name:!0})){const t=n.writer,o=t.createElement("listItem"),i=function(t){let e=0,n=t.parent;for(;n;){if(n.is("element","li"))e++;else{const t=n.previousSibling;t&&t.is("element","li")&&e++}n=n.parent}return e}(e.viewItem);t.setAttribute("listIndent",i,o);const r=e.viewItem.parent&&"ol"==e.viewItem.parent.name?"numbered":"bulleted";if(t.setAttribute("listType",r,o),!n.safeInsert(o,e.modelCursor))return;const s=function(t,e,n){const{writer:o,schema:i}=n;let r=o.createPositionAfter(t);for(const s of e)if("ul"==s.name||"ol"==s.name)r=n.convertItem(s,r).modelCursor;else{const e=n.convertItem(s,o.createPositionAt(t,"end")),a=e.modelRange.start.nodeAfter;a&&a.is("element")&&!i.checkChild(t,a.name)&&(t=e.modelCursor.parent.is("element","listItem")?e.modelCursor.parent:aw(e.modelCursor),r=o.createPositionAfter(t))}return r}(o,e.viewItem.getChildren(),n);e.modelRange=t.createRange(e.modelCursor,s),n.updateConversionResult(o,e)}}function ow(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){const t=Array.from(e.viewItem.getChildren());for(const e of t){!(e.is("element","li")||lw(e))&&e._remove()}}}function iw(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){if(0===e.viewItem.childCount)return;const t=[...e.viewItem.getChildren()];let n=!1;for(const e of t)n&&!lw(e)&&e._remove(),lw(e)&&(n=!0)}}function rw(t){return(e,n)=>{if(n.isPhantom)return;const o=n.modelPosition.nodeBefore;if(o&&o.is("element","listItem")){const e=n.mapper.toViewElement(o),i=e.getAncestors().find(lw),r=t.createPositionAt(e,0).getWalker();for(const t of r){if("elementStart"==t.type&&t.item.is("element","li")){n.viewPosition=t.previousPosition;break}if("elementEnd"==t.type&&t.item==i){n.viewPosition=t.nextPosition;break}}}}}function sw(t,[e,n]){let o,i=e.is("documentFragment")?e.getChild(0):e;if(o=n?this.createSelection(n):this.document.selection,i&&i.is("element","listItem")){const t=o.getFirstPosition();let e=null;if(t.parent.is("element","listItem")?e=t.parent:t.nodeBefore&&t.nodeBefore.is("element","listItem")&&(e=t.nodeBefore),e){const t=e.getAttribute("listIndent");if(t>0)for(;i&&i.is("element","listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+t),i=i.nextSibling}}}function aw(t){const e=new Ha({startPosition:t});let n;do{n=e.next()}while(!n.value.item.is("element","listItem"));return n.value.item}function cw(t,e,n,o,i,r){const s=Kb(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:t,foo:"b"}),a=i.mapper,c=i.writer,l=s?s.getAttribute("listIndent"):null;let d;if(s)if(l==t){const t=a.toViewElement(s).parent;d=c.createPositionAfter(t)}else{const t=r.createPositionAt(s,"end");d=a.toViewPosition(t)}else d=n;d=Yb(d);for(const t of[...o.getChildren()])lw(t)&&(d=c.move(c.createRangeOn(t),d).end,Wb(c,t,t.nextSibling),Wb(c,t.previousSibling,t))}function lw(t){return t.is("element","ol")||t.is("element","ul")}class dw extends ue{static get pluginName(){return"ListEditing"}static get requires(){return[Mg,Pg]}init(){const t=this.editor;t.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const e=t.data,n=t.editing;var o;t.model.document.registerPostFixer((e=>function(t,e){const n=t.document.differ.getChanges(),o=new Map;let i=!1;for(const o of n)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const n=o.position.nodeAfter;n.hasAttribute("listIndent")&&(e.removeAttribute("listIndent",n),i=!0),n.hasAttribute("listType")&&(e.removeAttribute("listType",n),i=!0),n.hasAttribute("listStyle")&&(e.removeAttribute("listStyle",n),i=!0),n.hasAttribute("listReversed")&&(e.removeAttribute("listReversed",n),i=!0),n.hasAttribute("listStart")&&(e.removeAttribute("listStart",n),i=!0);for(const e of Array.from(t.createRangeIn(n)).filter((t=>t.item.is("element","listItem"))))r(e.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const t of o.values())s(t),a(t);return i;function r(t){const e=t.nodeBefore;if(e&&e.is("element","listItem")){let t=e;if(o.has(t))return;for(let e=t.previousSibling;e&&e.is("element","listItem");e=t.previousSibling)if(t=e,o.has(t))return;o.set(e,t)}else{const e=t.nodeAfter;e&&e.is("element","listItem")&&o.set(e,e)}}function s(t){let n=0,o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(r>n){let s;null===o?(o=r-n,s=n):(o>r&&(o=r),s=r-o),e.setAttribute("listIndent",s,t),i=!0}else o=null,n=t.getAttribute("listIndent")+1;t=t.nextSibling}}function a(t){let n=[],o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(n=n.slice(0,r+1)),0!=r)if(n[r]){const o=n[r];t.getAttribute("listType")!=o&&(e.setAttribute("listType",o,t),i=!0)}else n[r]=t.getAttribute("listType");o=t,t=t.nextSibling}}}(t.model,e))),n.mapper.registerViewToModelLength("li",hw),e.mapper.registerViewToModelLength("li",hw),n.mapper.on("modelToViewPosition",rw(n.view)),n.mapper.on("viewToModelPosition",(o=t.model,(t,e)=>{const n=e.viewPosition,i=n.parent,r=e.mapper;if("ul"==i.name||"ol"==i.name){if(n.isAtEnd){const t=r.toModelElement(n.nodeBefore),i=r.getModelLength(n.nodeBefore);e.modelPosition=o.createPositionBefore(t).getShiftedBy(i)}else{const t=r.toModelElement(n.nodeAfter);e.modelPosition=o.createPositionBefore(t)}t.stop()}else if("li"==i.name&&n.nodeBefore&&("ul"==n.nodeBefore.name||"ol"==n.nodeBefore.name)){const s=r.toModelElement(i);let a=1,c=n.nodeBefore;for(;c&&lw(c);)a+=r.getModelLength(c),c=c.previousSibling;e.modelPosition=o.createPositionBefore(s).getShiftedBy(a),t.stop()}})),e.mapper.on("modelToViewPosition",rw(n.view)),t.conversion.for("editingDowncast").add((e=>{e.on("insert",tw,{priority:"high"}),e.on("insert:listItem",Zb(t.model)),e.on("attribute:listType:listItem",Jb,{priority:"high"}),e.on("attribute:listType:listItem",Xb,{priority:"low"}),e.on("attribute:listIndent:listItem",function(t){return(e,n,o)=>{if(!o.consumable.consume(n.item,"attribute:listIndent"))return;const i=o.mapper.toViewElement(n.item),r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s);r.remove(c),a&&a.nextSibling&&Wb(r,a,a.nextSibling),cw(n.attributeOldValue+1,n.range.start,c.start,i,o,t),Gb(n.item,i,o,t);for(const t of n.item.getChildren())o.consumable.consume(t,"insert")}}(t.model)),e.on("remove:listItem",function(t){return(e,n,o)=>{const i=o.mapper.toViewPosition(n.position).getLastMatchingPosition((t=>!t.item.is("element","li"))).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s),l=r.remove(c);a&&a.nextSibling&&Wb(r,a,a.nextSibling),cw(o.mapper.toModelElement(i).getAttribute("listIndent")+1,n.position,c.start,i,o,t);for(const t of r.createRangeIn(l).getItems())o.mapper.unbindViewElement(t);e.stop()}}(t.model)),e.on("remove",ew,{priority:"low"})})),t.conversion.for("dataDowncast").add((e=>{e.on("insert",tw,{priority:"high"}),e.on("insert:listItem",Zb(t.model))})),t.conversion.for("upcast").add((t=>{t.on("element:ul",ow,{priority:"high"}),t.on("element:ol",ow,{priority:"high"}),t.on("element:li",iw,{priority:"high"}),t.on("element:li",nw)})),t.model.on("insertContent",sw,{priority:"high"}),t.commands.add("numberedList",new Fb(t,"numbered")),t.commands.add("bulletedList",new Fb(t,"bulleted")),t.commands.add("indentList",new Ub(t,"forward")),t.commands.add("outdentList",new Ub(t,"backward"));const i=n.view.document;this.listenTo(i,"enter",((t,e)=>{const n=this.editor.model.document,o=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(i,"delete",((t,e)=>{if("backward"!==e.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const o=n.getFirstPosition();if(!o.isAtStart)return;const i=o.parent;if("listItem"!==i.name)return;i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(t.editing.view.document,"tab",((e,n)=>{const o=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(o).isEnabled&&(t.execute(o),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"li"})}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList")),n&&n.registerChildCommand(t.get("outdentList"))}}function hw(t){let e=1;for(const n of t.getChildren())if("ul"==n.name||"ol"==n.name)for(const t of n.getChildren())e+=hw(t);return e}class uw extends ue{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;Qb(this.editor,"numberedList",t("Numbered List"),''),Qb(this.editor,"bulletedList",t("Bulleted List"),'')}}function gw(t,e){return t=>{t.on("attribute:url:media",n)};function n(n,o,i){if(!i.consumable.consume(o.item,n.name))return;const r=o.attributeNewValue,s=i.writer,a=i.mapper.toViewElement(o.item),c=[...a.getChildren()].find((t=>t.getCustomProperty("media-content")));s.remove(c);const l=t.getMediaViewElement(s,r,e);s.insert(s.createPositionAt(a,0),l)}}function mw(t,e,n,o){return t.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(t,n,o),t.createSlot()])}function pw(t){const e=t.getSelectedElement();return e&&e.is("element","media")?e:null}function fw(t,e,n,o){t.change((i=>{const r=i.createElement("media",{url:e});t.insertObject(r,n,null,{setSelection:"on",findOptimalPosition:o})}))}class kw extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=pw(e);this.value=n?n.getAttribute("url"):null,this.isEnabled=function(t){const e=t.getSelectedElement();return!!e&&"media"===e.name}(e)||function(t,e){let n=Qg(t,e).start.parent;n.isEmpty&&!e.schema.isLimit(n)&&(n=n.parent);return e.schema.checkChild(n,"media")}(e,t)}execute(t){const e=this.editor.model,n=e.document.selection,o=pw(n);o?e.change((e=>{e.setAttribute("url",t,o)})):fw(e,t,n,!0)}}class bw{constructor(t,e){const n=e.providers,o=e.extraProviders||[],i=new Set(e.removeProviders),r=n.concat(o).filter((t=>{const e=t.name;return e?!i.has(e):(l("media-embed-no-provider-name",{provider:t}),!1)}));this.locale=t,this.providerDefinitions=r}hasMedia(t){return!!this._getMedia(t)}getMediaViewElement(t,e,n){return this._getMedia(e).getViewElement(t,n)}_getMedia(t){if(!t)return new ww(this.locale);t=t.trim();for(const e of this.providerDefinitions){const n=e.html,o=So(e.url);for(const e of o){const o=this._getUrlMatches(t,e);if(o)return new ww(this.locale,t,o,n)}}return null}_getUrlMatches(t,e){let n=t.match(e);if(n)return n;let o=t.replace(/^https?:\/\//,"");return n=o.match(e),n||(o=o.replace(/^www\./,""),n=o.match(e),n||null)}}class ww{constructor(t,e,n,o){this.url=this._getValidUrl(e),this._t=t.t,this._match=n,this._previewRenderer=o}getViewElement(t,e){const n={};let o;if(e.renderForEditingView||e.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),e.renderForEditingView&&(n.class="ck-media__wrapper");const i=this._getPreviewHtml(e);o=t.createRawElement("div",n,((t,e)=>{e.setContentOf(t,i)}))}else this.url&&(n.url=this.url),o=t.createEmptyElement(e.elementName,n);return t.setCustomProperty("media-content",!0,o),o}_getPreviewHtml(t){return this._previewRenderer?this._previewRenderer(this._match):this.url&&t.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const t=new gh,e=new dh;t.text=this._t("Open media in new tab"),e.content='',e.viewBox="0 0 64 42";return new Fd({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]},t]}]}).render().outerHTML}_getValidUrl(t){return t?t.match(/^https?/)?t:"https://"+t:null}}var _w=n(7442),Aw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(_w.Z,Aw);_w.Z.locals;class Cw extends ue{static get pluginName(){return"MediaEmbedEditing"}constructor(t){super(t),t.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>`
`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`
`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:t=>`
`},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`
`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new bw(t.locale,t.config.get("mediaEmbed"))}init(){const t=this.editor,e=t.model.schema,n=t.t,o=t.conversion,i=t.config.get("mediaEmbed.previewsInData"),r=t.config.get("mediaEmbed.elementName"),s=this.registry;t.commands.add("mediaEmbed",new kw(t)),e.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),o.for("dataDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const n=t.getAttribute("url");return mw(e,s,n,{elementName:r,renderMediaPreview:n&&i})}}),o.for("dataDowncast").add(gw(s,{elementName:r,renderMediaPreview:i})),o.for("editingDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const o=t.getAttribute("url");return function(t,e,n){return e.setCustomProperty("media",!0,t),Ug(t,e,{label:n})}(mw(e,s,o,{elementName:r,renderForEditingView:!0}),e,n("media widget"))}}),o.for("editingDowncast").add(gw(s,{elementName:r,renderForEditingView:!0})),o.for("upcast").elementToElement({view:t=>["oembed",r].includes(t.name)&&t.getAttribute("url")?{name:!0}:null,model:(t,{writer:e})=>{const n=t.getAttribute("url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(t,{writer:e})=>{const n=t.getAttribute("data-oembed-url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).add((t=>{t.on("element:figure",(function(t,e,n){if(!n.consumable.consume(e.viewItem,{name:!0,classes:"media"}))return;const{modelRange:o,modelCursor:i}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=o,e.modelCursor=i;Ta(o.getItems())||n.consumable.revert(e.viewItem,{name:!0,classes:"media"})}))}))}}const vw=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class yw extends ue{static get requires(){return[ym,Pg,pp]}static get pluginName(){return"AutoMediaEmbed"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document;this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=Xl.fromPosition(t.start);n.stickiness="toPrevious";const o=Xl.fromPosition(t.end);o.stickiness="toNext",e.once("change:data",(()=>{this._embedMediaBetweenPositions(n,o),n.detach(),o.detach()}),{priority:"high"})})),t.commands.get("undo").on("execute",(()=>{this._timeoutId&&(is.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedMediaBetweenPositions(t,e){const n=this.editor,o=n.plugins.get(Cw).registry,i=new sc(t,e),r=i.getWalker({ignoreElementEnd:!0});let s="";for(const t of r)t.item.is("$textProxy")&&(s+=t.item.data);if(s=s.trim(),!s.match(vw))return void i.detach();if(!o.hasMedia(s))return void i.detach();n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Xl.fromPosition(t),this._timeoutId=is.window.setTimeout((()=>{n.model.change((t=>{let e;this._timeoutId=null,t.remove(i),i.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert),fw(n.model,s,e,!1),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get("Delete").requestUndoOnBackspace()}),100)):i.detach()}}var xw=n(9292),Dw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(xw.Z,Dw);xw.Z.locals;class Ew extends jd{constructor(t,e){super(e);const n=e.t;this.focusTracker=new Na,this.keystrokes=new Ba,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Nd.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",(t=>!!t)),this.cancelButtonView=this._createButton(n("Cancel"),Nd.cancel,"ck-button-cancel","cancel"),this._focusables=new Ld,this._focusCycler=new Ph({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=t,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]}),zd(this)}render(){super.render(),Pd({view:this});[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t),this.listenTo(this.urlInputView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(t){this.urlInputView.fieldView.element.value=t.trim()}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.urlInputView.errorText=e,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const t=this.locale.t,e=new Au(this.locale,Cu),n=e.fieldView;return this._urlInputViewInfoDefault=t("Paste the media URL in the input."),this._urlInputViewInfoTip=t("Tip: Paste the URL into the content to embed faster."),e.label=t("Media URL"),e.infoText=this._urlInputViewInfoDefault,n.on("input",(()=>{e.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()})),e}_createButton(t,e,n,o){const i=new fh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}}class Mw extends ue{static get requires(){return[Cw]}static get pluginName(){return"MediaEmbedUI"}init(){const t=this.editor,e=t.commands.get("mediaEmbed"),n=t.plugins.get(Cw).registry;t.ui.componentFactory.add("mediaEmbed",(o=>{const i=eu(o),r=new Ew(function(t,e){return[e=>{if(!e.url.length)return t("The URL must not be empty.")},n=>{if(!e.hasMedia(n.url))return t("This media URL is not supported.")}]}(t.t,n),t.locale);return this._setUpDropdown(i,r,e,t),this._setUpForm(i,r,e),i}))}_setUpDropdown(t,e,n){const o=this.editor,i=o.t,r=t.buttonView;function s(){o.editing.view.focus(),t.isOpen=!1}t.bind("isEnabled").to(n),t.panelView.children.add(e),r.set({label:i("Insert media"),icon:'',tooltip:!0}),r.on("open",(()=>{e.disableCssTransitions(),e.url=n.value||"",e.urlInputView.fieldView.select(),e.focus(),e.enableCssTransitions()}),{priority:"low"}),t.on("submit",(()=>{e.isValid()&&(o.execute("mediaEmbed",e.url),s())})),t.on("change:isOpen",(()=>e.resetFormStatus())),t.on("cancel",(()=>s()))}_setUpForm(t,e,n){e.delegate("submit","cancel").to(t),e.urlInputView.bind("value").to(n,"value"),e.urlInputView.bind("isReadOnly").to(n,"isEnabled",(t=>!t))}}var Iw=n(4652),Sw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Iw.Z,Sw);Iw.Z.locals;function Tw(t,e){if(!t.childCount)return;const n=new gg(t.document),o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),i=[];for(const t of n)if("elementStart"===t.type&&o.match(t.item)){const e=zw(t.item);i.push({element:t.item,id:e.id,order:e.order,indent:e.indent})}return i}(t,n);if(!o.length)return;let i=null,r=1;o.forEach(((t,s)=>{const a=function(t,e){if(!t)return!0;if(t.id!==e.id)return e.indent-t.indent!=1;const n=e.element.previousSibling;if(!n)return!0;return o=n,!(o.is("element","ol")||o.is("element","ul"));var o}(o[s-1],t),c=a?null:o[s-1],l=(h=t,(d=c)?h.indent-d.indent:h.indent-1);var d,h;if(a&&(i=null,r=1),!i||0!==l){const o=function(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]{0,100});/gi,i=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=n.exec(e);let s="decimal",a="ol",c=null;if(r&&r[1]){const e=o.exec(r[1]);if(e&&e[1]&&(s=e[1].trim(),a="bullet"!==s&&"image"!==s?"ol":"ul"),"bullet"===s){const e=function(t){const e=function(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);return t.is("$text")?t:t.getChild(0)}}(t);if(!e)return null;const n=e._data;if("o"===n)return"circle";if("·"===n)return"disc";if("§"===n)return"square";return null}(t.element);e&&(s=e)}else{const t=i.exec(r[1]);t&&t[1]&&(c=parseInt(t[1]))}}return{type:a,startIndex:c,style:Nw(s)}}(t,e);if(i){if(t.indent>r){const t=i.getChild(i.childCount-1),e=t.getChild(t.childCount-1);i=Bw(o,e,n),r+=1}else if(t.indent1&&n.setAttribute("start",t.startIndex,i),i}function zw(t){const e={},n=t.getStyle("mso-list");if(n){const t=n.match(/(^|\s{1,100})l(\d+)/i),o=n.match(/\s{0,100}lfo(\d+)/i),i=n.match(/\s{0,100}level(\d+)/i);t&&o&&i&&(e.id=t[2],e.order=o[1],e.indent=i[1])}return e}const Pw=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class Lw{constructor(t){this.document=t}isActive(t){return Pw.test(t)}execute(t){const e=new gg(this.document),{body:n}=t._parsedData;!function(t,e){for(const n of t.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const o=t.getChildIndex(n);e.remove(n),e.insertChild(o,n.getChildren(),t)}}(n,e),function(t,e){for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","li")){const n=t.getChild(0);n&&n.is("element","p")&&e.unwrapElement(n)}}}(n,e),t.content=n}}function Ow(t,e){if(!t.childCount)return;const n=new gg,o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n){if("elementStart"!=t.type)continue;const e=t.item,n=e.previousSibling&&e.previousSibling.name||null;o.match(e)&&e.getAttribute("o:gfxdata")&&"v:shapetype"!==n&&i.push(t.item.getAttribute("id"))}return i}(t,n);!function(t,e,n){const o=n.createRangeIn(e),i=new Uo({name:"img"}),r=[];for(const e of o)if(i.match(e.item)){const n=e.item,o=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];o.length&&o.every((e=>t.indexOf(e)>-1))?r.push(n):n.getAttribute("src")||r.push(n)}for(const t of r)n.remove(t)}(o,t,n),function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n)"elementStart"==t.type&&o.match(t.item)&&i.push(t.item);for(const t of i)e.remove(t)}(t,n);const i=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:"img"}),i=[];for(const t of n)o.match(t.item)&&t.item.getAttribute("src").startsWith("file://")&&i.push(t.item);return i}(t,n);i.length&&function(t,e,n){if(t.length===e.length)for(let o=0;oString.fromCharCode(parseInt(t,16)))).join(""))}const jw=//i,Fw=/xmlns:o="urn:schemas-microsoft-com/i;class Vw{constructor(t){this.document=t}isActive(t){return jw.test(t)||Fw.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;Tw(e,n),Ow(e,t.dataTransfer.getData("text/rtf")),t.content=e}}function Hw(t){return t.replace(/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join("  ").substr(0,e.length)))}function Uw(t,e){const n=new DOMParser,o=function(t){return Hw(Hw(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g," <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="",n="",o=t.indexOf(e);if(o<0)return t;const i=t.indexOf(n,o+e.length);return t.substring(0,o+e.length)+(i>=0?t.substring(i):"")}(t=t.replace(//g,"")}(i.getData("text/html")):i.getData("text/plain")&&(((s=(s=i.getData("text/plain")).replace(//g,">").replace(/\r?\n\r?\n/g,"

").replace(/\r?\n/g,"
").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g,"  ")).includes("

")||s.includes("
"))&&(s=`

${s}

`),r=s),r=this.editor.data.htmlProcessor.toView(r));const a=new e(this,"inputTransformation");this.fire(a,{content:r,dataTransfer:i,targetRanges:n.targetRanges,method:n.method}),a.stop.called&&t.stop(),o.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,e)=>{if(e.content.isEmpty)return;const o=this.editor.data.toModel(e.content,"$clipboardHolder");0!=o.childCount&&(t.stop(),n.change((()=>{this.fire("contentInsertion",{content:o,method:e.method,dataTransfer:e.dataTransfer,targetRanges:e.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,e)=>{e.resultRange=n.insertContent(e.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document;function o(o,i){const r=i.dataTransfer;i.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:o.name})}this.listenTo(n,"copy",o,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.isReadOnly?n.preventDefault():o(e,n)}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",Hg(o.content))),"cut"==o.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}function*Gg(t,e){for(const n of e)n&&t.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class qg extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n,o){const i=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return void(i||s!=a||t.deleteContent(n));if(i){const t=Gg(e.model.schema,n.getAttributes());Wg(e,r.start),e.setSelectionAttribute(t)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd),i=s==a;t.deleteContent(n,{leaveUnmerged:o}),o&&(i?Wg(e,n.focus):e.setSelection(a,0))}}(this.editor.model,n,e.selection,t.schema),this.fire("afterExecute",{writer:n})}))}}function Wg(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}class Yg extends Cs{constructor(t){super(t);const e=this.document;e.on("keydown",((t,n)=>{if(this.isEnabled&&n.keyCode==dr.enter){const o=new Gi(e,"enter",e.selection.getFirstRange());e.fire(o,new qs(e,n.domEvent,{isSoft:n.shiftKey})),o.stop.called&&t.stop()}}))}observe(){}}class Kg extends ue{static get pluginName(){return"Enter"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(Yg),t.commands.add("enter",new qg(t)),this.listenTo(n,"enter",((n,o)=>{o.preventDefault(),o.isSoft||(t.execute("enter"),e.scrollToTheSelection())}),{priority:"low"})}}class $g{constructor(t,e=20){this.model=t,this.size=0,this.limit=e,this.isLocked=!1,this._changeCallback=(t,e)=>{e.isLocal&&e.isUndoable&&e!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}input(t){this.size+=t,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(t){this.isLocked&&!t||(this._batch=null,this.size=0)}}class Qg extends me{constructor(t,e){super(t),this.direction=e,this._buffer=new $g(t.model,t.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(t={}){const e=this.editor.model,n=e.document;e.enqueueChange(this._buffer.batch,(o=>{this._buffer.lock();const i=o.createSelection(t.selection||n.selection),r=t.sequence||1,s=i.isCollapsed;if(i.isCollapsed&&e.modifySelection(i,{direction:this.direction,unit:t.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(o);if(this._shouldReplaceFirstBlockWithParagraph(i,r))return void this.editor.execute("paragraph",{selection:i});if(i.isCollapsed)return;let a=0;i.getFirstRange().getMinimalFlatRanges().forEach((t=>{a+=Vi(t.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),e.deleteContent(i,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),o.setSelection(i),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(t){if(t>1)return!1;const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(o)))return!1;if(!e.schema.checkChild(o,"paragraph"))return!1;const i=o.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(t){const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n),i=t.createElement("paragraph");t.remove(t.createRangeIn(o)),t.insert(i,o),t.setSelection(i,0)}_shouldReplaceFirstBlockWithParagraph(t,e){const n=this.editor.model;if(e>1||"backward"!=this.direction)return!1;if(!t.isCollapsed)return!1;const o=t.getFirstPosition(),i=n.schema.getLimitElement(o),r=i.getChild(0);return o.parent==r&&(!!t.containsEntireContent(r)&&(!!n.schema.checkChild(i,"paragraph")&&"paragraph"!=r.name))}}function Zg(t){if(t.newChildren.length-t.oldChildren.length!=1)return;const e=function(t,e){const n=[];let o,i=0;return t.forEach((t=>{"equal"==t?(r(),i++):"insert"==t?(s("insert")?o.values.push(e[i]):(r(),o={type:"insert",index:i,values:[e[i]]}),i++):s("delete")?o.howMany++:(r(),o={type:"delete",index:i,howMany:1})})),r(),n;function r(){o&&(n.push(o),o=null)}function s(t){return o&&o.type==t}}(qr(t.oldChildren,t.newChildren,Jg),t.newChildren);if(e.length>1)return;const n=e[0];return n.values[0]&&n.values[0].is("$text")?n:void 0}function Jg(t,e){return t&&t.is("$text")&&e&&e.is("$text")?t.data===e.data:t===e}function Xg(t,e){const n=e.selection,o=t.shiftKey&&t.keyCode===dr.delete,i=!n.isCollapsed;return o&&i}class tm extends Cs{constructor(t){super(t);const e=t.document;let n=0;function o(t,n,o){const i=new Gi(e,"delete",e.selection.getFirstRange());e.fire(i,new qs(e,n,o)),i.stop.called&&t.stop()}e.on("keyup",((t,e)=>{e.keyCode!=dr.delete&&e.keyCode!=dr.backspace||(n=0)})),e.on("keydown",((t,i)=>{if(sr.isWindows&&Xg(i,e))return;const r={};if(i.keyCode==dr.delete)r.direction="forward",r.unit="character";else{if(i.keyCode!=dr.backspace)return;r.direction="backward",r.unit="codePoint"}const s=sr.isMac?i.altKey:i.ctrlKey;r.unit=s?"word":r.unit,r.sequence=++n,o(t,i.domEvent,r)})),sr.isAndroid&&e.on("beforeinput",((e,n)=>{if("deleteContentBackward"!=n.domEvent.inputType)return;const i={unit:"codepoint",direction:"backward",sequence:1},r=n.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(i.selectionToRemove=t.domConverter.domSelectionToView(r)),o(e,n.domEvent,i)}))}observe(){}}class em extends ue{static get pluginName(){return"Delete"}init(){const t=this.editor,e=t.editing.view,n=e.document,o=t.model.document;e.addObserver(tm),this._undoOnBackspace=!1;const i=new Qg(t,"forward");if(t.commands.add("deleteForward",i),t.commands.add("forwardDelete",i),t.commands.add("delete",new Qg(t,"backward")),this.listenTo(n,"delete",((n,o)=>{const i={unit:o.unit,sequence:o.sequence};if(o.selectionToRemove){const e=t.model.createSelection(),n=[];for(const e of o.selectionToRemove.getRanges())n.push(t.editing.mapper.toModelRange(e));e.setTo(n),i.selection=e}t.execute("forward"==o.direction?"deleteForward":"delete",i),o.preventDefault(),e.scrollToTheSelection()}),{priority:"low"}),sr.isAndroid){let t=null;this.listenTo(n,"delete",((e,n)=>{const o=n.domTarget.ownerDocument.defaultView.getSelection();t={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}}),{priority:"lowest"}),this.listenTo(n,"keyup",((e,n)=>{if(t){const e=n.domTarget.ownerDocument.defaultView.getSelection();e.collapse(t.anchorNode,t.anchorOffset),e.extend(t.focusNode,t.focusOffset),t=null}}))}this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",((e,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._undoOnBackspace=!1,t.execute("undo"),n.preventDefault(),e.stop())}),{context:"$capture"}),this.listenTo(o,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class nm{constructor(){this._stack=[]}add(t,e){const n=this._stack,o=n[0];this._insertDescriptor(t);const i=n[0];o===i||om(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}remove(t,e){const n=this._stack,o=n[0];this._removeDescriptor(t);const i=n[0];o===i||om(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(om(t,e[n]))return;n>-1&&e.splice(n,1);let o=0;for(;e[o]&&im(e[o],t);)o++;e.splice(o,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function om(t,e){return t&&e&&t.priority==e.priority&&rm(t.classes)==rm(e.classes)}function im(t,e){return t.priority>e.priority||!(t.priorityrm(e.classes)}function rm(t){return Array.isArray(t)?t.sort().join(","):t}he(nm,k);const sm='',am="ck-widget_selected";function cm(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function lm(t,e,n={}){if(!t.is("containerElement"))throw new c("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass("ck-widget",t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=fm,n.label&&function(t,e,n){n.setCustomProperty("widgetLabel",e,t)}(t,n.label,e),n.hasSelectionHandle&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(t){const e=this.toDomElement(t),n=new lh;return n.set("content",sm),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),um(t,e),t}function dm(t,e,n){if(e.classes&&n.addClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.setAttribute(o,e.attributes[o],t)}function hm(t,e,n){if(e.classes&&n.removeClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.removeAttribute(o,t)}function um(t,e,n=dm,o=hm){const i=new nm;i.on("change:top",((e,i)=>{i.oldDescriptor&&o(t,i.oldDescriptor,i.writer),i.newDescriptor&&n(t,i.newDescriptor,i.writer)})),e.setCustomProperty("addHighlight",((t,e,n)=>i.add(e,n)),t),e.setCustomProperty("removeHighlight",((t,e,n)=>i.remove(e,n)),t)}function gm(t){const e=t.getCustomProperty("widgetLabel");return e?"function"==typeof e?e():e:""}function mm(t,e){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",((n,o,i)=>{e.setAttribute("contenteditable",i?"false":"true",t)})),t.on("change:isFocused",((n,o,i)=>{i?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)})),um(t,e),t}function pm(t,e){const n=t.getSelectedElement();if(n){const o=wm(t);if(o)return e.createRange(e.createPositionAt(n,o))}return od(t,e)}function fm(){return null}const km="widget-type-around";function bm(t,e,n){return t&&cm(t)&&!n.isInline(e)}function wm(t){return t.getAttribute(km)}const Am=[ur("arrowUp"),ur("arrowRight"),ur("arrowDown"),ur("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let t=112;t<=135;t++)Am.push(t);function _m(t){return!(!t.ctrlKey&&!t.metaKey)||Am.includes(t.keyCode)}var Cm=n(4921),vm={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Cm.Z,vm);Cm.Z.locals;const ym=["before","after"],xm=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,Em="ck-widget__type-around_disabled";class Dm extends ue{static get pluginName(){return"WidgetTypeAround"}static get requires(){return[Kg,em]}constructor(t){super(t),this._currentFakeCaretModelElement=null}init(){const t=this.editor,e=t.editing.view;this.on("change:isEnabled",((n,o,i)=>{e.change((t=>{for(const n of e.document.roots)i?t.removeClass(Em,n):t.addClass(Em,n)})),i||t.model.change((t=>{t.removeSelectionAttribute(km)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(t,e){const n=this.editor,o=n.editing.view,i=n.model.schema.getAttributesWithProperty(t,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(t,e),attributes:i}),o.focus(),o.scrollToTheSelection()}_listenToIfEnabled(t,e,n,o){this.listenTo(t,e,((...t)=>{this.isEnabled&&n(...t)}),o)}_insertParagraphAccordingToFakeCaretPosition(){const t=this.editor.model.document.selection,e=wm(t);if(!e)return!1;const n=t.getSelectedElement();return this._insertParagraph(n,e),!0}_enableTypeAroundUIInjection(){const t=this.editor,e=t.model.schema,n=t.locale.t,o={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};t.editing.downcastDispatcher.on("insert",((t,n,i)=>{const r=i.mapper.toViewElement(n.item);bm(r,n.item,e)&&function(t,e,n){const o=t.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(t){const n=this.toDomElement(t);return function(t,e){for(const n of ym){const o=new jd({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:e[n]},children:[t.ownerDocument.importNode(xm,!0)]});t.appendChild(o.render())}}(n,e),function(t){const e=new jd({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});t.appendChild(e.render())}(n),n}));t.insert(t.createPositionAt(n,"end"),o)}(i.writer,o,r)}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const t=this.editor,e=t.model,n=e.document.selection,o=e.schema,i=t.editing.view;function r(t){return`ck-widget_type-around_show-fake-caret_${t}`}this._listenToIfEnabled(i.document,"arrowKey",((t,e)=>{this._handleArrowKeyPress(t,e)}),{context:[cm,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(km)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();if(e){if(bm(t.editing.mapper.toViewElement(e),e,o))return}t.model.change((t=>{t.removeSelectionAttribute(km)}))})),this._listenToIfEnabled(t.editing.downcastDispatcher,"selection",((t,e,n)=>{const i=n.writer;if(this._currentFakeCaretModelElement){const t=n.mapper.toViewElement(this._currentFakeCaretModelElement);t&&(i.removeClass(ym.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!bm(a,s,o))return;const c=wm(e.selection);c&&(i.addClass(r(c),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,o)=>{o||t.model.change((t=>{t.removeSelectionAttribute(km)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,o=n.model,i=o.document.selection,r=o.schema,s=n.editing.view,a=function(t,e){const n=pr(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;bm(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):i.isCollapsed?l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(l=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),l&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=wm(e.document.selection);return e.change((e=>{if(!n)return e.setSelectionAttribute(km,t?"after":"before"),!0;if(!(n===(t?"after":"before")))return e.removeSelectionAttribute(km),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,o=n.schema,i=e.plugins.get("Widget"),r=i._getObjectElementNextToSelection(t);return!!bm(e.editing.mapper.toViewElement(r),r,o)&&(n.change((e=>{i._setSelectionOverElement(r),e.setSelectionAttribute(km,t?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(t){const e=this.editor,n=e.model,o=n.schema,i=e.editing.mapper,r=n.document.selection,s=t?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!bm(i.toViewElement(s),s,o)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(km,t?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const t=this.editor,e=t.editing.view;this._listenToIfEnabled(e.document,"mousedown",((n,o)=>{const i=o.domTarget.closest(".ck-widget__type-around__button");if(!i)return;const r=function(t){return t.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(i),s=function(t,e){const n=t.closest(".ck-widget");return e.mapDomToView(n)}(i,e.domConverter),a=t.editing.mapper.toModelElement(s);this._insertParagraph(a,r),o.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const t=this.editor,e=t.model.document.selection,n=t.editing.view;this._listenToIfEnabled(n.document,"enter",((n,o)=>{if("atTarget"!=n.eventPhase)return;const i=e.getSelectedElement(),r=t.editing.mapper.toViewElement(i),s=t.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:bm(r,i,s)&&(this._insertParagraph(i,o.isSoft?"before":"after"),a=!0),a&&(o.preventDefault(),n.stop())}),{context:cm})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view,e=[dr.enter,dr.delete,dr.backspace];this._listenToIfEnabled(t.document,"keydown",((t,n)=>{e.includes(n.keyCode)||_m(n)||this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const t=this.editor,e=t.editing.view,n=t.model,o=n.schema;this._listenToIfEnabled(e.document,"delete",((e,i)=>{if("atTarget"!=e.eventPhase)return;const r=wm(n.document.selection);if(!r)return;const s=i.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)t.execute("delete",{selection:n.createSelection(a,"on")});else{const e=o.getNearestSelectionRange(n.createPositionAt(a,r),s);if(e)if(e.isCollapsed){const i=n.createSelection(e.start);if(n.modifySelection(i,{direction:s}),i.focus.isEqual(e.start)){const t=function(t,e){let n=e;for(const o of e.getAncestors({parentFirst:!0})){if(o.childCount>1||t.isLimit(o))break;n=o}return n}(o,e.start.parent);n.deleteContent(n.createSelection(t,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}i.preventDefault(),e.stop()}),{context:cm})}_enableInsertContentIntegration(){const t=this.editor,e=this.editor.model,n=e.document.selection;this._listenToIfEnabled(t.model,"insertContent",((t,[o,i])=>{if(i&&!i.is("documentSelection"))return;const r=wm(n);return r?(t.stop(),e.change((t=>{const i=n.getSelectedElement(),s=e.createPositionAt(i,r),a=t.createSelection(s),c=e.insertContent(o,a);return t.setSelection(a),c}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"insertObject",((t,n)=>{const[,o,,i={}]=n;if(o&&!o.is("documentSelection"))return;const r=wm(e);r&&(i.findOptimalPosition=r,n[3]=i)}),{priority:"high"})}_enableDeleteContentIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"deleteContent",((t,[n])=>{if(n&&!n.is("documentSelection"))return;wm(e)&&t.stop()}),{priority:"high"})}}function Im(t){const e=t.model;return(n,o)=>{const i=o.keyCode==dr.arrowup,r=o.keyCode==dr.arrowdown,s=o.shiftKey,a=e.document.selection;if(!i&&!r)return;const c=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,c))return;const l=function(t,e,n){const o=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=Tm(o,t,"forward");if(!n)return null;const i=o.createRange(t,n),r=Sm(o.schema,i,"backward");return r?o.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=Tm(o,t,"backward");if(!n)return null;const i=o.createRange(n,t),r=Sm(o.schema,i,"forward");return r?o.createRange(r,t):null}}(t,a,c);if(l){if(l.isCollapsed){if(a.isCollapsed)return;if(s)return}(l.isCollapsed||function(t,e,n){const o=t.model,i=t.view.domConverter;if(n){const t=o.createSelection(e.start);o.modifySelection(t),t.focus.isAtEnd||e.start.isEqual(t.focus)||(e=o.createRange(t.focus,e.end))}const r=t.mapper.toViewRange(e),s=i.viewRangeToDom(r),a=pa.getDomRangeRects(s);let c;for(const t of a)if(void 0!==c){if(Math.round(t.top)>=c)return!1;c=Math.max(c,Math.round(t.bottom))}else c=Math.round(t.bottom);return!0}(t,l,c))&&(e.change((t=>{const n=c?l.end:l.start;if(s){const o=e.createSelection(a.anchor);o.setFocus(n),t.setSelection(o)}else t.setSelection(n)})),n.stop(),o.preventDefault(),o.stopPropagation())}}}function Tm(t,e,n){const o=t.schema,i=t.createRangeIn(e.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:t,item:s,type:a}of i.getWalker({startPosition:e,direction:n})){if(o.isLimit(s)&&!o.isInline(s))return t;if(a==r&&o.isBlock(s))return null}return null}function Sm(t,e,n){const o="backward"==n?e.end:e.start;if(t.checkChild(o,"$text"))return o;for(const{nextPosition:o}of e.getWalker({direction:n}))if(t.checkChild(o,"$text"))return o;return null}var Mm=n(3488),Nm={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Mm.Z,Nm);Mm.Z.locals;class zm extends ue{static get pluginName(){return"Widget"}static get requires(){return[Dm,em]}init(){const t=this.editor,e=t.editing.view,n=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",((e,n,o)=>{const i=o.writer,r=n.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=t.editing.mapper.toViewElement(s);cm(a)&&o.consumable.consume(r,"selection")&&i.setSelection(i.createRangeOn(a),{fake:!0,label:gm(a)})})),this.editor.editing.downcastDispatcher.on("selection",((t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const o=n.writer,i=o.document.selection;let r=null;for(const t of i.getRanges())for(const e of t){const t=e.item;cm(t)&&!Bm(t,r)&&(o.addClass(am,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(ug),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[cm,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",Im(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"})}_onMousedown(t,e){const n=this.editor,o=n.editing.view,i=o.document;let r=e.target;if(function(t){for(;t;){if(t.is("editableElement")&&!t.is("rootElement"))return!0;if(cm(t))return!1;t=t.parent}return!1}(r)){if((sr.isSafari||sr.isGecko)&&e.domEvent.detail>=3){const t=n.editing.mapper,o=r.is("attributeElement")?r.findAncestor((t=>!t.is("attributeElement"))):r,i=t.toModelElement(o);e.preventDefault(),this.editor.model.change((t=>{t.setSelection(i,"in")}))}return}if(!cm(r)&&(r=r.findAncestor(cm),!r))return;sr.isAndroid&&e.preventDefault(),i.isFocused||o.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,o=this.editor.model,i=o.schema,r=o.document.selection,s=r.getSelectedElement(),a=pr(n,this.editor.locale.contentLanguageDirection),c="down"==a||"right"==a,l="up"==a||"down"==a;if(s&&i.isObject(s)){const n=c?r.getLastPosition():r.getFirstPosition(),s=i.getNearestSelectionRange(n,c?"forward":"backward");return void(s&&(o.change((t=>{t.setSelection(s)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed&&!e.shiftKey){const n=r.getFirstPosition(),s=r.getLastPosition(),a=n.nodeAfter,l=s.nodeBefore;return void((a&&i.isObject(a)||l&&i.isObject(l))&&(o.change((t=>{t.setSelection(c?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&i.isObject(d)){if(i.isInline(d)&&l)return;this._setSelectionOverElement(d),e.preventDefault(),t.stop()}}_preventDefaultOnArrowKeyPress(t,e){const n=this.editor.model,o=n.schema,i=n.document.selection.getSelectedElement();i&&o.isObject(i)&&(e.preventDefault(),t.stop())}_handleDelete(t){if(this.editor.isReadOnly)return;const e=this.editor.model.document.selection;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change((t=>{let o=e.anchor.parent;for(;o.isEmpty;){const e=o;o=e.parent,t.remove(e)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(t){this.editor.model.change((e=>{e.setSelection(e.createRangeOn(t))}))}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,o=e.document.selection,i=e.createSelection(o);if(e.modifySelection(i,{direction:t?"forward":"backward"}),i.isEqual(o))return null;const r=t?i.focus.nodeBefore:i.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(am,e);this._previouslySelected.clear()}}function Bm(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}const Pm=function(t,e,n){var o=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return x(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),sa(t,e,{leading:o,maxWait:e,trailing:i})};var Lm=n(903),Om={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Lm.Z,Om);Lm.Z.locals;class Rm extends ue{static get pluginName(){return"DragDrop"}static get requires(){return[Ug,zm]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=Pm((t=>this._updateDropMarker(t)),40),this._removeDropMarkerDelayed=Vm((()=>this._removeDropMarker()),40),this._clearDraggableAttributesDelayed=Vm((()=>this._clearDraggableAttributes()),40),e.addObserver(Fg),e.addObserver(ug),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((t,e,n)=>{n||this._finalizeDragging(!1)})),sr.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=e.document,o=t.editing.view,i=o.document;this.listenTo(i,"dragstart",((o,s)=>{const a=n.selection;if(s.target&&s.target.is("editableElement"))return void s.preventDefault();const c=s.target?Hm(s.target):null;if(c){const n=t.editing.mapper.toModelElement(c);this._draggedRange=sc.fromRange(e.createRangeOn(n)),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!i.selection.isCollapsed){const t=i.selection.getSelectedElement();t&&cm(t)||(this._draggedRange=sc.fromRange(a.getFirstRange()))}if(!this._draggedRange)return void s.preventDefault();this._draggingUid=r(),s.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",s.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=e.createSelection(this._draggedRange.toRange()),d=t.data.toView(e.getSelectedContent(l));i.fire("clipboardOutput",{dataTransfer:s.dataTransfer,content:d,method:o.name}),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(i,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this.listenTo(i,"dragenter",(()=>{this.isEnabled&&o.focus()})),this.listenTo(i,"dragleave",(()=>{this._removeDropMarkerDelayed()})),this.listenTo(i,"dragging",((e,n)=>{if(!this.isEnabled)return void(n.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const o=jm(t,n.targetRanges,n.target);this._draggedRange||(n.dataTransfer.dropEffect="copy"),sr.isGecko||("copy"==n.dataTransfer.effectAllowed?n.dataTransfer.dropEffect="copy":["all","copyMove"].includes(n.dataTransfer.effectAllowed)&&(n.dataTransfer.dropEffect="move")),o&&this._updateDropMarkerThrottled(o)}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"clipboardInput",((e,n)=>{if("drop"!=n.method)return;const o=jm(t,n.targetRanges,n.target);if(this._removeDropMarker(),!o)return this._finalizeDragging(!1),void e.stop();this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==Fm(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(o,!0))return this._finalizeDragging(!1),void e.stop();n.targetRanges=[t.editing.mapper.toViewRange(o)]}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(Ug);t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n=e.targetRanges.map((t=>this.editor.editing.mapper.toModelRange(t)));this.editor.model.change((t=>t.setSelection(n)))}),{priority:"high"}),t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n="move"==Fm(e.dataTransfer),o=!e.resultRange||!e.resultRange.isCollapsed;this._finalizeDragging(o&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const t=this.editor,e=t.editing.view,n=e.document;this.listenTo(n,"mousedown",((o,i)=>{if(sr.isAndroid||!i)return;this._clearDraggableAttributesDelayed.cancel();let r=Hm(i.target);if(sr.isBlink&&!t.isReadOnly&&!r&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&cm(t)||(r=n.selection.editableElement)}r&&(e.change((t=>{t.setAttribute("draggable","true",r)})),this._draggableElement=t.editing.mapper.toModelElement(r))})),this.listenTo(n,"mouseup",(()=>{sr.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const t=this.editor.editing;t.view.change((e=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&e.removeAttribute("draggable",t.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_setupDropMarker(){const t=this.editor;t.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),t.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(e,{writer:n})=>{if(t.model.schema.checkChild(e.markerRange.start,"$text"))return n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.innerHTML="⁠⁠",e}))}})}_updateDropMarker(t){const e=this.editor,n=e.model.markers;e.model.change((e=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(t)||e.updateMarker("drop-target",{range:t}):e.addMarker("drop-target",{range:t,usingOperation:!1,affectsData:!1})}))}_removeDropMarker(){const t=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_finalizeDragging(t){const e=this.editor,n=e.model;this._removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(t&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function jm(t,e,n){const o=t.model,i=t.editing.mapper;let r=null;const s=e?e[0].start:null;if(n.is("uiElement")&&(n=n.parent),r=function(t,e){const n=t.model,o=t.editing.mapper;if(cm(e))return n.createRangeOn(o.toModelElement(e));if(!e.is("editableElement")){const t=e.findAncestor((t=>cm(t)||t.is("editableElement")));if(cm(t))return n.createRangeOn(o.toModelElement(t))}return null}(t,n),r)return r;const a=function(t,e){const n=t.editing.mapper,o=t.editing.view,i=n.toModelElement(e);if(i)return i;const r=o.createPositionBefore(e),s=n.findMappedViewAncestor(r);return n.toModelElement(s)}(t,n),c=s?i.toModelPosition(s):null;return c?(r=function(t,e,n){const o=t.model;if(!o.schema.checkChild(n,"$block"))return null;const i=o.createPositionAt(n,0),r=e.path.slice(0,i.path.length),s=o.createPositionFromPath(e.root,r).nodeAfter;if(s&&o.schema.isObject(s))return o.createRangeOn(s);return null}(t,c,a),r||(r=o.schema.getNearestSelectionRange(c,sr.isGecko?"forward":"backward"),r||function(t,e){const n=t.model;for(;e;){if(n.schema.isObject(e))return n.createRangeOn(e);e=e.parent}}(t,c.parent))):function(t,e){const n=t.model,o=n.schema,i=n.createPositionAt(e,0);return o.getNearestSelectionRange(i,"forward")}(t,a)}function Fm(t){return sr.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function Vm(t,e){let n;function o(...i){o.cancel(),n=setTimeout((()=>t(...i)),e)}return o.cancel=()=>{clearTimeout(n)},o}function Hm(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(cm);if(cm(t))return t;const e=t.findAncestor((t=>cm(t)||t.is("editableElement")));return cm(e)?e:null}class Um extends ue{static get pluginName(){return"PastePlainText"}static get requires(){return[Ug]}init(){const t=this.editor,e=t.model,n=t.editing.view,o=n.document,i=e.document.selection;let r=!1;n.addObserver(Fg),this.listenTo(o,"keydown",((t,e)=>{r=e.shiftKey})),t.plugins.get(Ug).on("contentInsertion",((t,n)=>{(r||function(t,e){if(t.childCount>1)return!1;const n=t.getChild(0);if(e.isObject(n))return!1;return 0==[...n.getAttributeKeys()].length}(n.content,e.schema))&&e.change((t=>{const o=Array.from(i.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));i.isCollapsed||e.deleteContent(i,{doNotAutoparagraph:!0}),o.push(...i.getAttributes());const r=t.createRangeIn(n.content);for(const e of r.getItems())e.is("$textProxy")&&t.setAttributes(o,e)}))}))}}class Gm extends ue{static get pluginName(){return"Clipboard"}static get requires(){return[Ug,Rm,Um]}}class qm extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n){const o=n.isCollapsed,i=n.getFirstRange(),r=i.start.parent,s=i.end.parent,a=r==s;if(o){const o=Gg(t.schema,n.getAttributes());Wm(t,e,i.end),e.removeSelectionAttribute(n.getAttributeKeys()),e.setSelectionAttribute(o)}else{const o=!(i.start.isAtStart&&i.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:o}),a?Wm(t,e,n.focus):o&&e.setSelection(s,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})}))}refresh(){const t=this.editor.model,e=t.document;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const o=e.getFirstRange(),i=o.start.parent,r=o.end.parent;if((Ym(i,t)||Ym(r,t))&&i!==r)return!1;return!0}(t.schema,e.selection)}}function Wm(t,e,n){const o=e.createElement("softBreak");t.insertContent(o,n),e.setSelection(o,"after")}function Ym(t,e){return!t.is("rootElement")&&(e.isLimit(t)||Ym(t.parent,e))}class Km extends ue{static get pluginName(){return"ShiftEnter"}init(){const t=this.editor,e=t.model.schema,n=t.conversion,o=t.editing.view,i=o.document;e.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(t,{writer:e})=>e.createEmptyElement("br")}),o.addObserver(Yg),t.commands.add("shiftEnter",new qm(t)),this.listenTo(i,"enter",((e,n)=>{n.preventDefault(),n.isSoft&&(t.execute("shiftEnter"),o.scrollToTheSelection())}),{priority:"low"})}}class $m extends me{constructor(t){super(t),this.affectsData=!1}execute(){const t=this.editor.model,e=t.document.selection;let n=t.schema.getLimitElement(e);if(e.containsEntireContent(n)||!Qm(t.schema,n))do{if(n=n.parent,!n)return}while(!Qm(t.schema,n));t.change((t=>{t.setSelection(n,"in")}))}}function Qm(t,e){return t.isLimit(e)&&(t.checkChild(e,"$text")||t.checkChild(e,"paragraph"))}const Zm=gr("Ctrl+A");class Jm extends ue{static get pluginName(){return"SelectAllEditing"}init(){const t=this.editor,e=t.editing.view.document;t.commands.add("selectAll",new $m(t)),this.listenTo(e,"keydown",((e,n)=>{ur(n)===Zm&&(t.execute("selectAll"),n.preventDefault())}))}}class Xm extends ue{static get pluginName(){return"SelectAllUI"}init(){const t=this.editor;t.ui.componentFactory.add("selectAll",(e=>{const n=t.commands.get("selectAll"),o=new ph(e),i=e.t;return o.set({label:i("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),o.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),o}))}}class tp extends ue{static get requires(){return[Jm,Xm]}static get pluginName(){return"SelectAll"}}class ep extends me{constructor(t,e){super(t),this._buffer=new $g(t.model,e)}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,o=t.text||"",i=o.length,r=t.range?e.createSelection(t.range):n.selection,s=t.resultRange;e.enqueueChange(this._buffer.batch,(t=>{this._buffer.lock(),e.deleteContent(r),o&&e.insertContent(t.createText(o,n.selection.getAttributes()),r),s?t.setSelection(s):r.is("documentSelection")||t.setSelection(r),this._buffer.unlock(),this._buffer.input(i)}))}}class np{constructor(t){this.editor=t,this.editing=this.editor.editing}handle(t,e){if(function(t){if(0==t.length)return!1;for(const e of t)if("children"===e.type&&!Zg(e))return!0;return!1}(t))this._handleContainerChildrenMutations(t,e);else for(const n of t)this._handleTextMutation(n,e),this._handleTextNodeInsertion(n)}_handleContainerChildrenMutations(t,e){const n=function(t){const e=t.map((t=>t.node)).reduce(((t,e)=>t.getCommonAncestor(e,{includeSelf:!0})));if(!e)return;return e.getAncestors({includeSelf:!0,parentFirst:!0}).find((t=>t.is("containerElement")||t.is("rootElement")))}(t);if(!n)return;const o=this.editor.editing.view.domConverter.mapViewToDom(n),i=new gs(this.editor.editing.view.document),r=this.editor.data.toModel(i.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(n);if(!s)return;const a=Array.from(r.getChildren()),c=Array.from(s.getChildren()),l=a[a.length-1],d=c[c.length-1],h=l&&l.is("element","softBreak"),u=d&&!d.is("element","softBreak");h&&u&&a.pop();const g=this.editor.model.schema;if(!op(a,g)||!op(c,g))return;const m=a.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," "),p=c.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," ");if(p===m)return;const f=qr(p,m),{firstChangeAt:k,insertions:b,deletions:w}=ip(f);let A=null;e&&(A=this.editing.mapper.toModelRange(e.getFirstRange()));const _=m.substr(k,b),C=this.editor.model.createRange(this.editor.model.createPositionAt(s,k),this.editor.model.createPositionAt(s,k+w));this.editor.execute("input",{text:_,range:C,resultRange:A})}_handleTextMutation(t,e){if("text"!=t.type)return;const n=t.newText.replace(/\u00A0/g," "),o=t.oldText.replace(/\u00A0/g," ");if(o===n)return;const i=qr(o,n),{firstChangeAt:r,insertions:s,deletions:a}=ip(i);let c=null;e&&(c=this.editing.mapper.toModelRange(e.getFirstRange()));const l=this.editing.view.createPositionAt(t.node,r),d=this.editing.mapper.toModelPosition(l),h=this.editor.model.createRange(d,d.getShiftedBy(a)),u=n.substr(r,s);this.editor.execute("input",{text:u,range:h,resultRange:c})}_handleTextNodeInsertion(t){if("children"!=t.type)return;const e=Zg(t),n=this.editing.view.createPositionAt(t.node,e.index),o=this.editing.mapper.toModelPosition(n),i=e.values[0].data;this.editor.execute("input",{text:i.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function op(t,e){return t.every((t=>e.isInline(t)))}function ip(t){let e=null,n=null;for(let o=0;o{n.deleteContent(n.document.selection)})),t.unlock()}sr.isAndroid?o.document.on("beforeinput",((t,e)=>r(e)),{priority:"lowest"}):o.document.on("keydown",((t,e)=>r(e)),{priority:"lowest"}),o.document.on("compositionstart",(function(){const t=n.document,e=1!==t.selection.rangeCount||t.selection.getFirstRange().isFlat;t.selection.isCollapsed||e||s()}),{priority:"lowest"}),o.document.on("compositionend",(()=>{e=n.createSelection(n.document.selection)}),{priority:"lowest"})}(t),function(t){t.editing.view.document.on("mutations",((e,n,o)=>{new np(t).handle(n,o)}))}(t)}}class sp extends ue{static get requires(){return[rp,em]}static get pluginName(){return"Typing"}}function ap(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>o.is("$text")||o.is("$textProxy")?t+o.data:(n=e.createPositionAfter(o),"")),""),range:e.createRange(n,t.end)}}class cp{constructor(t,e){this.model=t,this.testCallback=e,this.hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(t.document.selection),this.stopListening(t.document))})),this._startListening()}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",((e,{directChange:n})=>{n&&(t.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))})),this.listenTo(t,"change:data",((t,e)=>{!e.isUndo&&e.isLocal&&this._evaluateTextBeforeSelection("data",{batch:e})}))}_evaluateTextBeforeSelection(t,e={}){const n=this.model,o=n.document.selection,i=n.createRange(n.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=ap(i,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const n=Object.assign(e,{text:r,range:s});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${t}`,n)}}}he(cp,re);class lp extends ue{static get pluginName(){return"TwoStepCaretMovement"}constructor(t){super(t),this.attributes=new Set,this._overrideUid=null}init(){const t=this.editor,e=t.model,n=t.editing.view,o=t.locale,i=e.document.selection;this.listenTo(n.document,"arrowKey",((t,e)=>{if(!i.isCollapsed)return;if(e.shiftKey||e.altKey||e.ctrlKey)return;const n=e.keyCode==dr.arrowright,r=e.keyCode==dr.arrowleft;if(!n&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&n||"rtl"===s&&r?this._handleForwardMovement(e):this._handleBackwardMovement(e),!0===a&&t.stop()}),{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(i,"change:range",((t,e)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!e.directChange&&gp(i.getFirstPosition(),this.attributes)||this._restoreGravity())}))}registerAttribute(t){this.attributes.add(t)}_handleForwardMovement(t){const e=this.attributes,n=this.editor.model.document.selection,o=n.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!dp(n,e))&&(gp(o,e)?(up(t),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(t){const e=this.attributes,n=this.editor.model,o=n.document.selection,i=o.getFirstPosition();return this._isGravityOverridden?(up(t),this._restoreGravity(),hp(n,e,i),!0):i.isAtStart?!!dp(o,e)&&(up(t),hp(n,e,i),!0):function(t,e){return gp(t.getShiftedBy(-1),e)}(i,e)?i.isAtEnd&&!dp(o,e)&&gp(i,e)?(up(t),hp(n,e,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):void 0}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((t=>t.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((t=>{t.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function dp(t,e){for(const n of e)if(t.hasAttribute(n))return!0;return!1}function hp(t,e,n){const o=n.nodeBefore;t.change((t=>{o?t.setSelectionAttribute(o.getAttributes()):t.removeSelectionAttribute(e)}))}function up(t){t.preventDefault()}function gp(t,e){const{nodeBefore:n,nodeAfter:o}=t;for(const t of e){const e=n?n.getAttribute(t):void 0;if((o?o.getAttribute(t):void 0)!==e)return!0}return!1}var mp=/[\\^$.*+?()[\]{}|]/g,pp=RegExp(mp.source);const fp=function(t){return(t=si(t))&&pp.test(t)?t.replace(mp,"\\$&"):t},kp={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:vp('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:vp("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:vp("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:vp('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:vp('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:vp("'"),to:[null,"‚",null,"’"]}},bp={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},wp=["symbols","mathematical","typography","quotes"];function Ap(t){return"string"==typeof t?new RegExp(`(${fp(t)})$`):t}function _p(t){return"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t}function Cp(t){return(t.textNode?t.textNode:t.nodeAfter).getAttributes()}function vp(t){return new RegExp(`(^|\\s)(${t})([^${t}]*)(${t})$`)}function yp(t,e,n,o){return o.createRange(xp(t,e,n,!0,o),xp(t,e,n,!1,o))}function xp(t,e,n,o,i){let r=t.textNode||(o?t.nodeBefore:t.nodeAfter),s=null;for(;r&&r.getAttribute(e)==n;)s=r,r=o?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,o?"before":"after"):t}class Ep extends me{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(t.data,"set",((t,e)=>{e[1]={...e[1]};const n=e[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(t.data,"set",((t,e)=>{e[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const o=this.editor.model,i=o.document,r=[],s=t.map((t=>t.getTransformedByOperations(n))),a=s.flat();for(const t of s){const e=t.filter((t=>t.root!=i.graveyard)).filter((t=>!Ip(t,a)));e.length&&(Dp(e),r.push(e[0]))}r.length&&o.change((t=>{t.setSelection(r,{backward:e})}))}_undo(t,e){const n=this.editor.model,o=n.document;this._createdBatches.add(e);const i=t.operations.slice().filter((t=>t.isDocumentOperation));i.reverse();for(const t of i){const i=t.baseVersion+1,r=Array.from(o.history.getOperations(i)),s=ig([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const i of s)e.addOperation(i),n.applyOperation(i),o.history.setOperationAsUndone(t,i)}}}function Dp(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class Tp extends Ep{execute(t=null){const e=t?this._stack.findIndex((e=>e.batch==t)):this._stack.length-1,n=this._stack.splice(e,1)[0],o=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(o,(()=>{this._undo(n.batch,o);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t),this.fire("revert",n.batch,o)})),this.refresh()}}class Sp extends Ep{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,(()=>{const n=t.batch.operations[t.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(n);this._restoreSelection(t.selection.ranges,t.selection.isBackward,o),this._undo(t.batch,e)})),this.refresh()}}class Mp extends ue{static get pluginName(){return"UndoEditing"}constructor(t){super(t),this._batchRegistry=new WeakSet}init(){const t=this.editor;this._undoCommand=new Tp(t),this._redoCommand=new Sp(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",((t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const o=n.batch,i=this._redoCommand._createdBatches.has(o),r=this._undoCommand._createdBatches.has(o);this._batchRegistry.has(o)||(this._batchRegistry.add(o),o.isUndoable&&(i?this._undoCommand.addBatch(o):r||(this._undoCommand.addBatch(o),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((t,e,n)=>{this._redoCommand.addBatch(n)})),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo")}}const Np='',zp='';class Bp extends ue{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?Np:zp,i="ltr"==e.uiLanguageDirection?zp:Np;this._addButton("undo",n("Undo"),"CTRL+Z",o),this._addButton("redo",n("Redo"),"CTRL+Y",i)}_addButton(t,e,n,o){const i=this.editor;i.ui.componentFactory.add(t,(r=>{const s=i.commands.get(t),a=new ph(r);return a.set({label:e,icon:o,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",(()=>{i.execute(t),i.editing.view.focus()})),a}))}}class Pp extends ue{static get requires(){return[Mp,Bp]}static get pluginName(){return"Undo"}}const Lp=["left","right","center","justify"];function Op(t){return Lp.includes(t)}function Rp(t,e){return"rtl"==e.contentLanguageDirection?"right"===t:"left"===t}function jp(t){const e=t.map((t=>{let e;return e="string"==typeof t?{name:t}:t,e})).filter((t=>{const e=!!Lp.includes(t.name);return e||l("alignment-config-name-not-recognized",{option:t}),e})),n=e.filter((t=>!!t.className)).length;if(n&&n{const i=o.slice(n+1);if(i.some((t=>t.name==e.name)))throw new c("alignment-config-name-already-defined",{option:e,configuredOptions:t});if(e.className){if(i.some((t=>t.className==e.className)))throw new c("alignment-config-classname-already-defined",{option:e,configuredOptions:t})}})),e}const Fp="alignment";class Vp extends me{refresh(){const t=this.editor.locale,e=Ma(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!e&&this._canBeAligned(e),this.isEnabled&&e.hasAttribute("alignment")?this.value=e.getAttribute("alignment"):this.value="rtl"===t.contentLanguageDirection?"right":"left"}execute(t={}){const e=this.editor,n=e.locale,o=e.model,i=o.document,r=t.value;o.change((t=>{const e=Array.from(i.selection.getSelectedBlocks()).filter((t=>this._canBeAligned(t))),o=e[0].getAttribute("alignment");Rp(r,n)||o===r||!r?function(t,e){for(const n of t)e.removeAttribute(Fp,n)}(e,t):function(t,e,n){for(const o of t)e.setAttribute(Fp,n,o)}(e,t,r)}))}_canBeAligned(t){return this.editor.model.schema.checkAttribute(t,Fp)}}class Hp extends ue{static get pluginName(){return"AlignmentEditing"}constructor(t){super(t),t.config.define("alignment",{options:[...Lp.map((t=>({name:t})))]})}init(){const t=this.editor,e=t.locale,n=t.model.schema,o=jp(t.config.get("alignment.options")).filter((t=>Op(t.name)&&!Rp(t.name,e))),i=o.some((t=>!!t.className));n.extend("$block",{allowAttributes:"alignment"}),t.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),i?t.conversion.attributeToAttribute(function(t){const e={model:{key:"alignment",values:t.map((t=>t.name))},view:{}};for(const n of t)e.view[n.name]={key:"class",value:n.className};return e}(o)):t.conversion.for("downcast").attributeToAttribute(function(t){const e={model:{key:"alignment",values:t.map((t=>t.name))},view:{}};for(const{name:n}of t)e.view[n]={key:"style",value:{"text-align":n}};return e}(o));const r=function(t){const e=[];for(const{name:n}of t)e.push({view:{key:"style",value:{"text-align":n}},model:{key:"alignment",value:n}});return e}(o);for(const e of r)t.conversion.for("upcast").attributeToAttribute(e);const s=function(t){const e=[];for(const{name:n}of t)e.push({view:{key:"align",value:n},model:{key:"alignment",value:n}});return e}(o);for(const e of s)t.conversion.for("upcast").attributeToAttribute(e);t.commands.add("alignment",new Vp(t))}}const Up=new Map([["left",Md.alignLeft],["right",Md.alignRight],["center",Md.alignCenter],["justify",Md.alignJustify]]);class Gp extends ue{get localizedOptionTitles(){const t=this.editor.t;return{left:t("Align left"),right:t("Align right"),center:t("Align center"),justify:t("Justify")}}static get pluginName(){return"AlignmentUI"}init(){const t=this.editor,e=t.ui.componentFactory,n=t.t,o=jp(t.config.get("alignment.options"));o.map((t=>t.name)).filter(Op).forEach((t=>this._addButton(t))),e.add("alignment",(t=>{const i=nu(t),r=o.map((t=>e.create(`alignment:${t.name}`)));ou(i,r),i.buttonView.set({label:n("Text alignment"),tooltip:!0}),i.toolbarView.isVertical=!0,i.toolbarView.ariaLabel=n("Text alignment toolbar"),i.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const s="rtl"===t.contentLanguageDirection?Up.get("right"):Up.get("left");return i.buttonView.bind("icon").toMany(r,"isOn",((...t)=>{const e=t.findIndex((t=>t));return e<0?s:r[e].icon})),i.bind("isEnabled").toMany(r,"isEnabled",((...t)=>t.some((t=>t)))),i}))}_addButton(t){const e=this.editor;e.ui.componentFactory.add(`alignment:${t}`,(n=>{const o=e.commands.get("alignment"),i=new ph(n);return i.set({label:this.localizedOptionTitles[t],icon:Up.get(t),tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(o),i.bind("isOn").to(o,"value",(e=>e===t)),this.listenTo(i,"execute",(()=>{e.execute("alignment",{value:t}),e.editing.view.focus()})),i}))}}class qp extends me{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=e.selection.getAttribute(this.attributeKey),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,o=t.value;e.change((t=>{if(n.isCollapsed)o?t.setSelectionAttribute(this.attributeKey,o):t.removeSelectionAttribute(this.attributeKey);else{const i=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of i)o?t.setAttribute(this.attributeKey,o,e):t.removeAttribute(this.attributeKey,e)}}))}}class Wp extends Io{constructor(t){super(t),this.set("isEmpty",!0),this.on("change",(()=>{this.set("isEmpty",0===this.length)}))}add(t,e){this.find((e=>e.color===t.color))||super.add(t,e)}hasColor(t){return!!this.find((e=>e.color===t))}}he(Wp,re);var Yp=n(1896),Kp={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Yp.Z,Kp);Yp.Z.locals;class $p extends Rd{constructor(t,{colors:e,columns:n,removeButtonLabel:o,documentColorsLabel:i,documentColorsCount:r}){super(t),this.items=this.createCollection(),this.colorDefinitions=e,this.focusTracker=new Na,this.keystrokes=new za,this.set("selectedColor"),this.removeButtonLabel=o,this.columns=n,this.documentColors=new Wp,this.documentColorsCount=r,this._focusCycler=new Ch({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this._documentColorsLabel=i,this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table"]},children:this.items}),this.items.add(this._removeColorButton())}updateDocumentColors(t,e){const n=t.document,o=this.documentColorsCount;this.documentColors.clear();for(const i of n.getRootNames()){const r=n.getRoot(i),s=t.createRangeIn(r);for(const t of s.getItems())if(t.is("$textProxy")&&t.hasAttribute(e)&&(this._addColorToDocumentColors(t.getAttribute(e)),this.documentColors.length>=o))return}}updateSelectedColors(){const t=this.documentColorsGrid,e=this.staticColorsGrid,n=this.selectedColor;e.selectedColor=n,t&&(t.selectedColor=n)}render(){super.render();for(const t of this.items)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendGrids(){if(!this.staticColorsGrid&&(this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount)){const t=jd.bind(this.documentColors,this.documentColors),e=new du(this.locale);e.text=this._documentColorsLabel,e.extendTemplate({attributes:{class:["ck","ck-color-grid__label",t.if("isEmpty","ck-hidden")]}}),this.items.add(e),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_removeColorButton(){const t=new ph;return t.set({withText:!0,icon:Md.eraser,tooltip:!0,label:this.removeButtonLabel}),t.class="ck-color-table__remove-color",t.on("execute",(()=>{this.fire("execute",{value:null})})),t}_createStaticColorsGrid(){const t=new Eh(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return t.delegate("execute").to(this),t}_createDocumentColorsGrid(){const t=jd.bind(this.documentColors,this.documentColors),e=new Eh(this.locale,{columns:this.columns});return e.delegate("execute").to(this),e.extendTemplate({attributes:{class:t.if("isEmpty","ck-hidden")}}),e.items.bindTo(this.documentColors).using((t=>{const e=new Ah;return e.set({color:t.color,hasBorder:t.options&&t.options.hasBorder}),t.label&&e.set({label:t.label,tooltip:!0}),e.on("execute",(()=>{this.fire("execute",{value:t.color})})),e})),this.documentColors.on("change:isEmpty",((t,n,o)=>{o&&(e.selectedColor=null)})),e}_addColorToDocumentColors(t){const e=this.colorDefinitions.find((e=>e.color===t));e?this.documentColors.add(Object.assign({},e)):this.documentColors.add({color:t,label:t,options:{hasBorder:!1}})}}const Qp="fontSize",Zp="fontFamily",Jp="fontColor",Xp="fontBackgroundColor";function tf(t,e){const n={model:{key:t,values:[]},view:{},upcastAlso:{}};for(const t of e)n.model.values.push(t.model),n.view[t.model]=t.view,t.upcastAlso&&(n.upcastAlso[t.model]=t.upcastAlso);return n}function ef(t){return e=>e.getStyle(t).replace(/\s/g,"")}function nf(t){return(e,{writer:n})=>n.createAttributeElement("span",{style:`${t}:${e}`},{priority:7})}class of extends qp{constructor(t){super(t,Qp)}}function rf(t){return t.map((t=>function(t){if(e=t,"object"==typeof e&&e.title&&e.model&&e.view)return af(t);var e;const n=function(t){return sf[t]||sf[t.model]}(t);if(n)return af(n);if("default"===t)return{model:void 0,title:"Default"};if(function(t){let e;if("object"==typeof t){if(!t.model)throw new c("font-size-invalid-definition",null,t);e=parseFloat(t.model)}else e=parseFloat(t);return isNaN(e)}(t))return;return function(t){"number"!=typeof t&&"string"!=typeof t||(t={title:String(t),model:`${parseFloat(t)}px`});return t.view={name:"span",styles:{"font-size":t.model}},af(t)}(t)}(t))).filter((t=>!!t))}const sf={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function af(t){return t.view.priority||(t.view.priority=7),t}const cf=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class lf extends ue{static get pluginName(){return"FontSizeEditing"}constructor(t){super(t),t.config.define(Qp,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Qp}),t.model.schema.setAttributeProperties(Qp,{isFormatting:!0,copyOnEnter:!0});const e=t.config.get("fontSize.supportAllValues"),n=rf(this.editor.config.get("fontSize.options")).filter((t=>t.model)),o=tf(Qp,n);e?(this._prepareAnyValueConverters(o),this._prepareCompatibilityConverter()):t.conversion.attributeToElement(o),t.commands.add(Qp,new of(t))}_prepareAnyValueConverters(t){const e=this.editor,n=t.model.values.filter((t=>{return!(e=String(t),_g.test(e)||function(t){return Cg.test(t)}(String(t)));var e}));if(n.length)throw new c("font-size-invalid-use-of-named-presets",null,{presets:n});e.conversion.for("downcast").attributeToElement({model:Qp,view:(t,{writer:e})=>{if(t)return e.createAttributeElement("span",{style:"font-size:"+t},{priority:7})}}),e.conversion.for("upcast").elementToAttribute({model:{key:Qp,value:t=>t.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:Qp,value:t=>{const e=t.getAttribute("size"),n="-"===e[0]||"+"===e[0];let o=parseInt(e,10);n&&(o=3+o);const i=cf.length-1,r=Math.min(Math.max(o,0),i);return cf[r]}}})}}var df=n(6007),hf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(df.Z,hf);df.Z.locals;class uf extends ue{static get pluginName(){return"FontSizeUI"}init(){const t=this.editor,e=t.t,n=this._getLocalizedOptions(),o=t.commands.get(Qp);t.ui.componentFactory.add(Qp,(i=>{const r=nu(i);return iu(r,function(t,e){const n=new Io;for(const o of t){const t={type:"button",model:new Eu({commandName:Qp,commandParam:o.model,label:o.title,class:"ck-fontsize-option",withText:!0})};o.view&&o.view.styles&&t.model.set("labelStyle",`font-size:${o.view.styles["font-size"]}`),o.view&&o.view.classes&&t.model.set("class",`${t.model.class} ${o.view.classes}`),t.model.bind("isOn").to(e,"value",(t=>t===o.model)),n.add(t)}return n}(n,o)),r.buttonView.set({label:e("Font Size"),icon:'',tooltip:!0}),r.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),r.bind("isEnabled").to(o),this.listenTo(r,"execute",(e=>{t.execute(e.source.commandName,{value:e.source.commandParam}),t.editing.view.focus()})),r}))}_getLocalizedOptions(){const t=this.editor,e=t.t,n={Default:e("Default"),Tiny:e("Tiny"),Small:e("Small"),Big:e("Big"),Huge:e("Huge")};return rf(t.config.get(Qp).options).map((t=>{const e=n[t.title];return e&&e!=t.title&&(t=Object.assign({},t,{title:e})),t}))}}class gf extends qp{constructor(t){super(t,Zp)}}function mf(t){return t.map(pf).filter((t=>!!t))}function pf(t){return"object"==typeof t?t:"default"===t?{title:"Default",model:void 0}:"string"==typeof t?function(t){const e=t.replace(/"|'/g,"").split(","),n=e[0],o=e.map(ff).join(", ");return{title:n,model:o,view:{name:"span",styles:{"font-family":o},priority:7}}}(t):void 0}function ff(t){return(t=t.trim()).indexOf(" ")>0&&(t=`'${t}'`),t}class kf extends ue{static get pluginName(){return"FontFamilyEditing"}constructor(t){super(t),t.config.define(Zp,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Zp}),t.model.schema.setAttributeProperties(Zp,{isFormatting:!0,copyOnEnter:!0});const e=mf(t.config.get("fontFamily.options")).filter((t=>t.model)),n=tf(Zp,e);t.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):t.conversion.attributeToElement(n),t.commands.add(Zp,new gf(t))}_prepareAnyValueConverters(){const t=this.editor;t.conversion.for("downcast").attributeToElement({model:Zp,view:(t,{writer:e})=>e.createAttributeElement("span",{style:"font-family:"+t},{priority:7})}),t.conversion.for("upcast").elementToAttribute({model:{key:Zp,value:t=>t.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:Zp,value:t=>t.getAttribute("face")}})}}class bf extends ue{static get pluginName(){return"FontFamilyUI"}init(){const t=this.editor,e=t.t,n=this._getLocalizedOptions(),o=t.commands.get(Zp);t.ui.componentFactory.add(Zp,(i=>{const r=nu(i);return iu(r,function(t,e){const n=new Io;for(const o of t){const t={type:"button",model:new Eu({commandName:Zp,commandParam:o.model,label:o.title,withText:!0})};t.model.bind("isOn").to(e,"value",(t=>t===o.model||!(!t||!o.model)&&t.split(",")[0].replace(/'/g,"").toLowerCase()===o.model.toLowerCase())),o.view&&o.view.styles&&t.model.set("labelStyle",`font-family: ${o.view.styles["font-family"]}`),n.add(t)}return n}(n,o)),r.buttonView.set({label:e("Font Family"),icon:'',tooltip:!0}),r.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),r.bind("isEnabled").to(o),this.listenTo(r,"execute",(e=>{t.execute(e.source.commandName,{value:e.source.commandParam}),t.editing.view.focus()})),r}))}_getLocalizedOptions(){const t=this.editor,e=t.t;return mf(t.config.get(Zp).options).map((t=>("Default"===t.title&&(t.title=e("Default")),t)))}}class wf extends qp{constructor(t){super(t,Jp)}}class Af extends ue{static get pluginName(){return"FontColorEditing"}constructor(t){super(t),t.config.define(Jp,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),t.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:Jp,value:ef("color")}}),t.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:Jp,value:t=>t.getAttribute("color")}}),t.conversion.for("downcast").attributeToElement({model:Jp,view:nf("color")}),t.commands.add(Jp,new wf(t)),t.model.schema.extend("$text",{allowAttributes:Jp}),t.model.schema.setAttributeProperties(Jp,{isFormatting:!0,copyOnEnter:!0})}}class _f extends ue{constructor(t,{commandName:e,icon:n,componentName:o,dropdownLabel:i}){super(t),this.commandName=e,this.componentName=o,this.icon=n,this.dropdownLabel=i,this.columns=t.config.get(`${this.componentName}.columns`),this.colorTableView=void 0}init(){const t=this.editor,e=t.locale,n=e.t,o=t.commands.get(this.commandName),i=function(t){return t.map(wh).filter((t=>!!t))}(t.config.get(this.componentName).colors),r=function(t,e){const n=t.t,o={Black:n("Black"),"Dim grey":n("Dim grey"),Grey:n("Grey"),"Light grey":n("Light grey"),White:n("White"),Red:n("Red"),Orange:n("Orange"),Yellow:n("Yellow"),"Light green":n("Light green"),Green:n("Green"),Aquamarine:n("Aquamarine"),Turquoise:n("Turquoise"),"Light blue":n("Light blue"),Blue:n("Blue"),Purple:n("Purple")};return e.map((t=>{const e=o[t.label];return e&&e!=t.label&&(t.label=e),t}))}(e,i),s=t.config.get(`${this.componentName}.documentColors`);t.ui.componentFactory.add(this.componentName,(e=>{const i=nu(e);return this.colorTableView=function({dropdownView:t,colors:e,columns:n,removeButtonLabel:o,documentColorsLabel:i,documentColorsCount:r}){const s=t.locale,a=new $p(s,{colors:e,columns:n,removeButtonLabel:o,documentColorsLabel:i,documentColorsCount:r});return t.colorTableView=a,t.panelView.children.add(a),a.delegate("execute").to(t,"execute"),a}({dropdownView:i,colors:r.map((t=>({label:t.label,color:t.model,options:{hasBorder:t.hasBorder}}))),columns:this.columns,removeButtonLabel:n("Remove color"),documentColorsLabel:0!==s?n("Document colors"):void 0,documentColorsCount:void 0===s?this.columns:s}),this.colorTableView.bind("selectedColor").to(o,"value"),i.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),i.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),i.bind("isEnabled").to(o),i.on("execute",((e,n)=>{t.execute(this.commandName,n),t.editing.view.focus()})),i.on("change:isOpen",((e,n,o)=>{i.colorTableView.appendGrids(),o&&(0!==s&&this.colorTableView.updateDocumentColors(t.model,this.componentName),this.colorTableView.updateSelectedColors())})),i}))}}class Cf extends _f{constructor(t){const e=t.locale.t;super(t,{commandName:Jp,componentName:Jp,icon:'',dropdownLabel:e("Font Color")})}static get pluginName(){return"FontColorUI"}}class vf extends qp{constructor(t){super(t,Xp)}}class yf extends ue{static get pluginName(){return"FontBackgroundColorEditing"}constructor(t){super(t),t.config.define(Xp,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),t.data.addStyleProcessorRules(zg),t.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:Xp,value:ef("background-color")}}),t.conversion.for("downcast").attributeToElement({model:Xp,view:nf("background-color")}),t.commands.add(Xp,new vf(t)),t.model.schema.extend("$text",{allowAttributes:Xp}),t.model.schema.setAttributeProperties(Xp,{isFormatting:!0,copyOnEnter:!0})}}class xf extends _f{constructor(t){const e=t.locale.t;super(t,{commandName:Xp,componentName:Xp,icon:'',dropdownLabel:e("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class Ef{constructor(){const t=new window.FileReader;this._reader=t,this._data=void 0,this.set("loaded",0),t.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(t){const e=this._reader;return this.total=t.size,new Promise(((n,o)=>{e.onload=()=>{const t=e.result;this._data=t,n(t)},e.onerror=()=>{o("error")},e.onabort=()=>{o("aborted")},this._reader.readAsDataURL(t)}))}abort(){this._reader.abort()}}he(Ef,re);class Df extends ue{static get pluginName(){return"FileRepository"}static get requires(){return[Td]}init(){this.loaders=new Io,this.loaders.on("add",(()=>this._updatePendingAction())),this.loaders.on("remove",(()=>this._updatePendingAction())),this._loadersMap=new Map,this._pendingAction=null,this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0))}getLoader(t){return this._loadersMap.get(t)||null}createLoader(t){if(!this.createUploadAdapter)return l("filerepository-no-upload-adapter"),null;const e=new If(Promise.resolve(t),this.createUploadAdapter);return this.loaders.add(e),this._loadersMap.set(t,e),t instanceof Promise&&e.file.then((t=>{this._loadersMap.set(t,e)})).catch((()=>{})),e.on("change:uploaded",(()=>{let t=0;for(const e of this.loaders)t+=e.uploaded;this.uploaded=t})),e.on("change:uploadTotal",(()=>{let t=0;for(const e of this.loaders)e.uploadTotal&&(t+=e.uploadTotal);this.uploadTotal=t})),e}destroyLoader(t){const e=t instanceof If?t:this.getLoader(t);e._destroy(),this.loaders.remove(e),this._loadersMap.forEach(((t,n)=>{t===e&&this._loadersMap.delete(n)}))}_updatePendingAction(){const t=this.editor.plugins.get(Td);if(this.loaders.length){if(!this._pendingAction){const e=this.editor.t,n=t=>`${e("Upload in progress")} ${parseInt(t)}%.`;this._pendingAction=t.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else t.remove(this._pendingAction),this._pendingAction=null}}he(Df,re);class If{constructor(t,e){this.id=r(),this._filePromiseWrapper=this._createFilePromiseWrapper(t),this._adapter=e(this),this._reader=new Ef,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((t=>this._filePromiseWrapper?t:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new c("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((t=>this._reader.read(t))).then((t=>{if("reading"!==this.status)throw this.status;return this.status="idle",t})).catch((t=>{if("aborted"===t)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:t}))}upload(){if("idle"!=this.status)throw new c("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((t=>(this.uploadResponse=t,this.status="idle",t))).catch((t=>{if("aborted"===this.status)throw"aborted";throw this.status="error",t}))}abort(){const t=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==t?this._reader.abort():"uploading"==t&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(t){const e={};return e.promise=new Promise(((n,o)=>{e.rejecter=o,e.isFulfilled=!1,t.then((t=>{e.isFulfilled=!0,n(t)})).catch((t=>{e.isFulfilled=!0,o(t)}))})),e}}he(If,re);class Tf extends Rd{constructor(t){super(t),this.buttonView=new ph(t),this._fileInputView=new Sf(t),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",(()=>{this._fileInputView.open()}))}focus(){this.buttonView.focus()}}class Sf extends Rd{constructor(t){super(t),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:e.to("acceptedType"),multiple:e.to("allowMultipleFiles")},on:{change:e.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}const Mf="ckCsrfToken",Nf="abcdefghijklmnopqrstuvwxyz0123456789";function zf(){let t=function(t){t=t.toLowerCase();const e=document.cookie.split(";");for(const n of e){const e=n.split("=");if(decodeURIComponent(e[0].trim().toLowerCase())===t)return decodeURIComponent(e[1])}return null}(Mf);var e,n;return t&&40==t.length||(t=function(t){let e="";const n=new Uint8Array(t);window.crypto.getRandomValues(n);for(let t=0;t.5?o.toUpperCase():o}return e}(40),e=Mf,n=t,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(n)+";path=/"),t}class Bf{constructor(t,e,n){this.loader=t,this.url=e,this.t=n}upload(){return this.loader.file.then((t=>new Promise(((e,n)=>{this._initRequest(),this._initListeners(e,n,t),this._sendRequest(t)}))))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const t=this.xhr=new XMLHttpRequest;t.open("POST",this.url,!0),t.responseType="json"}_initListeners(t,e,n){const o=this.xhr,i=this.loader,r=(0,this.t)("Cannot upload file:")+` ${n.name}.`;o.addEventListener("error",(()=>e(r))),o.addEventListener("abort",(()=>e())),o.addEventListener("load",(()=>{const n=o.response;if(!n||!n.uploaded)return e(n&&n.error&&n.error.message?n.error.message:r);t({default:n.url})})),o.upload&&o.upload.addEventListener("progress",(t=>{t.lengthComputable&&(i.uploadTotal=t.total,i.uploaded=t.loaded)}))}_sendRequest(t){const e=new FormData;e.append("upload",t),e.append("ckCsrfToken",zf()),this.xhr.send(e)}}function Pf(t,e,n,o){let i,r=null;"function"==typeof o?i=o:(r=t.commands.get(o),i=()=>{t.execute(o)}),t.model.document.on("change:data",((s,a)=>{if(r&&!r.isEnabled||!e.isEnabled)return;const c=Ma(t.model.document.selection.getRanges());if(!c.isCollapsed)return;if(a.isUndo||!a.isLocal)return;const l=Array.from(t.model.document.differ.getChanges()),d=l[0];if(1!=l.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const h=d.position.parent;if(h.is("element","codeBlock"))return;if(h.is("element","listItem")&&"function"!=typeof o&&!["numberedList","bulletedList","todoList"].includes(o))return;if(r&&!0===r.value)return;const u=h.getChild(0),g=t.model.createRangeOn(u);if(!g.containsRange(c)&&!c.end.isEqual(g.end))return;const m=n.exec(u.data.substr(0,c.end.offset));m&&t.model.enqueueChange((e=>{const n=e.createPositionAt(h,0),o=e.createPositionAt(h,m[0].length),r=new sc(n,o);if(!1!==i({match:m})){e.remove(r);const n=t.model.document.selection.getFirstRange(),o=e.createRangeIn(h);!h.isEmpty||o.isEqual(n)||o.containsRange(n,!0)||e.remove(h)}r.detach(),t.model.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function Lf(t,e,n,o){let i,r;n instanceof RegExp?i=n:r=n,r=r||(t=>{let e;const n=[],o=[];for(;null!==(e=i.exec(t))&&!(e&&e.length<4);){let{index:t,1:i,2:r,3:s}=e;const a=i+r+s;t+=e[0].length-a.length;const c=[t,t+i.length],l=[t+i.length+r.length,t+i.length+r.length+s.length];n.push(c),n.push(l),o.push([t+i.length,t+i.length+r.length])}return{remove:n,format:o}}),t.model.document.on("change:data",((n,i)=>{if(i.isUndo||!i.isLocal||!e.isEnabled)return;const s=t.model,a=s.document.selection;if(!a.isCollapsed)return;const c=Array.from(s.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const d=a.focus,h=d.parent,{text:u,range:g}=function(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>!o.is("$text")&&!o.is("$textProxy")||o.getAttribute("code")?(n=e.createPositionAfter(o),""):t+o.data),""),range:e.createRange(n,t.end)}}(s.createRange(s.createPositionAt(h,0),d),s),m=r(u),p=Of(g.start,m.format,s),f=Of(g.start,m.remove,s);p.length&&f.length&&s.enqueueChange((e=>{if(!1!==o(e,p)){for(const t of f.reverse())e.remove(t);s.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function Of(t,e,n){return e.filter((t=>void 0!==t[0]&&void 0!==t[1])).map((e=>n.createRange(t.getShiftedBy(e[0]),t.getShiftedBy(e[1]))))}function Rf(t,e){return(n,o)=>{if(!t.commands.get(e).isEnabled)return!1;const i=t.model.schema.getValidRanges(o,e);for(const t of i)n.setAttribute(e,!0,t);n.removeSelectionAttribute(e)}}class jf extends me{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,o=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(n.isCollapsed)o?t.setSelectionAttribute(this.attributeKey,!0):t.removeSelectionAttribute(this.attributeKey);else{const i=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of i)o?t.setAttribute(this.attributeKey,o,e):t.removeAttribute(this.attributeKey,e)}}))}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const t of n.getRanges())for(const n of t.getItems())if(e.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}const Ff="bold";class Vf extends ue{static get pluginName(){return"BoldEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Ff}),t.model.schema.setAttributeProperties(Ff,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Ff,view:"strong",upcastAlso:["b",t=>{const e=t.getStyle("font-weight");return e?"bold"==e||Number(e)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),t.commands.add(Ff,new jf(t,Ff)),t.keystrokes.set("CTRL+B",Ff)}}const Hf="bold";class Uf extends ue{static get pluginName(){return"BoldUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Hf,(n=>{const o=t.commands.get(Hf),i=new ph(n);return i.set({label:e("Bold"),icon:'',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(Hf),t.editing.view.focus()})),i}))}}const Gf="italic";class qf extends ue{static get pluginName(){return"ItalicEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Gf}),t.model.schema.setAttributeProperties(Gf,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Gf,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(Gf,new jf(t,Gf)),t.keystrokes.set("CTRL+I",Gf)}}const Wf="italic";class Yf extends ue{static get pluginName(){return"ItalicUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Wf,(n=>{const o=t.commands.get(Wf),i=new ph(n);return i.set({label:e("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(Wf),t.editing.view.focus()})),i}))}}const Kf="strikethrough";class $f extends ue{static get pluginName(){return"StrikethroughEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Kf}),t.model.schema.setAttributeProperties(Kf,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Kf,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),t.commands.add(Kf,new jf(t,Kf)),t.keystrokes.set("CTRL+SHIFT+X","strikethrough")}}const Qf="strikethrough";class Zf extends ue{static get pluginName(){return"StrikethroughUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Qf,(n=>{const o=t.commands.get(Qf),i=new ph(n);return i.set({label:e("Strikethrough"),icon:'',keystroke:"CTRL+SHIFT+X",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(Qf),t.editing.view.focus()})),i}))}}const Jf="underline";class Xf extends ue{static get pluginName(){return"UnderlineEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Jf}),t.model.schema.setAttributeProperties(Jf,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Jf,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),t.commands.add(Jf,new jf(t,Jf)),t.keystrokes.set("CTRL+U","underline")}}const tk="underline";class ek extends ue{static get pluginName(){return"UnderlineUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(tk,(n=>{const o=t.commands.get(tk),i=new ph(n);return i.set({label:e("Underline"),icon:'',keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(tk),t.editing.view.focus()})),i}))}}class nk extends me{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.schema,o=e.document.selection,i=Array.from(o.getSelectedBlocks()),r=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(r){const e=i.filter((t=>ok(t)||rk(n,t)));this._applyQuote(t,e)}else this._removeQuote(t,i.filter(ok))}))}_getValue(){const t=Ma(this.editor.model.document.selection.getSelectedBlocks());return!(!t||!ok(t))}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.document.selection,e=this.editor.model.schema,n=Ma(t.getSelectedBlocks());return!!n&&rk(e,n)}_removeQuote(t,e){ik(t,e).reverse().forEach((e=>{if(e.start.isAtStart&&e.end.isAtEnd)return void t.unwrap(e.start.parent);if(e.start.isAtStart){const n=t.createPositionBefore(e.start.parent);return void t.move(e,n)}e.end.isAtEnd||t.split(e.end);const n=t.createPositionAfter(e.end.parent);t.move(e,n)}))}_applyQuote(t,e){const n=[];ik(t,e).reverse().forEach((e=>{let o=ok(e.start);o||(o=t.createElement("blockQuote"),t.wrap(e,o)),n.push(o)})),n.reverse().reduce(((e,n)=>e.nextSibling==n?(t.merge(t.createPositionAfter(e)),e):n))}}function ok(t){return"blockQuote"==t.parent.name?t.parent:null}function ik(t,e){let n,o=0;const i=[];for(;o{const o=t.model.document.differ.getChanges();for(const t of o)if("insert"==t.type){const o=t.position.nodeAfter;if(!o)continue;if(o.is("element","blockQuote")&&o.isEmpty)return n.remove(o),!0;if(o.is("element","blockQuote")&&!e.checkChild(t.position,o))return n.unwrap(o),!0;if(o.is("element")){const t=n.createRangeIn(o);for(const o of t.getItems())if(o.is("element","blockQuote")&&!e.checkChild(n.createPositionBefore(o),o))return n.unwrap(o),!0}}else if("remove"==t.type){const e=t.position.parent;if(e.is("element","blockQuote")&&e.isEmpty)return n.remove(e),!0}return!1}));const n=this.editor.editing.view.document,o=t.model.document.selection,i=t.commands.get("blockQuote");this.listenTo(n,"enter",((e,n)=>{if(!o.isCollapsed||!i.value)return;o.getLastPosition().parent.isEmpty&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"}),this.listenTo(n,"delete",((e,n)=>{if("backward"!=n.direction||!o.isCollapsed||!i.value)return;const r=o.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"})}}var ak=n(3062),ck={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(ak.Z,ck);ak.Z.locals;class lk extends ue{static get pluginName(){return"BlockQuoteUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("blockQuote",(n=>{const o=t.commands.get("blockQuote"),i=new ph(n);return i.set({label:e("Block quote"),icon:Md.quote,tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),i}))}}class dk extends ue{static get pluginName(){return"CKFinderUI"}init(){const t=this.editor,e=t.ui.componentFactory,n=t.t;e.add("ckfinder",(e=>{const o=t.commands.get("ckfinder"),i=new ph(e);return i.set({label:n("Insert image or file"),icon:'',tooltip:!0}),i.bind("isEnabled").to(o),i.on("execute",(()=>{t.execute("ckfinder"),t.editing.view.focus()})),i}))}}class hk extends me{constructor(t){super(t),this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",(()=>this.refresh()),{priority:"low"})}refresh(){const t=this.editor.commands.get("insertImage"),e=this.editor.commands.get("link");this.isEnabled=t.isEnabled||e.isEnabled}execute(){const t=this.editor,e=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=e&&"modal"!=e)throw new c("ckfinder-unknown-openermethod",t);const n=this.editor.config.get("ckfinder.options")||{};n.chooseFiles=!0;const o=n.onInit;n.language||(n.language=t.locale.uiLanguage),n.onInit=e=>{o&&o(e),e.on("files:choose",(n=>{const o=n.data.files.toArray(),i=o.filter((t=>!t.isImage())),r=o.filter((t=>t.isImage()));for(const e of i)t.execute("link",e.getUrl());const s=[];for(const t of r){const n=t.getUrl();s.push(n||e.request("file:getProxyUrl",{file:t}))}s.length&&uk(t,s)})),e.on("file:choose:resizedImage",(e=>{const n=e.data.resizedUrl;if(n)uk(t,[n]);else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not obtain resized image URL."),{title:n("Selecting resized image failed"),namespace:"ckfinder"})}}))},window.CKFinder[e](n)}}function uk(t,e){if(t.commands.get("insertImage").isEnabled)t.execute("insertImage",{source:e});else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not insert image at the current position."),{title:n("Inserting image failed"),namespace:"ckfinder"})}}class gk extends ue{static get pluginName(){return"CKFinderEditing"}static get requires(){return[xu,"LinkEditing"]}init(){const t=this.editor;if(!t.plugins.has("ImageBlockEditing")&&!t.plugins.has("ImageInlineEditing"))throw new c("ckfinder-missing-image-plugin",t);t.commands.add("ckfinder",new hk(t))}}class mk extends ue{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",Df]}init(){const t=this.editor,e=t.plugins.get("CloudServices"),n=e.token,o=e.uploadUrl;n&&(this._uploadGateway=t.plugins.get("CloudServicesCore").createUploadGateway(n,o),t.plugins.get(Df).createUploadAdapter=t=>new pk(this._uploadGateway,t))}}class pk{constructor(t,e){this.uploadGateway=t,this.loader=e}upload(){return this.loader.file.then((t=>(this.fileUploader=this.uploadGateway.upload(t),this.fileUploader.on("progress",((t,e)=>{this.loader.uploadTotal=e.total,this.loader.uploaded=e.uploaded})),this.fileUploader.send())))}abort(){this.fileUploader.abort()}}class fk extends me{refresh(){const t=this.editor.model,e=Ma(t.document.selection.getSelectedBlocks());this.value=!!e&&e.is("element","paragraph"),this.isEnabled=!!e&&kk(e,t.schema)}execute(t={}){const e=this.editor.model,n=e.document;e.change((o=>{const i=(t.selection||n.selection).getSelectedBlocks();for(const t of i)!t.is("element","paragraph")&&kk(t,e.schema)&&o.rename(t,"paragraph")}))}}function kk(t,e){return e.checkChild(t.parent,"paragraph")&&!e.isObject(t)}class bk extends me{execute(t){const e=this.editor.model,n=t.attributes;let o=t.position;e.change((t=>{const i=t.createElement("paragraph");if(n&&e.schema.setAllowedAttributes(i,n,t),!e.schema.checkChild(o.parent,i)){const n=e.schema.findAllowedParent(o,i);if(!n)return;o=t.split(o,n).position}e.insertContent(i,o),t.setSelection(i,"in")}))}}class wk extends ue{static get pluginName(){return"Paragraph"}init(){const t=this.editor,e=t.model;t.commands.add("paragraph",new fk(t)),t.commands.add("insertParagraph",new bk(t)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(t,{writer:e})=>wk.paragraphLikeElements.has(t.name)?t.isEmpty?null:e.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}wk.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class Ak extends me{constructor(t,e){super(t),this.modelElements=e}refresh(){const t=Ma(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some((e=>_k(t,e,this.editor.model.schema)))}execute(t){const e=this.editor.model,n=e.document,o=t.value;e.change((t=>{const i=Array.from(n.selection.getSelectedBlocks()).filter((t=>_k(t,o,e.schema)));for(const e of i)e.is("element",o)||t.rename(e,o)}))}}function _k(t,e,n){return n.checkChild(t.parent,e)&&!n.isObject(t)}const Ck="paragraph";class vk extends ue{static get pluginName(){return"HeadingEditing"}constructor(t){super(t),t.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[wk]}init(){const t=this.editor,e=t.config.get("heading.options"),n=[];for(const o of e)o.model!==Ck&&(t.model.schema.register(o.model,{inheritAllFrom:"$block"}),t.conversion.elementToElement(o),n.push(o.model));this._addDefaultH1Conversion(t),t.commands.add("heading",new Ak(t,n))}afterInit(){const t=this.editor,e=t.commands.get("enter"),n=t.config.get("heading.options");e&&this.listenTo(e,"afterExecute",((e,o)=>{const i=t.model.document.selection.getFirstPosition().parent;n.some((t=>i.is("element",t.model)))&&!i.is("element",Ck)&&0===i.childCount&&o.writer.rename(i,Ck)}))}_addDefaultH1Conversion(t){t.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:s.get("low")+1})}}var yk=n(8733),xk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(yk.Z,xk);yk.Z.locals;class Ek extends ue{static get pluginName(){return"HeadingUI"}init(){const t=this.editor,e=t.t,n=function(t){const e=t.t,n={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return t.config.get("heading.options").map((t=>{const e=n[t.title];return e&&e!=t.title&&(t.title=e),t}))}(t),o=e("Choose heading"),i=e("Heading");t.ui.componentFactory.add("heading",(e=>{const r={},s=new Io,a=t.commands.get("heading"),c=t.commands.get("paragraph"),l=[a];for(const t of n){const e={type:"button",model:new Eu({label:t.title,class:t.class,withText:!0})};"paragraph"===t.model?(e.model.bind("isOn").to(c,"value"),e.model.set("commandName","paragraph"),l.push(c)):(e.model.bind("isOn").to(a,"value",(e=>e===t.model)),e.model.set({commandName:"heading",commandValue:t.model})),s.add(e),r[t.model]=t.title}const d=nu(e);return iu(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:i}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(l,"isEnabled",((...t)=>t.some((t=>t)))),d.buttonView.bind("label").to(a,"value",c,"value",((t,e)=>{const n=t||e&&"paragraph";return r[n]?r[n]:o})),this.listenTo(d,"execute",(e=>{t.execute(e.source.commandName,e.source.commandValue?{value:e.source.commandValue}:void 0),t.editing.view.focus()})),d}))}}class Dk extends ue{static get requires(){return[ju]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",(e=>{(function(t){const e=t.getSelectedElement();return!(!e||!cm(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{ariaLabel:e,items:n,getRelatedElement:o,balloonClassName:i="ck-toolbar-container"}){if(!n.length)return void l("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new Uh(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new c("widget-toolbar-duplicated",this,{toolbarId:t});a.fillFromConfig(n,r.ui.componentFactory),this._toolbarDefinitions.set(t,{view:a,getRelatedElement:o,balloonClassName:i})}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const o of this._toolbarDefinitions.values()){const i=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&i)if(this.editor.ui.focusTracker.isFocused){const r=i.getAncestors().length;r>t&&(t=r,e=i,n=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(t,e){this._isToolbarVisible(t)?Ik(this.editor,e):this._isToolbarInBalloon(t)||(this._balloon.add({view:t.view,position:Tk(this.editor,e),balloonClassName:t.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const e=t.getRelatedElement(this.editor.editing.view.document.selection);Ik(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function Ik(t,e){const n=t.plugins.get("ContextualBalloon"),o=Tk(t,e);n.updatePosition(o)}function Tk(t,e){const n=t.editing.view,o=Nu.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast,o.viewportStickyNorth]}}class Sk{constructor(t){this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=t,this._referenceCoordinates=null}begin(t,e,n){const o=new pa(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(Mk(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new pa(t),o=e.split("-"),i={x:"right"==o[1]?n.right:n.left,y:"bottom"==o[0]?n.bottom:n.top};return i.x+=t.ownerDocument.defaultView.scrollX,i.y+=t.ownerDocument.defaultView.scrollY,i}(e,function(t){const e=t.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[e[0]]}-${n[e[1]]}`}(this.activeHandlePosition)),this.originalWidth=o.width,this.originalHeight=o.height,this.aspectRatio=o.width/o.height;const i=n.style.width;i&&i.match(/^\d+(\.\d*)?%$/)?this.originalWidthPercents=parseFloat(i):this.originalWidthPercents=function(t,e){const n=t.parentElement,o=parseFloat(n.ownerDocument.defaultView.getComputedStyle(n).width);return e.width/o*100}(n,o)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}function Mk(t){return`ck-widget__resizer__handle-${t}`}he(Sk,re);class Nk extends Rd{constructor(){super();const t=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",t.to("_viewPosition",(t=>t?`ck-orientation-${t}`:""))],style:{display:t.if("_isVisible","none",(t=>!t))}},children:[{text:t.to("_label")}]})}_bindToState(t,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",((t,e)=>null!==t&&null!==e)),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",((e,n,o)=>"px"===t.unit?`${e}×${n}`:`${o}%`)),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",((t,e,n)=>e<50||n<50?"above-center":t))}_dismiss(){this.unbind(),this._isVisible=!1}}class zk{constructor(t){this._options=t,this._viewResizerWrapper=null,this.set("isEnabled",!0),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(t=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),t.stop())}),{priority:"high"}),this.on("change:isEnabled",(()=>{this.isEnabled&&this.redraw()}))}attach(){const t=this,e=this._options.viewElement;this._options.editor.editing.view.change((n=>{const o=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(e){const n=this.toDomElement(e);return t._appendHandles(n),t._appendSizeUI(n),t.on("change:isEnabled",((t,e,o)=>{n.style.display=o?"":"none"})),n.style.display=t.isEnabled?"":"none",n}));n.insert(n.createPositionAt(e,"end"),o),n.addClass("ck-widget_with-resizer",e),this._viewResizerWrapper=o}))}begin(t){this.state=new Sk(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(t,this._getHandleHost(),this._getResizeHost())}updateSize(t){const e=this._proposeNewSize(t);this._options.editor.editing.view.change((t=>{const n=this._options.unit||"%",o=("%"===n?e.widthPercents:e.width)+n;t.setStyle("width",o,this._options.viewElement)}));const n=this._getHandleHost(),o=new pa(n);e.handleHostWidth=Math.round(o.width),e.handleHostHeight=Math.round(o.height);const i=new pa(n);e.width=Math.round(i.width),e.height=Math.round(i.height),this.redraw(o),this.state.update(e)}commit(){const t=this._options.unit||"%",e=("%"===t?this.state.proposedWidthPercents:this.state.proposedWidth)+t;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(e)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(t){const e=this._domResizerWrapper;if(!((n=e)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const o=e.parentElement,i=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(o.isSameNode(i)){const e=t||new pa(i);a=[e.width+"px",e.height+"px",void 0,void 0]}else a=[i.offsetWidth+"px",i.offsetHeight+"px",i.offsetLeft+"px",i.offsetTop+"px"];"same"!==Oo(s,a)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)}))}containsHandle(t){return this._domResizerWrapper.contains(t)}static isResizeHandle(t){return t.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change((t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(t){const e=this.state,n={x:(o=t).pageX,y:o.pageY};var o;const i=!this._options.isCentered||this._options.isCentered(this),r={x:e._referenceCoordinates.x-(n.x+e.originalWidth),y:n.y-e.originalHeight-e._referenceCoordinates.y};i&&e.activeHandlePosition.endsWith("-right")&&(r.x=n.x-(e._referenceCoordinates.x+e.originalWidth)),i&&(r.x*=2);const s={width:Math.abs(e.originalWidth+r.x),height:Math.abs(e.originalHeight+r.y)};s.dominant=s.width/e.aspectRatio>s.height?"width":"height",s.max=s[s.dominant];const a={width:s.width,height:s.height};return"width"==s.dominant?a.height=a.width/e.aspectRatio:a.width=a.height*e.aspectRatio,{width:Math.round(a.width),height:Math.round(a.height),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*a.width*100)/100,100)}}_getResizeHost(){const t=this._domResizerWrapper.parentElement;return this._options.getResizeHost(t)}_getHandleHost(){const t=this._domResizerWrapper.parentElement;return this._options.getHandleHost(t)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const o of e)t.appendChild(new jd({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=o,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new Nk,this._sizeView.render(),t.appendChild(this._sizeView.element)}}he(zk,re);var Bk=n(8506),Pk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Bk.Z,Pk);Bk.Z.locals;class Lk extends ue{static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,e=is.window.document;this.set("visibleResizer",null),this.set("_activeResizer",null),this._resizers=new Map,t.view.addObserver(ug),this._observer=Object.create(ws),this.listenTo(t.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(e,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(e,"mouseup",this._mouseUpListener.bind(this));const n=()=>{this.visibleResizer&&this.visibleResizer.redraw()};this._redrawFocusedResizerThrottled=Pm(n,200),this.on("change:visibleResizer",n),this.editor.ui.on("update",this._redrawFocusedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[t,e]of this._resizers)t.isAttached()||(this._resizers.delete(t),e.destroy())}),{priority:"lowest"}),this._observer.listenTo(is.window,"resize",this._redrawFocusedResizerThrottled);const o=this.editor.editing.view.document.selection;o.on("change",(()=>{const t=o.getSelectedElement();this.visibleResizer=this.getResizerByViewElement(t)||null}))}destroy(){this._observer.stopListening();for(const t of this._resizers.values())t.destroy();this._redrawFocusedResizerThrottled.cancel()}attachTo(t){const e=new zk(t),n=this.editor.plugins;if(e.attach(),n.has("WidgetToolbarRepository")){const t=n.get("WidgetToolbarRepository");e.on("begin",(()=>{t.forceDisabled("resize")}),{priority:"lowest"}),e.on("cancel",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"}),e.on("commit",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(t.viewElement,e);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==e&&(this.visibleResizer=e),e}getResizerByViewElement(t){return this._resizers.get(t)}_getResizerByHandle(t){for(const e of this._resizers.values())if(e.containsHandle(t))return e}_mouseDownListener(t,e){const n=e.domTarget;zk.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n),this._activeResizer&&(this._activeResizer.begin(n),t.stop(),e.preventDefault()))}_mouseMoveListener(t,e){this._activeResizer&&this._activeResizer.updateSize(e)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}he(Lk,re);class Ok extends me{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(t){const e=this.editor,n=e.plugins.get("ImageUtils"),o=e.model,i=n.getClosestSelectedImageElement(o.document.selection);o.change((e=>{e.setAttribute("alt",t.newValue,i)}))}}function Rk(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot()])}function jk(t,e){const n=t.plugins.get("ImageUtils"),o=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>{if(!n.isInlineImageView(t))return null;if(!o)return i(t);return(t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:i(t)};function i(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function Fk(t,e){const n=Ma(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}class Vk extends ue{static get pluginName(){return"ImageUtils"}isImage(t){return this.isInlineImage(t)||this.isBlockImage(t)}isInlineImageView(t){return!!t&&t.is("element","img")}isBlockImageView(t){return!!t&&t.is("element","figure")&&t.hasClass("image")}insertImage(t={},e=null,n=null){const o=this.editor,i=o.model,r=i.document.selection;n=Hk(o,e||r,n),t={...Object.fromEntries(r.getAttributes()),...t};for(const e in t)i.schema.checkAttribute(n,e)||delete t[e];return i.change((o=>{const r=o.createElement(n,t);return i.insertObject(r,e,null,{setSelection:"on",findOptimalPosition:!e&&"imageInline"!=n}),r.parent?r:null}))}getClosestSelectedImageWidget(t){const e=t.getSelectedElement();if(e&&this.isImageWidget(e))return e;let n=t.getFirstPosition().parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent}return null}getClosestSelectedImageElement(t){const e=t.getSelectedElement();return this.isImage(e)?e:t.getFirstPosition().findAncestor("imageBlock")}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){if("imageBlock"==Hk(t,e)){const n=function(t,e){const n=pm(t,e).start.parent;if(n.isEmpty&&!n.is("element","$root"))return n.parent;return n}(e,t.model);if(t.model.schema.checkChild(n,"imageBlock"))return!0}else if(t.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}(this.editor,t)&&function(t){return[...t.focus.getAncestors()].every((t=>!t.is("element","imageBlock")))}(t)}toImageWidget(t,e,n){e.setCustomProperty("image",!0,t);return lm(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&cm(t)}isBlockImage(t){return!!t&&t.is("element","imageBlock")}isInlineImage(t){return!!t&&t.is("element","imageInline")}findViewImgElement(t){if(this.isInlineImageView(t))return t;const e=this.editor.editing.view;for(const{item:n}of e.createRangeIn(t))if(this.isInlineImageView(n))return n}}function Hk(t,e,n){const o=t.model.schema,i=t.config.get("image.insert.type");return t.plugins.has("ImageBlockEditing")?t.plugins.has("ImageInlineEditing")?n||("inline"===i?"imageInline":"block"===i?"imageBlock":e.is("selection")?Fk(o,e):o.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class Uk extends ue{static get requires(){return[Vk]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new Ok(this.editor))}}var Gk=n(1905),qk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Gk.Z,qk);Gk.Z.locals;var Wk=n(6764),Yk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Wk.Z,Yk);Wk.Z.locals;class Kk extends Rd{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new Na,this.keystrokes=new za,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),Md.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),Md.cancel,"ck-button-cancel","cancel"),this._focusables=new Pd,this._focusCycler=new Ch({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]}),zd(this)}render(){super.render(),this.keystrokes.listenTo(this.element),Bd({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,o){const i=new ph(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createLabeledInputView(){const t=this.locale.t,e=new Cu(this.locale,vu);return e.label=t("Text alternative"),e}}function $k(t){const e=t.editing.view,n=Nu.defaultPositions,o=t.plugins.get("ImageUtils");return{target:e.domConverter.viewToDom(o.getClosestSelectedImageWidget(e.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class Qk extends ue{static get requires(){return[ju]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",(n=>{const o=t.commands.get("imageTextAlternative"),i=new ph(n);return i.set({label:e("Change image text alternative"),icon:Md.lowVision,tooltip:!0}),i.bind("isEnabled").to(o,"isEnabled"),this.listenTo(i,"execute",(()=>{this._showForm()})),i}))}_createForm(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Kk(t.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{t.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),this.listenTo(t.ui,"update",(()=>{n.getClosestSelectedImageWidget(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=$k(t);e.updatePosition(n)}}(t):this._hideForm(!0)})),Nd({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:$k(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class Zk extends ue{static get requires(){return[Uk,Qk]}static get pluginName(){return"ImageTextAlternative"}}function Jk(t,e){return t=>{t.on(`attribute:srcset:${e}`,n)};function n(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);if(null===n.attributeNewValue){const t=n.attributeOldValue;t.data&&(i.removeAttribute("srcset",s),i.removeAttribute("sizes",s),t.width&&i.removeAttribute("width",s))}else{const t=n.attributeNewValue;t.data&&(i.setAttribute("srcset",t.data,s),i.setAttribute("sizes","100vw",s),t.width&&i.setAttribute("width",t.width,s))}}}function Xk(t,e,n){return t=>{t.on(`attribute:${n}:${e}`,o)};function o(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);i.setAttribute(n.attributeKey,n.attributeNewValue||"",s)}}class tb extends Cs{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}class eb extends me{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&l("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&l("image-inline-plugin-required")}refresh(){this.isEnabled=this.editor.plugins.get("ImageUtils").isImageAllowed()}execute(t){const e=So(t.source),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if("string"==typeof t&&(t={src:t}),e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);o.insertImage({...t,...i},e)}else o.insertImage({...t,...i})}))}}class nb extends ue{static get requires(){return[Vk]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(tb),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:t=>{const e={data:t.getAttribute("srcset")};return t.hasAttribute("width")&&(e.width=t.getAttribute("width")),e}}});const n=new eb(t);t.commands.add("insertImage",n),t.commands.add("imageInsert",n)}}class ob extends me{constructor(t,e){super(t),this._modelElementName=e}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=t.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=t.isInlineImage(e):this.isEnabled=t.isBlockImage(e)}execute(){const t=this.editor,e=this.editor.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(e.document.selection),i=Object.fromEntries(o.getAttributes());return i.src||i.uploadId?e.change((t=>{const r=Array.from(e.markers).filter((t=>t.getRange().containsItem(o))),s=n.insertImage(i,e.createSelection(o,"on"),this._modelElementName);if(!s)return null;const a=t.createRangeOn(s);for(const e of r){const n=e.getRange(),o="$graveyard"!=n.root.rootName?n.getJoined(a,!0):a;t.updateMarker(e,{range:o})}return{oldElement:o,newElement:s}})):null}}class ib extends ue{static get requires(){return[nb,Vk,Ug]}static get pluginName(){return"ImageBlockEditing"}init(){const t=this.editor;t.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),t.plugins.has("ImageInlineEditing")&&(t.commands.add("imageTypeBlock",new ob(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:e})=>Rk(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>o.toImageWidget(Rk(n),n,e("image widget"))}),n.for("downcast").add(Xk(o,"imageBlock","src")).add(Xk(o,"imageBlock","alt")).add(Jk(o,"imageBlock")),n.for("upcast").elementToElement({view:jk(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)}).add(function(t){return t=>{t.on("element:figure",e)};function e(e,n,o){if(!o.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const i=t.findViewImgElement(n.viewItem);if(!i||!o.consumable.test(i,{name:!0}))return;o.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=Ma(o.convertItem(i,n.modelCursor).modelRange.getItems());r?(o.convertChildren(n.viewItem,r),o.updateConversionResult(r,n)):o.consumable.revert(n.viewItem,{name:!0,classes:"image"})}}(o))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isInlineImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageBlock"===Fk(e.schema,c)){const t=new gg(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}}))}}var rb=n(3508),sb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(rb.Z,sb);rb.Z.locals;class ab extends ue{static get requires(){return[ib,zm,Zk]}static get pluginName(){return"ImageBlock"}}class cb extends ue{static get requires(){return[nb,Vk,Ug]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor,e=t.model.schema;e.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),e.addChildCheck(((t,e)=>{if(t.endsWith("caption")&&"imageInline"===e.name)return!1})),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new ob(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(t,{writer:e})=>e.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(t,{writer:n})=>o.toImageWidget(function(t){return t.createContainerElement("span",{class:"image-inline"},t.createEmptyElement("img"))}(n),n,e("image widget"))}),n.for("downcast").add(Xk(o,"imageInline","src")).add(Xk(o,"imageInline","alt")).add(Jk(o,"imageInline")),n.for("upcast").elementToElement({view:jk(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isBlockImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageInline"===Fk(e.schema,c)){const t=new gg(n.document),e=s.map((e=>1===e.childCount?(Array.from(e.getAttributes()).forEach((n=>t.setAttribute(...n,o.findViewImgElement(e)))),e.getChild(0)):e));r.content=t.createDocumentFragment(e)}}))}}class lb extends ue{static get requires(){return[cb,zm,Zk]}static get pluginName(){return"ImageInline"}}class db extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils");if(!t.plugins.has(ib))return this.isEnabled=!1,void(this.value=!1);const n=t.model.document.selection,o=n.getSelectedElement();if(!o){const t=e.getCaptionFromModelSelection(n);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=this.editor.plugins.get("ImageUtils").isImage(o),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(o):this.value=!1}execute(t={}){const{focusCaptionOnShow:e}=t;this.editor.model.change((t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)}))}_showImageCaption(t,e){const n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing");let i=n.getSelectedElement();const r=o._getSavedCaption(i);this.editor.plugins.get("ImageUtils").isInlineImage(i)&&(this.editor.execute("imageTypeBlock"),i=n.getSelectedElement());const s=r||t.createElement("caption");t.append(s,i),e&&t.setSelection(s,"in")}_hideImageCaption(t){const e=this.editor,n=e.model.document.selection,o=e.plugins.get("ImageCaptionEditing"),i=e.plugins.get("ImageCaptionUtils");let r,s=n.getSelectedElement();s?r=i.getCaptionFromImageModelElement(s):(r=i.getCaptionFromModelSelection(n),s=r.parent),o._saveCaption(s,r),t.setSelection(s,"on"),t.remove(r)}}class hb extends ue{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[Vk]}getCaptionFromImageModelElement(t){for(const e of t.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(t){const e=this.editor.plugins.get("ImageUtils"),n=t.getFirstPosition().findAncestor("caption");return n&&e.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(t){const e=this.editor.plugins.get("ImageUtils");return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}}class ub extends ue{static get requires(){return[Vk,hb]}static get pluginName(){return"ImageCaptionEditing"}constructor(t){super(t),this._savedCaptionsMap=new WeakMap}init(){const t=this.editor,e=t.model.schema;e.isRegistered("caption")?e.extend("caption",{allowIn:"imageBlock"}):e.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleImageCaption",new db(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration()}_setupConversion(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils"),o=t.plugins.get("ImageCaptionUtils"),i=t.t;t.conversion.for("upcast").elementToElement({view:t=>o.matchImageCaptionViewElement(t),model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>n.isBlockImage(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:o})=>{if(!n.isBlockImage(t.parent))return null;const r=o.createEditableElement("figcaption");return o.setCustomProperty("imageCaption",!0,r),$u({view:e,element:r,text:i("Enter image caption"),keepOnFocus:!0}),mm(r,o)}})}_setupImageTypeCommandsIntegration(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.plugins.get("ImageCaptionUtils"),o=t.commands.get("imageTypeInline"),i=t.commands.get("imageTypeBlock"),r=t=>{if(!t.return)return;const{oldElement:o,newElement:i}=t.return;if(!o)return;if(e.isBlockImage(o)){const t=n.getCaptionFromImageModelElement(o);if(t)return void this._saveCaption(i,t)}const r=this._getSavedCaption(o);r&&this._saveCaption(i,r)};o&&this.listenTo(o,"execute",r,{priority:"low"}),i&&this.listenTo(i,"execute",r,{priority:"low"})}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?Va.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}}class gb extends ue{static get requires(){return[hb]}static get pluginName(){return"ImageCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageCaptionUtils"),o=t.t;t.ui.componentFactory.add("toggleImageCaption",(i=>{const r=t.commands.get("toggleImageCaption"),s=new ph(i);return s.set({icon:Md.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(t=>o(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{t.execute("toggleImageCaption",{focusCaptionOnShow:!0});const o=n.getCaptionFromModelSelection(t.model.document.selection);if(o){const n=t.editing.mapper.toViewElement(o);e.scrollToTheSelection(),e.change((t=>{t.addClass("image__caption_highlighted",n)}))}})),s}))}}var mb=n(2640),pb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(mb.Z,pb);mb.Z.locals;class fb extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils").getClosestSelectedImageElement(t.model.document.selection);this.isEnabled=!!e,e&&e.hasAttribute("width")?this.value={width:e.getAttribute("width"),height:null}:this.value=null}execute(t){const e=this.editor,n=e.model,o=e.plugins.get("ImageUtils").getClosestSelectedImageElement(n.document.selection);this.value={width:t.width,height:null},o&&n.change((e=>{e.setAttribute("width",t.width,o)}))}}class kb extends ue{static get requires(){return[Vk]}static get pluginName(){return"ImageResizeEditing"}constructor(t){super(t),t.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const t=this.editor,e=new fb(t);this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline"),t.commands.add("resizeImage",e),t.commands.add("imageResize",e)}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:"width"}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:"width"})}_registerConverters(t){const e=this.editor;e.conversion.for("downcast").add((e=>e.on(`attribute:width:${t}`,((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const o=n.writer,i=n.mapper.toViewElement(e.item);null!==e.attributeNewValue?(o.setStyle("width",e.attributeNewValue,i),o.addClass("image_resized",i)):(o.removeStyle("width",i),o.removeClass("image_resized",i))})))),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{width:/.+/}},model:{key:"width",value:t=>t.getStyle("width")}})}}const bb={small:Md.objectSizeSmall,medium:Md.objectSizeMedium,large:Md.objectSizeLarge,original:Md.objectSizeFull};class wb extends ue{static get requires(){return[kb]}static get pluginName(){return"ImageResizeButtons"}constructor(t){super(t),this._resizeUnit=t.config.get("image.resizeUnit")}init(){const t=this.editor,e=t.config.get("image.resizeOptions"),n=t.commands.get("resizeImage");this.bind("isEnabled").to(n);for(const t of e)this._registerImageResizeButton(t);this._registerImageResizeDropdown(e)}_registerImageResizeButton(t){const e=this.editor,{name:n,value:o,icon:i}=t,r=o?o+this._resizeUnit:null;e.ui.componentFactory.add(n,(n=>{const o=new ph(n),s=e.commands.get("resizeImage"),a=this._getOptionLabelValue(t,!0);if(!bb[i])throw new c("imageresizebuttons-missing-icon",e,t);return o.set({label:a,icon:bb[i],tooltip:a,isToggleable:!0}),o.bind("isEnabled").to(this),o.bind("isOn").to(s,"value",Ab(r)),this.listenTo(o,"execute",(()=>{e.execute("resizeImage",{width:r})})),o}))}_registerImageResizeDropdown(t){const e=this.editor,n=e.t,o=t.find((t=>!t.value)),i=i=>{const r=e.commands.get("resizeImage"),s=nu(i,Ih),a=s.buttonView;return a.set({tooltip:n("Resize image"),commandValue:o.value,icon:bb.medium,isToggleable:!0,label:this._getOptionLabelValue(o),withText:!0,class:"ck-resize-image-button"}),a.bind("label").to(r,"value",(t=>t&&t.width?t.width:this._getOptionLabelValue(o))),s.bind("isOn").to(r),s.bind("isEnabled").to(this),iu(s,this._getResizeDropdownListItemDefinitions(t,r)),s.listView.ariaLabel=n("Image resize list"),this.listenTo(s,"execute",(t=>{e.execute(t.source.commandName,{width:t.source.commandValue}),e.editing.view.focus()})),s};e.ui.componentFactory.add("resizeImage",i),e.ui.componentFactory.add("imageResize",i)}_getOptionLabelValue(t,e){const n=this.editor.t;return t.label?t.label:e?t.value?n("Resize image to %0",t.value+this._resizeUnit):n("Resize image to the original size"):t.value?t.value+this._resizeUnit:n("Original")}_getResizeDropdownListItemDefinitions(t,e){const n=new Io;return t.map((t=>{const o=t.value?t.value+this._resizeUnit:null,i={type:"button",model:new Eu({commandName:"resizeImage",commandValue:o,label:this._getOptionLabelValue(t),withText:!0,icon:null})};i.model.bind("isOn").to(e,"value",Ab(o)),n.add(i)})),n}}function Ab(t){return e=>null===t&&e===t||e&&e.width===t}const _b=/(image|image-inline)/,Cb="image_resized";class vb extends ue{static get requires(){return[Lk]}static get pluginName(){return"ImageResizeHandles"}init(){const t=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(t),this._setupResizerCreator()}_setupResizerCreator(){const t=this.editor,e=t.editing.view;e.addObserver(tb),this.listenTo(e.document,"imageLoaded",((n,o)=>{if(!o.target.matches("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"))return;const i=t.editing.view.domConverter,r=i.domToView(o.target).findAncestor({classes:_b});let s=this.editor.plugins.get(Lk).getResizerByViewElement(r);if(s)return void s.redraw();const a=t.editing.mapper,c=a.toModelElement(r);s=t.plugins.get(Lk).attachTo({unit:t.config.get("image.resizeUnit"),modelElement:c,viewElement:r,editor:t,getHandleHost:t=>t.querySelector("img"),getResizeHost:()=>i.viewToDom(a.toViewElement(c.parent)),isCentered(){const t=c.getAttribute("imageStyle");return!t||"block"==t||"alignCenter"==t},onCommit(n){e.change((t=>{t.removeClass(Cb,r)})),t.execute("resizeImage",{width:n})}}),s.on("updateSize",(()=>{r.hasClass(Cb)||e.change((t=>{t.addClass(Cb,r)}))})),s.bind("isEnabled").to(this)}))}}var yb=n(6270),xb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(yb.Z,xb);yb.Z.locals;class Eb extends me{constructor(t,e){super(t),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(e.map((t=>{if(t.isDefault)for(const e of t.modelElements)this._defaultStyles[e]=t.name;return[t.name,t]})))}refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?t.hasAttribute("imageStyle")?this.value=t.getAttribute("imageStyle"):this.value=this._defaultStyles[t.name]:this.value=!1}execute(t={}){const e=this.editor,n=e.model,o=e.plugins.get("ImageUtils");n.change((e=>{const i=t.value;let r=o.getClosestSelectedImageElement(n.document.selection);i&&this.shouldConvertImageType(i,r)&&(this.editor.execute(o.isBlockImage(r)?"imageTypeInline":"imageTypeBlock"),r=o.getClosestSelectedImageElement(n.document.selection)),!i||this._styles.get(i).isDefault?e.removeAttribute("imageStyle",r):e.setAttribute("imageStyle",i,r)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}const{objectFullWidth:Db,objectInline:Ib,objectLeft:Tb,objectRight:Sb,objectCenter:Mb,objectBlockLeft:Nb,objectBlockRight:zb}=Md,Bb={get inline(){return{name:"inline",title:"In line",icon:Ib,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Tb,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Nb,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Mb,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Sb,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:zb,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Mb,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Sb,modelElements:["imageBlock"],className:"image-style-side"}}},Pb={full:Db,left:Nb,right:zb,center:Mb,inlineLeft:Tb,inlineRight:Sb,inline:Ib},Lb=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function Ob(t){l("image-style-configuration-definition-invalid",t)}const Rb={normalizeStyles:function(t){return(t.configuredStyles.options||[]).map((t=>function(t){t="string"==typeof t?Bb[t]?{...Bb[t]}:{name:t}:function(t,e){const n={...e};for(const o in t)Object.prototype.hasOwnProperty.call(e,o)||(n[o]=t[o]);return n}(Bb[t.name],t);"string"==typeof t.icon&&(t.icon=Pb[t.icon]||t.icon);return t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:o,name:i}=t;if(!(o&&o.length&&i))return Ob({style:t}),!1;{const i=[e?"imageBlock":null,n?"imageInline":null];if(!o.some((t=>i.includes(t))))return l("image-style-missing-dependency",{style:t,missingPlugins:o.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)))},getDefaultStylesConfiguration:function(t,e){return t&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:t?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(t){return t.has("ImageBlockEditing")&&t.has("ImageInlineEditing")?[...Lb]:[]},warnInvalidStyle:Ob,DEFAULT_OPTIONS:Bb,DEFAULT_ICONS:Pb,DEFAULT_DROPDOWN_DEFINITIONS:Lb};function jb(t,e){for(const n of e)if(n.name===t)return n}class Fb extends ue{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[Vk]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=Rb,n=this.editor,o=n.plugins.has("ImageBlockEditing"),i=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",e(o,i)),this.normalizedStyles=t({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:o,isInlinePluginLoaded:i}),this._setupConversion(o,i),this._setupPostFixer(),n.commands.add("imageStyle",new Eb(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,o=n.model.schema,i=(r=this.normalizedStyles,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const o=jb(e.attributeNewValue,r),i=jb(e.attributeOldValue,r),s=n.mapper.toViewElement(e.item),a=n.writer;i&&a.removeClass(i.className,s),o&&a.addClass(o.className,s)});var r;const s=function(t){const e={imageInline:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageInline"))),imageBlock:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageBlock")))};return(t,n,o)=>{if(!n.modelRange)return;const i=n.viewItem,r=Ma(n.modelRange.getItems());if(r&&o.schema.checkAttribute(r,"imageStyle"))for(const t of e[r.name])o.consumable.consume(i,{classes:t.className})&&o.writer.setAttribute("imageStyle",t.name,r)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",i),n.data.downcastDispatcher.on("attribute:imageStyle",i),t&&(o.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),e&&(o.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(Vk),o=new Map(this.normalizedStyles.map((t=>[t.name,t])));e.registerPostFixer((t=>{let i=!1;for(const r of e.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let e="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(e&&e.is("element","paragraph")&&e.childCount>0&&(e=e.getChild(0)),!n.isImage(e))continue;const s=e.getAttribute("imageStyle");if(!s)continue;const a=o.get(s);a&&a.modelElements.includes(e.name)||(t.removeAttribute("imageStyle",e),i=!0)}return i}))}}var Vb=n(5083),Hb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Vb.Z,Hb);Vb.Z.locals;class Ub extends ue{static get requires(){return[Fb]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Wrap text":t("Wrap text"),"Break text":t("Break text"),"In line":t("In line"),"Full size image":t("Full size image"),"Side image":t("Side image"),"Left aligned image":t("Left aligned image"),"Centered image":t("Centered image"),"Right aligned image":t("Right aligned image")}}init(){const t=this.editor.plugins,e=this.editor.config.get("image.toolbar")||[],n=Gb(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const o=Gb([...e.filter(x),...Rb.getDefaultDropdownDefinitions(t)],this.localizedDefaultStylesTitles);for(const t of o)this._createDropdown(t,n)}_createDropdown(t,e){const n=this.editor.ui.componentFactory;n.add(t.name,(o=>{let i;const{defaultItem:r,items:s,title:a}=t,c=s.filter((t=>e.find((({name:e})=>qb(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(i=e),e}));s.length!==c.length&&Rb.warnInvalidStyle({dropdown:t});const l=nu(o,Mh),d=l.buttonView;return ou(l,c),d.set({label:Wb(a,i.label),class:null,tooltip:!0}),d.bind("icon").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return e<0?i.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return Wb(a,e<0?i.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(st))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(st)?"ck-splitbutton_flatten":null)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:i.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(st))),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(qb(e),(n=>{const o=this.editor.commands.get("imageStyle"),i=new ph(n);return i.set({label:t.title,icon:t.icon,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(o,"isEnabled"),i.bind("isOn").to(o,"value",(t=>t===e)),i.on("execute",this._executeCommand.bind(this,e)),i}))}_executeCommand(t){this.editor.execute("imageStyle",{value:t}),this.editor.editing.view.focus()}}function Gb(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function qb(t){return`imageStyle:${t}`}function Wb(t,e){return(t?t+": ":"")+e}function Yb(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function Kb(t){return new Promise(((e,n)=>{const o=t.getAttribute("src");fetch(o).then((t=>t.blob())).then((t=>{const n=$b(t,o),i=n.replace("image/",""),r=new File([t],`image.${i}`,{type:n});e(r)})).catch((t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise(((e,n)=>{const o=is.document.createElement("img");o.addEventListener("load",(()=>{const t=is.document.createElement("canvas");t.width=o.width,t.height=o.height;t.getContext("2d").drawImage(o,0,0),t.toBlob((t=>t?e(t):n()))})),o.addEventListener("error",(()=>n())),o.src=t}))}(t).then((e=>{const n=$b(e,t),o=n.replace("image/","");return new File([e],`image.${o}`,{type:n})}))}(o).then(e).catch(n):n(t)))}))}function $b(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class Qb extends ue{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor,e=t.t,n=n=>{const o=new Tf(n),i=t.commands.get("uploadImage"),r=t.config.get("image.upload.types"),s=Yb(r);return o.set({acceptedType:r.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0}),o.buttonView.set({label:e("Insert image"),icon:Md.image,tooltip:!0}),o.buttonView.bind("isEnabled").to(i),o.on("done",((e,n)=>{const o=Array.from(n).filter((t=>s.test(t.type)));o.length&&t.execute("uploadImage",{file:o})})),o};t.ui.componentFactory.add("uploadImage",n),t.ui.componentFactory.add("imageUpload",n)}}var Zb=n(3689),Jb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Zb.Z,Jb);Zb.Z.locals;var Xb=n(4036),tw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Xb.Z,tw);Xb.Z.locals;var ew=n(3773),nw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(ew.Z,nw);ew.Z.locals;class ow extends ue{static get pluginName(){return"ImageUploadProgress"}constructor(t){super(t),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",((...t)=>this.uploadStatusChange(...t))),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",((...t)=>this.uploadStatusChange(...t)))}uploadStatusChange(t,e,n){const o=this.editor,i=e.item,r=i.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=o.plugins.get("ImageUtils"),a=o.plugins.get(Df),c=r?e.attributeNewValue:null,l=this.placeholder,d=o.editing.mapper.toViewElement(i),h=n.writer;if("reading"==c)return iw(d,h),void rw(s,l,d,h);if("uploading"==c){const t=a.loaders.get(r);return iw(d,h),void(t?(sw(d,h),function(t,e,n,o){const i=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),i),n.on("change:uploadedPercent",((t,e,n)=>{o.change((t=>{t.setStyle("width",n+"%",i)}))}))}(d,h,t,o.editing.view),function(t,e,n,o){if(o.data){const i=t.findViewImgElement(e);n.setAttribute("src",o.data,i)}}(s,d,h,t)):rw(s,l,d,h))}"complete"==c&&a.loaders.get(r)&&function(t,e,n){const o=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),o),setTimeout((()=>{n.change((t=>t.remove(t.createRangeOn(o))))}),3e3)}(d,h,o.editing.view),function(t,e){cw(t,e,"progressBar")}(d,h),sw(d,h),function(t,e){e.removeClass("ck-appear",t)}(d,h)}}function iw(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function rw(t,e,n,o){n.hasClass("ck-image-upload-placeholder")||o.addClass("ck-image-upload-placeholder",n);const i=t.findViewImgElement(n);i.getAttribute("src")!==e&&o.setAttribute("src",e,i),aw(n,"placeholder")||o.insert(o.createPositionAfter(i),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(o))}function sw(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),cw(t,e,"placeholder")}function aw(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function cw(t,e,n){const o=aw(t,n);o&&e.remove(e.createRangeOn(o))}class lw extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(n)}execute(t){const e=So(t.file),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if(e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);this._uploadImage(t,i,e)}else this._uploadImage(t,i)}))}_uploadImage(t,e,n){const o=this.editor,i=o.plugins.get(Df).createLoader(t),r=o.plugins.get("ImageUtils");i&&r.insertImage({...e,uploadId:i.id},n)}}class dw extends ue{static get requires(){return[Df,xu,Ug,Vk]}static get pluginName(){return"ImageUploadEditing"}constructor(t){super(t),t.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const t=this.editor,e=t.model.document,n=t.conversion,o=t.plugins.get(Df),i=t.plugins.get("ImageUtils"),r=Yb(t.config.get("image.upload.types")),s=new lw(t);t.commands.add("uploadImage",s),t.commands.add("imageUpload",s),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,n)=>{if(o=n.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const i=Array.from(n.dataTransfer.files).filter((t=>!!t&&r.test(t.type)));i.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.model.enqueueChange((()=>{t.execute("uploadImage",{file:i})}))})))})),this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).filter((t=>function(t,e){return!(!t.isInlineImageView(e)||!e.getAttribute("src"))&&(e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||e.getAttribute("src").match(/^blob:/g))}(i,t.item)&&!t.item.getAttribute("uploadProcessed"))).map((t=>({promise:Kb(t.item),imageElement:t.item})));if(!r.length)return;const s=new gg(t.editing.view.document);for(const t of r){s.setAttribute("uploadProcessed",!0,t.imageElement);const e=o.createLoader(t.promise);e&&(s.setAttribute("src","",t.imageElement),s.setAttribute("uploadId",e.id,t.imageElement))}})),t.editing.view.document.on("dragover",((t,e)=>{e.preventDefault()})),e.on("change",(()=>{const n=e.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),i=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter,r="$graveyard"==e.position.root.rootName;for(const e of hw(t,n)){const t=e.getAttribute("uploadId");if(!t)continue;const n=o.loaders.get(t);n&&(r?i.has(t)||n.abort():(i.add(t),this._uploadImageElements.set(t,e),"idle"==n.status&&this._readAndUpload(n)))}}})),this.on("uploadComplete",((t,{imageElement:e,data:n})=>{const o=n.urls?n.urls:n;this.editor.model.change((t=>{t.setAttribute("src",o.default,e),this._parseAndSetSrcsetAttributeOnImage(o,e,t)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(t){const e=this.editor,n=e.model,o=e.locale.t,i=e.plugins.get(Df),r=e.plugins.get(xu),s=e.plugins.get("ImageUtils"),a=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","reading",a.get(t.id))})),t.read().then((()=>{const o=t.upload(),i=a.get(t.id);if(sr.isSafari){const t=e.editing.mapper.toViewElement(i),n=s.findViewImgElement(t);e.editing.view.once("render",(()=>{if(!n.parent)return;const t=e.editing.view.domConverter.mapViewToDom(n.parent);if(!t)return;const o=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=o}))}return n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",i)})),o})).then((e=>{n.enqueueChange({isUndoable:!1},(n=>{const o=a.get(t.id);n.setAttribute("uploadStatus","complete",o),this.fire("uploadComplete",{data:e,imageElement:o})})),c()})).catch((e=>{if("error"!==t.status&&"aborted"!==t.status)throw e;"error"==t.status&&e&&r.showWarning(e,{title:o("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{e.remove(a.get(t.id))})),c()}));function c(){n.enqueueChange({isUndoable:!1},(e=>{const n=a.get(t.id);e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n),a.delete(t.id)})),i.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let o=0;const i=Object.keys(t).filter((t=>{const e=parseInt(t,10);if(!isNaN(e))return o=Math.max(o,e),!0})).map((e=>`${t[e]} ${e}w`)).join(", ");""!=i&&n.setAttribute("srcset",{data:i,width:o},e)}}function hw(t,e){const n=t.plugins.get("ImageUtils");return Array.from(t.model.createRangeOn(e)).filter((t=>n.isImage(t.item))).map((t=>t.item))}class uw extends ue{static get pluginName(){return"IndentEditing"}init(){const t=this.editor;t.commands.add("indent",new fe(t)),t.commands.add("outdent",new fe(t))}}const gw='',mw='';class pw extends ue{static get pluginName(){return"IndentUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?gw:mw,i="ltr"==e.uiLanguageDirection?mw:gw;this._defineButton("indent",n("Increase indent"),o),this._defineButton("outdent",n("Decrease indent"),i)}_defineButton(t,e,n){const o=this.editor;o.ui.componentFactory.add(t,(i=>{const r=o.commands.get(t),s=new ph(i);return s.set({label:e,icon:n,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",(()=>{o.execute(t),o.editing.view.focus()})),s}))}}class fw extends me{constructor(t,e){super(t),this._indentBehavior=e}refresh(){const t=this.editor.model,e=Ma(t.document.selection.getSelectedBlocks());e&&t.schema.checkAttribute(e,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(e.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const t=this.editor.model,e=function(t){const e=t.document.selection,n=t.schema;return Array.from(e.getSelectedBlocks()).filter((t=>n.checkAttribute(t,"blockIndent")))}(t);t.change((t=>{for(const n of e){const e=n.getAttribute("blockIndent"),o=this._indentBehavior.getNextIndent(e);o?t.setAttribute("blockIndent",o,n):t.removeAttribute("blockIndent",n)}}))}}class kw{constructor(t){this.isForward="forward"===t.direction,this.offset=t.offset,this.unit=t.unit}checkEnabled(t){const e=parseFloat(t||0);return this.isForward||e>0}getNextIndent(t){const e=parseFloat(t||0);if(!(!t||t.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const n=e+(this.isForward?this.offset:-this.offset);return n>0?n+this.unit:void 0}}class bw{constructor(t){this.isForward="forward"===t.direction,this.classes=t.classes}checkEnabled(t){const e=this.classes.indexOf(t);return this.isForward?e=0}getNextIndent(t){const e=this.classes.indexOf(t),n=this.isForward?1:-1;return this.classes[e+n]}}const ww=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class Aw{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(t){Array.isArray(t)?t.forEach((t=>this._definitions.add(t))):this._definitions.add(t)}getDispatcher(){return t=>{t.on("attribute:linkHref",((t,e,n)=>{if(!n.consumable.test(e.item,"attribute:linkHref"))return;if(!e.item.is("selection")&&!n.schema.isInline(e.item))return;const o=n.writer,i=o.document.selection;for(const t of this._definitions){const r=o.createAttributeElement("a",t.attributes,{priority:5});t.classes&&o.addClass(t.classes,r);for(const e in t.styles)o.setStyle(e,t.styles[e],r);o.setCustomProperty("link",!0,r),t.callback(e.attributeNewValue)?e.item.is("selection")?o.wrap(i.getFirstRange(),r):o.wrap(n.mapper.toViewRange(e.range),r):o.unwrap(n.mapper.toViewRange(e.range),r)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return t=>{t.on("attribute:linkHref:imageBlock",((t,e,{writer:n,mapper:o})=>{const i=o.toViewElement(e.item),r=Array.from(i.getChildren()).find((t=>"a"===t.name));for(const t of this._definitions){const o=Ho(t.attributes);if(t.callback(e.attributeNewValue)){for(const[t,e]of o)"class"===t?n.addClass(e,r):n.setAttribute(t,e,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r)}else{for(const[t,e]of o)"class"===t?n.removeClass(e,r):n.removeAttribute(t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r)}}}))}}}const _w=function(t,e,n){var o=t.length;return n=void 0===n?o:n,!e&&n>=o?t:hi(t,e,n)};var Cw=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const vw=function(t){return Cw.test(t)};const yw=function(t){return t.split("")};var xw="[\\ud800-\\udfff]",Ew="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Dw="\\ud83c[\\udffb-\\udfff]",Iw="[^\\ud800-\\udfff]",Tw="(?:\\ud83c[\\udde6-\\uddff]){2}",Sw="[\\ud800-\\udbff][\\udc00-\\udfff]",Mw="(?:"+Ew+"|"+Dw+")"+"?",Nw="[\\ufe0e\\ufe0f]?",zw=Nw+Mw+("(?:\\u200d(?:"+[Iw,Tw,Sw].join("|")+")"+Nw+Mw+")*"),Bw="(?:"+[Iw+Ew+"?",Ew,Tw,Sw,xw].join("|")+")",Pw=RegExp(Dw+"(?="+Dw+")|"+Bw+zw,"g");const Lw=function(t){return t.match(Pw)||[]};const Ow=function(t){return vw(t)?Lw(t):yw(t)};const Rw=function(t){return function(e){e=si(e);var n=vw(e)?Ow(e):void 0,o=n?n[0]:e.charAt(0),i=n?_w(n,1).join(""):e.slice(1);return o[t]()+i}}("toUpperCase"),jw=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Fw=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,Vw=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,Hw=/^((\w+:(\/{2,})?)|(\W))/i,Uw="Ctrl+K";function Gw(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function qw(t){return function(t){return t.replace(jw,"").match(Fw)}(t=String(t))?t:"#"}function Ww(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function Yw(t,e){const n=(o=t,Vw.test(o)?"mailto:":e);var o;const i=!!n&&!Hw.test(t);return t&&i?n+t:t}function Kw(t){window.open(t,"_blank","noopener")}class $w extends me{constructor(t){super(t),this.manualDecorators=new Io,this.automaticDecorators=new Aw}restoreManualDecoratorStates(){for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement()||Ma(e.getSelectedBlocks());Ww(n,t.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttribute(n,"linkHref")):(this.value=e.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref"));for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}execute(t,e={}){const n=this.editor.model,o=n.document.selection,i=[],r=[];for(const t in e)e[t]?i.push(t):r.push(t);n.change((e=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=yp(s,"linkHref",o.getAttribute("linkHref"),n);e.setAttribute("linkHref",t,a),i.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)})),e.setSelection(e.createPositionAfter(a.end.nodeBefore))}else if(""!==t){const r=Ho(o.getAttributes());r.set("linkHref",t),i.forEach((t=>{r.set(t,!0)}));const{end:a}=n.insertContent(e.createText(t,r),s);e.setSelection(a)}["linkHref",...i,...r].forEach((t=>{e.removeSelectionAttribute(t)}))}else{const s=n.schema.getValidRanges(o.getRanges(),"linkHref"),a=[];for(const t of o.getSelectedBlocks())n.schema.checkAttribute(t,"linkHref")&&a.push(e.createRangeOn(t));const c=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&c.push(t);for(const n of c)e.setAttribute("linkHref",t,n),i.forEach((t=>{e.setAttribute(t,!0,n)})),r.forEach((t=>{e.removeAttribute(t,n)}))}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,o=n.getSelectedElement();return Ww(o,e.schema)?o.getAttribute(t):n.getAttribute(t)}_isRangeToUpdate(t,e){for(const n of e)if(n.containsRange(t))return!1;return!0}}class Qw extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();Ww(n,t.schema)?this.isEnabled=t.schema.checkAttribute(n,"linkHref"):this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref")}execute(){const t=this.editor,e=this.editor.model,n=e.document.selection,o=t.commands.get("link");e.change((t=>{const i=n.isCollapsed?[yp(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),e)]:e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of i)if(t.removeAttribute("linkHref",e),o)for(const n of o.manualDecorators)t.removeAttribute(n.id,e)}))}}class Zw{constructor({id:t,label:e,attributes:n,classes:o,styles:i,defaultValue:r}){this.id=t,this.set("value"),this.defaultValue=r,this.label=e,this.attributes=n,this.classes=o,this.styles=i}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}he(Zw,re);var Jw=n(9773),Xw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Jw.Z,Xw);Jw.Z.locals;const tA="automatic",eA=/^(https?:)?\/\//;class nA extends ue{static get pluginName(){return"LinkEditing"}static get requires(){return[lp,rp,Ug]}constructor(t){super(t),t.config.define("link",{addTargetToExternalLinks:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Gw}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,e)=>Gw(qw(t),e)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new $w(t)),t.commands.add("unlink",new Qw(t));const e=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>(t.label&&n[t.label]&&(t.label=n[t.label]),t))),e}(t.t,function(t){const e=[];if(t)for(const[n,o]of Object.entries(t)){const t=Object.assign({},o,{id:`link${Rw(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(e.filter((t=>t.mode===tA))),this._enableManualDecorators(e.filter((t=>"manual"===t.mode)));t.plugins.get(lp).registerAttribute("linkHref"),function(t,e,n,o){const i=t.editing.view,r=new Set;i.document.registerPostFixer((i=>{const s=t.model.document.selection;let a=!1;if(s.hasAttribute(e)){const c=yp(s.getFirstPosition(),e,s.getAttribute(e),t.model),l=t.editing.mapper.toViewRange(c);for(const t of l.getItems())t.is("element",n)&&!t.hasClass(o)&&(i.addClass(o,t),r.add(t),a=!0)}return a})),t.conversion.for("editingDowncast").add((t=>{function e(){i.change((t=>{for(const e of r.values())t.removeClass(o,e),r.delete(e)}))}t.on("insert",e,{priority:"highest"}),t.on("remove",e,{priority:"highest"}),t.on("attribute",e,{priority:"highest"}),t.on("selection",e,{priority:"highest"})}))}(t,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:tA,callback:t=>eA.test(t),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(t),n.length&&e.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(t){if(!t.length)return;const e=this.editor,n=e.commands.get("link").manualDecorators;t.forEach((t=>{e.model.schema.extend("$text",{allowAttributes:t.id}),t=new Zw(t),n.add(t),e.conversion.for("downcast").attributeToElement({model:t.id,view:(e,{writer:n,schema:o},{item:i})=>{if(o.isInline(i)&&e){const e=n.createAttributeElement("a",t.attributes,{priority:5});t.classes&&n.addClass(t.classes,e);for(const o in t.styles)n.setStyle(o,t.styles[o],e);return n.setCustomProperty("link",!0,e),e}}}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",...t._createPattern()},model:{key:t.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document,n=t.model.document;this.listenTo(e,"click",((t,e)=>{if(!(sr.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const o=n.getAttribute("href");o&&(t.stop(),e.preventDefault(),Kw(o))}),{context:"$capture"}),this.listenTo(e,"enter",((t,e)=>{const o=n.selection,i=o.getSelectedElement(),r=i?i.getAttribute("linkHref"):o.getAttribute("linkHref");r&&e.domEvent.altKey&&(t.stop(),Kw(r))}),{context:"a"})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(t,"insertContent",(()=>{const n=e.anchor.nodeBefore,o=e.anchor.nodeAfter;e.hasAttribute("linkHref")&&n&&n.hasAttribute("linkHref")&&(o&&o.hasAttribute("linkHref")||t.change((e=>{oA(e,rA(t.schema))})))}),{priority:"low"})}_enableClickingAfterLink(){const t=this.editor,e=t.model;t.editing.view.addObserver(ug);let n=!1;this.listenTo(t.editing.view.document,"mousedown",(()=>{n=!0})),this.listenTo(t.editing.view.document,"selectionChange",(()=>{if(!n)return;n=!1;const t=e.document.selection;if(!t.isCollapsed)return;if(!t.hasAttribute("linkHref"))return;const o=t.getFirstPosition(),i=yp(o,"linkHref",t.getAttribute("linkHref"),e);(o.isTouching(i.start)||o.isTouching(i.end))&&e.change((t=>{oA(t,rA(e.schema))}))}))}_enableTypingOverLink(){const t=this.editor,e=t.editing.view;let n,o;this.listenTo(e.document,"delete",(()=>{o=!0}),{priority:"high"}),this.listenTo(t.model,"deleteContent",(()=>{const e=t.model.document.selection;e.isCollapsed||(o?o=!1:iA(t)&&function(t){const e=t.document.selection,n=e.getFirstPosition(),o=e.getLastPosition(),i=n.nodeAfter;if(!i)return!1;if(!i.is("$text"))return!1;if(!i.hasAttribute("linkHref"))return!1;const r=o.textNode||o.nodeBefore;if(i===r)return!0;return yp(n,"linkHref",i.getAttribute("linkHref"),t).containsRange(t.createRange(n,o),!0)}(t.model)&&(n=e.getAttributes()))}),{priority:"high"}),this.listenTo(t.model,"insertContent",((e,[i])=>{o=!1,iA(t)&&n&&(t.model.change((t=>{for(const[e,o]of n)t.setAttribute(e,o,i)})),n=null)}),{priority:"high"})}_handleDeleteContentAfterLink(){const t=this.editor,e=t.model,n=e.document.selection,o=t.editing.view;let i=!1,r=!1;this.listenTo(o.document,"delete",((t,e)=>{r=e.domEvent.keyCode===dr.backspace}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{i=!1;const t=n.getFirstPosition(),o=n.getAttribute("linkHref");if(!o)return;const r=yp(t,"linkHref",o,e);i=r.containsPosition(t)||r.end.isEqual(t)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{r&&(r=!1,i||t.model.enqueueChange((t=>{oA(t,rA(e.schema))})))}),{priority:"low"})}}function oA(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}function iA(t){return t.model.change((t=>t.batch)).isTyping}function rA(t){return t.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))}var sA=n(7754),aA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(sA.Z,aA);sA.Z.locals;class cA extends Rd{constructor(t,e){super(t);const n=t.t;this.focusTracker=new Na,this.keystrokes=new za,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Md.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),Md.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusables=new Pd,this._focusCycler=new Ch({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children}),zd(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),Bd({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].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()}_createUrlInput(){const t=this.locale.t,e=new Cu(this.locale,vu);return e.label=t("Link URL"),e}_createButton(t,e,n,o){const i=new ph(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createManualDecoratorSwitches(t){const e=this.createCollection();for(const n of t.manualDecorators){const o=new bh(this.locale);o.set({name:n.id,label:n.label,withText:!0}),o.bind("isOn").toMany([n,t],"value",((t,e)=>void 0===e&&void 0===t?n.defaultValue:t)),o.on("execute",(()=>{n.set("value",!o.isOn)})),e.add(o)}return e}_createFormChildren(t){const e=this.createCollection();if(e.add(this.urlInputView),t.length){const t=new Rd;t.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((t=>({tag:"li",children:[t],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),e.add(t)}return e.add(this.saveButtonView),e.add(this.cancelButtonView),e}}var lA=n(2347),dA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(lA.Z,dA);lA.Z.locals;class hA extends Rd{constructor(t){super(t);const e=t.t;this.focusTracker=new Na,this.keystrokes=new za,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(e("Unlink"),'',"unlink"),this.editButtonView=this._createButton(e("Edit link"),Md.pencil,"edit"),this.set("href"),this._focusables=new Pd,this._focusCycler=new Ch({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].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()}_createButton(t,e,n){const o=new ph(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.delegate("execute").to(this,n),o}_createPreviewButton(){const t=new ph(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("Open link in new tab")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&qw(t))),target:"_blank",rel:"noopener noreferrer"}}),t.bind("label").to(this,"href",(t=>t||n("This link has no URL"))),t.bind("isEnabled").to(this,"href",(t=>!!t)),t.template.tag="a",t.template.eventListeners={},t}}const uA="link-ui";class gA extends ue{static get requires(){return[ju]}static get pluginName(){return"LinkUI"}init(){const t=this.editor;t.editing.view.addObserver(hg),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=t.plugins.get(ju),this._createToolbarLinkButton(),this._enableUserBalloonInteractions(),t.conversion.for("editingDowncast").markerToHighlight({model:uA,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:uA,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const t=this.editor,e=new hA(t.locale),n=t.commands.get("link"),o=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(o),this.listenTo(e,"edit",(()=>{this._addFormView()})),this.listenTo(e,"unlink",(()=>{t.execute("unlink"),this._hideUI()})),e.keystrokes.set("Esc",((t,e)=>{this._hideUI(),e()})),e.keystrokes.set(Uw,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),o=new cA(t.locale,e);return o.urlInputView.fieldView.bind("value").to(e,"value"),o.urlInputView.bind("isReadOnly").to(e,"isEnabled",(t=>!t)),o.saveButtonView.bind("isEnabled").to(e),this.listenTo(o,"submit",(()=>{const{value:e}=o.urlInputView.fieldView.element,i=Yw(e,n);t.execute("link",i,o.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(o,"cancel",(()=>{this._closeFormView()})),o.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),o}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link"),n=t.t;t.keystrokes.set(Uw,((t,n)=>{n(),e.isEnabled&&this._showUI(!0)})),t.ui.componentFactory.add("link",(t=>{const o=new ph(t);return o.isEnabled=!0,o.label=n("Link"),o.icon='',o.keystroke=Uw,o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(e,"isEnabled"),o.bind("isOn").to(e,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}))}_enableUserBalloonInteractions(){const t=this.editor.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),this.editor.keystrokes.set("Tab",((t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((t,e)=>{this._isUIVisible&&(this._hideUI(),e())})),Nd({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=t.value||""}_closeFormView(){const t=this.editor.commands.get("link");t.restoreManualDecoratorStates(),void 0!==t.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(t=!1){this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),o=r();const i=()=>{const t=this._getSelectedLinkElement(),e=r();n&&!t||!n&&e!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=t,o=e};function r(){return e.selection.focus.getAncestors().reverse().find((t=>t.is("element")))}this.listenTo(t.ui,"update",i),this.listenTo(this._balloon,"change:visibleView",i)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const t=this.editor.editing.view,e=this.editor.model,n=t.document;let o=null;if(e.markers.has(uA)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(uA)),n=t.createRange(t.createPositionBefore(e[0]),t.createPositionAfter(e[e.length-1]));o=t.domConverter.viewRangeToDom(n)}else o=()=>{const e=this._getSelectedLinkElement();return e?t.domConverter.mapViewToDom(e):t.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:o}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection,n=e.getSelectedElement();if(e.isCollapsed||n&&cm(n))return mA(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),o=mA(n.start),i=mA(n.end);return o&&o==i&&t.createRangeIn(o).getTrimmed().isEqual(n)?o:null}}_showFakeVisualSelection(){const t=this.editor.model;t.change((e=>{const n=t.document.selection.getFirstRange();if(t.markers.has(uA))e.updateMarker(uA,{range:n});else if(n.start.isAtEnd){const o=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(uA,{usingOperation:!1,affectsData:!1,range:e.createRange(o,n.end)})}else e.addMarker(uA,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(uA)&&t.change((t=>{t.removeMarker(uA)}))}}function mA(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))}const pA=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})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class fA extends ue{static get requires(){return[em]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",(()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const t=this.editor,e=new cp(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=kA(t.substr(0,t.length-1));return e?{url:e}:void 0}));e.on("matched:data",((e,n)=>{const{batch:o,range:i,url:r}=n;if(!o.isTyping)return;const s=i.end.getShiftedBy(-1),a=s.getShiftedBy(-r.length),c=t.model.createRange(a,s);this._applyAutoLink(r,c)})),e.bind("isEnabled").to(this)}_enableEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("enter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition();if(!t.parent.previousSibling)return;const n=e.createRangeIn(t.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("shiftEnter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition(),n=e.createRange(e.createPositionAt(t.parent,0),t.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(t){const e=this.editor.model,{text:n,range:o}=ap(t,e),i=kA(n);if(i){const t=e.createRange(o.end.getShiftedBy(-i.length),o.end);this._applyAutoLink(i,t)}}_applyAutoLink(t,e){const n=this.editor.model,o=this.editor.plugins.get("Delete");this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&n.enqueueChange((i=>{const r=this.editor.config.get("link.defaultProtocol"),s=Yw(t,r);i.setAttribute("linkHref",s,e),n.enqueueChange((()=>{o.requestUndoOnBackspace()}))}))}}function kA(t){const e=pA.exec(t);return e?e[2]:null}class bA extends me{constructor(t,e){super(t),this.type=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,o=Array.from(n.selection.getSelectedBlocks()).filter((t=>AA(t,e.schema))),i=void 0!==t.forceValue?!t.forceValue:this.value;e.change((t=>{if(i){let e=o[o.length-1].nextSibling,n=Number.POSITIVE_INFINITY,i=[];for(;e&&"listItem"==e.name&&0!==e.getAttribute("listIndent");){const t=e.getAttribute("listIndent");t=n;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&t[e?"unshift":"push"](i),i=i[e?"previousSibling":"nextSibling"]}}function AA(t,e){return e.checkChild(t.parent,"listItem")&&!e.isObject(t)}class _A extends me{constructor(t,e){super(t),this._indentBy="forward"==e?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=t.document;let n=Array.from(e.selection.getSelectedBlocks());t.change((t=>{const e=n[n.length-1];let o=e.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>e.getAttribute("listIndent");)n.push(o),o=o.nextSibling;this._indentBy<0&&(n=n.reverse());for(const e of n){const n=e.getAttribute("listIndent")+this._indentBy;n<0?t.rename(e,"paragraph"):t.setAttribute("listIndent",n,e)}this.fire("_executeCleanup",n)}))}_checkEnabled(){const t=Ma(this.editor.model.document.selection.getSelectedBlocks());if(!t||!t.is("element","listItem"))return!1;if(this._indentBy>0){const e=t.getAttribute("listIndent"),n=t.getAttribute("listType");let o=t.previousSibling;for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=e;){if(o.getAttribute("listIndent")==e)return o.getAttribute("listType")==n;o=o.previousSibling}return!1}return!0}}function CA(t,e){const n=e.mapper,o=e.writer,i="numbered"==t.getAttribute("listType")?"ol":"ul",r=function(t){const e=t.createContainerElement("li");return e.getFillerOffset=NA,e}(o),s=o.createContainerElement(i,null);return o.insert(o.createPositionAt(s,0),r),n.bindElements(t,r),r}function vA(t,e,n,o){const i=e.parent,r=n.mapper,s=n.writer;let a=r.toViewPosition(o.createPositionBefore(t));const c=EA(t.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:t.getAttribute("listIndent")}),l=t.previousSibling;if(c&&c.getAttribute("listIndent")==t.getAttribute("listIndent")){const t=r.toViewElement(c);a=s.breakContainer(s.createPositionAfter(t))}else if(l&&"listItem"==l.name){a=r.toViewPosition(o.createPositionAt(l,"end"));const t=r.findMappedViewAncestor(a),e=function(t){for(const e of t.getChildren())if("ul"==e.name||"ol"==e.name)return e;return null}(t);a=e?s.createPositionBefore(e):s.createPositionAt(t,"end")}else a=r.toViewPosition(o.createPositionBefore(t));if(a=xA(a),s.insert(a,i),l&&"listItem"==l.name){const t=r.toViewElement(l),n=s.createRange(s.createPositionAt(t,0),a).getWalker({ignoreElementEnd:!0});for(const t of n)if(t.item.is("element","li")){const o=s.breakContainer(s.createPositionBefore(t.item)),i=t.item.parent,r=s.createPositionAt(e,"end");yA(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(i),r),n.position=o}}else{const n=i.nextSibling;if(n&&(n.is("element","ul")||n.is("element","ol"))){let o=null;for(const e of n.getChildren()){const n=r.toModelElement(e);if(!(n&&n.getAttribute("listIndent")>t.getAttribute("listIndent")))break;o=e}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(e,"end")))}}yA(s,i,i.nextSibling),yA(s,i.previousSibling,i)}function yA(t,e,n){return!e||!n||"ul"!=e.name&&"ol"!=e.name||e.name!=n.name||e.getAttribute("class")!==n.getAttribute("class")?null:t.mergeContainers(t.createPositionAfter(e))}function xA(t){return t.getLastMatchingPosition((t=>t.item.is("uiElement")))}function EA(t,e){const n=!!e.sameIndent,o=!!e.smallerIndent,i=e.listIndent;let r=t;for(;r&&"listItem"==r.name;){const t=r.getAttribute("listIndent");if(n&&i==t||o&&i>t)return r;r="forward"===e.direction?r.nextSibling:r.previousSibling}return null}function DA(t,e,n,o){t.ui.componentFactory.add(e,(i=>{const r=t.commands.get(e),s=new ph(i);return s.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),s}))}function IA(t,e){const n=[],o=t.parent,i={ignoreElementEnd:!0,startPosition:t,shallow:!0,direction:e},r=o.getAttribute("listIndent"),s=[...new Ha(i)].filter((t=>t.item.is("element"))).map((t=>t.item));for(const t of s){if(!t.is("element","listItem"))break;if(t.getAttribute("listIndent")r)){if(t.getAttribute("listType")!==o.getAttribute("listType"))break;if(t.getAttribute("listStyle")!==o.getAttribute("listStyle"))break;if(t.getAttribute("listReversed")!==o.getAttribute("listReversed"))break;if(t.getAttribute("listStart")!==o.getAttribute("listStart"))break;"backward"===e?n.unshift(t):n.push(t)}}return n}function TA(t){let e=[...t.document.selection.getSelectedBlocks()].filter((t=>t.is("element","listItem"))).map((e=>{const n=t.change((t=>t.createPositionAt(e,0)));return[...IA(n,"backward"),...IA(n,"forward")]})).flat();return e=[...new Set(e)],e}const SA=["disc","circle","square"],MA=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function NA(){const t=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||t?0:zi.call(this)}function zA(t){return(e,n,o)=>{const i=o.consumable;if(!i.test(n.item,"insert")||!i.test(n.item,"attribute:listType")||!i.test(n.item,"attribute:listIndent"))return;i.consume(n.item,"insert"),i.consume(n.item,"attribute:listType"),i.consume(n.item,"attribute:listIndent");const r=n.item;vA(r,CA(r,o),o,t)}}function BA(t,e,n){if(!n.consumable.test(e.item,t.name))return;const o=n.mapper.toViewElement(e.item),i=n.writer;i.breakContainer(i.createPositionBefore(o)),i.breakContainer(i.createPositionAfter(o));const r=o.parent,s="numbered"==e.attributeNewValue?"ol":"ul";i.rename(s,r)}function PA(t,e,n){n.consumable.consume(e.item,t.name);const o=n.mapper.toViewElement(e.item).parent,i=n.writer;yA(i,o,o.nextSibling),yA(i,o.previousSibling,o)}function LA(t,e,n){if(n.consumable.test(e.item,t.name)&&"listItem"!=e.item.name){let t=n.mapper.toViewPosition(e.range.start);const o=n.writer,i=[];for(;("ul"==t.parent.name||"ol"==t.parent.name)&&(t=o.breakContainer(t),"li"==t.parent.name);){const e=t,n=o.createPositionAt(t.parent,"end");if(!e.isEqual(n)){const t=o.remove(o.createRange(e,n));i.push(t)}t=o.createPositionAfter(t.parent)}if(i.length>0){for(let e=0;e0){const e=yA(o,n,n.nextSibling);e&&e.parent==n&&t.offset--}}yA(o,t.nodeBefore,t.nodeAfter)}}}function OA(t,e,n){const o=n.mapper.toViewPosition(e.position),i=o.nodeBefore,r=o.nodeAfter;yA(n.writer,i,r)}function RA(t,e,n){if(n.consumable.consume(e.viewItem,{name:!0})){const t=n.writer,o=t.createElement("listItem"),i=function(t){let e=0,n=t.parent;for(;n;){if(n.is("element","li"))e++;else{const t=n.previousSibling;t&&t.is("element","li")&&e++}n=n.parent}return e}(e.viewItem);t.setAttribute("listIndent",i,o);const r=e.viewItem.parent&&"ol"==e.viewItem.parent.name?"numbered":"bulleted";if(t.setAttribute("listType",r,o),!n.safeInsert(o,e.modelCursor))return;const s=function(t,e,n){const{writer:o,schema:i}=n;let r=o.createPositionAfter(t);for(const s of e)if("ul"==s.name||"ol"==s.name)r=n.convertItem(s,r).modelCursor;else{const e=n.convertItem(s,o.createPositionAt(t,"end")),a=e.modelRange.start.nodeAfter;a&&a.is("element")&&!i.checkChild(t,a.name)&&(t=e.modelCursor.parent.is("element","listItem")?e.modelCursor.parent:UA(e.modelCursor),r=o.createPositionAfter(t))}return r}(o,e.viewItem.getChildren(),n);e.modelRange=t.createRange(e.modelCursor,s),n.updateConversionResult(o,e)}}function jA(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){const t=Array.from(e.viewItem.getChildren());for(const e of t){!(e.is("element","li")||qA(e))&&e._remove()}}}function FA(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){if(0===e.viewItem.childCount)return;const t=[...e.viewItem.getChildren()];let n=!1;for(const e of t)n&&!qA(e)&&e._remove(),qA(e)&&(n=!0)}}function VA(t){return(e,n)=>{if(n.isPhantom)return;const o=n.modelPosition.nodeBefore;if(o&&o.is("element","listItem")){const e=n.mapper.toViewElement(o),i=e.getAncestors().find(qA),r=t.createPositionAt(e,0).getWalker();for(const t of r){if("elementStart"==t.type&&t.item.is("element","li")){n.viewPosition=t.previousPosition;break}if("elementEnd"==t.type&&t.item==i){n.viewPosition=t.nextPosition;break}}}}}function HA(t,[e,n]){let o,i=e.is("documentFragment")?e.getChild(0):e;if(o=n?this.createSelection(n):this.document.selection,i&&i.is("element","listItem")){const t=o.getFirstPosition();let e=null;if(t.parent.is("element","listItem")?e=t.parent:t.nodeBefore&&t.nodeBefore.is("element","listItem")&&(e=t.nodeBefore),e){const t=e.getAttribute("listIndent");if(t>0)for(;i&&i.is("element","listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+t),i=i.nextSibling}}}function UA(t){const e=new Ha({startPosition:t});let n;do{n=e.next()}while(!n.value.item.is("element","listItem"));return n.value.item}function GA(t,e,n,o,i,r){const s=EA(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:t,foo:"b"}),a=i.mapper,c=i.writer,l=s?s.getAttribute("listIndent"):null;let d;if(s)if(l==t){const t=a.toViewElement(s).parent;d=c.createPositionAfter(t)}else{const t=r.createPositionAt(s,"end");d=a.toViewPosition(t)}else d=n;d=xA(d);for(const t of[...o.getChildren()])qA(t)&&(d=c.move(c.createRangeOn(t),d).end,yA(c,t,t.nextSibling),yA(c,t.previousSibling,t))}function qA(t){return t.is("element","ol")||t.is("element","ul")}class WA extends ue{static get pluginName(){return"ListEditing"}static get requires(){return[Kg,em]}init(){const t=this.editor;t.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const e=t.data,n=t.editing;var o;t.model.document.registerPostFixer((e=>function(t,e){const n=t.document.differ.getChanges(),o=new Map;let i=!1;for(const o of n)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const n=o.position.nodeAfter;n.hasAttribute("listIndent")&&(e.removeAttribute("listIndent",n),i=!0),n.hasAttribute("listType")&&(e.removeAttribute("listType",n),i=!0),n.hasAttribute("listStyle")&&(e.removeAttribute("listStyle",n),i=!0),n.hasAttribute("listReversed")&&(e.removeAttribute("listReversed",n),i=!0),n.hasAttribute("listStart")&&(e.removeAttribute("listStart",n),i=!0);for(const e of Array.from(t.createRangeIn(n)).filter((t=>t.item.is("element","listItem"))))r(e.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const t of o.values())s(t),a(t);return i;function r(t){const e=t.nodeBefore;if(e&&e.is("element","listItem")){let t=e;if(o.has(t))return;for(let e=t.previousSibling;e&&e.is("element","listItem");e=t.previousSibling)if(t=e,o.has(t))return;o.set(e,t)}else{const e=t.nodeAfter;e&&e.is("element","listItem")&&o.set(e,e)}}function s(t){let n=0,o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(r>n){let s;null===o?(o=r-n,s=n):(o>r&&(o=r),s=r-o),e.setAttribute("listIndent",s,t),i=!0}else o=null,n=t.getAttribute("listIndent")+1;t=t.nextSibling}}function a(t){let n=[],o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(n=n.slice(0,r+1)),0!=r)if(n[r]){const o=n[r];t.getAttribute("listType")!=o&&(e.setAttribute("listType",o,t),i=!0)}else n[r]=t.getAttribute("listType");o=t,t=t.nextSibling}}}(t.model,e))),n.mapper.registerViewToModelLength("li",YA),e.mapper.registerViewToModelLength("li",YA),n.mapper.on("modelToViewPosition",VA(n.view)),n.mapper.on("viewToModelPosition",(o=t.model,(t,e)=>{const n=e.viewPosition,i=n.parent,r=e.mapper;if("ul"==i.name||"ol"==i.name){if(n.isAtEnd){const t=r.toModelElement(n.nodeBefore),i=r.getModelLength(n.nodeBefore);e.modelPosition=o.createPositionBefore(t).getShiftedBy(i)}else{const t=r.toModelElement(n.nodeAfter);e.modelPosition=o.createPositionBefore(t)}t.stop()}else if("li"==i.name&&n.nodeBefore&&("ul"==n.nodeBefore.name||"ol"==n.nodeBefore.name)){const s=r.toModelElement(i);let a=1,c=n.nodeBefore;for(;c&&qA(c);)a+=r.getModelLength(c),c=c.previousSibling;e.modelPosition=o.createPositionBefore(s).getShiftedBy(a),t.stop()}})),e.mapper.on("modelToViewPosition",VA(n.view)),t.conversion.for("editingDowncast").add((e=>{e.on("insert",LA,{priority:"high"}),e.on("insert:listItem",zA(t.model)),e.on("attribute:listType:listItem",BA,{priority:"high"}),e.on("attribute:listType:listItem",PA,{priority:"low"}),e.on("attribute:listIndent:listItem",function(t){return(e,n,o)=>{if(!o.consumable.consume(n.item,"attribute:listIndent"))return;const i=o.mapper.toViewElement(n.item),r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s);r.remove(c),a&&a.nextSibling&&yA(r,a,a.nextSibling),GA(n.attributeOldValue+1,n.range.start,c.start,i,o,t),vA(n.item,i,o,t);for(const t of n.item.getChildren())o.consumable.consume(t,"insert")}}(t.model)),e.on("remove:listItem",function(t){return(e,n,o)=>{const i=o.mapper.toViewPosition(n.position).getLastMatchingPosition((t=>!t.item.is("element","li"))).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s),l=r.remove(c);a&&a.nextSibling&&yA(r,a,a.nextSibling),GA(o.mapper.toModelElement(i).getAttribute("listIndent")+1,n.position,c.start,i,o,t);for(const t of r.createRangeIn(l).getItems())o.mapper.unbindViewElement(t);e.stop()}}(t.model)),e.on("remove",OA,{priority:"low"})})),t.conversion.for("dataDowncast").add((e=>{e.on("insert",LA,{priority:"high"}),e.on("insert:listItem",zA(t.model))})),t.conversion.for("upcast").add((t=>{t.on("element:ul",jA,{priority:"high"}),t.on("element:ol",jA,{priority:"high"}),t.on("element:li",FA,{priority:"high"}),t.on("element:li",RA)})),t.model.on("insertContent",HA,{priority:"high"}),t.commands.add("numberedList",new bA(t,"numbered")),t.commands.add("bulletedList",new bA(t,"bulleted")),t.commands.add("indentList",new _A(t,"forward")),t.commands.add("outdentList",new _A(t,"backward"));const i=n.view.document;this.listenTo(i,"enter",((t,e)=>{const n=this.editor.model.document,o=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(i,"delete",((t,e)=>{if("backward"!==e.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const o=n.getFirstPosition();if(!o.isAtStart)return;const i=o.parent;if("listItem"!==i.name)return;i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(t.editing.view.document,"tab",((e,n)=>{const o=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(o).isEnabled&&(t.execute(o),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"li"})}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList")),n&&n.registerChildCommand(t.get("outdentList"))}}function YA(t){let e=1;for(const n of t.getChildren())if("ul"==n.name||"ol"==n.name)for(const t of n.getChildren())e+=YA(t);return e}const KA='',$A='';class QA extends ue{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;DA(this.editor,"numberedList",t("Numbered List"),KA),DA(this.editor,"bulletedList",t("Bulleted List"),$A)}}class ZA extends me{constructor(t,e){super(t),this._defaultType=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){this._tryToConvertItemsToList(t);const e=this.editor.model,n=TA(e);n.length&&e.change((e=>{for(const o of n)e.setAttribute("listStyle",t.type||this._defaultType,o)}))}_getValue(){const t=this.editor.model.document.selection.getFirstPosition().parent;return t&&t.is("element","listItem")?t.getAttribute("listStyle"):null}_checkEnabled(){const t=this.editor,e=t.commands.get("numberedList"),n=t.commands.get("bulletedList");return e.isEnabled||n.isEnabled}_tryToConvertItemsToList(t){if(!t.type)return;const e=(n=t.type,SA.includes(n)?"bulleted":MA.includes(n)?"numbered":null);var n;if(!e)return;const o=this.editor,i=e+"List";o.commands.get(i).value||o.execute(i)}}class JA extends me{refresh(){const t=this._getValue();this.value=t,this.isEnabled=null!=t}execute(t={}){const e=this.editor.model,n=TA(e).filter((t=>"numbered"==t.getAttribute("listType")));e.change((e=>{for(const o of n)e.setAttribute("listReversed",!!t.reversed,o)}))}_getValue(){const t=this.editor.model.document.selection.getFirstPosition().parent;return t&&t.is("element","listItem")&&"numbered"==t.getAttribute("listType")?t.getAttribute("listReversed"):null}}class XA extends me{refresh(){const t=this._getValue();this.value=t,this.isEnabled=null!=t}execute(t={}){const e=this.editor.model,n=TA(e).filter((t=>"numbered"==t.getAttribute("listType")));e.change((e=>{for(const o of n)e.setAttribute("listStart",t.startIndex||1,o)}))}_getValue(){const t=this.editor.model.document.selection.getFirstPosition().parent;return t&&t.is("element","listItem")&&"numbered"==t.getAttribute("listType")?t.getAttribute("listStart"):null}}const t_="default";class e_ extends ue{static get requires(){return[WA]}static get pluginName(){return"ListPropertiesEditing"}constructor(t){super(t),t.config.define("list",{properties:{styles:!0,startIndex:!1,reversed:!1}})}init(){const t=this.editor,e=t.model,n=function(t){const e=[];t.styles&&e.push({attributeName:"listStyle",defaultValue:t_,addCommand(t){t.commands.add("listStyle",new ZA(t,t_))},appliesToListItem:()=>!0,setAttributeOnDowncast(t,e,n){e&&e!==t_?t.setStyle("list-style-type",e,n):t.removeStyle("list-style-type",n)},getAttributeOnUpcast:t=>t.getStyle("list-style-type")||t_});t.reversed&&e.push({attributeName:"listReversed",defaultValue:!1,addCommand(t){t.commands.add("listReversed",new JA(t))},appliesToListItem:t=>"numbered"==t.getAttribute("listType"),setAttributeOnDowncast(t,e,n){e?t.setAttribute("reversed","reversed",n):t.removeAttribute("reversed",n)},getAttributeOnUpcast:t=>t.hasAttribute("reversed")});t.startIndex&&e.push({attributeName:"listStart",defaultValue:1,addCommand(t){t.commands.add("listStart",new XA(t))},appliesToListItem:t=>"numbered"==t.getAttribute("listType"),setAttributeOnDowncast(t,e,n){1!=e?t.setAttribute("start",e,n):t.removeAttribute("start",n)},getAttributeOnUpcast:t=>t.getAttribute("start")||1});return e}(t.config.get("list.properties"));e.schema.extend("listItem",{allowAttributes:n.map((t=>t.attributeName))});for(const e of n)e.addCommand(t);var o;this.listenTo(t.commands.get("indentList"),"_executeCleanup",function(t,e){return(n,o)=>{const i=o[0],r=i.getAttribute("listIndent"),s=o.filter((t=>t.getAttribute("listIndent")===r));let a=null;i.previousSibling.getAttribute("listIndent")+1!==r&&(a=EA(i.previousSibling,{sameIndent:!0,direction:"backward",listIndent:r})),t.model.change((t=>{for(const n of s)for(const o of e)if(o.appliesToListItem(n)){const e=null==a?o.defaultValue:a.getAttribute(o.attributeName);t.setAttribute(o.attributeName,e,n)}}))}}(t,n)),this.listenTo(t.commands.get("outdentList"),"_executeCleanup",function(t,e){return(n,o)=>{if(!(o=o.reverse().filter((t=>t.is("element","listItem")))).length)return;const i=o[0].getAttribute("listIndent"),r=o[0].getAttribute("listType");let s=o[0].previousSibling;if(s.is("element","listItem"))for(;s.getAttribute("listIndent")!==i;)s=s.previousSibling;else s=null;s||(s=o[o.length-1].nextSibling),s&&s.is("element","listItem")&&s.getAttribute("listType")===r&&t.model.change((t=>{const n=o.filter((t=>t.getAttribute("listIndent")===i));for(const o of n)for(const n of e)if(n.appliesToListItem(o)){const e=n.attributeName,i=s.getAttribute(e);t.setAttribute(e,i,o)}}))}}(t,n)),this.listenTo(t.commands.get("bulletedList"),"_executeCleanup",i_(t)),this.listenTo(t.commands.get("numberedList"),"_executeCleanup",i_(t)),e.document.registerPostFixer(function(t,e){return n=>{let o=!1;const i=r_(t.model.document.differ.getChanges()).filter((t=>"todo"!==t.getAttribute("listType")));if(!i.length)return o;let r=i[i.length-1].nextSibling;if((!r||!r.is("element","listItem"))&&(r=i[0].previousSibling,r)){const t=i[0].getAttribute("listIndent");for(;r.is("element","listItem")&&r.getAttribute("listIndent")!==t&&(r=r.previousSibling,r););}for(const t of e){const e=t.attributeName;for(const s of i)if(t.appliesToListItem(s))if(s.hasAttribute(e)){const i=s.previousSibling;o_(i,s,t.attributeName)&&(n.setAttribute(e,i.getAttribute(e),s),o=!0)}else n_(r,s,t)?n.setAttribute(e,r.getAttribute(e),s):n.setAttribute(e,t.defaultValue,s),o=!0;else n.removeAttribute(e,s)}return o}}(t,n)),t.conversion.for("upcast").add((o=n,t=>{t.on("element:li",((t,e,n)=>{const i=e.viewItem.parent;if(!i)return;const r=e.modelRange.start.nodeAfter||e.modelRange.end.nodeBefore;for(const t of o)if(t.appliesToListItem(r)){const e=t.getAttributeOnUpcast(i);n.writer.setAttribute(t.attributeName,e,r)}}),{priority:"low"})})),t.conversion.for("downcast").add(function(t){return n=>{for(const o of t)n.on(`attribute:${o.attributeName}:listItem`,((t,n,i)=>{const r=i.writer,s=n.item,a=EA(s.previousSibling,{sameIndent:!0,listIndent:s.getAttribute("listIndent"),direction:"backward"}),c=i.mapper.toViewElement(s);e(s,a)||r.breakContainer(r.createPositionBefore(c)),o.setAttributeOnDowncast(r,n.attributeNewValue,c.parent)}),{priority:"low"})};function e(t,e){return e&&t.getAttribute("listType")===e.getAttribute("listType")&&t.getAttribute("listIndent")===e.getAttribute("listIndent")&&t.getAttribute("listStyle")===e.getAttribute("listStyle")&&t.getAttribute("listReversed")===e.getAttribute("listReversed")&&t.getAttribute("listStart")===e.getAttribute("listStart")}}(n)),this._mergeListAttributesWhileMergingLists(n)}afterInit(){const t=this.editor;t.commands.get("todoList")&&t.model.document.registerPostFixer(function(t){return e=>{const n=r_(t.model.document.differ.getChanges()).filter((t=>"todo"===t.getAttribute("listType")&&(t.hasAttribute("listStyle")||t.hasAttribute("listReversed")||t.hasAttribute("listStart"))));if(!n.length)return!1;for(const t of n)e.removeAttribute("listStyle",t),e.removeAttribute("listReversed",t),e.removeAttribute("listStart",t);return!0}}(t))}_mergeListAttributesWhileMergingLists(t){const e=this.editor.model;let n;this.listenTo(e,"deleteContent",((t,[e])=>{const o=e.getFirstPosition(),i=e.getLastPosition();if(o.parent===i.parent)return;if(!o.parent.is("element","listItem"))return;const r=i.parent.nextSibling;if(!r||!r.is("element","listItem"))return;const s=EA(o.parent,{sameIndent:!0,listIndent:r.getAttribute("listIndent")});s&&s.getAttribute("listType")===r.getAttribute("listType")&&(n=s)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{n&&(e.change((e=>{const o=EA(n.nextSibling,{sameIndent:!0,listIndent:n.getAttribute("listIndent"),direction:"forward"});if(!o)return void(n=null);const i=[o,...IA(e.createPositionAt(o,0),"forward")];for(const o of i)for(const i of t)if(i.appliesToListItem(o)){const t=i.attributeName,r=n.getAttribute(t);e.setAttribute(t,r,o)}})),n=null)}),{priority:"low"})}}function n_(t,e,n){if(!t)return!1;const o=t.getAttribute(n.attributeName);return!!o&&(o!=n.defaultValue&&t.getAttribute("listType")===e.getAttribute("listType"))}function o_(t,e,n){if(!t||!t.is("element","listItem"))return!1;if(e.getAttribute("listType")!==t.getAttribute("listType"))return!1;const o=t.getAttribute("listIndent");if(o<1||o!==e.getAttribute("listIndent"))return!1;const i=t.getAttribute(n);return!(!i||i===e.getAttribute(n))}function i_(t){return(e,n)=>{n=n.filter((t=>t.is("element","listItem"))),t.model.change((t=>{for(const e of n)t.removeAttribute("listStyle",e)}))}}function r_(t){const e=[];for(const n of t){const t=s_(n);t&&t.is("element","listItem")&&e.push(t)}return e}function s_(t){return"attribute"===t.type?t.range.start.nodeAfter:"insert"===t.type?t.position.nodeAfter:null}var a_=n(4721),c_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(a_.Z,c_);a_.Z.locals;class l_ extends Rd{constructor(t,e){super(t);const n=this.bindTemplate;this.set("isCollapsed",!1),this.set("label",""),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set("_collapsibleAriaLabelUid"),e&&this.children.addMany(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-collapsible",n.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:n.if("isCollapsed","hidden"),"aria-labelledby":n.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}_createButtonView(){const t=new ph(this.locale),e=t.bindTemplate;return t.set({withText:!0,icon:Dh}),t.extendTemplate({attributes:{"aria-expanded":e.to("isOn",(t=>String(t)))}}),t.bind("label").to(this),t.bind("isOn").to(this,"isCollapsed",(t=>!t)),t.on("execute",(()=>{this.isCollapsed=!this.isCollapsed})),t}}var d_=n(6082),h_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(d_.Z,h_);d_.Z.locals;class u_ extends Rd{constructor(t,{enabledProperties:e,styleButtonViews:n,styleGridAriaLabel:o}){super(t);const i=["ck","ck-list-properties"];this.children=this.createCollection(),this.stylesView=null,this.additionalPropertiesCollapsibleView=null,this.startIndexFieldView=null,this.reversedSwitchButtonView=null,this.focusTracker=new Na,this.keystrokes=new za,this.focusables=new Pd,this.focusCycler=new Ch({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),e.styles?(this.stylesView=this._createStylesView(n,o),this.children.add(this.stylesView)):i.push("ck-list-properties_without-styles"),(e.startIndex||e.reversed)&&(this._addNumberedListPropertyViews(e,n),i.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:i},children:this.children})}render(){if(super.render(),this.stylesView){for(const t of this.stylesView.children)this.focusables.add(t),this.focusTracker.add(t.element);(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element))}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element),this.listenTo(this.startIndexFieldView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"});const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(t,e){const n=new Rd(this.locale);return n.children=n.createCollection(this.locale),n.children.addMany(t),n.setTemplate({tag:"div",attributes:{"aria-label":e,class:["ck","ck-list-styles-list"]},children:n.children}),n.children.delegate("execute").to(this),n}_addNumberedListPropertyViews(t){const e=this.locale.t,n=[];t.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),n.push(this.startIndexFieldView)),t.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),n.push(this.reversedSwitchButtonView)),t.styles?(this.additionalPropertiesCollapsibleView=new l_(this.locale,n),this.additionalPropertiesCollapsibleView.set({label:e("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(n,"isEnabled",((...t)=>t.some((t=>t)))),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",((t,e,n)=>{n||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)})),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(n)}_createStartIndexField(){const t=this.locale.t,e=new Cu(this.locale,yu);return e.set({label:t("Start at"),class:"ck-numbered-list-properties__start-index"}),e.fieldView.set({min:1,step:1,value:1,inputMode:"numeric"}),e.fieldView.on("input",(()=>{const n=e.fieldView.element,o=n.valueAsNumber;Number.isNaN(o)||(n.checkValidity()?this.fire("listStart",{startIndex:o}):e.errorText=t("Start index must be greater than 0."))})),e}_createReversedSwitchButton(){const t=this.locale.t,e=new bh(this.locale);return e.set({withText:!0,label:t("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),e.delegate("execute").to(this,"listReversed"),e}}var g_=n(2417),m_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(g_.Z,m_);g_.Z.locals;class p_ extends ue{static get pluginName(){return"ListPropertiesUI"}init(){const t=this.editor,e=t.locale.t,n=t.config.get("list.properties");n.styles&&t.ui.componentFactory.add("bulletedList",f_({editor:t,parentCommandName:"bulletedList",buttonLabel:e("Bulleted List"),buttonIcon:$A,styleGridAriaLabel:e("Bulleted list styles toolbar"),styleDefinitions:[{label:e("Toggle the disc list style"),tooltip:e("Disc"),type:"disc",icon:''},{label:e("Toggle the circle list style"),tooltip:e("Circle"),type:"circle",icon:''},{label:e("Toggle the square list style"),tooltip:e("Square"),type:"square",icon:''}]})),(n.styles||n.startIndex||n.reversed)&&t.ui.componentFactory.add("numberedList",f_({editor:t,parentCommandName:"numberedList",buttonLabel:e("Numbered List"),buttonIcon:KA,styleGridAriaLabel:e("Numbered list styles toolbar"),styleDefinitions:[{label:e("Toggle the decimal list style"),tooltip:e("Decimal"),type:"decimal",icon:''},{label:e("Toggle the decimal with leading zero list style"),tooltip:e("Decimal with leading zero"),type:"decimal-leading-zero",icon:''},{label:e("Toggle the lower–roman list style"),tooltip:e("Lower–roman"),type:"lower-roman",icon:''},{label:e("Toggle the upper–roman list style"),tooltip:e("Upper-roman"),type:"upper-roman",icon:''},{label:e("Toggle the lower–latin list style"),tooltip:e("Lower-latin"),type:"lower-latin",icon:''},{label:e("Toggle the upper–latin list style"),tooltip:e("Upper-latin"),type:"upper-latin",icon:''}]}))}}function f_({editor:t,parentCommandName:e,buttonLabel:n,buttonIcon:o,styleGridAriaLabel:i,styleDefinitions:r}){const s=t.commands.get(e);return a=>{const c=nu(a,Mh),l=c.buttonView;c.bind("isEnabled").to(s),c.class="ck-list-styles-dropdown",l.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),l.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),l.bind("isOn").to(s,"value",(t=>!!t));const d=function({editor:t,dropdownView:e,parentCommandName:n,styleDefinitions:o,styleGridAriaLabel:i}){const r=t.locale,s=t.config.get("list.properties");let a;"numberedList"!=n&&(s.startIndex=!1,s.reversed=!1);if(s.styles){const e=t.commands.get("listStyle"),i=function({editor:t,listStyleCommand:e,parentCommandName:n}){const o=t.locale,i=t.commands.get(n);return({label:n,type:r,icon:s,tooltip:a})=>{const c=new ph(o);return c.set({label:n,icon:s,tooltip:a}),e.on("change:value",(()=>{c.isOn=e.value===r})),c.on("execute",(()=>{i.value?e.value!==r?t.execute("listStyle",{type:r}):t.execute("listStyle",{type:e._defaultType}):t.model.change((()=>{t.execute("listStyle",{type:r})})),t.editing.view.focus()})),c}}({editor:t,parentCommandName:n,listStyleCommand:e}),r="function"==typeof e.isStyleTypeSupported?t=>e.isStyleTypeSupported(t.type):()=>!0;a=o.filter(r).map(i)}const c=new u_(r,{styleGridAriaLabel:i,enabledProperties:s,styleButtonViews:a});if(s.startIndex){const e=t.commands.get("listStart");c.startIndexFieldView.bind("isEnabled").to(e),c.startIndexFieldView.fieldView.bind("value").to(e),c.on("listStart",((e,n)=>t.execute("listStart",n)))}if(s.reversed){const e=t.commands.get("listReversed");c.reversedSwitchButtonView.bind("isEnabled").to(e),c.reversedSwitchButtonView.bind("isOn").to(e,"value"),c.on("listReversed",(()=>{const n=e.value;t.execute("listReversed",{reversed:!n})}))}return c.delegate("execute").to(e),c}({editor:t,dropdownView:c,parentCommandName:e,styleGridAriaLabel:i,styleDefinitions:r});return c.panelView.children.add(d),c}}function k_(t,e){return t=>{t.on("attribute:url:media",n)};function n(n,o,i){if(!i.consumable.consume(o.item,n.name))return;const r=o.attributeNewValue,s=i.writer,a=i.mapper.toViewElement(o.item),c=[...a.getChildren()].find((t=>t.getCustomProperty("media-content")));s.remove(c);const l=t.getMediaViewElement(s,r,e);s.insert(s.createPositionAt(a,0),l)}}function b_(t,e,n,o){return t.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(t,n,o),t.createSlot()])}function w_(t){const e=t.getSelectedElement();return e&&e.is("element","media")?e:null}function A_(t,e,n,o){t.change((i=>{const r=i.createElement("media",{url:e});t.insertObject(r,n,null,{setSelection:"on",findOptimalPosition:o})}))}class __ extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=w_(e);this.value=n?n.getAttribute("url"):null,this.isEnabled=function(t){const e=t.getSelectedElement();return!!e&&"media"===e.name}(e)||function(t,e){let n=pm(t,e).start.parent;n.isEmpty&&!e.schema.isLimit(n)&&(n=n.parent);return e.schema.checkChild(n,"media")}(e,t)}execute(t){const e=this.editor.model,n=e.document.selection,o=w_(n);o?e.change((e=>{e.setAttribute("url",t,o)})):A_(e,t,n,!0)}}class C_{constructor(t,e){const n=e.providers,o=e.extraProviders||[],i=new Set(e.removeProviders),r=n.concat(o).filter((t=>{const e=t.name;return e?!i.has(e):(l("media-embed-no-provider-name",{provider:t}),!1)}));this.locale=t,this.providerDefinitions=r}hasMedia(t){return!!this._getMedia(t)}getMediaViewElement(t,e,n){return this._getMedia(e).getViewElement(t,n)}_getMedia(t){if(!t)return new v_(this.locale);t=t.trim();for(const e of this.providerDefinitions){const n=e.html,o=So(e.url);for(const e of o){const o=this._getUrlMatches(t,e);if(o)return new v_(this.locale,t,o,n)}}return null}_getUrlMatches(t,e){let n=t.match(e);if(n)return n;let o=t.replace(/^https?:\/\//,"");return n=o.match(e),n||(o=o.replace(/^www\./,""),n=o.match(e),n||null)}}class v_{constructor(t,e,n,o){this.url=this._getValidUrl(e),this._t=t.t,this._match=n,this._previewRenderer=o}getViewElement(t,e){const n={};let o;if(e.renderForEditingView||e.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),e.renderForEditingView&&(n.class="ck-media__wrapper");const i=this._getPreviewHtml(e);o=t.createRawElement("div",n,((t,e)=>{e.setContentOf(t,i)}))}else this.url&&(n.url=this.url),o=t.createEmptyElement(e.elementName,n);return t.setCustomProperty("media-content",!0,o),o}_getPreviewHtml(t){return this._previewRenderer?this._previewRenderer(this._match):this.url&&t.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const t=new uh,e=new lh;t.text=this._t("Open media in new tab"),e.content='',e.viewBox="0 0 64 42";return new jd({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]},t]}]}).render().outerHTML}_getValidUrl(t){return t?t.match(/^https?/)?t:"https://"+t:null}}var y_=n(7442),x_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(y_.Z,x_);y_.Z.locals;class E_ extends ue{static get pluginName(){return"MediaEmbedEditing"}constructor(t){super(t),t.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>`
`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`
`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:t=>`
`},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`
`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new C_(t.locale,t.config.get("mediaEmbed"))}init(){const t=this.editor,e=t.model.schema,n=t.t,o=t.conversion,i=t.config.get("mediaEmbed.previewsInData"),r=t.config.get("mediaEmbed.elementName"),s=this.registry;t.commands.add("mediaEmbed",new __(t)),e.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),o.for("dataDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const n=t.getAttribute("url");return b_(e,s,n,{elementName:r,renderMediaPreview:n&&i})}}),o.for("dataDowncast").add(k_(s,{elementName:r,renderMediaPreview:i})),o.for("editingDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const o=t.getAttribute("url");return function(t,e,n){return e.setCustomProperty("media",!0,t),lm(t,e,{label:n})}(b_(e,s,o,{elementName:r,renderForEditingView:!0}),e,n("media widget"))}}),o.for("editingDowncast").add(k_(s,{elementName:r,renderForEditingView:!0})),o.for("upcast").elementToElement({view:t=>["oembed",r].includes(t.name)&&t.getAttribute("url")?{name:!0}:null,model:(t,{writer:e})=>{const n=t.getAttribute("url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(t,{writer:e})=>{const n=t.getAttribute("data-oembed-url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).add((t=>{t.on("element:figure",(function(t,e,n){if(!n.consumable.consume(e.viewItem,{name:!0,classes:"media"}))return;const{modelRange:o,modelCursor:i}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=o,e.modelCursor=i;Ma(o.getItems())||n.consumable.revert(e.viewItem,{name:!0,classes:"media"})}))}))}}const D_=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class I_ extends ue{static get requires(){return[Gm,em,Pp]}static get pluginName(){return"AutoMediaEmbed"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document;this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=Xl.fromPosition(t.start);n.stickiness="toPrevious";const o=Xl.fromPosition(t.end);o.stickiness="toNext",e.once("change:data",(()=>{this._embedMediaBetweenPositions(n,o),n.detach(),o.detach()}),{priority:"high"})})),t.commands.get("undo").on("execute",(()=>{this._timeoutId&&(is.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedMediaBetweenPositions(t,e){const n=this.editor,o=n.plugins.get(E_).registry,i=new sc(t,e),r=i.getWalker({ignoreElementEnd:!0});let s="";for(const t of r)t.item.is("$textProxy")&&(s+=t.item.data);if(s=s.trim(),!s.match(D_))return void i.detach();if(!o.hasMedia(s))return void i.detach();n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Xl.fromPosition(t),this._timeoutId=is.window.setTimeout((()=>{n.model.change((t=>{let e;this._timeoutId=null,t.remove(i),i.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert),A_(n.model,s,e,!1),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get("Delete").requestUndoOnBackspace()}),100)):i.detach()}}var T_=n(9292),S_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(T_.Z,S_);T_.Z.locals;class M_ extends Rd{constructor(t,e){super(e);const n=e.t;this.focusTracker=new Na,this.keystrokes=new za,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Md.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",(t=>!!t)),this.cancelButtonView=this._createButton(n("Cancel"),Md.cancel,"ck-button-cancel","cancel"),this._focusables=new Pd,this._focusCycler=new Ch({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=t,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]}),zd(this)}render(){super.render(),Bd({view:this});[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t),this.listenTo(this.urlInputView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(t){this.urlInputView.fieldView.element.value=t.trim()}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.urlInputView.errorText=e,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const t=this.locale.t,e=new Cu(this.locale,vu),n=e.fieldView;return this._urlInputViewInfoDefault=t("Paste the media URL in the input."),this._urlInputViewInfoTip=t("Tip: Paste the URL into the content to embed faster."),e.label=t("Media URL"),e.infoText=this._urlInputViewInfoDefault,n.on("input",(()=>{e.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()})),e}_createButton(t,e,n,o){const i=new ph(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}}class N_ extends ue{static get requires(){return[E_]}static get pluginName(){return"MediaEmbedUI"}init(){const t=this.editor,e=t.commands.get("mediaEmbed"),n=t.plugins.get(E_).registry;t.ui.componentFactory.add("mediaEmbed",(o=>{const i=nu(o),r=new M_(function(t,e){return[e=>{if(!e.url.length)return t("The URL must not be empty.")},n=>{if(!e.hasMedia(n.url))return t("This media URL is not supported.")}]}(t.t,n),t.locale);return this._setUpDropdown(i,r,e,t),this._setUpForm(i,r,e),i}))}_setUpDropdown(t,e,n){const o=this.editor,i=o.t,r=t.buttonView;function s(){o.editing.view.focus(),t.isOpen=!1}t.bind("isEnabled").to(n),t.panelView.children.add(e),r.set({label:i("Insert media"),icon:'',tooltip:!0}),r.on("open",(()=>{e.disableCssTransitions(),e.url=n.value||"",e.urlInputView.fieldView.select(),e.focus(),e.enableCssTransitions()}),{priority:"low"}),t.on("submit",(()=>{e.isValid()&&(o.execute("mediaEmbed",e.url),s())})),t.on("change:isOpen",(()=>e.resetFormStatus())),t.on("cancel",(()=>s()))}_setUpForm(t,e,n){e.delegate("submit","cancel").to(t),e.urlInputView.bind("value").to(n,"value"),e.urlInputView.bind("isReadOnly").to(n,"isEnabled",(t=>!t))}}var z_=n(4652),B_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(z_.Z,B_);z_.Z.locals;function P_(t,e){if(!t.childCount)return;const n=new gg(t.document),o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),i=[];for(const t of n)if("elementStart"===t.type&&o.match(t.item)){const e=R_(t.item);i.push({element:t.item,id:e.id,order:e.order,indent:e.indent})}return i}(t,n);if(!o.length)return;let i=null,r=1;o.forEach(((t,s)=>{const a=function(t,e){if(!t)return!0;if(t.id!==e.id)return e.indent-t.indent!=1;const n=e.element.previousSibling;if(!n)return!0;return o=n,!(o.is("element","ol")||o.is("element","ul"));var o}(o[s-1],t),c=a?null:o[s-1],l=(h=t,(d=c)?h.indent-d.indent:h.indent-1);var d,h;if(a&&(i=null,r=1),!i||0!==l){const o=function(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]{0,100});/gi,i=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=n.exec(e);let s="decimal",a="ol",c=null;if(r&&r[1]){const e=o.exec(r[1]);if(e&&e[1]&&(s=e[1].trim(),a="bullet"!==s&&"image"!==s?"ol":"ul"),"bullet"===s){const e=function(t){const e=function(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);return t.is("$text")?t:t.getChild(0)}}(t);if(!e)return null;const n=e._data;if("o"===n)return"circle";if("·"===n)return"disc";if("§"===n)return"square";return null}(t.element);e&&(s=e)}else{const t=i.exec(r[1]);t&&t[1]&&(c=parseInt(t[1]))}}return{type:a,startIndex:c,style:L_(s)}}(t,e);if(i){if(t.indent>r){const t=i.getChild(i.childCount-1),e=t.getChild(t.childCount-1);i=O_(o,e,n),r+=1}else if(t.indent1&&n.setAttribute("start",t.startIndex,i),i}function R_(t){const e={},n=t.getStyle("mso-list");if(n){const t=n.match(/(^|\s{1,100})l(\d+)/i),o=n.match(/\s{0,100}lfo(\d+)/i),i=n.match(/\s{0,100}level(\d+)/i);t&&o&&i&&(e.id=t[2],e.order=o[1],e.indent=i[1])}return e}const j_=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class F_{constructor(t){this.document=t}isActive(t){return j_.test(t)}execute(t){const e=new gg(this.document),{body:n}=t._parsedData;!function(t,e){for(const n of t.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const o=t.getChildIndex(n);e.remove(n),e.insertChild(o,n.getChildren(),t)}}(n,e),function(t,e){for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","li")){const n=t.getChild(0);n&&n.is("element","p")&&e.unwrapElement(n)}}}(n,e),t.content=n}}function V_(t,e){if(!t.childCount)return;const n=new gg,o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n){if("elementStart"!=t.type)continue;const e=t.item,n=e.previousSibling&&e.previousSibling.name||null;o.match(e)&&e.getAttribute("o:gfxdata")&&"v:shapetype"!==n&&i.push(t.item.getAttribute("id"))}return i}(t,n);!function(t,e,n){const o=n.createRangeIn(e),i=new Uo({name:"img"}),r=[];for(const e of o)if(i.match(e.item)){const n=e.item,o=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];o.length&&o.every((e=>t.indexOf(e)>-1))?r.push(n):n.getAttribute("src")||r.push(n)}for(const t of r)n.remove(t)}(o,t,n),function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n)"elementStart"==t.type&&o.match(t.item)&&i.push(t.item);for(const t of i)e.remove(t)}(t,n);const i=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:"img"}),i=[];for(const t of n)o.match(t.item)&&t.item.getAttribute("src").startsWith("file://")&&i.push(t.item);return i}(t,n);i.length&&function(t,e,n){if(t.length===e.length)for(let o=0;oString.fromCharCode(parseInt(t,16)))).join(""))}const U_=//i,G_=/xmlns:o="urn:schemas-microsoft-com/i;class q_{constructor(t){this.document=t}isActive(t){return U_.test(t)||G_.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;P_(e,n),V_(e,t.dataTransfer.getData("text/rtf")),t.content=e}}function W_(t){return t.replace(/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join("  ").substr(0,e.length)))}function Y_(t,e){const n=new DOMParser,o=function(t){return W_(W_(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g," <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="",n="",o=t.indexOf(e);if(o<0)return t;const i=t.indexOf(n,o+e.length);return t.substring(0,o+e.length)+(i>=0?t.substring(i):"")}(t=t.replace(//g,"")}(i.getData("text/html")):i.getData("text/plain")&&(((s=(s=i.getData("text/plain")).replace(//g,">").replace(/\r?\n\r?\n/g,"

").replace(/\r?\n/g,"
").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g,"  ")).includes("

")||s.includes("
"))&&(s=`

${s}

`),r=s),r=this.editor.data.htmlProcessor.toView(r));const a=new e(this,"inputTransformation");this.fire(a,{content:r,dataTransfer:i,targetRanges:n.targetRanges,method:n.method}),a.stop.called&&t.stop(),o.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,e)=>{if(e.content.isEmpty)return;const o=this.editor.data.toModel(e.content,"$clipboardHolder");0!=o.childCount&&(t.stop(),n.change((()=>{this.fire("contentInsertion",{content:o,method:e.method,dataTransfer:e.dataTransfer,targetRanges:e.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,e)=>{e.resultRange=n.insertContent(e.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document;function o(o,i){const r=i.dataTransfer;i.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:o.name})}this.listenTo(n,"copy",o,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.isReadOnly?n.preventDefault():o(e,n)}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",bg(o.content))),"cut"==o.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}function*_g(t,e){for(const n of e)n&&t.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class Ag extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n,o){const i=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return void(i||s!=a||t.deleteContent(n));if(i){const t=_g(e.model.schema,n.getAttributes());Cg(e,r.start),e.setSelectionAttribute(t)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd),i=s==a;t.deleteContent(n,{leaveUnmerged:o}),o&&(i?Cg(e,n.focus):e.setSelection(a,0))}}(this.editor.model,n,e.selection,t.schema),this.fire("afterExecute",{writer:n})}))}}function Cg(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}class vg extends Cs{constructor(t){super(t);const e=this.document;e.on("keydown",((t,n)=>{if(this.isEnabled&&n.keyCode==dr.enter){const o=new qi(e,"enter",e.selection.getFirstRange());e.fire(o,new Gs(e,n.domEvent,{isSoft:n.shiftKey})),o.stop.called&&t.stop()}}))}observe(){}}class yg extends ue{static get pluginName(){return"Enter"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(vg),t.commands.add("enter",new Ag(t)),this.listenTo(n,"enter",((n,o)=>{o.preventDefault(),o.isSoft||(t.execute("enter"),e.scrollToTheSelection())}),{priority:"low"})}}class xg{constructor(t,e=20){this.model=t,this.size=0,this.limit=e,this.isLocked=!1,this._changeCallback=(t,e)=>{e.isLocal&&e.isUndoable&&e!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}input(t){this.size+=t,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(t){this.isLocked&&!t||(this._batch=null,this.size=0)}}class Dg extends me{constructor(t,e){super(t),this.direction=e,this._buffer=new xg(t.model,t.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(t={}){const e=this.editor.model,n=e.document;e.enqueueChange(this._buffer.batch,(o=>{this._buffer.lock();const i=o.createSelection(t.selection||n.selection),r=t.sequence||1,s=i.isCollapsed;if(i.isCollapsed&&e.modifySelection(i,{direction:this.direction,unit:t.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(o);if(this._shouldReplaceFirstBlockWithParagraph(i,r))return void this.editor.execute("paragraph",{selection:i});if(i.isCollapsed)return;let a=0;i.getFirstRange().getMinimalFlatRanges().forEach((t=>{a+=Vi(t.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),e.deleteContent(i,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),o.setSelection(i),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(t){if(t>1)return!1;const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(o)))return!1;if(!e.schema.checkChild(o,"paragraph"))return!1;const i=o.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(t){const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n),i=t.createElement("paragraph");t.remove(t.createRangeIn(o)),t.insert(i,o),t.setSelection(i,0)}_shouldReplaceFirstBlockWithParagraph(t,e){const n=this.editor.model;if(e>1||"backward"!=this.direction)return!1;if(!t.isCollapsed)return!1;const o=t.getFirstPosition(),i=n.schema.getLimitElement(o),r=i.getChild(0);return o.parent==r&&(!!t.containsEntireContent(r)&&(!!n.schema.checkChild(i,"paragraph")&&"paragraph"!=r.name))}}function Eg(t){if(t.newChildren.length-t.oldChildren.length!=1)return;const e=function(t,e){const n=[];let o,i=0;return t.forEach((t=>{"equal"==t?(r(),i++):"insert"==t?(s("insert")?o.values.push(e[i]):(r(),o={type:"insert",index:i,values:[e[i]]}),i++):s("delete")?o.howMany++:(r(),o={type:"delete",index:i,howMany:1})})),r(),n;function r(){o&&(n.push(o),o=null)}function s(t){return o&&o.type==t}}(Gr(t.oldChildren,t.newChildren,Mg),t.newChildren);if(e.length>1)return;const n=e[0];return n.values[0]&&n.values[0].is("$text")?n:void 0}function Mg(t,e){return t&&t.is("$text")&&e&&e.is("$text")?t.data===e.data:t===e}function Ig(t,e){const n=e.selection,o=t.shiftKey&&t.keyCode===dr.delete,i=!n.isCollapsed;return o&&i}class Sg extends Cs{constructor(t){super(t);const e=t.document;let n=0;function o(t,n,o){const i=new qi(e,"delete",e.selection.getFirstRange());e.fire(i,new Gs(e,n,o)),i.stop.called&&t.stop()}e.on("keyup",((t,e)=>{e.keyCode!=dr.delete&&e.keyCode!=dr.backspace||(n=0)})),e.on("keydown",((t,i)=>{if(sr.isWindows&&Ig(i,e))return;const r={};if(i.keyCode==dr.delete)r.direction="forward",r.unit="character";else{if(i.keyCode!=dr.backspace)return;r.direction="backward",r.unit="codePoint"}const s=sr.isMac?i.altKey:i.ctrlKey;r.unit=s?"word":r.unit,r.sequence=++n,o(t,i.domEvent,r)})),sr.isAndroid&&e.on("beforeinput",((e,n)=>{if("deleteContentBackward"!=n.domEvent.inputType)return;const i={unit:"codepoint",direction:"backward",sequence:1},r=n.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(i.selectionToRemove=t.domConverter.domSelectionToView(r)),o(e,n.domEvent,i)}))}observe(){}}class Tg extends ue{static get pluginName(){return"Delete"}init(){const t=this.editor,e=t.editing.view,n=e.document,o=t.model.document;e.addObserver(Sg),this._undoOnBackspace=!1;const i=new Dg(t,"forward");if(t.commands.add("deleteForward",i),t.commands.add("forwardDelete",i),t.commands.add("delete",new Dg(t,"backward")),this.listenTo(n,"delete",((n,o)=>{const i={unit:o.unit,sequence:o.sequence};if(o.selectionToRemove){const e=t.model.createSelection(),n=[];for(const e of o.selectionToRemove.getRanges())n.push(t.editing.mapper.toModelRange(e));e.setTo(n),i.selection=e}t.execute("forward"==o.direction?"deleteForward":"delete",i),o.preventDefault(),e.scrollToTheSelection()}),{priority:"low"}),sr.isAndroid){let t=null;this.listenTo(n,"delete",((e,n)=>{const o=n.domTarget.ownerDocument.defaultView.getSelection();t={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}}),{priority:"lowest"}),this.listenTo(n,"keyup",((e,n)=>{if(t){const e=n.domTarget.ownerDocument.defaultView.getSelection();e.collapse(t.anchorNode,t.anchorOffset),e.extend(t.focusNode,t.focusOffset),t=null}}))}this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",((e,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._undoOnBackspace=!1,t.execute("undo"),n.preventDefault(),e.stop())}),{context:"$capture"}),this.listenTo(o,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class Ng{constructor(){this._stack=[]}add(t,e){const n=this._stack,o=n[0];this._insertDescriptor(t);const i=n[0];o===i||Bg(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}remove(t,e){const n=this._stack,o=n[0];this._removeDescriptor(t);const i=n[0];o===i||Bg(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(Bg(t,e[n]))return;n>-1&&e.splice(n,1);let o=0;for(;e[o]&&zg(e[o],t);)o++;e.splice(o,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function Bg(t,e){return t&&e&&t.priority==e.priority&&Pg(t.classes)==Pg(e.classes)}function zg(t,e){return t.priority>e.priority||!(t.priorityPg(e.classes)}function Pg(t){return Array.isArray(t)?t.sort().join(","):t}he(Ng,k);const Lg='',Og="ck-widget_selected";function Rg(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function jg(t,e,n={}){if(!t.is("containerElement"))throw new c("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass("ck-widget",t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=Wg,n.label&&function(t,e,n){n.setCustomProperty("widgetLabel",e,t)}(t,n.label,e),n.hasSelectionHandle&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(t){const e=this.toDomElement(t),n=new hh;return n.set("content",Lg),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),Hg(t,e),t}function Fg(t,e,n){if(e.classes&&n.addClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.setAttribute(o,e.attributes[o],t)}function Vg(t,e,n){if(e.classes&&n.removeClass(So(e.classes),t),e.attributes)for(const o in e.attributes)n.removeAttribute(o,t)}function Hg(t,e,n=Fg,o=Vg){const i=new Ng;i.on("change:top",((e,i)=>{i.oldDescriptor&&o(t,i.oldDescriptor,i.writer),i.newDescriptor&&n(t,i.newDescriptor,i.writer)})),e.setCustomProperty("addHighlight",((t,e,n)=>i.add(e,n)),t),e.setCustomProperty("removeHighlight",((t,e,n)=>i.remove(e,n)),t)}function Ug(t){const e=t.getCustomProperty("widgetLabel");return e?"function"==typeof e?e():e:""}function qg(t,e){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",((n,o,i)=>{e.setAttribute("contenteditable",i?"false":"true",t)})),t.on("change:isFocused",((n,o,i)=>{i?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)})),Hg(t,e),t}function Gg(t,e){const n=t.getSelectedElement();if(n){const o=Qg(t);if(o)return e.createRange(e.createPositionAt(n,o))}return id(t,e)}function Wg(){return null}const Yg="widget-type-around";function Kg(t,e,n){return t&&Rg(t)&&!n.isInline(e)}function Qg(t){return t.getAttribute(Yg)}const $g=[ur("arrowUp"),ur("arrowRight"),ur("arrowDown"),ur("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let t=112;t<=135;t++)$g.push(t);function Zg(t){return!(!t.ctrlKey&&!t.metaKey)||$g.includes(t.keyCode)}var Jg=n(4921),Xg={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Jg.Z,Xg);Jg.Z.locals;const tm=["before","after"],em=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,nm="ck-widget__type-around_disabled";class om extends ue{static get pluginName(){return"WidgetTypeAround"}static get requires(){return[yg,Tg]}constructor(t){super(t),this._currentFakeCaretModelElement=null}init(){const t=this.editor,e=t.editing.view;this.on("change:isEnabled",((n,o,i)=>{e.change((t=>{for(const n of e.document.roots)i?t.removeClass(nm,n):t.addClass(nm,n)})),i||t.model.change((t=>{t.removeSelectionAttribute(Yg)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(t,e){const n=this.editor,o=n.editing.view,i=n.model.schema.getAttributesWithProperty(t,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(t,e),attributes:i}),o.focus(),o.scrollToTheSelection()}_listenToIfEnabled(t,e,n,o){this.listenTo(t,e,((...t)=>{this.isEnabled&&n(...t)}),o)}_insertParagraphAccordingToFakeCaretPosition(){const t=this.editor.model.document.selection,e=Qg(t);if(!e)return!1;const n=t.getSelectedElement();return this._insertParagraph(n,e),!0}_enableTypeAroundUIInjection(){const t=this.editor,e=t.model.schema,n=t.locale.t,o={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};t.editing.downcastDispatcher.on("insert",((t,n,i)=>{const r=i.mapper.toViewElement(n.item);Kg(r,n.item,e)&&function(t,e,n){const o=t.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(t){const n=this.toDomElement(t);return function(t,e){for(const n of tm){const o=new Vd({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:e[n]},children:[t.ownerDocument.importNode(em,!0)]});t.appendChild(o.render())}}(n,e),function(t){const e=new Vd({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});t.appendChild(e.render())}(n),n}));t.insert(t.createPositionAt(n,"end"),o)}(i.writer,o,r)}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const t=this.editor,e=t.model,n=e.document.selection,o=e.schema,i=t.editing.view;function r(t){return`ck-widget_type-around_show-fake-caret_${t}`}this._listenToIfEnabled(i.document,"arrowKey",((t,e)=>{this._handleArrowKeyPress(t,e)}),{context:[Rg,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(Yg)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();if(e){if(Kg(t.editing.mapper.toViewElement(e),e,o))return}t.model.change((t=>{t.removeSelectionAttribute(Yg)}))})),this._listenToIfEnabled(t.editing.downcastDispatcher,"selection",((t,e,n)=>{const i=n.writer;if(this._currentFakeCaretModelElement){const t=n.mapper.toViewElement(this._currentFakeCaretModelElement);t&&(i.removeClass(tm.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!Kg(a,s,o))return;const c=Qg(e.selection);c&&(i.addClass(r(c),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,o)=>{o||t.model.change((t=>{t.removeSelectionAttribute(Yg)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,o=n.model,i=o.document.selection,r=o.schema,s=n.editing.view,a=function(t,e){const n=pr(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;Kg(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):i.isCollapsed?l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(l=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),l&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=Qg(e.document.selection);return e.change((e=>{if(!n)return e.setSelectionAttribute(Yg,t?"after":"before"),!0;if(!(n===(t?"after":"before")))return e.removeSelectionAttribute(Yg),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,o=n.schema,i=e.plugins.get("Widget"),r=i._getObjectElementNextToSelection(t);return!!Kg(e.editing.mapper.toViewElement(r),r,o)&&(n.change((e=>{i._setSelectionOverElement(r),e.setSelectionAttribute(Yg,t?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(t){const e=this.editor,n=e.model,o=n.schema,i=e.editing.mapper,r=n.document.selection,s=t?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!Kg(i.toViewElement(s),s,o)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(Yg,t?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const t=this.editor,e=t.editing.view;this._listenToIfEnabled(e.document,"mousedown",((n,o)=>{const i=o.domTarget.closest(".ck-widget__type-around__button");if(!i)return;const r=function(t){return t.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(i),s=function(t,e){const n=t.closest(".ck-widget");return e.mapDomToView(n)}(i,e.domConverter),a=t.editing.mapper.toModelElement(s);this._insertParagraph(a,r),o.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const t=this.editor,e=t.model.document.selection,n=t.editing.view;this._listenToIfEnabled(n.document,"enter",((n,o)=>{if("atTarget"!=n.eventPhase)return;const i=e.getSelectedElement(),r=t.editing.mapper.toViewElement(i),s=t.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Kg(r,i,s)&&(this._insertParagraph(i,o.isSoft?"before":"after"),a=!0),a&&(o.preventDefault(),n.stop())}),{context:Rg})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view,e=[dr.enter,dr.delete,dr.backspace];this._listenToIfEnabled(t.document,"keydown",((t,n)=>{e.includes(n.keyCode)||Zg(n)||this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const t=this.editor,e=t.editing.view,n=t.model,o=n.schema;this._listenToIfEnabled(e.document,"delete",((e,i)=>{if("atTarget"!=e.eventPhase)return;const r=Qg(n.document.selection);if(!r)return;const s=i.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)t.execute("delete",{selection:n.createSelection(a,"on")});else{const e=o.getNearestSelectionRange(n.createPositionAt(a,r),s);if(e)if(e.isCollapsed){const i=n.createSelection(e.start);if(n.modifySelection(i,{direction:s}),i.focus.isEqual(e.start)){const t=function(t,e){let n=e;for(const o of e.getAncestors({parentFirst:!0})){if(o.childCount>1||t.isLimit(o))break;n=o}return n}(o,e.start.parent);n.deleteContent(n.createSelection(t,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}i.preventDefault(),e.stop()}),{context:Rg})}_enableInsertContentIntegration(){const t=this.editor,e=this.editor.model,n=e.document.selection;this._listenToIfEnabled(t.model,"insertContent",((t,[o,i])=>{if(i&&!i.is("documentSelection"))return;const r=Qg(n);return r?(t.stop(),e.change((t=>{const i=n.getSelectedElement(),s=e.createPositionAt(i,r),a=t.createSelection(s),c=e.insertContent(o,a);return t.setSelection(a),c}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"insertObject",((t,n)=>{const[,o,,i={}]=n;if(o&&!o.is("documentSelection"))return;const r=Qg(e);r&&(i.findOptimalPosition=r,n[3]=i)}),{priority:"high"})}_enableDeleteContentIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"deleteContent",((t,[n])=>{if(n&&!n.is("documentSelection"))return;Qg(e)&&t.stop()}),{priority:"high"})}}function im(t){const e=t.model;return(n,o)=>{const i=o.keyCode==dr.arrowup,r=o.keyCode==dr.arrowdown,s=o.shiftKey,a=e.document.selection;if(!i&&!r)return;const c=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,c))return;const l=function(t,e,n){const o=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=rm(o,t,"forward");if(!n)return null;const i=o.createRange(t,n),r=sm(o.schema,i,"backward");return r?o.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=rm(o,t,"backward");if(!n)return null;const i=o.createRange(n,t),r=sm(o.schema,i,"forward");return r?o.createRange(r,t):null}}(t,a,c);if(l){if(l.isCollapsed){if(a.isCollapsed)return;if(s)return}(l.isCollapsed||function(t,e,n){const o=t.model,i=t.view.domConverter;if(n){const t=o.createSelection(e.start);o.modifySelection(t),t.focus.isAtEnd||e.start.isEqual(t.focus)||(e=o.createRange(t.focus,e.end))}const r=t.mapper.toViewRange(e),s=i.viewRangeToDom(r),a=pa.getDomRangeRects(s);let c;for(const t of a)if(void 0!==c){if(Math.round(t.top)>=c)return!1;c=Math.max(c,Math.round(t.bottom))}else c=Math.round(t.bottom);return!0}(t,l,c))&&(e.change((t=>{const n=c?l.end:l.start;if(s){const o=e.createSelection(a.anchor);o.setFocus(n),t.setSelection(o)}else t.setSelection(n)})),n.stop(),o.preventDefault(),o.stopPropagation())}}}function rm(t,e,n){const o=t.schema,i=t.createRangeIn(e.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:t,item:s,type:a}of i.getWalker({startPosition:e,direction:n})){if(o.isLimit(s)&&!o.isInline(s))return t;if(a==r&&o.isBlock(s))return null}return null}function sm(t,e,n){const o="backward"==n?e.end:e.start;if(t.checkChild(o,"$text"))return o;for(const{nextPosition:o}of e.getWalker({direction:n}))if(t.checkChild(o,"$text"))return o;return null}var am=n(3488),cm={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(am.Z,cm);am.Z.locals;class lm extends ue{static get pluginName(){return"Widget"}static get requires(){return[om,Tg]}init(){const t=this.editor,e=t.editing.view,n=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",((e,n,o)=>{const i=o.writer,r=n.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=t.editing.mapper.toViewElement(s);Rg(a)&&o.consumable.consume(r,"selection")&&i.setSelection(i.createRangeOn(a),{fake:!0,label:Ug(a)})})),this.editor.editing.downcastDispatcher.on("selection",((t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const o=n.writer,i=o.document.selection;let r=null;for(const t of i.getRanges())for(const e of t){const t=e.item;Rg(t)&&!dm(t,r)&&(o.addClass(Og,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(lg),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[Rg,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",im(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"})}_onMousedown(t,e){const n=this.editor,o=n.editing.view,i=o.document;let r=e.target;if(function(t){for(;t;){if(t.is("editableElement")&&!t.is("rootElement"))return!0;if(Rg(t))return!1;t=t.parent}return!1}(r)){if((sr.isSafari||sr.isGecko)&&e.domEvent.detail>=3){const t=n.editing.mapper,o=r.is("attributeElement")?r.findAncestor((t=>!t.is("attributeElement"))):r,i=t.toModelElement(o);e.preventDefault(),this.editor.model.change((t=>{t.setSelection(i,"in")}))}return}if(!Rg(r)&&(r=r.findAncestor(Rg),!r))return;sr.isAndroid&&e.preventDefault(),i.isFocused||o.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,o=this.editor.model,i=o.schema,r=o.document.selection,s=r.getSelectedElement(),a=pr(n,this.editor.locale.contentLanguageDirection),c="down"==a||"right"==a,l="up"==a||"down"==a;if(s&&i.isObject(s)){const n=c?r.getLastPosition():r.getFirstPosition(),s=i.getNearestSelectionRange(n,c?"forward":"backward");return void(s&&(o.change((t=>{t.setSelection(s)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed&&!e.shiftKey){const n=r.getFirstPosition(),s=r.getLastPosition(),a=n.nodeAfter,l=s.nodeBefore;return void((a&&i.isObject(a)||l&&i.isObject(l))&&(o.change((t=>{t.setSelection(c?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&i.isObject(d)){if(i.isInline(d)&&l)return;this._setSelectionOverElement(d),e.preventDefault(),t.stop()}}_preventDefaultOnArrowKeyPress(t,e){const n=this.editor.model,o=n.schema,i=n.document.selection.getSelectedElement();i&&o.isObject(i)&&(e.preventDefault(),t.stop())}_handleDelete(t){if(this.editor.isReadOnly)return;const e=this.editor.model.document.selection;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change((t=>{let o=e.anchor.parent;for(;o.isEmpty;){const e=o;o=e.parent,t.remove(e)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(t){this.editor.model.change((e=>{e.setSelection(e.createRangeOn(t))}))}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,o=e.document.selection,i=e.createSelection(o);if(e.modifySelection(i,{direction:t?"forward":"backward"}),i.isEqual(o))return null;const r=t?i.focus.nodeBefore:i.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(Og,e);this._previouslySelected.clear()}}function dm(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}const hm=function(t,e,n){var o=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return x(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),sa(t,e,{leading:o,maxWait:e,trailing:i})};var um=n(903),gm={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(um.Z,gm);um.Z.locals;class mm extends ue{static get pluginName(){return"DragDrop"}static get requires(){return[wg,lm]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=hm((t=>this._updateDropMarker(t)),40),this._removeDropMarkerDelayed=km((()=>this._removeDropMarker()),40),this._clearDraggableAttributesDelayed=km((()=>this._clearDraggableAttributes()),40),e.addObserver(fg),e.addObserver(lg),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((t,e,n)=>{n||this._finalizeDragging(!1)})),sr.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=e.document,o=t.editing.view,i=o.document;this.listenTo(i,"dragstart",((o,s)=>{const a=n.selection;if(s.target&&s.target.is("editableElement"))return void s.preventDefault();const c=s.target?bm(s.target):null;if(c){const n=t.editing.mapper.toModelElement(c);this._draggedRange=ac.fromRange(e.createRangeOn(n)),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!i.selection.isCollapsed){const t=i.selection.getSelectedElement();t&&Rg(t)||(this._draggedRange=ac.fromRange(a.getFirstRange()))}if(!this._draggedRange)return void s.preventDefault();this._draggingUid=r(),s.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",s.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=e.createSelection(this._draggedRange.toRange()),d=t.data.toView(e.getSelectedContent(l));i.fire("clipboardOutput",{dataTransfer:s.dataTransfer,content:d,method:o.name}),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(i,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this.listenTo(i,"dragenter",(()=>{this.isEnabled&&o.focus()})),this.listenTo(i,"dragleave",(()=>{this._removeDropMarkerDelayed()})),this.listenTo(i,"dragging",((e,n)=>{if(!this.isEnabled)return void(n.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const o=pm(t,n.targetRanges,n.target);this._draggedRange||(n.dataTransfer.dropEffect="copy"),sr.isGecko||("copy"==n.dataTransfer.effectAllowed?n.dataTransfer.dropEffect="copy":["all","copyMove"].includes(n.dataTransfer.effectAllowed)&&(n.dataTransfer.dropEffect="move")),o&&this._updateDropMarkerThrottled(o)}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"clipboardInput",((e,n)=>{if("drop"!=n.method)return;const o=pm(t,n.targetRanges,n.target);if(this._removeDropMarker(),!o)return this._finalizeDragging(!1),void e.stop();this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==fm(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(o,!0))return this._finalizeDragging(!1),void e.stop();n.targetRanges=[t.editing.mapper.toViewRange(o)]}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(wg);t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n=e.targetRanges.map((t=>this.editor.editing.mapper.toModelRange(t)));this.editor.model.change((t=>t.setSelection(n)))}),{priority:"high"}),t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n="move"==fm(e.dataTransfer),o=!e.resultRange||!e.resultRange.isCollapsed;this._finalizeDragging(o&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const t=this.editor,e=t.editing.view,n=e.document;this.listenTo(n,"mousedown",((o,i)=>{if(sr.isAndroid||!i)return;this._clearDraggableAttributesDelayed.cancel();let r=bm(i.target);if(sr.isBlink&&!t.isReadOnly&&!r&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&Rg(t)||(r=n.selection.editableElement)}r&&(e.change((t=>{t.setAttribute("draggable","true",r)})),this._draggableElement=t.editing.mapper.toModelElement(r))})),this.listenTo(n,"mouseup",(()=>{sr.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const t=this.editor.editing;t.view.change((e=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&e.removeAttribute("draggable",t.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_setupDropMarker(){const t=this.editor;t.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),t.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(e,{writer:n})=>{if(t.model.schema.checkChild(e.markerRange.start,"$text"))return n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.innerHTML="⁠⁠",e}))}})}_updateDropMarker(t){const e=this.editor,n=e.model.markers;e.model.change((e=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(t)||e.updateMarker("drop-target",{range:t}):e.addMarker("drop-target",{range:t,usingOperation:!1,affectsData:!1})}))}_removeDropMarker(){const t=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_finalizeDragging(t){const e=this.editor,n=e.model;this._removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(t&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function pm(t,e,n){const o=t.model,i=t.editing.mapper;let r=null;const s=e?e[0].start:null;if(n.is("uiElement")&&(n=n.parent),r=function(t,e){const n=t.model,o=t.editing.mapper;if(Rg(e))return n.createRangeOn(o.toModelElement(e));if(!e.is("editableElement")){const t=e.findAncestor((t=>Rg(t)||t.is("editableElement")));if(Rg(t))return n.createRangeOn(o.toModelElement(t))}return null}(t,n),r)return r;const a=function(t,e){const n=t.editing.mapper,o=t.editing.view,i=n.toModelElement(e);if(i)return i;const r=o.createPositionBefore(e),s=n.findMappedViewAncestor(r);return n.toModelElement(s)}(t,n),c=s?i.toModelPosition(s):null;return c?(r=function(t,e,n){const o=t.model;if(!o.schema.checkChild(n,"$block"))return null;const i=o.createPositionAt(n,0),r=e.path.slice(0,i.path.length),s=o.createPositionFromPath(e.root,r).nodeAfter;if(s&&o.schema.isObject(s))return o.createRangeOn(s);return null}(t,c,a),r||(r=o.schema.getNearestSelectionRange(c,sr.isGecko?"forward":"backward"),r||function(t,e){const n=t.model;for(;e;){if(n.schema.isObject(e))return n.createRangeOn(e);e=e.parent}}(t,c.parent))):function(t,e){const n=t.model,o=n.schema,i=n.createPositionAt(e,0);return o.getNearestSelectionRange(i,"forward")}(t,a)}function fm(t){return sr.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function km(t,e){let n;function o(...i){o.cancel(),n=setTimeout((()=>t(...i)),e)}return o.cancel=()=>{clearTimeout(n)},o}function bm(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(Rg);if(Rg(t))return t;const e=t.findAncestor((t=>Rg(t)||t.is("editableElement")));return Rg(e)?e:null}class wm extends ue{static get pluginName(){return"PastePlainText"}static get requires(){return[wg]}init(){const t=this.editor,e=t.model,n=t.editing.view,o=n.document,i=e.document.selection;let r=!1;n.addObserver(fg),this.listenTo(o,"keydown",((t,e)=>{r=e.shiftKey})),t.plugins.get(wg).on("contentInsertion",((t,n)=>{(r||function(t,e){if(t.childCount>1)return!1;const n=t.getChild(0);if(e.isObject(n))return!1;return 0==[...n.getAttributeKeys()].length}(n.content,e.schema))&&e.change((t=>{const o=Array.from(i.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));i.isCollapsed||e.deleteContent(i,{doNotAutoparagraph:!0}),o.push(...i.getAttributes());const r=t.createRangeIn(n.content);for(const e of r.getItems())e.is("$textProxy")&&t.setAttributes(o,e)}))}))}}class _m extends ue{static get pluginName(){return"Clipboard"}static get requires(){return[wg,mm,wm]}}class Am extends me{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n){const o=n.isCollapsed,i=n.getFirstRange(),r=i.start.parent,s=i.end.parent,a=r==s;if(o){const o=_g(t.schema,n.getAttributes());Cm(t,e,i.end),e.removeSelectionAttribute(n.getAttributeKeys()),e.setSelectionAttribute(o)}else{const o=!(i.start.isAtStart&&i.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:o}),a?Cm(t,e,n.focus):o&&e.setSelection(s,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})}))}refresh(){const t=this.editor.model,e=t.document;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const o=e.getFirstRange(),i=o.start.parent,r=o.end.parent;if((vm(i,t)||vm(r,t))&&i!==r)return!1;return!0}(t.schema,e.selection)}}function Cm(t,e,n){const o=e.createElement("softBreak");t.insertContent(o,n),e.setSelection(o,"after")}function vm(t,e){return!t.is("rootElement")&&(e.isLimit(t)||vm(t.parent,e))}class ym extends ue{static get pluginName(){return"ShiftEnter"}init(){const t=this.editor,e=t.model.schema,n=t.conversion,o=t.editing.view,i=o.document;e.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(t,{writer:e})=>e.createEmptyElement("br")}),o.addObserver(vg),t.commands.add("shiftEnter",new Am(t)),this.listenTo(i,"enter",((e,n)=>{n.preventDefault(),n.isSoft&&(t.execute("shiftEnter"),o.scrollToTheSelection())}),{priority:"low"})}}class xm extends me{constructor(t){super(t),this.affectsData=!1}execute(){const t=this.editor.model,e=t.document.selection;let n=t.schema.getLimitElement(e);if(e.containsEntireContent(n)||!Dm(t.schema,n))do{if(n=n.parent,!n)return}while(!Dm(t.schema,n));t.change((t=>{t.setSelection(n,"in")}))}}function Dm(t,e){return t.isLimit(e)&&(t.checkChild(e,"$text")||t.checkChild(e,"paragraph"))}const Em=gr("Ctrl+A");class Mm extends ue{static get pluginName(){return"SelectAllEditing"}init(){const t=this.editor,e=t.editing.view.document;t.commands.add("selectAll",new xm(t)),this.listenTo(e,"keydown",((e,n)=>{ur(n)===Em&&(t.execute("selectAll"),n.preventDefault())}))}}class Im extends ue{static get pluginName(){return"SelectAllUI"}init(){const t=this.editor;t.ui.componentFactory.add("selectAll",(e=>{const n=t.commands.get("selectAll"),o=new kh(e),i=e.t;return o.set({label:i("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),o.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),o}))}}class Sm extends ue{static get requires(){return[Mm,Im]}static get pluginName(){return"SelectAll"}}class Tm extends me{constructor(t,e){super(t),this._buffer=new xg(t.model,e)}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,o=t.text||"",i=o.length,r=t.range?e.createSelection(t.range):n.selection,s=t.resultRange;e.enqueueChange(this._buffer.batch,(t=>{this._buffer.lock(),e.deleteContent(r),o&&e.insertContent(t.createText(o,n.selection.getAttributes()),r),s?t.setSelection(s):r.is("documentSelection")||t.setSelection(r),this._buffer.unlock(),this._buffer.input(i)}))}}class Nm{constructor(t){this.editor=t,this.editing=this.editor.editing}handle(t,e){if(function(t){if(0==t.length)return!1;for(const e of t)if("children"===e.type&&!Eg(e))return!0;return!1}(t))this._handleContainerChildrenMutations(t,e);else for(const n of t)this._handleTextMutation(n,e),this._handleTextNodeInsertion(n)}_handleContainerChildrenMutations(t,e){const n=function(t){const e=t.map((t=>t.node)).reduce(((t,e)=>t.getCommonAncestor(e,{includeSelf:!0})));if(!e)return;return e.getAncestors({includeSelf:!0,parentFirst:!0}).find((t=>t.is("containerElement")||t.is("rootElement")))}(t);if(!n)return;const o=this.editor.editing.view.domConverter.mapViewToDom(n),i=new gs(this.editor.editing.view.document),r=this.editor.data.toModel(i.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(n);if(!s)return;const a=Array.from(r.getChildren()),c=Array.from(s.getChildren()),l=a[a.length-1],d=c[c.length-1],h=l&&l.is("element","softBreak"),u=d&&!d.is("element","softBreak");h&&u&&a.pop();const g=this.editor.model.schema;if(!Bm(a,g)||!Bm(c,g))return;const m=a.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," "),p=c.map((t=>t.is("$text")?t.data:"@")).join("").replace(/\u00A0/g," ");if(p===m)return;const f=Gr(p,m),{firstChangeAt:k,insertions:b,deletions:w}=zm(f);let _=null;e&&(_=this.editing.mapper.toModelRange(e.getFirstRange()));const A=m.substr(k,b),C=this.editor.model.createRange(this.editor.model.createPositionAt(s,k),this.editor.model.createPositionAt(s,k+w));this.editor.execute("input",{text:A,range:C,resultRange:_})}_handleTextMutation(t,e){if("text"!=t.type)return;const n=t.newText.replace(/\u00A0/g," "),o=t.oldText.replace(/\u00A0/g," ");if(o===n)return;const i=Gr(o,n),{firstChangeAt:r,insertions:s,deletions:a}=zm(i);let c=null;e&&(c=this.editing.mapper.toModelRange(e.getFirstRange()));const l=this.editing.view.createPositionAt(t.node,r),d=this.editing.mapper.toModelPosition(l),h=this.editor.model.createRange(d,d.getShiftedBy(a)),u=n.substr(r,s);this.editor.execute("input",{text:u,range:h,resultRange:c})}_handleTextNodeInsertion(t){if("children"!=t.type)return;const e=Eg(t),n=this.editing.view.createPositionAt(t.node,e.index),o=this.editing.mapper.toModelPosition(n),i=e.values[0].data;this.editor.execute("input",{text:i.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function Bm(t,e){return t.every((t=>e.isInline(t)))}function zm(t){let e=null,n=null;for(let o=0;o{n.deleteContent(n.document.selection)})),t.unlock()}sr.isAndroid?o.document.on("beforeinput",((t,e)=>r(e)),{priority:"lowest"}):o.document.on("keydown",((t,e)=>r(e)),{priority:"lowest"}),o.document.on("compositionstart",(function(){const t=n.document,e=1!==t.selection.rangeCount||t.selection.getFirstRange().isFlat;t.selection.isCollapsed||e||s()}),{priority:"lowest"}),o.document.on("compositionend",(()=>{e=n.createSelection(n.document.selection)}),{priority:"lowest"})}(t),function(t){t.editing.view.document.on("mutations",((e,n,o)=>{new Nm(t).handle(n,o)}))}(t)}}class Lm extends ue{static get requires(){return[Pm,Tg]}static get pluginName(){return"Typing"}}function Om(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>o.is("$text")||o.is("$textProxy")?t+o.data:(n=e.createPositionAfter(o),"")),""),range:e.createRange(n,t.end)}}class Rm{constructor(t,e){this.model=t,this.testCallback=e,this.hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(t.document.selection),this.stopListening(t.document))})),this._startListening()}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",((e,{directChange:n})=>{n&&(t.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))})),this.listenTo(t,"change:data",((t,e)=>{!e.isUndo&&e.isLocal&&this._evaluateTextBeforeSelection("data",{batch:e})}))}_evaluateTextBeforeSelection(t,e={}){const n=this.model,o=n.document.selection,i=n.createRange(n.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=Om(i,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const n=Object.assign(e,{text:r,range:s});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${t}`,n)}}}he(Rm,re);class jm extends ue{static get pluginName(){return"TwoStepCaretMovement"}constructor(t){super(t),this.attributes=new Set,this._overrideUid=null}init(){const t=this.editor,e=t.model,n=t.editing.view,o=t.locale,i=e.document.selection;this.listenTo(n.document,"arrowKey",((t,e)=>{if(!i.isCollapsed)return;if(e.shiftKey||e.altKey||e.ctrlKey)return;const n=e.keyCode==dr.arrowright,r=e.keyCode==dr.arrowleft;if(!n&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&n||"rtl"===s&&r?this._handleForwardMovement(e):this._handleBackwardMovement(e),!0===a&&t.stop()}),{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(i,"change:range",((t,e)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!e.directChange&&Um(i.getFirstPosition(),this.attributes)||this._restoreGravity())}))}registerAttribute(t){this.attributes.add(t)}_handleForwardMovement(t){const e=this.attributes,n=this.editor.model.document.selection,o=n.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!Fm(n,e))&&(Um(o,e)?(Hm(t),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(t){const e=this.attributes,n=this.editor.model,o=n.document.selection,i=o.getFirstPosition();return this._isGravityOverridden?(Hm(t),this._restoreGravity(),Vm(n,e,i),!0):i.isAtStart?!!Fm(o,e)&&(Hm(t),Vm(n,e,i),!0):function(t,e){return Um(t.getShiftedBy(-1),e)}(i,e)?i.isAtEnd&&!Fm(o,e)&&Um(i,e)?(Hm(t),Vm(n,e,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):void 0}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((t=>t.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((t=>{t.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function Fm(t,e){for(const n of e)if(t.hasAttribute(n))return!0;return!1}function Vm(t,e,n){const o=n.nodeBefore;t.change((t=>{o?t.setSelectionAttribute(o.getAttributes()):t.removeSelectionAttribute(e)}))}function Hm(t){t.preventDefault()}function Um(t,e){const{nodeBefore:n,nodeAfter:o}=t;for(const t of e){const e=n?n.getAttribute(t):void 0;if((o?o.getAttribute(t):void 0)!==e)return!0}return!1}var qm=/[\\^$.*+?()[\]{}|]/g,Gm=RegExp(qm.source);const Wm=function(t){return(t=si(t))&&Gm.test(t)?t.replace(qm,"\\$&"):t},Ym={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:Xm('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:Xm("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:Xm("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:Xm('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:Xm('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:Xm("'"),to:[null,"‚",null,"’"]}},Km={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Qm=["symbols","mathematical","typography","quotes"];function $m(t){return"string"==typeof t?new RegExp(`(${Wm(t)})$`):t}function Zm(t){return"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t}function Jm(t){return(t.textNode?t.textNode:t.nodeAfter).getAttributes()}function Xm(t){return new RegExp(`(^|\\s)(${t})([^${t}]*)(${t})$`)}function tp(t,e,n,o){return o.createRange(ep(t,e,n,!0,o),ep(t,e,n,!1,o))}function ep(t,e,n,o,i){let r=t.textNode||(o?t.nodeBefore:t.nodeAfter),s=null;for(;r&&r.getAttribute(e)==n;)s=r,r=o?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,o?"before":"after"):t}class np extends me{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(t.data,"set",((t,e)=>{e[1]={...e[1]};const n=e[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(t.data,"set",((t,e)=>{e[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const o=this.editor.model,i=o.document,r=[],s=t.map((t=>t.getTransformedByOperations(n))),a=s.flat();for(const t of s){const e=t.filter((t=>t.root!=i.graveyard)).filter((t=>!ip(t,a)));e.length&&(op(e),r.push(e[0]))}r.length&&o.change((t=>{t.setSelection(r,{backward:e})}))}_undo(t,e){const n=this.editor.model,o=n.document;this._createdBatches.add(e);const i=t.operations.slice().filter((t=>t.isDocumentOperation));i.reverse();for(const t of i){const i=t.baseVersion+1,r=Array.from(o.history.getOperations(i)),s=eg([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const i of s)e.addOperation(i),n.applyOperation(i),o.history.setOperationAsUndone(t,i)}}}function op(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class rp extends np{execute(t=null){const e=t?this._stack.findIndex((e=>e.batch==t)):this._stack.length-1,n=this._stack.splice(e,1)[0],o=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(o,(()=>{this._undo(n.batch,o);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t),this.fire("revert",n.batch,o)})),this.refresh()}}class sp extends np{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,(()=>{const n=t.batch.operations[t.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(n);this._restoreSelection(t.selection.ranges,t.selection.isBackward,o),this._undo(t.batch,e)})),this.refresh()}}class ap extends ue{static get pluginName(){return"UndoEditing"}constructor(t){super(t),this._batchRegistry=new WeakSet}init(){const t=this.editor;this._undoCommand=new rp(t),this._redoCommand=new sp(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",((t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const o=n.batch,i=this._redoCommand._createdBatches.has(o),r=this._undoCommand._createdBatches.has(o);this._batchRegistry.has(o)||(this._batchRegistry.add(o),o.isUndoable&&(i?this._undoCommand.addBatch(o):r||(this._undoCommand.addBatch(o),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((t,e,n)=>{this._redoCommand.addBatch(n)})),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo")}}const cp='',lp='';class dp extends ue{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?cp:lp,i="ltr"==e.uiLanguageDirection?lp:cp;this._addButton("undo",n("Undo"),"CTRL+Z",o),this._addButton("redo",n("Redo"),"CTRL+Y",i)}_addButton(t,e,n,o){const i=this.editor;i.ui.componentFactory.add(t,(r=>{const s=i.commands.get(t),a=new kh(r);return a.set({label:e,icon:o,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",(()=>{i.execute(t),i.editing.view.focus()})),a}))}}class hp extends ue{static get requires(){return[ap,dp]}static get pluginName(){return"Undo"}}class up{constructor(){const t=new window.FileReader;this._reader=t,this._data=void 0,this.set("loaded",0),t.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(t){const e=this._reader;return this.total=t.size,new Promise(((n,o)=>{e.onload=()=>{const t=e.result;this._data=t,n(t)},e.onerror=()=>{o("error")},e.onabort=()=>{o("aborted")},this._reader.readAsDataURL(t)}))}abort(){this._reader.abort()}}he(up,re);class gp extends ue{static get pluginName(){return"FileRepository"}static get requires(){return[Td]}init(){this.loaders=new Mo,this.loaders.on("add",(()=>this._updatePendingAction())),this.loaders.on("remove",(()=>this._updatePendingAction())),this._loadersMap=new Map,this._pendingAction=null,this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0))}getLoader(t){return this._loadersMap.get(t)||null}createLoader(t){if(!this.createUploadAdapter)return l("filerepository-no-upload-adapter"),null;const e=new mp(Promise.resolve(t),this.createUploadAdapter);return this.loaders.add(e),this._loadersMap.set(t,e),t instanceof Promise&&e.file.then((t=>{this._loadersMap.set(t,e)})).catch((()=>{})),e.on("change:uploaded",(()=>{let t=0;for(const e of this.loaders)t+=e.uploaded;this.uploaded=t})),e.on("change:uploadTotal",(()=>{let t=0;for(const e of this.loaders)e.uploadTotal&&(t+=e.uploadTotal);this.uploadTotal=t})),e}destroyLoader(t){const e=t instanceof mp?t:this.getLoader(t);e._destroy(),this.loaders.remove(e),this._loadersMap.forEach(((t,n)=>{t===e&&this._loadersMap.delete(n)}))}_updatePendingAction(){const t=this.editor.plugins.get(Td);if(this.loaders.length){if(!this._pendingAction){const e=this.editor.t,n=t=>`${e("Upload in progress")} ${parseInt(t)}%.`;this._pendingAction=t.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else t.remove(this._pendingAction),this._pendingAction=null}}he(gp,re);class mp{constructor(t,e){this.id=r(),this._filePromiseWrapper=this._createFilePromiseWrapper(t),this._adapter=e(this),this._reader=new up,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((t=>this._filePromiseWrapper?t:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new c("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((t=>this._reader.read(t))).then((t=>{if("reading"!==this.status)throw this.status;return this.status="idle",t})).catch((t=>{if("aborted"===t)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:t}))}upload(){if("idle"!=this.status)throw new c("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((t=>(this.uploadResponse=t,this.status="idle",t))).catch((t=>{if("aborted"===this.status)throw"aborted";throw this.status="error",t}))}abort(){const t=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==t?this._reader.abort():"uploading"==t&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(t){const e={};return e.promise=new Promise(((n,o)=>{e.rejecter=o,e.isFulfilled=!1,t.then((t=>{e.isFulfilled=!0,n(t)})).catch((t=>{e.isFulfilled=!0,o(t)}))})),e}}he(mp,re);class pp extends Fd{constructor(t){super(t),this.buttonView=new kh(t),this._fileInputView=new fp(t),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",(()=>{this._fileInputView.open()}))}focus(){this.buttonView.focus()}}class fp extends Fd{constructor(t){super(t),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:e.to("acceptedType"),multiple:e.to("allowMultipleFiles")},on:{change:e.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}const kp="ckCsrfToken",bp="abcdefghijklmnopqrstuvwxyz0123456789";function wp(){let t=function(t){t=t.toLowerCase();const e=document.cookie.split(";");for(const n of e){const e=n.split("=");if(decodeURIComponent(e[0].trim().toLowerCase())===t)return decodeURIComponent(e[1])}return null}(kp);var e,n;return t&&40==t.length||(t=function(t){let e="";const n=new Uint8Array(t);window.crypto.getRandomValues(n);for(let t=0;t.5?o.toUpperCase():o}return e}(40),e=kp,n=t,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(n)+";path=/"),t}class _p{constructor(t,e,n){this.loader=t,this.url=e,this.t=n}upload(){return this.loader.file.then((t=>new Promise(((e,n)=>{this._initRequest(),this._initListeners(e,n,t),this._sendRequest(t)}))))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const t=this.xhr=new XMLHttpRequest;t.open("POST",this.url,!0),t.responseType="json"}_initListeners(t,e,n){const o=this.xhr,i=this.loader,r=(0,this.t)("Cannot upload file:")+` ${n.name}.`;o.addEventListener("error",(()=>e(r))),o.addEventListener("abort",(()=>e())),o.addEventListener("load",(()=>{const n=o.response;if(!n||!n.uploaded)return e(n&&n.error&&n.error.message?n.error.message:r);t({default:n.url})})),o.upload&&o.upload.addEventListener("progress",(t=>{t.lengthComputable&&(i.uploadTotal=t.total,i.uploaded=t.loaded)}))}_sendRequest(t){const e=new FormData;e.append("upload",t),e.append("ckCsrfToken",wp()),this.xhr.send(e)}}function Ap(t,e,n,o){let i,r=null;"function"==typeof o?i=o:(r=t.commands.get(o),i=()=>{t.execute(o)}),t.model.document.on("change:data",((s,a)=>{if(r&&!r.isEnabled||!e.isEnabled)return;const c=Na(t.model.document.selection.getRanges());if(!c.isCollapsed)return;if(a.isUndo||!a.isLocal)return;const l=Array.from(t.model.document.differ.getChanges()),d=l[0];if(1!=l.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const h=d.position.parent;if(h.is("element","codeBlock"))return;if(h.is("element","listItem")&&"function"!=typeof o&&!["numberedList","bulletedList","todoList"].includes(o))return;if(r&&!0===r.value)return;const u=h.getChild(0),g=t.model.createRangeOn(u);if(!g.containsRange(c)&&!c.end.isEqual(g.end))return;const m=n.exec(u.data.substr(0,c.end.offset));m&&t.model.enqueueChange((e=>{const n=e.createPositionAt(h,0),o=e.createPositionAt(h,m[0].length),r=new ac(n,o);if(!1!==i({match:m})){e.remove(r);const n=t.model.document.selection.getFirstRange(),o=e.createRangeIn(h);!h.isEmpty||o.isEqual(n)||o.containsRange(n,!0)||e.remove(h)}r.detach(),t.model.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function Cp(t,e,n,o){let i,r;n instanceof RegExp?i=n:r=n,r=r||(t=>{let e;const n=[],o=[];for(;null!==(e=i.exec(t))&&!(e&&e.length<4);){let{index:t,1:i,2:r,3:s}=e;const a=i+r+s;t+=e[0].length-a.length;const c=[t,t+i.length],l=[t+i.length+r.length,t+i.length+r.length+s.length];n.push(c),n.push(l),o.push([t+i.length,t+i.length+r.length])}return{remove:n,format:o}}),t.model.document.on("change:data",((n,i)=>{if(i.isUndo||!i.isLocal||!e.isEnabled)return;const s=t.model,a=s.document.selection;if(!a.isCollapsed)return;const c=Array.from(s.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const d=a.focus,h=d.parent,{text:u,range:g}=function(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,o)=>!o.is("$text")&&!o.is("$textProxy")||o.getAttribute("code")?(n=e.createPositionAfter(o),""):t+o.data),""),range:e.createRange(n,t.end)}}(s.createRange(s.createPositionAt(h,0),d),s),m=r(u),p=vp(g.start,m.format,s),f=vp(g.start,m.remove,s);p.length&&f.length&&s.enqueueChange((e=>{if(!1!==o(e,p)){for(const t of f.reverse())e.remove(t);s.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function vp(t,e,n){return e.filter((t=>void 0!==t[0]&&void 0!==t[1])).map((e=>n.createRange(t.getShiftedBy(e[0]),t.getShiftedBy(e[1]))))}function yp(t,e){return(n,o)=>{if(!t.commands.get(e).isEnabled)return!1;const i=t.model.schema.getValidRanges(o,e);for(const t of i)n.setAttribute(e,!0,t);n.removeSelectionAttribute(e)}}class xp extends me{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,o=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(n.isCollapsed)o?t.setSelectionAttribute(this.attributeKey,!0):t.removeSelectionAttribute(this.attributeKey);else{const i=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of i)o?t.setAttribute(this.attributeKey,o,e):t.removeAttribute(this.attributeKey,e)}}))}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const t of n.getRanges())for(const n of t.getItems())if(e.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}const Dp="bold";class Ep extends ue{static get pluginName(){return"BoldEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Dp}),t.model.schema.setAttributeProperties(Dp,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Dp,view:"strong",upcastAlso:["b",t=>{const e=t.getStyle("font-weight");return e?"bold"==e||Number(e)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),t.commands.add(Dp,new xp(t,Dp)),t.keystrokes.set("CTRL+B",Dp)}}const Mp="bold";class Ip extends ue{static get pluginName(){return"BoldUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Mp,(n=>{const o=t.commands.get(Mp),i=new kh(n);return i.set({label:e("Bold"),icon:'',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(Mp),t.editing.view.focus()})),i}))}}const Sp="italic";class Tp extends ue{static get pluginName(){return"ItalicEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Sp}),t.model.schema.setAttributeProperties(Sp,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Sp,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(Sp,new xp(t,Sp)),t.keystrokes.set("CTRL+I",Sp)}}const Np="italic";class Bp extends ue{static get pluginName(){return"ItalicUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Np,(n=>{const o=t.commands.get(Np),i=new kh(n);return i.set({label:e("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute(Np),t.editing.view.focus()})),i}))}}class zp extends me{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.schema,o=e.document.selection,i=Array.from(o.getSelectedBlocks()),r=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(r){const e=i.filter((t=>Pp(t)||Op(n,t)));this._applyQuote(t,e)}else this._removeQuote(t,i.filter(Pp))}))}_getValue(){const t=Na(this.editor.model.document.selection.getSelectedBlocks());return!(!t||!Pp(t))}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.document.selection,e=this.editor.model.schema,n=Na(t.getSelectedBlocks());return!!n&&Op(e,n)}_removeQuote(t,e){Lp(t,e).reverse().forEach((e=>{if(e.start.isAtStart&&e.end.isAtEnd)return void t.unwrap(e.start.parent);if(e.start.isAtStart){const n=t.createPositionBefore(e.start.parent);return void t.move(e,n)}e.end.isAtEnd||t.split(e.end);const n=t.createPositionAfter(e.end.parent);t.move(e,n)}))}_applyQuote(t,e){const n=[];Lp(t,e).reverse().forEach((e=>{let o=Pp(e.start);o||(o=t.createElement("blockQuote"),t.wrap(e,o)),n.push(o)})),n.reverse().reduce(((e,n)=>e.nextSibling==n?(t.merge(t.createPositionAfter(e)),e):n))}}function Pp(t){return"blockQuote"==t.parent.name?t.parent:null}function Lp(t,e){let n,o=0;const i=[];for(;o{const o=t.model.document.differ.getChanges();for(const t of o)if("insert"==t.type){const o=t.position.nodeAfter;if(!o)continue;if(o.is("element","blockQuote")&&o.isEmpty)return n.remove(o),!0;if(o.is("element","blockQuote")&&!e.checkChild(t.position,o))return n.unwrap(o),!0;if(o.is("element")){const t=n.createRangeIn(o);for(const o of t.getItems())if(o.is("element","blockQuote")&&!e.checkChild(n.createPositionBefore(o),o))return n.unwrap(o),!0}}else if("remove"==t.type){const e=t.position.parent;if(e.is("element","blockQuote")&&e.isEmpty)return n.remove(e),!0}return!1}));const n=this.editor.editing.view.document,o=t.model.document.selection,i=t.commands.get("blockQuote");this.listenTo(n,"enter",((e,n)=>{if(!o.isCollapsed||!i.value)return;o.getLastPosition().parent.isEmpty&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"}),this.listenTo(n,"delete",((e,n)=>{if("backward"!=n.direction||!o.isCollapsed||!i.value)return;const r=o.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"})}}var jp=n(3062),Fp={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(jp.Z,Fp);jp.Z.locals;class Vp extends ue{static get pluginName(){return"BlockQuoteUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("blockQuote",(n=>{const o=t.commands.get("blockQuote"),i=new kh(n);return i.set({label:e("Block quote"),icon:Bd.quote,tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),i}))}}class Hp extends ue{static get pluginName(){return"CKFinderUI"}init(){const t=this.editor,e=t.ui.componentFactory,n=t.t;e.add("ckfinder",(e=>{const o=t.commands.get("ckfinder"),i=new kh(e);return i.set({label:n("Insert image or file"),icon:'',tooltip:!0}),i.bind("isEnabled").to(o),i.on("execute",(()=>{t.execute("ckfinder"),t.editing.view.focus()})),i}))}}class Up extends me{constructor(t){super(t),this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",(()=>this.refresh()),{priority:"low"})}refresh(){const t=this.editor.commands.get("insertImage"),e=this.editor.commands.get("link");this.isEnabled=t.isEnabled||e.isEnabled}execute(){const t=this.editor,e=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=e&&"modal"!=e)throw new c("ckfinder-unknown-openermethod",t);const n=this.editor.config.get("ckfinder.options")||{};n.chooseFiles=!0;const o=n.onInit;n.language||(n.language=t.locale.uiLanguage),n.onInit=e=>{o&&o(e),e.on("files:choose",(n=>{const o=n.data.files.toArray(),i=o.filter((t=>!t.isImage())),r=o.filter((t=>t.isImage()));for(const e of i)t.execute("link",e.getUrl());const s=[];for(const t of r){const n=t.getUrl();s.push(n||e.request("file:getProxyUrl",{file:t}))}s.length&&qp(t,s)})),e.on("file:choose:resizedImage",(e=>{const n=e.data.resizedUrl;if(n)qp(t,[n]);else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not obtain resized image URL."),{title:n("Selecting resized image failed"),namespace:"ckfinder"})}}))},window.CKFinder[e](n)}}function qp(t,e){if(t.commands.get("insertImage").isEnabled)t.execute("insertImage",{source:e});else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("Could not insert image at the current position."),{title:n("Inserting image failed"),namespace:"ckfinder"})}}class Gp extends ue{static get pluginName(){return"CKFinderEditing"}static get requires(){return[vu,"LinkEditing"]}init(){const t=this.editor;if(!t.plugins.has("ImageBlockEditing")&&!t.plugins.has("ImageInlineEditing"))throw new c("ckfinder-missing-image-plugin",t);t.commands.add("ckfinder",new Up(t))}}class Wp extends ue{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",gp]}init(){const t=this.editor,e=t.plugins.get("CloudServices"),n=e.token,o=e.uploadUrl;n&&(this._uploadGateway=t.plugins.get("CloudServicesCore").createUploadGateway(n,o),t.plugins.get(gp).createUploadAdapter=t=>new Yp(this._uploadGateway,t))}}class Yp{constructor(t,e){this.uploadGateway=t,this.loader=e}upload(){return this.loader.file.then((t=>(this.fileUploader=this.uploadGateway.upload(t),this.fileUploader.on("progress",((t,e)=>{this.loader.uploadTotal=e.total,this.loader.uploaded=e.uploaded})),this.fileUploader.send())))}abort(){this.fileUploader.abort()}}class Kp extends me{refresh(){const t=this.editor.model,e=Na(t.document.selection.getSelectedBlocks());this.value=!!e&&e.is("element","paragraph"),this.isEnabled=!!e&&Qp(e,t.schema)}execute(t={}){const e=this.editor.model,n=e.document;e.change((o=>{const i=(t.selection||n.selection).getSelectedBlocks();for(const t of i)!t.is("element","paragraph")&&Qp(t,e.schema)&&o.rename(t,"paragraph")}))}}function Qp(t,e){return e.checkChild(t.parent,"paragraph")&&!e.isObject(t)}class $p extends me{execute(t){const e=this.editor.model,n=t.attributes;let o=t.position;e.change((t=>{const i=t.createElement("paragraph");if(n&&e.schema.setAllowedAttributes(i,n,t),!e.schema.checkChild(o.parent,i)){const n=e.schema.findAllowedParent(o,i);if(!n)return;o=t.split(o,n).position}e.insertContent(i,o),t.setSelection(i,"in")}))}}class Zp extends ue{static get pluginName(){return"Paragraph"}init(){const t=this.editor,e=t.model;t.commands.add("paragraph",new Kp(t)),t.commands.add("insertParagraph",new $p(t)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(t,{writer:e})=>Zp.paragraphLikeElements.has(t.name)?t.isEmpty?null:e.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}Zp.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class Jp extends me{constructor(t,e){super(t),this.modelElements=e}refresh(){const t=Na(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some((e=>Xp(t,e,this.editor.model.schema)))}execute(t){const e=this.editor.model,n=e.document,o=t.value;e.change((t=>{const i=Array.from(n.selection.getSelectedBlocks()).filter((t=>Xp(t,o,e.schema)));for(const e of i)e.is("element",o)||t.rename(e,o)}))}}function Xp(t,e,n){return n.checkChild(t.parent,e)&&!n.isObject(t)}const tf="paragraph";class ef extends ue{static get pluginName(){return"HeadingEditing"}constructor(t){super(t),t.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[Zp]}init(){const t=this.editor,e=t.config.get("heading.options"),n=[];for(const o of e)o.model!==tf&&(t.model.schema.register(o.model,{inheritAllFrom:"$block"}),t.conversion.elementToElement(o),n.push(o.model));this._addDefaultH1Conversion(t),t.commands.add("heading",new Jp(t,n))}afterInit(){const t=this.editor,e=t.commands.get("enter"),n=t.config.get("heading.options");e&&this.listenTo(e,"afterExecute",((e,o)=>{const i=t.model.document.selection.getFirstPosition().parent;n.some((t=>i.is("element",t.model)))&&!i.is("element",tf)&&0===i.childCount&&o.writer.rename(i,tf)}))}_addDefaultH1Conversion(t){t.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:s.get("low")+1})}}var nf=n(8733),of={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(nf.Z,of);nf.Z.locals;class rf extends ue{static get pluginName(){return"HeadingUI"}init(){const t=this.editor,e=t.t,n=function(t){const e=t.t,n={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return t.config.get("heading.options").map((t=>{const e=n[t.title];return e&&e!=t.title&&(t.title=e),t}))}(t),o=e("Choose heading"),i=e("Heading");t.ui.componentFactory.add("heading",(e=>{const r={},s=new Mo,a=t.commands.get("heading"),c=t.commands.get("paragraph"),l=[a];for(const t of n){const e={type:"button",model:new yu({label:t.title,class:t.class,withText:!0})};"paragraph"===t.model?(e.model.bind("isOn").to(c,"value"),e.model.set("commandName","paragraph"),l.push(c)):(e.model.bind("isOn").to(a,"value",(e=>e===t.model)),e.model.set({commandName:"heading",commandValue:t.model})),s.add(e),r[t.model]=t.title}const d=nu(e);return iu(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:i}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(l,"isEnabled",((...t)=>t.some((t=>t)))),d.buttonView.bind("label").to(a,"value",c,"value",((t,e)=>{const n=t||e&&"paragraph";return r[n]?r[n]:o})),this.listenTo(d,"execute",(e=>{t.execute(e.source.commandName,e.source.commandValue?{value:e.source.commandValue}:void 0),t.editing.view.focus()})),d}))}}class sf extends ue{static get requires(){return[Lu]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",(e=>{(function(t){const e=t.getSelectedElement();return!(!e||!Rg(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{ariaLabel:e,items:n,getRelatedElement:o,balloonClassName:i="ck-toolbar-container"}){if(!n.length)return void l("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new Uh(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new c("widget-toolbar-duplicated",this,{toolbarId:t});a.fillFromConfig(n,r.ui.componentFactory),this._toolbarDefinitions.set(t,{view:a,getRelatedElement:o,balloonClassName:i})}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const o of this._toolbarDefinitions.values()){const i=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&i)if(this.editor.ui.focusTracker.isFocused){const r=i.getAncestors().length;r>t&&(t=r,e=i,n=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(t,e){this._isToolbarVisible(t)?af(this.editor,e):this._isToolbarInBalloon(t)||(this._balloon.add({view:t.view,position:cf(this.editor,e),balloonClassName:t.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const e=t.getRelatedElement(this.editor.editing.view.document.selection);af(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function af(t,e){const n=t.plugins.get("ContextualBalloon"),o=cf(t,e);n.updatePosition(o)}function cf(t,e){const n=t.editing.view,o=Iu.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast,o.viewportStickyNorth]}}class lf{constructor(t){this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=t,this._referenceCoordinates=null}begin(t,e,n){const o=new pa(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(df(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new pa(t),o=e.split("-"),i={x:"right"==o[1]?n.right:n.left,y:"bottom"==o[0]?n.bottom:n.top};return i.x+=t.ownerDocument.defaultView.scrollX,i.y+=t.ownerDocument.defaultView.scrollY,i}(e,function(t){const e=t.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[e[0]]}-${n[e[1]]}`}(this.activeHandlePosition)),this.originalWidth=o.width,this.originalHeight=o.height,this.aspectRatio=o.width/o.height;const i=n.style.width;i&&i.match(/^\d+(\.\d*)?%$/)?this.originalWidthPercents=parseFloat(i):this.originalWidthPercents=function(t,e){const n=t.parentElement,o=parseFloat(n.ownerDocument.defaultView.getComputedStyle(n).width);return e.width/o*100}(n,o)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}function df(t){return`ck-widget__resizer__handle-${t}`}he(lf,re);class hf extends Fd{constructor(){super();const t=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",t.to("_viewPosition",(t=>t?`ck-orientation-${t}`:""))],style:{display:t.if("_isVisible","none",(t=>!t))}},children:[{text:t.to("_label")}]})}_bindToState(t,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",((t,e)=>null!==t&&null!==e)),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",((e,n,o)=>"px"===t.unit?`${e}×${n}`:`${o}%`)),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",((t,e,n)=>e<50||n<50?"above-center":t))}_dismiss(){this.unbind(),this._isVisible=!1}}class uf{constructor(t){this._options=t,this._viewResizerWrapper=null,this.set("isEnabled",!0),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(t=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),t.stop())}),{priority:"high"}),this.on("change:isEnabled",(()=>{this.isEnabled&&this.redraw()}))}attach(){const t=this,e=this._options.viewElement;this._options.editor.editing.view.change((n=>{const o=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(e){const n=this.toDomElement(e);return t._appendHandles(n),t._appendSizeUI(n),t.on("change:isEnabled",((t,e,o)=>{n.style.display=o?"":"none"})),n.style.display=t.isEnabled?"":"none",n}));n.insert(n.createPositionAt(e,"end"),o),n.addClass("ck-widget_with-resizer",e),this._viewResizerWrapper=o}))}begin(t){this.state=new lf(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(t,this._getHandleHost(),this._getResizeHost())}updateSize(t){const e=this._proposeNewSize(t);this._options.editor.editing.view.change((t=>{const n=this._options.unit||"%",o=("%"===n?e.widthPercents:e.width)+n;t.setStyle("width",o,this._options.viewElement)}));const n=this._getHandleHost(),o=new pa(n);e.handleHostWidth=Math.round(o.width),e.handleHostHeight=Math.round(o.height);const i=new pa(n);e.width=Math.round(i.width),e.height=Math.round(i.height),this.redraw(o),this.state.update(e)}commit(){const t=this._options.unit||"%",e=("%"===t?this.state.proposedWidthPercents:this.state.proposedWidth)+t;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(e)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(t){const e=this._domResizerWrapper;if(!((n=e)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const o=e.parentElement,i=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(o.isSameNode(i)){const e=t||new pa(i);a=[e.width+"px",e.height+"px",void 0,void 0]}else a=[i.offsetWidth+"px",i.offsetHeight+"px",i.offsetLeft+"px",i.offsetTop+"px"];"same"!==Oo(s,a)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)}))}containsHandle(t){return this._domResizerWrapper.contains(t)}static isResizeHandle(t){return t.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change((t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(t){const e=this.state,n={x:(o=t).pageX,y:o.pageY};var o;const i=!this._options.isCentered||this._options.isCentered(this),r={x:e._referenceCoordinates.x-(n.x+e.originalWidth),y:n.y-e.originalHeight-e._referenceCoordinates.y};i&&e.activeHandlePosition.endsWith("-right")&&(r.x=n.x-(e._referenceCoordinates.x+e.originalWidth)),i&&(r.x*=2);const s={width:Math.abs(e.originalWidth+r.x),height:Math.abs(e.originalHeight+r.y)};s.dominant=s.width/e.aspectRatio>s.height?"width":"height",s.max=s[s.dominant];const a={width:s.width,height:s.height};return"width"==s.dominant?a.height=a.width/e.aspectRatio:a.width=a.height*e.aspectRatio,{width:Math.round(a.width),height:Math.round(a.height),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*a.width*100)/100,100)}}_getResizeHost(){const t=this._domResizerWrapper.parentElement;return this._options.getResizeHost(t)}_getHandleHost(){const t=this._domResizerWrapper.parentElement;return this._options.getHandleHost(t)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const o of e)t.appendChild(new Vd({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=o,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new hf,this._sizeView.render(),t.appendChild(this._sizeView.element)}}he(uf,re);var gf=n(8506),mf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(gf.Z,mf);gf.Z.locals;he(class extends ue{static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,e=is.window.document;this.set("visibleResizer",null),this.set("_activeResizer",null),this._resizers=new Map,t.view.addObserver(lg),this._observer=Object.create(ws),this.listenTo(t.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(e,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(e,"mouseup",this._mouseUpListener.bind(this));const n=()=>{this.visibleResizer&&this.visibleResizer.redraw()};this._redrawFocusedResizerThrottled=hm(n,200),this.on("change:visibleResizer",n),this.editor.ui.on("update",this._redrawFocusedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[t,e]of this._resizers)t.isAttached()||(this._resizers.delete(t),e.destroy())}),{priority:"lowest"}),this._observer.listenTo(is.window,"resize",this._redrawFocusedResizerThrottled);const o=this.editor.editing.view.document.selection;o.on("change",(()=>{const t=o.getSelectedElement();this.visibleResizer=this.getResizerByViewElement(t)||null}))}destroy(){this._observer.stopListening();for(const t of this._resizers.values())t.destroy();this._redrawFocusedResizerThrottled.cancel()}attachTo(t){const e=new uf(t),n=this.editor.plugins;if(e.attach(),n.has("WidgetToolbarRepository")){const t=n.get("WidgetToolbarRepository");e.on("begin",(()=>{t.forceDisabled("resize")}),{priority:"lowest"}),e.on("cancel",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"}),e.on("commit",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(t.viewElement,e);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==e&&(this.visibleResizer=e),e}getResizerByViewElement(t){return this._resizers.get(t)}_getResizerByHandle(t){for(const e of this._resizers.values())if(e.containsHandle(t))return e}_mouseDownListener(t,e){const n=e.domTarget;uf.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n),this._activeResizer&&(this._activeResizer.begin(n),t.stop(),e.preventDefault()))}_mouseMoveListener(t,e){this._activeResizer&&this._activeResizer.updateSize(e)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}},re);class pf extends me{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(t){const e=this.editor,n=e.plugins.get("ImageUtils"),o=e.model,i=n.getClosestSelectedImageElement(o.document.selection);o.change((e=>{e.setAttribute("alt",t.newValue,i)}))}}function ff(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot()])}function kf(t,e){const n=t.plugins.get("ImageUtils"),o=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>{if(!n.isInlineImageView(t))return null;if(!o)return i(t);return(t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:i(t)};function i(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function bf(t,e){const n=Na(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}class wf extends ue{static get pluginName(){return"ImageUtils"}isImage(t){return this.isInlineImage(t)||this.isBlockImage(t)}isInlineImageView(t){return!!t&&t.is("element","img")}isBlockImageView(t){return!!t&&t.is("element","figure")&&t.hasClass("image")}insertImage(t={},e=null,n=null){const o=this.editor,i=o.model,r=i.document.selection;n=_f(o,e||r,n),t={...Object.fromEntries(r.getAttributes()),...t};for(const e in t)i.schema.checkAttribute(n,e)||delete t[e];return i.change((o=>{const r=o.createElement(n,t);return i.insertObject(r,e,null,{setSelection:"on",findOptimalPosition:!e&&"imageInline"!=n}),r.parent?r:null}))}getClosestSelectedImageWidget(t){const e=t.getSelectedElement();if(e&&this.isImageWidget(e))return e;let n=t.getFirstPosition().parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent}return null}getClosestSelectedImageElement(t){const e=t.getSelectedElement();return this.isImage(e)?e:t.getFirstPosition().findAncestor("imageBlock")}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){if("imageBlock"==_f(t,e)){const n=function(t,e){const n=Gg(t,e).start.parent;if(n.isEmpty&&!n.is("element","$root"))return n.parent;return n}(e,t.model);if(t.model.schema.checkChild(n,"imageBlock"))return!0}else if(t.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}(this.editor,t)&&function(t){return[...t.focus.getAncestors()].every((t=>!t.is("element","imageBlock")))}(t)}toImageWidget(t,e,n){e.setCustomProperty("image",!0,t);return jg(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&Rg(t)}isBlockImage(t){return!!t&&t.is("element","imageBlock")}isInlineImage(t){return!!t&&t.is("element","imageInline")}findViewImgElement(t){if(this.isInlineImageView(t))return t;const e=this.editor.editing.view;for(const{item:n}of e.createRangeIn(t))if(this.isInlineImageView(n))return n}}function _f(t,e,n){const o=t.model.schema,i=t.config.get("image.insert.type");return t.plugins.has("ImageBlockEditing")?t.plugins.has("ImageInlineEditing")?n||("inline"===i?"imageInline":"block"===i?"imageBlock":e.is("selection")?bf(o,e):o.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class Af extends ue{static get requires(){return[wf]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new pf(this.editor))}}var Cf=n(1905),vf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Cf.Z,vf);Cf.Z.locals;var yf=n(6764),xf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(yf.Z,xf);yf.Z.locals;class Df extends Fd{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new Ba,this.keystrokes=new za,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),Bd.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),Bd.cancel,"ck-button-cancel","cancel"),this._focusables=new Od,this._focusCycler=new Lh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]}),Pd(this)}render(){super.render(),this.keystrokes.listenTo(this.element),Ld({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,o){const i=new kh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createLabeledInputView(){const t=this.locale.t,e=new Au(this.locale,Cu);return e.label=t("Text alternative"),e}}function Ef(t){const e=t.editing.view,n=Iu.defaultPositions,o=t.plugins.get("ImageUtils");return{target:e.domConverter.viewToDom(o.getClosestSelectedImageWidget(e.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class Mf extends ue{static get requires(){return[Lu]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",(n=>{const o=t.commands.get("imageTextAlternative"),i=new kh(n);return i.set({label:e("Change image text alternative"),icon:Bd.lowVision,tooltip:!0}),i.bind("isEnabled").to(o,"isEnabled"),this.listenTo(i,"execute",(()=>{this._showForm()})),i}))}_createForm(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Df(t.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{t.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),this.listenTo(t.ui,"update",(()=>{n.getClosestSelectedImageWidget(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=Ef(t);e.updatePosition(n)}}(t):this._hideForm(!0)})),zd({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:Ef(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class If extends ue{static get requires(){return[Af,Mf]}static get pluginName(){return"ImageTextAlternative"}}function Sf(t,e){return t=>{t.on(`attribute:srcset:${e}`,n)};function n(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);if(null===n.attributeNewValue){const t=n.attributeOldValue;t.data&&(i.removeAttribute("srcset",s),i.removeAttribute("sizes",s),t.width&&i.removeAttribute("width",s))}else{const t=n.attributeNewValue;t.data&&(i.setAttribute("srcset",t.data,s),i.setAttribute("sizes","100vw",s),t.width&&i.setAttribute("width",t.width,s))}}}function Tf(t,e,n){return t=>{t.on(`attribute:${n}:${e}`,o)};function o(e,n,o){if(!o.consumable.consume(n.item,e.name))return;const i=o.writer,r=o.mapper.toViewElement(n.item),s=t.findViewImgElement(r);i.setAttribute(n.attributeKey,n.attributeNewValue||"",s)}}class Nf extends Cs{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}class Bf extends me{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&l("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&l("image-inline-plugin-required")}refresh(){this.isEnabled=this.editor.plugins.get("ImageUtils").isImageAllowed()}execute(t){const e=So(t.source),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if("string"==typeof t&&(t={src:t}),e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);o.insertImage({...t,...i},e)}else o.insertImage({...t,...i})}))}}class zf extends ue{static get requires(){return[wf]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(Nf),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:t=>{const e={data:t.getAttribute("srcset")};return t.hasAttribute("width")&&(e.width=t.getAttribute("width")),e}}});const n=new Bf(t);t.commands.add("insertImage",n),t.commands.add("imageInsert",n)}}class Pf extends me{constructor(t,e){super(t),this._modelElementName=e}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=t.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=t.isInlineImage(e):this.isEnabled=t.isBlockImage(e)}execute(){const t=this.editor,e=this.editor.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(e.document.selection),i=Object.fromEntries(o.getAttributes());return i.src||i.uploadId?e.change((t=>{const r=Array.from(e.markers).filter((t=>t.getRange().containsItem(o))),s=n.insertImage(i,e.createSelection(o,"on"),this._modelElementName);if(!s)return null;const a=t.createRangeOn(s);for(const e of r){const n=e.getRange(),o="$graveyard"!=n.root.rootName?n.getJoined(a,!0):a;t.updateMarker(e,{range:o})}return{oldElement:o,newElement:s}})):null}}class Lf extends ue{static get requires(){return[zf,wf,wg]}static get pluginName(){return"ImageBlockEditing"}init(){const t=this.editor;t.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),t.plugins.has("ImageInlineEditing")&&(t.commands.add("imageTypeBlock",new Pf(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:e})=>ff(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>o.toImageWidget(ff(n),n,e("image widget"))}),n.for("downcast").add(Tf(o,"imageBlock","src")).add(Tf(o,"imageBlock","alt")).add(Sf(o,"imageBlock")),n.for("upcast").elementToElement({view:kf(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)}).add(function(t){return t=>{t.on("element:figure",e)};function e(e,n,o){if(!o.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const i=t.findViewImgElement(n.viewItem);if(!i||!o.consumable.test(i,{name:!0}))return;o.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=Na(o.convertItem(i,n.modelCursor).modelRange.getItems());r?(o.convertChildren(n.viewItem,r),o.updateConversionResult(r,n)):o.consumable.revert(n.viewItem,{name:!0,classes:"image"})}}(o))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isInlineImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageBlock"===bf(e.schema,c)){const t=new dg(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}}))}}var Of=n(3508),Rf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Of.Z,Rf);Of.Z.locals;class jf extends ue{static get requires(){return[Lf,lm,If]}static get pluginName(){return"ImageBlock"}}class Ff extends ue{static get requires(){return[zf,wf,wg]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor,e=t.model.schema;e.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),e.addChildCheck(((t,e)=>{if(t.endsWith("caption")&&"imageInline"===e.name)return!1})),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new Pf(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,o=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(t,{writer:e})=>e.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(t,{writer:n})=>o.toImageWidget(function(t){return t.createContainerElement("span",{class:"image-inline"},t.createEmptyElement("img"))}(n),n,e("image widget"))}),n.for("downcast").add(Tf(o,"imageInline","src")).add(Tf(o,"imageInline","alt")).add(Sf(o,"imageInline")),n.for("upcast").elementToElement({view:kf(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,o=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((i,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isBlockImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageInline"===bf(e.schema,c)){const t=new dg(n.document),e=s.map((e=>1===e.childCount?(Array.from(e.getAttributes()).forEach((n=>t.setAttribute(...n,o.findViewImgElement(e)))),e.getChild(0)):e));r.content=t.createDocumentFragment(e)}}))}}class Vf extends ue{static get requires(){return[Ff,lm,If]}static get pluginName(){return"ImageInline"}}class Hf extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils");if(!t.plugins.has(Lf))return this.isEnabled=!1,void(this.value=!1);const n=t.model.document.selection,o=n.getSelectedElement();if(!o){const t=e.getCaptionFromModelSelection(n);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=this.editor.plugins.get("ImageUtils").isImage(o),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(o):this.value=!1}execute(t={}){const{focusCaptionOnShow:e}=t;this.editor.model.change((t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)}))}_showImageCaption(t,e){const n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing");let i=n.getSelectedElement();const r=o._getSavedCaption(i);this.editor.plugins.get("ImageUtils").isInlineImage(i)&&(this.editor.execute("imageTypeBlock"),i=n.getSelectedElement());const s=r||t.createElement("caption");t.append(s,i),e&&t.setSelection(s,"in")}_hideImageCaption(t){const e=this.editor,n=e.model.document.selection,o=e.plugins.get("ImageCaptionEditing"),i=e.plugins.get("ImageCaptionUtils");let r,s=n.getSelectedElement();s?r=i.getCaptionFromImageModelElement(s):(r=i.getCaptionFromModelSelection(n),s=r.parent),o._saveCaption(s,r),t.setSelection(s,"on"),t.remove(r)}}class Uf extends ue{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[wf]}getCaptionFromImageModelElement(t){for(const e of t.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(t){const e=this.editor.plugins.get("ImageUtils"),n=t.getFirstPosition().findAncestor("caption");return n&&e.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(t){const e=this.editor.plugins.get("ImageUtils");return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}}class qf extends ue{static get requires(){return[wf,Uf]}static get pluginName(){return"ImageCaptionEditing"}constructor(t){super(t),this._savedCaptionsMap=new WeakMap}init(){const t=this.editor,e=t.model.schema;e.isRegistered("caption")?e.extend("caption",{allowIn:"imageBlock"}):e.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleImageCaption",new Hf(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration()}_setupConversion(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils"),o=t.plugins.get("ImageCaptionUtils"),i=t.t;t.conversion.for("upcast").elementToElement({view:t=>o.matchImageCaptionViewElement(t),model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>n.isBlockImage(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:o})=>{if(!n.isBlockImage(t.parent))return null;const r=o.createEditableElement("figcaption");return o.setCustomProperty("imageCaption",!0,r),Wu({view:e,element:r,text:i("Enter image caption"),keepOnFocus:!0}),qg(r,o)}})}_setupImageTypeCommandsIntegration(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.plugins.get("ImageCaptionUtils"),o=t.commands.get("imageTypeInline"),i=t.commands.get("imageTypeBlock"),r=t=>{if(!t.return)return;const{oldElement:o,newElement:i}=t.return;if(!o)return;if(e.isBlockImage(o)){const t=n.getCaptionFromImageModelElement(o);if(t)return void this._saveCaption(i,t)}const r=this._getSavedCaption(o);r&&this._saveCaption(i,r)};o&&this.listenTo(o,"execute",r,{priority:"low"}),i&&this.listenTo(i,"execute",r,{priority:"low"})}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?Ha.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}}class Gf extends ue{static get requires(){return[Uf]}static get pluginName(){return"ImageCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageCaptionUtils"),o=t.t;t.ui.componentFactory.add("toggleImageCaption",(i=>{const r=t.commands.get("toggleImageCaption"),s=new kh(i);return s.set({icon:Bd.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(t=>o(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{t.execute("toggleImageCaption",{focusCaptionOnShow:!0});const o=n.getCaptionFromModelSelection(t.model.document.selection);if(o){const n=t.editing.mapper.toViewElement(o);e.scrollToTheSelection(),e.change((t=>{t.addClass("image__caption_highlighted",n)}))}})),s}))}}var Wf=n(2640),Yf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Wf.Z,Yf);Wf.Z.locals;class Kf extends me{constructor(t,e){super(t),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(e.map((t=>{if(t.isDefault)for(const e of t.modelElements)this._defaultStyles[e]=t.name;return[t.name,t]})))}refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?t.hasAttribute("imageStyle")?this.value=t.getAttribute("imageStyle"):this.value=this._defaultStyles[t.name]:this.value=!1}execute(t={}){const e=this.editor,n=e.model,o=e.plugins.get("ImageUtils");n.change((e=>{const i=t.value;let r=o.getClosestSelectedImageElement(n.document.selection);i&&this.shouldConvertImageType(i,r)&&(this.editor.execute(o.isBlockImage(r)?"imageTypeInline":"imageTypeBlock"),r=o.getClosestSelectedImageElement(n.document.selection)),!i||this._styles.get(i).isDefault?e.removeAttribute("imageStyle",r):e.setAttribute("imageStyle",i,r)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}const{objectFullWidth:Qf,objectInline:$f,objectLeft:Zf,objectRight:Jf,objectCenter:Xf,objectBlockLeft:tk,objectBlockRight:ek}=Bd,nk={get inline(){return{name:"inline",title:"In line",icon:$f,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Zf,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:tk,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Xf,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Jf,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:ek,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Xf,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Jf,modelElements:["imageBlock"],className:"image-style-side"}}},ok={full:Qf,left:tk,right:ek,center:Xf,inlineLeft:Zf,inlineRight:Jf,inline:$f},ik=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function rk(t){l("image-style-configuration-definition-invalid",t)}const sk={normalizeStyles:function(t){return(t.configuredStyles.options||[]).map((t=>function(t){t="string"==typeof t?nk[t]?{...nk[t]}:{name:t}:function(t,e){const n={...e};for(const o in t)Object.prototype.hasOwnProperty.call(e,o)||(n[o]=t[o]);return n}(nk[t.name],t);"string"==typeof t.icon&&(t.icon=ok[t.icon]||t.icon);return t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:o,name:i}=t;if(!(o&&o.length&&i))return rk({style:t}),!1;{const i=[e?"imageBlock":null,n?"imageInline":null];if(!o.some((t=>i.includes(t))))return l("image-style-missing-dependency",{style:t,missingPlugins:o.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)))},getDefaultStylesConfiguration:function(t,e){return t&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:t?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(t){return t.has("ImageBlockEditing")&&t.has("ImageInlineEditing")?[...ik]:[]},warnInvalidStyle:rk,DEFAULT_OPTIONS:nk,DEFAULT_ICONS:ok,DEFAULT_DROPDOWN_DEFINITIONS:ik};function ak(t,e){for(const n of e)if(n.name===t)return n}class ck extends ue{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[wf]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=sk,n=this.editor,o=n.plugins.has("ImageBlockEditing"),i=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",e(o,i)),this.normalizedStyles=t({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:o,isInlinePluginLoaded:i}),this._setupConversion(o,i),this._setupPostFixer(),n.commands.add("imageStyle",new Kf(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,o=n.model.schema,i=(r=this.normalizedStyles,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const o=ak(e.attributeNewValue,r),i=ak(e.attributeOldValue,r),s=n.mapper.toViewElement(e.item),a=n.writer;i&&a.removeClass(i.className,s),o&&a.addClass(o.className,s)});var r;const s=function(t){const e={imageInline:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageInline"))),imageBlock:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageBlock")))};return(t,n,o)=>{if(!n.modelRange)return;const i=n.viewItem,r=Na(n.modelRange.getItems());if(r&&o.schema.checkAttribute(r,"imageStyle"))for(const t of e[r.name])o.consumable.consume(i,{classes:t.className})&&o.writer.setAttribute("imageStyle",t.name,r)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",i),n.data.downcastDispatcher.on("attribute:imageStyle",i),t&&(o.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),e&&(o.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(wf),o=new Map(this.normalizedStyles.map((t=>[t.name,t])));e.registerPostFixer((t=>{let i=!1;for(const r of e.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let e="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(e&&e.is("element","paragraph")&&e.childCount>0&&(e=e.getChild(0)),!n.isImage(e))continue;const s=e.getAttribute("imageStyle");if(!s)continue;const a=o.get(s);a&&a.modelElements.includes(e.name)||(t.removeAttribute("imageStyle",e),i=!0)}return i}))}}var lk=n(5083),dk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(lk.Z,dk);lk.Z.locals;class hk extends ue{static get requires(){return[ck]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Wrap text":t("Wrap text"),"Break text":t("Break text"),"In line":t("In line"),"Full size image":t("Full size image"),"Side image":t("Side image"),"Left aligned image":t("Left aligned image"),"Centered image":t("Centered image"),"Right aligned image":t("Right aligned image")}}init(){const t=this.editor.plugins,e=this.editor.config.get("image.toolbar")||[],n=uk(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const o=uk([...e.filter(x),...sk.getDefaultDropdownDefinitions(t)],this.localizedDefaultStylesTitles);for(const t of o)this._createDropdown(t,n)}_createDropdown(t,e){const n=this.editor.ui.componentFactory;n.add(t.name,(o=>{let i;const{defaultItem:r,items:s,title:a}=t,c=s.filter((t=>e.find((({name:e})=>gk(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(i=e),e}));s.length!==c.length&&sk.warnInvalidStyle({dropdown:t});const l=nu(o,Eh),d=l.buttonView;return ou(l,c),d.set({label:mk(a,i.label),class:null,tooltip:!0}),d.bind("icon").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return e<0?i.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(st);return mk(a,e<0?i.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(st))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(st)?"ck-splitbutton_flatten":null)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:i.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(st))),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(gk(e),(n=>{const o=this.editor.commands.get("imageStyle"),i=new kh(n);return i.set({label:t.title,icon:t.icon,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(o,"isEnabled"),i.bind("isOn").to(o,"value",(t=>t===e)),i.on("execute",this._executeCommand.bind(this,e)),i}))}_executeCommand(t){this.editor.execute("imageStyle",{value:t}),this.editor.editing.view.focus()}}function uk(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function gk(t){return`imageStyle:${t}`}function mk(t,e){return(t?t+": ":"")+e}function pk(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function fk(t){return new Promise(((e,n)=>{const o=t.getAttribute("src");fetch(o).then((t=>t.blob())).then((t=>{const n=kk(t,o),i=n.replace("image/",""),r=new File([t],`image.${i}`,{type:n});e(r)})).catch((t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise(((e,n)=>{const o=is.document.createElement("img");o.addEventListener("load",(()=>{const t=is.document.createElement("canvas");t.width=o.width,t.height=o.height;t.getContext("2d").drawImage(o,0,0),t.toBlob((t=>t?e(t):n()))})),o.addEventListener("error",(()=>n())),o.src=t}))}(t).then((e=>{const n=kk(e,t),o=n.replace("image/","");return new File([e],`image.${o}`,{type:n})}))}(o).then(e).catch(n):n(t)))}))}function kk(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class bk extends ue{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor,e=t.t,n=n=>{const o=new pp(n),i=t.commands.get("uploadImage"),r=t.config.get("image.upload.types"),s=pk(r);return o.set({acceptedType:r.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0}),o.buttonView.set({label:e("Insert image"),icon:Bd.image,tooltip:!0}),o.buttonView.bind("isEnabled").to(i),o.on("done",((e,n)=>{const o=Array.from(n).filter((t=>s.test(t.type)));o.length&&t.execute("uploadImage",{file:o})})),o};t.ui.componentFactory.add("uploadImage",n),t.ui.componentFactory.add("imageUpload",n)}}var wk=n(3689),_k={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(wk.Z,_k);wk.Z.locals;var Ak=n(4036),Ck={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Ak.Z,Ck);Ak.Z.locals;var vk=n(3773),yk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(vk.Z,yk);vk.Z.locals;class xk extends ue{static get pluginName(){return"ImageUploadProgress"}constructor(t){super(t),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",((...t)=>this.uploadStatusChange(...t))),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",((...t)=>this.uploadStatusChange(...t)))}uploadStatusChange(t,e,n){const o=this.editor,i=e.item,r=i.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=o.plugins.get("ImageUtils"),a=o.plugins.get(gp),c=r?e.attributeNewValue:null,l=this.placeholder,d=o.editing.mapper.toViewElement(i),h=n.writer;if("reading"==c)return Dk(d,h),void Ek(s,l,d,h);if("uploading"==c){const t=a.loaders.get(r);return Dk(d,h),void(t?(Mk(d,h),function(t,e,n,o){const i=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),i),n.on("change:uploadedPercent",((t,e,n)=>{o.change((t=>{t.setStyle("width",n+"%",i)}))}))}(d,h,t,o.editing.view),function(t,e,n,o){if(o.data){const i=t.findViewImgElement(e);n.setAttribute("src",o.data,i)}}(s,d,h,t)):Ek(s,l,d,h))}"complete"==c&&a.loaders.get(r)&&function(t,e,n){const o=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),o),setTimeout((()=>{n.change((t=>t.remove(t.createRangeOn(o))))}),3e3)}(d,h,o.editing.view),function(t,e){Sk(t,e,"progressBar")}(d,h),Mk(d,h),function(t,e){e.removeClass("ck-appear",t)}(d,h)}}function Dk(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function Ek(t,e,n,o){n.hasClass("ck-image-upload-placeholder")||o.addClass("ck-image-upload-placeholder",n);const i=t.findViewImgElement(n);i.getAttribute("src")!==e&&o.setAttribute("src",e,i),Ik(n,"placeholder")||o.insert(o.createPositionAfter(i),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(o))}function Mk(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),Sk(t,e,"placeholder")}function Ik(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function Sk(t,e,n){const o=Ik(t,n);o&&e.remove(e.createRangeOn(o))}class Tk extends me{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(n)}execute(t){const e=So(t.file),n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),i=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if(e&&r&&o.isImage(r)){const e=this.editor.model.createPositionAfter(r);this._uploadImage(t,i,e)}else this._uploadImage(t,i)}))}_uploadImage(t,e,n){const o=this.editor,i=o.plugins.get(gp).createLoader(t),r=o.plugins.get("ImageUtils");i&&r.insertImage({...e,uploadId:i.id},n)}}class Nk extends ue{static get requires(){return[gp,vu,wg,wf]}static get pluginName(){return"ImageUploadEditing"}constructor(t){super(t),t.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const t=this.editor,e=t.model.document,n=t.conversion,o=t.plugins.get(gp),i=t.plugins.get("ImageUtils"),r=pk(t.config.get("image.upload.types")),s=new Tk(t);t.commands.add("uploadImage",s),t.commands.add("imageUpload",s),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,n)=>{if(o=n.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const i=Array.from(n.dataTransfer.files).filter((t=>!!t&&r.test(t.type)));i.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.model.enqueueChange((()=>{t.execute("uploadImage",{file:i})}))})))})),this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).filter((t=>function(t,e){return!(!t.isInlineImageView(e)||!e.getAttribute("src"))&&(e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||e.getAttribute("src").match(/^blob:/g))}(i,t.item)&&!t.item.getAttribute("uploadProcessed"))).map((t=>({promise:fk(t.item),imageElement:t.item})));if(!r.length)return;const s=new dg(t.editing.view.document);for(const t of r){s.setAttribute("uploadProcessed",!0,t.imageElement);const e=o.createLoader(t.promise);e&&(s.setAttribute("src","",t.imageElement),s.setAttribute("uploadId",e.id,t.imageElement))}})),t.editing.view.document.on("dragover",((t,e)=>{e.preventDefault()})),e.on("change",(()=>{const n=e.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),i=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter,r="$graveyard"==e.position.root.rootName;for(const e of Bk(t,n)){const t=e.getAttribute("uploadId");if(!t)continue;const n=o.loaders.get(t);n&&(r?i.has(t)||n.abort():(i.add(t),this._uploadImageElements.set(t,e),"idle"==n.status&&this._readAndUpload(n)))}}})),this.on("uploadComplete",((t,{imageElement:e,data:n})=>{const o=n.urls?n.urls:n;this.editor.model.change((t=>{t.setAttribute("src",o.default,e),this._parseAndSetSrcsetAttributeOnImage(o,e,t)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(t){const e=this.editor,n=e.model,o=e.locale.t,i=e.plugins.get(gp),r=e.plugins.get(vu),s=e.plugins.get("ImageUtils"),a=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","reading",a.get(t.id))})),t.read().then((()=>{const o=t.upload(),i=a.get(t.id);if(sr.isSafari){const t=e.editing.mapper.toViewElement(i),n=s.findViewImgElement(t);e.editing.view.once("render",(()=>{if(!n.parent)return;const t=e.editing.view.domConverter.mapViewToDom(n.parent);if(!t)return;const o=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=o}))}return n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",i)})),o})).then((e=>{n.enqueueChange({isUndoable:!1},(n=>{const o=a.get(t.id);n.setAttribute("uploadStatus","complete",o),this.fire("uploadComplete",{data:e,imageElement:o})})),c()})).catch((e=>{if("error"!==t.status&&"aborted"!==t.status)throw e;"error"==t.status&&e&&r.showWarning(e,{title:o("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{e.remove(a.get(t.id))})),c()}));function c(){n.enqueueChange({isUndoable:!1},(e=>{const n=a.get(t.id);e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n),a.delete(t.id)})),i.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let o=0;const i=Object.keys(t).filter((t=>{const e=parseInt(t,10);if(!isNaN(e))return o=Math.max(o,e),!0})).map((e=>`${t[e]} ${e}w`)).join(", ");""!=i&&n.setAttribute("srcset",{data:i,width:o},e)}}function Bk(t,e){const n=t.plugins.get("ImageUtils");return Array.from(t.model.createRangeOn(e)).filter((t=>n.isImage(t.item))).map((t=>t.item))}class zk extends ue{static get pluginName(){return"IndentEditing"}init(){const t=this.editor;t.commands.add("indent",new fe(t)),t.commands.add("outdent",new fe(t))}}const Pk='',Lk='';class Ok extends ue{static get pluginName(){return"IndentUI"}init(){const t=this.editor,e=t.locale,n=t.t,o="ltr"==e.uiLanguageDirection?Pk:Lk,i="ltr"==e.uiLanguageDirection?Lk:Pk;this._defineButton("indent",n("Increase indent"),o),this._defineButton("outdent",n("Decrease indent"),i)}_defineButton(t,e,n){const o=this.editor;o.ui.componentFactory.add(t,(i=>{const r=o.commands.get(t),s=new kh(i);return s.set({label:e,icon:n,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",(()=>{o.execute(t),o.editing.view.focus()})),s}))}}class Rk{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(t){Array.isArray(t)?t.forEach((t=>this._definitions.add(t))):this._definitions.add(t)}getDispatcher(){return t=>{t.on("attribute:linkHref",((t,e,n)=>{if(!n.consumable.test(e.item,"attribute:linkHref"))return;if(!e.item.is("selection")&&!n.schema.isInline(e.item))return;const o=n.writer,i=o.document.selection;for(const t of this._definitions){const r=o.createAttributeElement("a",t.attributes,{priority:5});t.classes&&o.addClass(t.classes,r);for(const e in t.styles)o.setStyle(e,t.styles[e],r);o.setCustomProperty("link",!0,r),t.callback(e.attributeNewValue)?e.item.is("selection")?o.wrap(i.getFirstRange(),r):o.wrap(n.mapper.toViewRange(e.range),r):o.unwrap(n.mapper.toViewRange(e.range),r)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return t=>{t.on("attribute:linkHref:imageBlock",((t,e,{writer:n,mapper:o})=>{const i=o.toViewElement(e.item),r=Array.from(i.getChildren()).find((t=>"a"===t.name));for(const t of this._definitions){const o=Ho(t.attributes);if(t.callback(e.attributeNewValue)){for(const[t,e]of o)"class"===t?n.addClass(e,r):n.setAttribute(t,e,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r)}else{for(const[t,e]of o)"class"===t?n.removeClass(e,r):n.removeAttribute(t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r)}}}))}}}const jk=function(t,e,n){var o=t.length;return n=void 0===n?o:n,!e&&n>=o?t:hi(t,e,n)};var Fk=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const Vk=function(t){return Fk.test(t)};const Hk=function(t){return t.split("")};var Uk="[\\ud800-\\udfff]",qk="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Gk="\\ud83c[\\udffb-\\udfff]",Wk="[^\\ud800-\\udfff]",Yk="(?:\\ud83c[\\udde6-\\uddff]){2}",Kk="[\\ud800-\\udbff][\\udc00-\\udfff]",Qk="(?:"+qk+"|"+Gk+")"+"?",$k="[\\ufe0e\\ufe0f]?",Zk=$k+Qk+("(?:\\u200d(?:"+[Wk,Yk,Kk].join("|")+")"+$k+Qk+")*"),Jk="(?:"+[Wk+qk+"?",qk,Yk,Kk,Uk].join("|")+")",Xk=RegExp(Gk+"(?="+Gk+")|"+Jk+Zk,"g");const tb=function(t){return t.match(Xk)||[]};const eb=function(t){return Vk(t)?tb(t):Hk(t)};const nb=function(t){return function(e){e=si(e);var n=Vk(e)?eb(e):void 0,o=n?n[0]:e.charAt(0),i=n?jk(n,1).join(""):e.slice(1);return o[t]()+i}}("toUpperCase"),ob=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,ib=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,rb=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,sb=/^((\w+:(\/{2,})?)|(\W))/i,ab="Ctrl+K";function cb(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function lb(t){return function(t){return t.replace(ob,"").match(ib)}(t=String(t))?t:"#"}function db(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function hb(t,e){const n=(o=t,rb.test(o)?"mailto:":e);var o;const i=!!n&&!sb.test(t);return t&&i?n+t:t}function ub(t){window.open(t,"_blank","noopener")}class gb extends me{constructor(t){super(t),this.manualDecorators=new Mo,this.automaticDecorators=new Rk}restoreManualDecoratorStates(){for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement()||Na(e.getSelectedBlocks());db(n,t.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttribute(n,"linkHref")):(this.value=e.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref"));for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}execute(t,e={}){const n=this.editor.model,o=n.document.selection,i=[],r=[];for(const t in e)e[t]?i.push(t):r.push(t);n.change((e=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=tp(s,"linkHref",o.getAttribute("linkHref"),n);e.setAttribute("linkHref",t,a),i.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)})),e.setSelection(e.createPositionAfter(a.end.nodeBefore))}else if(""!==t){const r=Ho(o.getAttributes());r.set("linkHref",t),i.forEach((t=>{r.set(t,!0)}));const{end:a}=n.insertContent(e.createText(t,r),s);e.setSelection(a)}["linkHref",...i,...r].forEach((t=>{e.removeSelectionAttribute(t)}))}else{const s=n.schema.getValidRanges(o.getRanges(),"linkHref"),a=[];for(const t of o.getSelectedBlocks())n.schema.checkAttribute(t,"linkHref")&&a.push(e.createRangeOn(t));const c=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&c.push(t);for(const n of c)e.setAttribute("linkHref",t,n),i.forEach((t=>{e.setAttribute(t,!0,n)})),r.forEach((t=>{e.removeAttribute(t,n)}))}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,o=n.getSelectedElement();return db(o,e.schema)?o.getAttribute(t):n.getAttribute(t)}_isRangeToUpdate(t,e){for(const n of e)if(n.containsRange(t))return!1;return!0}}class mb extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();db(n,t.schema)?this.isEnabled=t.schema.checkAttribute(n,"linkHref"):this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref")}execute(){const t=this.editor,e=this.editor.model,n=e.document.selection,o=t.commands.get("link");e.change((t=>{const i=n.isCollapsed?[tp(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),e)]:e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of i)if(t.removeAttribute("linkHref",e),o)for(const n of o.manualDecorators)t.removeAttribute(n.id,e)}))}}class pb{constructor({id:t,label:e,attributes:n,classes:o,styles:i,defaultValue:r}){this.id=t,this.set("value"),this.defaultValue=r,this.label=e,this.attributes=n,this.classes=o,this.styles=i}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}he(pb,re);var fb=n(9773),kb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(fb.Z,kb);fb.Z.locals;const bb="automatic",wb=/^(https?:)?\/\//;class _b extends ue{static get pluginName(){return"LinkEditing"}static get requires(){return[jm,Pm,wg]}constructor(t){super(t),t.config.define("link",{addTargetToExternalLinks:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:cb}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,e)=>cb(lb(t),e)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new gb(t)),t.commands.add("unlink",new mb(t));const e=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>(t.label&&n[t.label]&&(t.label=n[t.label]),t))),e}(t.t,function(t){const e=[];if(t)for(const[n,o]of Object.entries(t)){const t=Object.assign({},o,{id:`link${nb(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(e.filter((t=>t.mode===bb))),this._enableManualDecorators(e.filter((t=>"manual"===t.mode)));t.plugins.get(jm).registerAttribute("linkHref"),function(t,e,n,o){const i=t.editing.view,r=new Set;i.document.registerPostFixer((i=>{const s=t.model.document.selection;let a=!1;if(s.hasAttribute(e)){const c=tp(s.getFirstPosition(),e,s.getAttribute(e),t.model),l=t.editing.mapper.toViewRange(c);for(const t of l.getItems())t.is("element",n)&&!t.hasClass(o)&&(i.addClass(o,t),r.add(t),a=!0)}return a})),t.conversion.for("editingDowncast").add((t=>{function e(){i.change((t=>{for(const e of r.values())t.removeClass(o,e),r.delete(e)}))}t.on("insert",e,{priority:"highest"}),t.on("remove",e,{priority:"highest"}),t.on("attribute",e,{priority:"highest"}),t.on("selection",e,{priority:"highest"})}))}(t,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:bb,callback:t=>wb.test(t),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(t),n.length&&e.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(t){if(!t.length)return;const e=this.editor,n=e.commands.get("link").manualDecorators;t.forEach((t=>{e.model.schema.extend("$text",{allowAttributes:t.id}),t=new pb(t),n.add(t),e.conversion.for("downcast").attributeToElement({model:t.id,view:(e,{writer:n,schema:o},{item:i})=>{if(o.isInline(i)&&e){const e=n.createAttributeElement("a",t.attributes,{priority:5});t.classes&&n.addClass(t.classes,e);for(const o in t.styles)n.setStyle(o,t.styles[o],e);return n.setCustomProperty("link",!0,e),e}}}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",...t._createPattern()},model:{key:t.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document,n=t.model.document;this.listenTo(e,"click",((t,e)=>{if(!(sr.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const o=n.getAttribute("href");o&&(t.stop(),e.preventDefault(),ub(o))}),{context:"$capture"}),this.listenTo(e,"enter",((t,e)=>{const o=n.selection,i=o.getSelectedElement(),r=i?i.getAttribute("linkHref"):o.getAttribute("linkHref");r&&e.domEvent.altKey&&(t.stop(),ub(r))}),{context:"a"})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(t,"insertContent",(()=>{const n=e.anchor.nodeBefore,o=e.anchor.nodeAfter;e.hasAttribute("linkHref")&&n&&n.hasAttribute("linkHref")&&(o&&o.hasAttribute("linkHref")||t.change((e=>{Ab(e,vb(t.schema))})))}),{priority:"low"})}_enableClickingAfterLink(){const t=this.editor,e=t.model;t.editing.view.addObserver(lg);let n=!1;this.listenTo(t.editing.view.document,"mousedown",(()=>{n=!0})),this.listenTo(t.editing.view.document,"selectionChange",(()=>{if(!n)return;n=!1;const t=e.document.selection;if(!t.isCollapsed)return;if(!t.hasAttribute("linkHref"))return;const o=t.getFirstPosition(),i=tp(o,"linkHref",t.getAttribute("linkHref"),e);(o.isTouching(i.start)||o.isTouching(i.end))&&e.change((t=>{Ab(t,vb(e.schema))}))}))}_enableTypingOverLink(){const t=this.editor,e=t.editing.view;let n,o;this.listenTo(e.document,"delete",(()=>{o=!0}),{priority:"high"}),this.listenTo(t.model,"deleteContent",(()=>{const e=t.model.document.selection;e.isCollapsed||(o?o=!1:Cb(t)&&function(t){const e=t.document.selection,n=e.getFirstPosition(),o=e.getLastPosition(),i=n.nodeAfter;if(!i)return!1;if(!i.is("$text"))return!1;if(!i.hasAttribute("linkHref"))return!1;const r=o.textNode||o.nodeBefore;if(i===r)return!0;return tp(n,"linkHref",i.getAttribute("linkHref"),t).containsRange(t.createRange(n,o),!0)}(t.model)&&(n=e.getAttributes()))}),{priority:"high"}),this.listenTo(t.model,"insertContent",((e,[i])=>{o=!1,Cb(t)&&n&&(t.model.change((t=>{for(const[e,o]of n)t.setAttribute(e,o,i)})),n=null)}),{priority:"high"})}_handleDeleteContentAfterLink(){const t=this.editor,e=t.model,n=e.document.selection,o=t.editing.view;let i=!1,r=!1;this.listenTo(o.document,"delete",((t,e)=>{r=e.domEvent.keyCode===dr.backspace}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{i=!1;const t=n.getFirstPosition(),o=n.getAttribute("linkHref");if(!o)return;const r=tp(t,"linkHref",o,e);i=r.containsPosition(t)||r.end.isEqual(t)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{r&&(r=!1,i||t.model.enqueueChange((t=>{Ab(t,vb(e.schema))})))}),{priority:"low"})}}function Ab(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}function Cb(t){return t.model.change((t=>t.batch)).isTyping}function vb(t){return t.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))}var yb=n(7754),xb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(yb.Z,xb);yb.Z.locals;class Db extends Fd{constructor(t,e){super(t);const n=t.t;this.focusTracker=new Ba,this.keystrokes=new za,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Bd.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),Bd.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusables=new Od,this._focusCycler=new Lh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children}),Pd(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),Ld({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].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()}_createUrlInput(){const t=this.locale.t,e=new Au(this.locale,Cu);return e.label=t("Link URL"),e}_createButton(t,e,n,o){const i=new kh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createManualDecoratorSwitches(t){const e=this.createCollection();for(const n of t.manualDecorators){const o=new _h(this.locale);o.set({name:n.id,label:n.label,withText:!0}),o.bind("isOn").toMany([n,t],"value",((t,e)=>void 0===e&&void 0===t?n.defaultValue:t)),o.on("execute",(()=>{n.set("value",!o.isOn)})),e.add(o)}return e}_createFormChildren(t){const e=this.createCollection();if(e.add(this.urlInputView),t.length){const t=new Fd;t.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((t=>({tag:"li",children:[t],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),e.add(t)}return e.add(this.saveButtonView),e.add(this.cancelButtonView),e}}var Eb=n(2347),Mb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Eb.Z,Mb);Eb.Z.locals;class Ib extends Fd{constructor(t){super(t);const e=t.t;this.focusTracker=new Ba,this.keystrokes=new za,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(e("Unlink"),'',"unlink"),this.editButtonView=this._createButton(e("Edit link"),Bd.pencil,"edit"),this.set("href"),this._focusables=new Od,this._focusCycler=new Lh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].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()}_createButton(t,e,n){const o=new kh(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.delegate("execute").to(this,n),o}_createPreviewButton(){const t=new kh(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("Open link in new tab")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&lb(t))),target:"_blank",rel:"noopener noreferrer"}}),t.bind("label").to(this,"href",(t=>t||n("This link has no URL"))),t.bind("isEnabled").to(this,"href",(t=>!!t)),t.template.tag="a",t.template.eventListeners={},t}}const Sb="link-ui";class Tb extends ue{static get requires(){return[Lu]}static get pluginName(){return"LinkUI"}init(){const t=this.editor;t.editing.view.addObserver(cg),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=t.plugins.get(Lu),this._createToolbarLinkButton(),this._enableUserBalloonInteractions(),t.conversion.for("editingDowncast").markerToHighlight({model:Sb,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:Sb,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const t=this.editor,e=new Ib(t.locale),n=t.commands.get("link"),o=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(o),this.listenTo(e,"edit",(()=>{this._addFormView()})),this.listenTo(e,"unlink",(()=>{t.execute("unlink"),this._hideUI()})),e.keystrokes.set("Esc",((t,e)=>{this._hideUI(),e()})),e.keystrokes.set(ab,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),o=new Db(t.locale,e);return o.urlInputView.fieldView.bind("value").to(e,"value"),o.urlInputView.bind("isReadOnly").to(e,"isEnabled",(t=>!t)),o.saveButtonView.bind("isEnabled").to(e),this.listenTo(o,"submit",(()=>{const{value:e}=o.urlInputView.fieldView.element,i=hb(e,n);t.execute("link",i,o.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(o,"cancel",(()=>{this._closeFormView()})),o.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),o}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link"),n=t.t;t.keystrokes.set(ab,((t,n)=>{n(),e.isEnabled&&this._showUI(!0)})),t.ui.componentFactory.add("link",(t=>{const o=new kh(t);return o.isEnabled=!0,o.label=n("Link"),o.icon='',o.keystroke=ab,o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(e,"isEnabled"),o.bind("isOn").to(e,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}))}_enableUserBalloonInteractions(){const t=this.editor.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),this.editor.keystrokes.set("Tab",((t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((t,e)=>{this._isUIVisible&&(this._hideUI(),e())})),zd({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=t.value||""}_closeFormView(){const t=this.editor.commands.get("link");t.restoreManualDecoratorStates(),void 0!==t.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(t=!1){this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),o=r();const i=()=>{const t=this._getSelectedLinkElement(),e=r();n&&!t||!n&&e!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=t,o=e};function r(){return e.selection.focus.getAncestors().reverse().find((t=>t.is("element")))}this.listenTo(t.ui,"update",i),this.listenTo(this._balloon,"change:visibleView",i)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const t=this.editor.editing.view,e=this.editor.model,n=t.document;let o=null;if(e.markers.has(Sb)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(Sb)),n=t.createRange(t.createPositionBefore(e[0]),t.createPositionAfter(e[e.length-1]));o=t.domConverter.viewRangeToDom(n)}else o=()=>{const e=this._getSelectedLinkElement();return e?t.domConverter.mapViewToDom(e):t.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:o}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection,n=e.getSelectedElement();if(e.isCollapsed||n&&Rg(n))return Nb(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),o=Nb(n.start),i=Nb(n.end);return o&&o==i&&t.createRangeIn(o).getTrimmed().isEqual(n)?o:null}}_showFakeVisualSelection(){const t=this.editor.model;t.change((e=>{const n=t.document.selection.getFirstRange();if(t.markers.has(Sb))e.updateMarker(Sb,{range:n});else if(n.start.isAtEnd){const o=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(Sb,{usingOperation:!1,affectsData:!1,range:e.createRange(o,n.end)})}else e.addMarker(Sb,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(Sb)&&t.change((t=>{t.removeMarker(Sb)}))}}function Nb(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))}const Bb=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})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class zb extends ue{static get requires(){return[Tg]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",(()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const t=this.editor,e=new Rm(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=Pb(t.substr(0,t.length-1));return e?{url:e}:void 0}));e.on("matched:data",((e,n)=>{const{batch:o,range:i,url:r}=n;if(!o.isTyping)return;const s=i.end.getShiftedBy(-1),a=s.getShiftedBy(-r.length),c=t.model.createRange(a,s);this._applyAutoLink(r,c)})),e.bind("isEnabled").to(this)}_enableEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("enter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition();if(!t.parent.previousSibling)return;const n=e.createRangeIn(t.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("shiftEnter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition(),n=e.createRange(e.createPositionAt(t.parent,0),t.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(t){const e=this.editor.model,{text:n,range:o}=Om(t,e),i=Pb(n);if(i){const t=e.createRange(o.end.getShiftedBy(-i.length),o.end);this._applyAutoLink(i,t)}}_applyAutoLink(t,e){const n=this.editor.model,o=this.editor.plugins.get("Delete");this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&n.enqueueChange((i=>{const r=this.editor.config.get("link.defaultProtocol"),s=hb(t,r);i.setAttribute("linkHref",s,e),n.enqueueChange((()=>{o.requestUndoOnBackspace()}))}))}}function Pb(t){const e=Bb.exec(t);return e?e[2]:null}class Lb extends me{constructor(t,e){super(t),this.type=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,o=Array.from(n.selection.getSelectedBlocks()).filter((t=>Rb(t,e.schema))),i=void 0!==t.forceValue?!t.forceValue:this.value;e.change((t=>{if(i){let e=o[o.length-1].nextSibling,n=Number.POSITIVE_INFINITY,i=[];for(;e&&"listItem"==e.name&&0!==e.getAttribute("listIndent");){const t=e.getAttribute("listIndent");t=n;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&t[e?"unshift":"push"](i),i=i[e?"previousSibling":"nextSibling"]}}function Rb(t,e){return e.checkChild(t.parent,"listItem")&&!e.isObject(t)}class jb extends me{constructor(t,e){super(t),this._indentBy="forward"==e?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=t.document;let n=Array.from(e.selection.getSelectedBlocks());t.change((t=>{const e=n[n.length-1];let o=e.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>e.getAttribute("listIndent");)n.push(o),o=o.nextSibling;this._indentBy<0&&(n=n.reverse());for(const e of n){const n=e.getAttribute("listIndent")+this._indentBy;n<0?t.rename(e,"paragraph"):t.setAttribute("listIndent",n,e)}this.fire("_executeCleanup",n)}))}_checkEnabled(){const t=Na(this.editor.model.document.selection.getSelectedBlocks());if(!t||!t.is("element","listItem"))return!1;if(this._indentBy>0){const e=t.getAttribute("listIndent"),n=t.getAttribute("listType");let o=t.previousSibling;for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=e;){if(o.getAttribute("listIndent")==e)return o.getAttribute("listType")==n;o=o.previousSibling}return!1}return!0}}function Fb(t,e){const n=e.mapper,o=e.writer,i="numbered"==t.getAttribute("listType")?"ol":"ul",r=function(t){const e=t.createContainerElement("li");return e.getFillerOffset=Wb,e}(o),s=o.createContainerElement(i,null);return o.insert(o.createPositionAt(s,0),r),n.bindElements(t,r),r}function Vb(t,e,n,o){const i=e.parent,r=n.mapper,s=n.writer;let a=r.toViewPosition(o.createPositionBefore(t));const c=qb(t.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:t.getAttribute("listIndent")}),l=t.previousSibling;if(c&&c.getAttribute("listIndent")==t.getAttribute("listIndent")){const t=r.toViewElement(c);a=s.breakContainer(s.createPositionAfter(t))}else if(l&&"listItem"==l.name){a=r.toViewPosition(o.createPositionAt(l,"end"));const t=r.findMappedViewAncestor(a),e=function(t){for(const e of t.getChildren())if("ul"==e.name||"ol"==e.name)return e;return null}(t);a=e?s.createPositionBefore(e):s.createPositionAt(t,"end")}else a=r.toViewPosition(o.createPositionBefore(t));if(a=Ub(a),s.insert(a,i),l&&"listItem"==l.name){const t=r.toViewElement(l),n=s.createRange(s.createPositionAt(t,0),a).getWalker({ignoreElementEnd:!0});for(const t of n)if(t.item.is("element","li")){const o=s.breakContainer(s.createPositionBefore(t.item)),i=t.item.parent,r=s.createPositionAt(e,"end");Hb(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(i),r),n.position=o}}else{const n=i.nextSibling;if(n&&(n.is("element","ul")||n.is("element","ol"))){let o=null;for(const e of n.getChildren()){const n=r.toModelElement(e);if(!(n&&n.getAttribute("listIndent")>t.getAttribute("listIndent")))break;o=e}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(e,"end")))}}Hb(s,i,i.nextSibling),Hb(s,i.previousSibling,i)}function Hb(t,e,n){return!e||!n||"ul"!=e.name&&"ol"!=e.name||e.name!=n.name||e.getAttribute("class")!==n.getAttribute("class")?null:t.mergeContainers(t.createPositionAfter(e))}function Ub(t){return t.getLastMatchingPosition((t=>t.item.is("uiElement")))}function qb(t,e){const n=!!e.sameIndent,o=!!e.smallerIndent,i=e.listIndent;let r=t;for(;r&&"listItem"==r.name;){const t=r.getAttribute("listIndent");if(n&&i==t||o&&i>t)return r;r="forward"===e.direction?r.nextSibling:r.previousSibling}return null}function Gb(t,e,n,o){t.ui.componentFactory.add(e,(i=>{const r=t.commands.get(e),s=new kh(i);return s.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),s}))}function Wb(){const t=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||t?0:Bi.call(this)}function Yb(t){return(e,n,o)=>{const i=o.consumable;if(!i.test(n.item,"insert")||!i.test(n.item,"attribute:listType")||!i.test(n.item,"attribute:listIndent"))return;i.consume(n.item,"insert"),i.consume(n.item,"attribute:listType"),i.consume(n.item,"attribute:listIndent");const r=n.item;Vb(r,Fb(r,o),o,t)}}function Kb(t,e,n){if(!n.consumable.test(e.item,t.name))return;const o=n.mapper.toViewElement(e.item),i=n.writer;i.breakContainer(i.createPositionBefore(o)),i.breakContainer(i.createPositionAfter(o));const r=o.parent,s="numbered"==e.attributeNewValue?"ol":"ul";i.rename(s,r)}function Qb(t,e,n){n.consumable.consume(e.item,t.name);const o=n.mapper.toViewElement(e.item).parent,i=n.writer;Hb(i,o,o.nextSibling),Hb(i,o.previousSibling,o)}function $b(t,e,n){if(n.consumable.test(e.item,t.name)&&"listItem"!=e.item.name){let t=n.mapper.toViewPosition(e.range.start);const o=n.writer,i=[];for(;("ul"==t.parent.name||"ol"==t.parent.name)&&(t=o.breakContainer(t),"li"==t.parent.name);){const e=t,n=o.createPositionAt(t.parent,"end");if(!e.isEqual(n)){const t=o.remove(o.createRange(e,n));i.push(t)}t=o.createPositionAfter(t.parent)}if(i.length>0){for(let e=0;e0){const e=Hb(o,n,n.nextSibling);e&&e.parent==n&&t.offset--}}Hb(o,t.nodeBefore,t.nodeAfter)}}}function Zb(t,e,n){const o=n.mapper.toViewPosition(e.position),i=o.nodeBefore,r=o.nodeAfter;Hb(n.writer,i,r)}function Jb(t,e,n){if(n.consumable.consume(e.viewItem,{name:!0})){const t=n.writer,o=t.createElement("listItem"),i=function(t){let e=0,n=t.parent;for(;n;){if(n.is("element","li"))e++;else{const t=n.previousSibling;t&&t.is("element","li")&&e++}n=n.parent}return e}(e.viewItem);t.setAttribute("listIndent",i,o);const r=e.viewItem.parent&&"ol"==e.viewItem.parent.name?"numbered":"bulleted";if(t.setAttribute("listType",r,o),!n.safeInsert(o,e.modelCursor))return;const s=function(t,e,n){const{writer:o,schema:i}=n;let r=o.createPositionAfter(t);for(const s of e)if("ul"==s.name||"ol"==s.name)r=n.convertItem(s,r).modelCursor;else{const e=n.convertItem(s,o.createPositionAt(t,"end")),a=e.modelRange.start.nodeAfter;a&&a.is("element")&&!i.checkChild(t,a.name)&&(t=e.modelCursor.parent.is("element","listItem")?e.modelCursor.parent:ow(e.modelCursor),r=o.createPositionAfter(t))}return r}(o,e.viewItem.getChildren(),n);e.modelRange=t.createRange(e.modelCursor,s),n.updateConversionResult(o,e)}}function Xb(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){const t=Array.from(e.viewItem.getChildren());for(const e of t){!(e.is("element","li")||rw(e))&&e._remove()}}}function tw(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){if(0===e.viewItem.childCount)return;const t=[...e.viewItem.getChildren()];let n=!1;for(const e of t)n&&!rw(e)&&e._remove(),rw(e)&&(n=!0)}}function ew(t){return(e,n)=>{if(n.isPhantom)return;const o=n.modelPosition.nodeBefore;if(o&&o.is("element","listItem")){const e=n.mapper.toViewElement(o),i=e.getAncestors().find(rw),r=t.createPositionAt(e,0).getWalker();for(const t of r){if("elementStart"==t.type&&t.item.is("element","li")){n.viewPosition=t.previousPosition;break}if("elementEnd"==t.type&&t.item==i){n.viewPosition=t.nextPosition;break}}}}}function nw(t,[e,n]){let o,i=e.is("documentFragment")?e.getChild(0):e;if(o=n?this.createSelection(n):this.document.selection,i&&i.is("element","listItem")){const t=o.getFirstPosition();let e=null;if(t.parent.is("element","listItem")?e=t.parent:t.nodeBefore&&t.nodeBefore.is("element","listItem")&&(e=t.nodeBefore),e){const t=e.getAttribute("listIndent");if(t>0)for(;i&&i.is("element","listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+t),i=i.nextSibling}}}function ow(t){const e=new Ua({startPosition:t});let n;do{n=e.next()}while(!n.value.item.is("element","listItem"));return n.value.item}function iw(t,e,n,o,i,r){const s=qb(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:t,foo:"b"}),a=i.mapper,c=i.writer,l=s?s.getAttribute("listIndent"):null;let d;if(s)if(l==t){const t=a.toViewElement(s).parent;d=c.createPositionAfter(t)}else{const t=r.createPositionAt(s,"end");d=a.toViewPosition(t)}else d=n;d=Ub(d);for(const t of[...o.getChildren()])rw(t)&&(d=c.move(c.createRangeOn(t),d).end,Hb(c,t,t.nextSibling),Hb(c,t.previousSibling,t))}function rw(t){return t.is("element","ol")||t.is("element","ul")}class sw extends ue{static get pluginName(){return"ListEditing"}static get requires(){return[yg,Tg]}init(){const t=this.editor;t.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const e=t.data,n=t.editing;var o;t.model.document.registerPostFixer((e=>function(t,e){const n=t.document.differ.getChanges(),o=new Map;let i=!1;for(const o of n)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const n=o.position.nodeAfter;n.hasAttribute("listIndent")&&(e.removeAttribute("listIndent",n),i=!0),n.hasAttribute("listType")&&(e.removeAttribute("listType",n),i=!0),n.hasAttribute("listStyle")&&(e.removeAttribute("listStyle",n),i=!0),n.hasAttribute("listReversed")&&(e.removeAttribute("listReversed",n),i=!0),n.hasAttribute("listStart")&&(e.removeAttribute("listStart",n),i=!0);for(const e of Array.from(t.createRangeIn(n)).filter((t=>t.item.is("element","listItem"))))r(e.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const t of o.values())s(t),a(t);return i;function r(t){const e=t.nodeBefore;if(e&&e.is("element","listItem")){let t=e;if(o.has(t))return;for(let e=t.previousSibling;e&&e.is("element","listItem");e=t.previousSibling)if(t=e,o.has(t))return;o.set(e,t)}else{const e=t.nodeAfter;e&&e.is("element","listItem")&&o.set(e,e)}}function s(t){let n=0,o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(r>n){let s;null===o?(o=r-n,s=n):(o>r&&(o=r),s=r-o),e.setAttribute("listIndent",s,t),i=!0}else o=null,n=t.getAttribute("listIndent")+1;t=t.nextSibling}}function a(t){let n=[],o=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(n=n.slice(0,r+1)),0!=r)if(n[r]){const o=n[r];t.getAttribute("listType")!=o&&(e.setAttribute("listType",o,t),i=!0)}else n[r]=t.getAttribute("listType");o=t,t=t.nextSibling}}}(t.model,e))),n.mapper.registerViewToModelLength("li",aw),e.mapper.registerViewToModelLength("li",aw),n.mapper.on("modelToViewPosition",ew(n.view)),n.mapper.on("viewToModelPosition",(o=t.model,(t,e)=>{const n=e.viewPosition,i=n.parent,r=e.mapper;if("ul"==i.name||"ol"==i.name){if(n.isAtEnd){const t=r.toModelElement(n.nodeBefore),i=r.getModelLength(n.nodeBefore);e.modelPosition=o.createPositionBefore(t).getShiftedBy(i)}else{const t=r.toModelElement(n.nodeAfter);e.modelPosition=o.createPositionBefore(t)}t.stop()}else if("li"==i.name&&n.nodeBefore&&("ul"==n.nodeBefore.name||"ol"==n.nodeBefore.name)){const s=r.toModelElement(i);let a=1,c=n.nodeBefore;for(;c&&rw(c);)a+=r.getModelLength(c),c=c.previousSibling;e.modelPosition=o.createPositionBefore(s).getShiftedBy(a),t.stop()}})),e.mapper.on("modelToViewPosition",ew(n.view)),t.conversion.for("editingDowncast").add((e=>{e.on("insert",$b,{priority:"high"}),e.on("insert:listItem",Yb(t.model)),e.on("attribute:listType:listItem",Kb,{priority:"high"}),e.on("attribute:listType:listItem",Qb,{priority:"low"}),e.on("attribute:listIndent:listItem",function(t){return(e,n,o)=>{if(!o.consumable.consume(n.item,"attribute:listIndent"))return;const i=o.mapper.toViewElement(n.item),r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s);r.remove(c),a&&a.nextSibling&&Hb(r,a,a.nextSibling),iw(n.attributeOldValue+1,n.range.start,c.start,i,o,t),Vb(n.item,i,o,t);for(const t of n.item.getChildren())o.consumable.consume(t,"insert")}}(t.model)),e.on("remove:listItem",function(t){return(e,n,o)=>{const i=o.mapper.toViewPosition(n.position).getLastMatchingPosition((t=>!t.item.is("element","li"))).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s),l=r.remove(c);a&&a.nextSibling&&Hb(r,a,a.nextSibling),iw(o.mapper.toModelElement(i).getAttribute("listIndent")+1,n.position,c.start,i,o,t);for(const t of r.createRangeIn(l).getItems())o.mapper.unbindViewElement(t);e.stop()}}(t.model)),e.on("remove",Zb,{priority:"low"})})),t.conversion.for("dataDowncast").add((e=>{e.on("insert",$b,{priority:"high"}),e.on("insert:listItem",Yb(t.model))})),t.conversion.for("upcast").add((t=>{t.on("element:ul",Xb,{priority:"high"}),t.on("element:ol",Xb,{priority:"high"}),t.on("element:li",tw,{priority:"high"}),t.on("element:li",Jb)})),t.model.on("insertContent",nw,{priority:"high"}),t.commands.add("numberedList",new Lb(t,"numbered")),t.commands.add("bulletedList",new Lb(t,"bulleted")),t.commands.add("indentList",new jb(t,"forward")),t.commands.add("outdentList",new jb(t,"backward"));const i=n.view.document;this.listenTo(i,"enter",((t,e)=>{const n=this.editor.model.document,o=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(i,"delete",((t,e)=>{if("backward"!==e.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const o=n.getFirstPosition();if(!o.isAtStart)return;const i=o.parent;if("listItem"!==i.name)return;i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(t.editing.view.document,"tab",((e,n)=>{const o=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(o).isEnabled&&(t.execute(o),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"li"})}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList")),n&&n.registerChildCommand(t.get("outdentList"))}}function aw(t){let e=1;for(const n of t.getChildren())if("ul"==n.name||"ol"==n.name)for(const t of n.getChildren())e+=aw(t);return e}class cw extends ue{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;Gb(this.editor,"numberedList",t("Numbered List"),''),Gb(this.editor,"bulletedList",t("Bulleted List"),'')}}function lw(t,e){return t=>{t.on("attribute:url:media",n)};function n(n,o,i){if(!i.consumable.consume(o.item,n.name))return;const r=o.attributeNewValue,s=i.writer,a=i.mapper.toViewElement(o.item),c=[...a.getChildren()].find((t=>t.getCustomProperty("media-content")));s.remove(c);const l=t.getMediaViewElement(s,r,e);s.insert(s.createPositionAt(a,0),l)}}function dw(t,e,n,o){return t.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(t,n,o),t.createSlot()])}function hw(t){const e=t.getSelectedElement();return e&&e.is("element","media")?e:null}function uw(t,e,n,o){t.change((i=>{const r=i.createElement("media",{url:e});t.insertObject(r,n,null,{setSelection:"on",findOptimalPosition:o})}))}class gw extends me{refresh(){const t=this.editor.model,e=t.document.selection,n=hw(e);this.value=n?n.getAttribute("url"):null,this.isEnabled=function(t){const e=t.getSelectedElement();return!!e&&"media"===e.name}(e)||function(t,e){let n=Gg(t,e).start.parent;n.isEmpty&&!e.schema.isLimit(n)&&(n=n.parent);return e.schema.checkChild(n,"media")}(e,t)}execute(t){const e=this.editor.model,n=e.document.selection,o=hw(n);o?e.change((e=>{e.setAttribute("url",t,o)})):uw(e,t,n,!0)}}class mw{constructor(t,e){const n=e.providers,o=e.extraProviders||[],i=new Set(e.removeProviders),r=n.concat(o).filter((t=>{const e=t.name;return e?!i.has(e):(l("media-embed-no-provider-name",{provider:t}),!1)}));this.locale=t,this.providerDefinitions=r}hasMedia(t){return!!this._getMedia(t)}getMediaViewElement(t,e,n){return this._getMedia(e).getViewElement(t,n)}_getMedia(t){if(!t)return new pw(this.locale);t=t.trim();for(const e of this.providerDefinitions){const n=e.html,o=So(e.url);for(const e of o){const o=this._getUrlMatches(t,e);if(o)return new pw(this.locale,t,o,n)}}return null}_getUrlMatches(t,e){let n=t.match(e);if(n)return n;let o=t.replace(/^https?:\/\//,"");return n=o.match(e),n||(o=o.replace(/^www\./,""),n=o.match(e),n||null)}}class pw{constructor(t,e,n,o){this.url=this._getValidUrl(e),this._t=t.t,this._match=n,this._previewRenderer=o}getViewElement(t,e){const n={};let o;if(e.renderForEditingView||e.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),e.renderForEditingView&&(n.class="ck-media__wrapper");const i=this._getPreviewHtml(e);o=t.createRawElement("div",n,((t,e)=>{e.setContentOf(t,i)}))}else this.url&&(n.url=this.url),o=t.createEmptyElement(e.elementName,n);return t.setCustomProperty("media-content",!0,o),o}_getPreviewHtml(t){return this._previewRenderer?this._previewRenderer(this._match):this.url&&t.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const t=new mh,e=new hh;t.text=this._t("Open media in new tab"),e.content='',e.viewBox="0 0 64 42";return new Vd({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]},t]}]}).render().outerHTML}_getValidUrl(t){return t?t.match(/^https?/)?t:"https://"+t:null}}var fw=n(7442),kw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(fw.Z,kw);fw.Z.locals;class bw extends ue{static get pluginName(){return"MediaEmbedEditing"}constructor(t){super(t),t.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>`
`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`
`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:t=>`
`},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`
`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new mw(t.locale,t.config.get("mediaEmbed"))}init(){const t=this.editor,e=t.model.schema,n=t.t,o=t.conversion,i=t.config.get("mediaEmbed.previewsInData"),r=t.config.get("mediaEmbed.elementName"),s=this.registry;t.commands.add("mediaEmbed",new gw(t)),e.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),o.for("dataDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const n=t.getAttribute("url");return dw(e,s,n,{elementName:r,renderMediaPreview:n&&i})}}),o.for("dataDowncast").add(lw(s,{elementName:r,renderMediaPreview:i})),o.for("editingDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const o=t.getAttribute("url");return function(t,e,n){return e.setCustomProperty("media",!0,t),jg(t,e,{label:n})}(dw(e,s,o,{elementName:r,renderForEditingView:!0}),e,n("media widget"))}}),o.for("editingDowncast").add(lw(s,{elementName:r,renderForEditingView:!0})),o.for("upcast").elementToElement({view:t=>["oembed",r].includes(t.name)&&t.getAttribute("url")?{name:!0}:null,model:(t,{writer:e})=>{const n=t.getAttribute("url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(t,{writer:e})=>{const n=t.getAttribute("data-oembed-url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).add((t=>{t.on("element:figure",(function(t,e,n){if(!n.consumable.consume(e.viewItem,{name:!0,classes:"media"}))return;const{modelRange:o,modelCursor:i}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=o,e.modelCursor=i;Na(o.getItems())||n.consumable.revert(e.viewItem,{name:!0,classes:"media"})}))}))}}const ww=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class _w extends ue{static get requires(){return[_m,Tg,hp]}static get pluginName(){return"AutoMediaEmbed"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document;this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=td.fromPosition(t.start);n.stickiness="toPrevious";const o=td.fromPosition(t.end);o.stickiness="toNext",e.once("change:data",(()=>{this._embedMediaBetweenPositions(n,o),n.detach(),o.detach()}),{priority:"high"})})),t.commands.get("undo").on("execute",(()=>{this._timeoutId&&(is.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedMediaBetweenPositions(t,e){const n=this.editor,o=n.plugins.get(bw).registry,i=new ac(t,e),r=i.getWalker({ignoreElementEnd:!0});let s="";for(const t of r)t.item.is("$textProxy")&&(s+=t.item.data);if(s=s.trim(),!s.match(ww))return void i.detach();if(!o.hasMedia(s))return void i.detach();n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=td.fromPosition(t),this._timeoutId=is.window.setTimeout((()=>{n.model.change((t=>{let e;this._timeoutId=null,t.remove(i),i.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert),uw(n.model,s,e,!1),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get("Delete").requestUndoOnBackspace()}),100)):i.detach()}}var Aw=n(9292),Cw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(Aw.Z,Cw);Aw.Z.locals;class vw extends Fd{constructor(t,e){super(e);const n=e.t;this.focusTracker=new Ba,this.keystrokes=new za,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Bd.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",(t=>!!t)),this.cancelButtonView=this._createButton(n("Cancel"),Bd.cancel,"ck-button-cancel","cancel"),this._focusables=new Od,this._focusCycler=new Lh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=t,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]}),Pd(this)}render(){super.render(),Ld({view:this});[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t),this.listenTo(this.urlInputView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(t){this.urlInputView.fieldView.element.value=t.trim()}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.urlInputView.errorText=e,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const t=this.locale.t,e=new Au(this.locale,Cu),n=e.fieldView;return this._urlInputViewInfoDefault=t("Paste the media URL in the input."),this._urlInputViewInfoTip=t("Tip: Paste the URL into the content to embed faster."),e.label=t("Media URL"),e.infoText=this._urlInputViewInfoDefault,n.on("input",(()=>{e.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()})),e}_createButton(t,e,n,o){const i=new kh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}}class yw extends ue{static get requires(){return[bw]}static get pluginName(){return"MediaEmbedUI"}init(){const t=this.editor,e=t.commands.get("mediaEmbed"),n=t.plugins.get(bw).registry;t.ui.componentFactory.add("mediaEmbed",(o=>{const i=nu(o),r=new vw(function(t,e){return[e=>{if(!e.url.length)return t("The URL must not be empty.")},n=>{if(!e.hasMedia(n.url))return t("This media URL is not supported.")}]}(t.t,n),t.locale);return this._setUpDropdown(i,r,e,t),this._setUpForm(i,r,e),i}))}_setUpDropdown(t,e,n){const o=this.editor,i=o.t,r=t.buttonView;function s(){o.editing.view.focus(),t.isOpen=!1}t.bind("isEnabled").to(n),t.panelView.children.add(e),r.set({label:i("Insert media"),icon:'',tooltip:!0}),r.on("open",(()=>{e.disableCssTransitions(),e.url=n.value||"",e.urlInputView.fieldView.select(),e.focus(),e.enableCssTransitions()}),{priority:"low"}),t.on("submit",(()=>{e.isValid()&&(o.execute("mediaEmbed",e.url),s())})),t.on("change:isOpen",(()=>e.resetFormStatus())),t.on("cancel",(()=>s()))}_setUpForm(t,e,n){e.delegate("submit","cancel").to(t),e.urlInputView.bind("value").to(n,"value"),e.urlInputView.bind("isReadOnly").to(n,"isEnabled",(t=>!t))}}var xw=n(4652),Dw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Zr()(xw.Z,Dw);xw.Z.locals;function Ew(t,e){if(!t.childCount)return;const n=new dg(t.document),o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),i=[];for(const t of n)if("elementStart"===t.type&&o.match(t.item)){const e=Sw(t.item);i.push({element:t.item,id:e.id,order:e.order,indent:e.indent})}return i}(t,n);if(!o.length)return;let i=null,r=1;o.forEach(((t,s)=>{const a=function(t,e){if(!t)return!0;if(t.id!==e.id)return e.indent-t.indent!=1;const n=e.element.previousSibling;if(!n)return!0;return o=n,!(o.is("element","ol")||o.is("element","ul"));var o}(o[s-1],t),c=a?null:o[s-1],l=(h=t,(d=c)?h.indent-d.indent:h.indent-1);var d,h;if(a&&(i=null,r=1),!i||0!==l){const o=function(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]{0,100});/gi,i=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=n.exec(e);let s="decimal",a="ol",c=null;if(r&&r[1]){const e=o.exec(r[1]);if(e&&e[1]&&(s=e[1].trim(),a="bullet"!==s&&"image"!==s?"ol":"ul"),"bullet"===s){const e=function(t){const e=function(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);return t.is("$text")?t:t.getChild(0)}}(t);if(!e)return null;const n=e._data;if("o"===n)return"circle";if("·"===n)return"disc";if("§"===n)return"square";return null}(t.element);e&&(s=e)}else{const t=i.exec(r[1]);t&&t[1]&&(c=parseInt(t[1]))}}return{type:a,startIndex:c,style:Mw(s)}}(t,e);if(i){if(t.indent>r){const t=i.getChild(i.childCount-1),e=t.getChild(t.childCount-1);i=Iw(o,e,n),r+=1}else if(t.indent1&&n.setAttribute("start",t.startIndex,i),i}function Sw(t){const e={},n=t.getStyle("mso-list");if(n){const t=n.match(/(^|\s{1,100})l(\d+)/i),o=n.match(/\s{0,100}lfo(\d+)/i),i=n.match(/\s{0,100}level(\d+)/i);t&&o&&i&&(e.id=t[2],e.order=o[1],e.indent=i[1])}return e}const Tw=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class Nw{constructor(t){this.document=t}isActive(t){return Tw.test(t)}execute(t){const e=new dg(this.document),{body:n}=t._parsedData;!function(t,e){for(const n of t.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const o=t.getChildIndex(n);e.remove(n),e.insertChild(o,n.getChildren(),t)}}(n,e),function(t,e){for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","li")){const n=t.getChild(0);n&&n.is("element","p")&&e.unwrapElement(n)}}}(n,e),t.content=n}}function Bw(t,e){if(!t.childCount)return;const n=new dg,o=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n){if("elementStart"!=t.type)continue;const e=t.item,n=e.previousSibling&&e.previousSibling.name||null;o.match(e)&&e.getAttribute("o:gfxdata")&&"v:shapetype"!==n&&i.push(t.item.getAttribute("id"))}return i}(t,n);!function(t,e,n){const o=n.createRangeIn(e),i=new Uo({name:"img"}),r=[];for(const e of o)if(i.match(e.item)){const n=e.item,o=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];o.length&&o.every((e=>t.indexOf(e)>-1))?r.push(n):n.getAttribute("src")||r.push(n)}for(const t of r)n.remove(t)}(o,t,n),function(t,e){const n=e.createRangeIn(t),o=new Uo({name:/v:(.+)/}),i=[];for(const t of n)"elementStart"==t.type&&o.match(t.item)&&i.push(t.item);for(const t of i)e.remove(t)}(t,n);const i=function(t,e){const n=e.createRangeIn(t),o=new Uo({name:"img"}),i=[];for(const t of n)o.match(t.item)&&t.item.getAttribute("src").startsWith("file://")&&i.push(t.item);return i}(t,n);i.length&&function(t,e,n){if(t.length===e.length)for(let o=0;oString.fromCharCode(parseInt(t,16)))).join(""))}const Pw=//i,Lw=/xmlns:o="urn:schemas-microsoft-com/i;class Ow{constructor(t){this.document=t}isActive(t){return Pw.test(t)||Lw.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;Ew(e,n),Bw(e,t.dataTransfer.getData("text/rtf")),t.content=e}}function Rw(t){return t.replace(/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join("  ").substr(0,e.length)))}function jw(t,e){const n=new DOMParser,o=function(t){return Rw(Rw(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g," <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="",n="",o=t.indexOf(e);if(o<0)return t;const i=t.indexOf(n,o+e.length);return t.substring(0,o+e.length)+(i>=0?t.substring(i):"")}(t=t.replace(//))return new i(null,8,r,g);if(r=p.match(/^<\?[\s\S]*?\?>/))return new i(null,7,r,g);if(r=p.match(/^/))return new i(null,10,r,g);if(r=p.match(/^/,!0))return new i("#cdata-section",4,r[1],g);if(r=p.match(/^([^<]+)/,!0))return new i("#text",3,decodeEntities(r[1]),g)}};u=y();)1!==u.nodeType||o?(1===u.nodeType||3===u.nodeType&&""!==u.nodeValue.trim())&&_e("parseXml: data after document end has been discarded"):o=u;return p.matchAll()&&_e("parseXml: parsing error"),o}function decodeEntities(r){return r.replace(/&(?:#([0-9]+)|#[xX]([0-9A-Fa-f]+)|([0-9A-Za-z]+));/g,(function(r,i,o,u){return i?String.fromCharCode(parseInt(i,10)):o?String.fromCharCode(parseInt(o,16)):u&&w[u]?String.fromCharCode(w[u]):r}))}function parseColor(r){var i,o;return r=(r||"").trim(),(i=g[r])?o=[i.slice(),1]:(i=r.match(/^rgba\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9.]+)\s*\)$/i))?(i[1]=parseInt(i[1]),i[2]=parseInt(i[2]),i[3]=parseInt(i[3]),i[4]=parseFloat(i[4]),i[1]<256&&i[2]<256&&i[3]<256&&i[4]<=1&&(o=[i.slice(1,4),i[4]])):(i=r.match(/^rgb\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)$/i))?(i[1]=parseInt(i[1]),i[2]=parseInt(i[2]),i[3]=parseInt(i[3]),i[1]<256&&i[2]<256&&i[3]<256&&(o=[i.slice(1,4),1])):(i=r.match(/^rgb\(\s*([0-9.]+)%\s*,\s*([0-9.]+)%\s*,\s*([0-9.]+)%\s*\)$/i))?(i[1]=2.55*parseFloat(i[1]),i[2]=2.55*parseFloat(i[2]),i[3]=2.55*parseFloat(i[3]),i[1]<256&&i[2]<256&&i[3]<256&&(o=[i.slice(1,4),1])):(i=r.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i))?o=[[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)],1]:(i=r.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i))&&(o=[[17*parseInt(i[1],16),17*parseInt(i[2],16),17*parseInt(i[3],16)],1]),Ce?Ce(o,r):o}function opacityToColor(r,i,o){var u=r[0].slice(),p=r[1]*i;if(o){for(var g=0;g=0;o--)i=multiplyMatrix(Ae[o].savedMatrix,i);return i}function getPageBBox(){return(new B).M(0,0).L(r.page.width,0).L(r.page.width,r.page.height).L(0,r.page.height).transform(inverseMatrix(getGlobalMatrix())).getBoundingBox()}function inverseMatrix(r){var i=r[0]*r[3]-r[1]*r[2];return[r[3]/i,-r[1]/i,-r[2]/i,r[0]/i,(r[2]*r[5]-r[3]*r[4])/i,(r[1]*r[4]-r[0]*r[5])/i]}function validateMatrix(r){var i=validateNumber(r[0]),o=validateNumber(r[1]),u=validateNumber(r[2]),p=validateNumber(r[3]),g=validateNumber(r[4]),y=validateNumber(r[5]);if(isNotEqual(i*p-o*u,0))return[i,o,u,p,g,y]}function solveEquation(r){var i=r[2]||0,o=r[1]||0,u=r[0]||0;if(isEqual(i,0)&&isEqual(o,0))return[];if(isEqual(i,0))return[-u/o];var p=o*o-4*i*u;return isNotEqual(p,0)&&p>0?[(-o+Math.sqrt(p))/(2*i),(-o-Math.sqrt(p))/(2*i)]:isEqual(p,0)?[-o/(2*i)]:[]}function getCurveValue(r,i){return(i[0]||0)+(i[1]||0)*r+(i[2]||0)*r*r+(i[3]||0)*r*r*r}function isEqual(r,i){return Math.abs(r-i)<1e-10}function isNotEqual(r,i){return Math.abs(r-i)>=1e-10}function validateNumber(r){return r>-1e21&&r<1e21?Math.round(1e6*r)/1e6:0}function parseTranform(r){for(var i,o=new P((r||"").trim()),u=[1,0,0,1,0,0];i=o.match(/^([A-Za-z]+)\s*[(]([^(]+)[)]/,!0);){for(var p=i[1],g=[],y=new P(i[2].trim()),w=void 0;w=y.matchNumber();)g.push(Number(w)),y.matchSeparator();if("matrix"===p&&6===g.length)u=multiplyMatrix(u,[g[0],g[1],g[2],g[3],g[4],g[5]]);else if("translate"===p&&2===g.length)u=multiplyMatrix(u,[1,0,0,1,g[0],g[1]]);else if("translate"===p&&1===g.length)u=multiplyMatrix(u,[1,0,0,1,g[0],0]);else if("scale"===p&&2===g.length)u=multiplyMatrix(u,[g[0],0,0,g[1],0,0]);else if("scale"===p&&1===g.length)u=multiplyMatrix(u,[g[0],0,0,g[0],0,0]);else if("rotate"===p&&3===g.length){var _=g[0]*Math.PI/180;u=multiplyMatrix(u,[1,0,0,1,g[1],g[2]],[Math.cos(_),Math.sin(_),-Math.sin(_),Math.cos(_),0,0],[1,0,0,1,-g[1],-g[2]])}else if("rotate"===p&&1===g.length){var x=g[0]*Math.PI/180;u=multiplyMatrix(u,[Math.cos(x),Math.sin(x),-Math.sin(x),Math.cos(x),0,0])}else if("skewX"===p&&1===g.length){var k=g[0]*Math.PI/180;u=multiplyMatrix(u,[1,0,Math.tan(k),1,0,0])}else{if("skewY"!==p||1!==g.length)return;var O=g[0]*Math.PI/180;u=multiplyMatrix(u,[1,Math.tan(O),0,1,0,0])}o.matchSeparator()}if(!o.matchAll())return u}function parseAspectRatio(r,i,o,u,p,g){var y=(r||"").trim().match(/^(none)$|^x(Min|Mid|Max)Y(Min|Mid|Max)(?:\s+(meet|slice))?$/)||[],w=y[1]||y[4]||"meet",_=y[2]||"Mid",x=y[3]||"Mid",k=i/u,P=o/p,O={Min:0,Mid:.5,Max:1}[_]-(g||0),I={Min:0,Mid:.5,Max:1}[x]-(g||0);return"slice"===w?P=k=Math.max(k,P):"meet"===w&&(P=k=Math.min(k,P)),[k,0,0,P,O*(i-u*k),I*(o-p*P)]}function parseStyleAttr(r){var i=Object.create(null);r=(r||"").trim().split(/;/);for(var o=0;ou&&(r=u,u=i,i=r),o>p&&(r=p,p=o,o=r);for(var g=solveEquation(P),y=0;y=0&&g[y]<=1){var w=getCurveValue(g[y],x);wu&&(u=w)}for(var _=solveEquation(O),I=0;I<_.length;I++)if(_[I]>=0&&_[I]<=1){var B=getCurveValue(_[I],k);Bp&&(p=B)}return[i,o,u,p]},this.getPointAtLength=function(r){if(isEqual(r,0))return this.startPoint;if(isEqual(r,this.totalLength))return this.endPoint;if(!(r<0||r>this.totalLength))for(var i=1;i<=_;i++){var o=I[i-1],u=I[i];if(o<=r&&r<=u){var p=(i-(u-r)/(u-o))/_,g=getCurveValue(p,x),y=getCurveValue(p,k),w=getCurveValue(p,P),B=getCurveValue(p,O);return[g,y,Math.atan2(B,w)]}}}},I=function LineSegment(r,i,o,u){this.totalLength=Math.sqrt((o-r)*(o-r)+(u-i)*(u-i)),this.startPoint=[r,i,Math.atan2(u-i,o-r)],this.endPoint=[o,u,Math.atan2(u-i,o-r)],this.getBoundingBox=function(){return[Math.min(this.startPoint[0],this.endPoint[0]),Math.min(this.startPoint[1],this.endPoint[1]),Math.max(this.startPoint[0],this.endPoint[0]),Math.max(this.startPoint[1],this.endPoint[1])]},this.getPointAtLength=function(r){if(r>=0&&r<=this.totalLength){var i=r/this.totalLength||0;return[this.startPoint[0]+i*(this.endPoint[0]-this.startPoint[0]),this.startPoint[1]+i*(this.endPoint[1]-this.startPoint[1]),this.startPoint[2]]}}},B=function SvgShape(){this.pathCommands=[],this.pathSegments=[],this.startPoint=null,this.endPoint=null,this.totalLength=0;var i,o,u,p=0,g=0,y=0,w=0;this.move=function(r,i){return p=y=r,g=w=i,null},this.line=function(r,i){var o=new I(y,w,r,i);return y=r,w=i,o},this.curve=function(r,i,o,u,p,g){var _=new O(y,w,r,i,o,u,p,g);return y=p,w=g,_},this.close=function(){var r=new I(y,w,p,g);return y=p,w=g,r},this.addCommand=function(r){this.pathCommands.push(r);var i=this[r[0]].apply(this,r.slice(3));i&&(i.hasStart=r[1],i.hasEnd=r[2],this.startPoint=this.startPoint||i.startPoint,this.endPoint=i.endPoint,this.pathSegments.push(i),this.totalLength+=i.totalLength)},this.M=function(r,o){return this.addCommand(["move",!0,!0,r,o]),i="M",this},this.m=function(r,i){return this.M(y+r,w+i)},this.Z=this.z=function(){return this.addCommand(["close",!0,!0]),i="Z",this},this.L=function(r,o){return this.addCommand(["line",!0,!0,r,o]),i="L",this},this.l=function(r,i){return this.L(y+r,w+i)},this.H=function(r){return this.L(r,w)},this.h=function(r){return this.L(y+r,w)},this.V=function(r){return this.L(y,r)},this.v=function(r){return this.L(y,w+r)},this.C=function(r,p,g,y,w,_){return this.addCommand(["curve",!0,!0,r,p,g,y,w,_]),i="C",o=g,u=y,this},this.c=function(r,i,o,u,p,g){return this.C(y+r,w+i,y+o,w+u,y+p,w+g)},this.S=function(r,p,g,_){return this.C(y+("C"===i?y-o:0),w+("C"===i?w-u:0),r,p,g,_)},this.s=function(r,p,g,_){return this.C(y+("C"===i?y-o:0),w+("C"===i?w-u:0),y+r,w+p,y+g,w+_)},this.Q=function(r,p,g,_){var x=y+2/3*(r-y),k=w+2/3*(p-w),P=g+2/3*(r-g),O=_+2/3*(p-_);return this.addCommand(["curve",!0,!0,x,k,P,O,g,_]),i="Q",o=r,u=p,this},this.q=function(r,i,o,u){return this.Q(y+r,w+i,y+o,w+u)},this.T=function(r,p){return this.Q(y+("Q"===i?y-o:0),w+("Q"===i?w-u:0),r,p)},this.t=function(r,p){return this.Q(y+("Q"===i?y-o:0),w+("Q"===i?w-u:0),y+r,w+p)},this.A=function(r,o,u,p,g,_,x){if(isEqual(r,0)||isEqual(o,0))this.addCommand(["line",!0,!0,_,x]);else{u*=Math.PI/180,r=Math.abs(r),o=Math.abs(o),p=1*!!p,g=1*!!g;var k=Math.cos(u)*(y-_)/2+Math.sin(u)*(w-x)/2,P=Math.cos(u)*(w-x)/2-Math.sin(u)*(y-_)/2,O=k*k/(r*r)+P*P/(o*o);O>1&&(r*=Math.sqrt(O),o*=Math.sqrt(O));var I=Math.sqrt(Math.max(0,r*r*o*o-r*r*P*P-o*o*k*k)/(r*r*P*P+o*o*k*k)),B=(p===g?-1:1)*I*r*P/o,R=(p===g?1:-1)*I*o*k/r,D=Math.cos(u)*B-Math.sin(u)*R+(y+_)/2,N=Math.sin(u)*B+Math.cos(u)*R+(w+x)/2,W=Math.atan2((P-R)/o,(k-B)/r),U=Math.atan2((-P-R)/o,(-k-B)/r);0===g&&U-W>0?U-=2*Math.PI:1===g&&U-W<0&&(U+=2*Math.PI);for(var j=Math.ceil(Math.abs(U-W)/(Math.PI/Pe)),G=0;Gi[2]&&(i[2]=r[2]),r[1]i[3]&&(i[3]=r[3]);return i[0]===1/0&&(i[0]=0),i[1]===1/0&&(i[1]=0),i[2]===-1/0&&(i[2]=0),i[3]===-1/0&&(i[3]=0),i},this.getPointAtLength=function(r){if(r>=0&&r<=this.totalLength){for(var i,o=0;op.selector.specificity||(i[g]=p.css[g],o[g]=p.selector.specificity)}return i}(r),this.allowedChildren=[],this.attr=function(i){if("function"==typeof r.getAttribute)return r.getAttribute(i)},this.resolveUrl=function(r){var o=(r||"").match(/^\s*(?:url\("(.*)#(.*)"\)|url\('(.*)#(.*)'\)|url\((.*)#(.*)\)|(.*)#(.*))\s*$/)||[],u=o[1]||o[3]||o[5]||o[7],p=o[2]||o[4]||o[6]||o[8];if(p){if(!u){var g=i.getElementById(p);if(g)return-1===this.stack.indexOf(g)?g:void _e('SVGtoPDF: loop of circular references for id "'+p+'"')}if(ke){var y=Ee[u];if(!y){(function isArrayLike(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length})(y=ke(u))||(y=[y]);for(var w=0;w=0&&o[3]>=0?o:i},this.getPercent=function(r,i){var o=this.attr(r),u=new P((o||"").trim()),p=u.matchNumber();return p?(u.match("%")&&(p*=.01),u.matchAll()?i:Math.max(0,Math.min(1,p))):i},this.chooseValue=function(r){for(var i=0;i=0&&(o=y);break;case"stroke-miterlimit":null!=(y=parseFloat(i))&&y>=1&&(o=y);break;case"word-spacing":case"letter-spacing":o=this.computeLength(i,this.getViewport());break;case"stroke-dashoffset":if(null!=(o=this.computeLength(i,this.getViewport()))&&o<0)for(var I=this.get("stroke-dasharray"),B=0;B0?r:this.ref?this.ref.getChildren():[]},this.getPaint=function(i,o,p,g){var y="userSpaceOnUse"!==this.attr("patternUnits"),w="objectBoundingBox"===this.attr("patternContentUnits"),_=this.getLength("x",y?1:this.getParentVWidth(),0),x=this.getLength("y",y?1:this.getParentVHeight(),0),k=this.getLength("width",y?1:this.getParentVWidth(),0),P=this.getLength("height",y?1:this.getParentVHeight(),0);w&&!y?(_=(_-i[0])/(i[2]-i[0])||0,x=(x-i[1])/(i[3]-i[1])||0,k=k/(i[2]-i[0])||0,P=P/(i[3]-i[1])||0):!w&&y&&(_=i[0]+_*(i[2]-i[0]),x=i[1]+x*(i[3]-i[1]),k*=i[2]-i[0],P*=i[3]-i[1]);var O=this.getViewbox("viewBox",[0,0,k,P]),I=multiplyMatrix(parseAspectRatio((this.attr("preserveAspectRatio")||"").trim(),k,P,O[2],O[3],0),[1,0,0,1,-O[0],-O[1]]),B=parseTranform(this.attr("patternTransform"));if(w&&(B=multiplyMatrix([i[2]-i[0],0,0,i[3]-i[1],i[0],i[1]],B)),(B=validateMatrix(B=multiplyMatrix(B,[1,0,0,1,_,x])))&&(I=validateMatrix(I))&&(k=validateNumber(k))&&(P=validateNumber(P))){var R=docBeginGroup([0,0,k,P]);return r.transform.apply(r,I),this.drawChildren(p,g),docEndGroup(R),[docCreatePattern(R,k,P,B),o]}return u?[u[0],u[1]*o]:void 0},this.getVWidth=function(){var r="userSpaceOnUse"!==this.attr("patternUnits"),i=this.getLength("width",r?1:this.getParentVWidth(),0);return this.getViewbox("viewBox",[0,0,i,0])[2]},this.getVHeight=function(){var r="userSpaceOnUse"!==this.attr("patternUnits"),i=this.getLength("height",r?1:this.getParentVHeight(),0);return this.getViewbox("viewBox",[0,0,0,i])[3]}},$=function SvgElemGradient(i,o,u){R.call(this,i,o),this.allowedChildren=["stop"],this.ref=function(){var r=this.getUrl("href")||this.getUrl("xlink:href");if(r&&r.nodeName===i.nodeName)return new SvgElemGradient(r,o,u)}.call(this);var p=this.attr;this.attr=function(r){var i=p.call(this,r);return null!=i||"href"===r||"xlink:href"===r?i:this.ref?this.ref.attr(r):null};var g=this.getChildren;this.getChildren=function(){var r=g.call(this);return r.length>0?r:this.ref?this.ref.getChildren():[]},this.getPaint=function(i,o,p,g){var w=this.getChildren();if(0!==w.length){if(1===w.length){var _=w[0],x=_.get("stop-color");if("none"===x)return;return opacityToColor(x,_.get("stop-opacity")*o,g)}var k,P,O,I,B,R,D="userSpaceOnUse"!==this.attr("gradientUnits"),N=parseTranform(this.attr("gradientTransform")),W=this.attr("spreadMethod"),U=0,j=0,G=1;if(D&&(N=multiplyMatrix([i[2]-i[0],0,0,i[3]-i[1],i[0],i[1]],N)),N=validateMatrix(N)){if("linearGradient"===this.name)P=this.getLength("x1",D?1:this.getVWidth(),0),O=this.getLength("x2",D?1:this.getVWidth(),D?1:this.getVWidth()),I=this.getLength("y1",D?1:this.getVHeight(),0),B=this.getLength("y2",D?1:this.getVHeight(),0);else{O=this.getLength("cx",D?1:this.getVWidth(),D?.5:.5*this.getVWidth()),B=this.getLength("cy",D?1:this.getVHeight(),D?.5:.5*this.getVHeight()),R=this.getLength("r",D?1:this.getViewport(),D?.5:.5*this.getViewport()),P=this.getLength("fx",D?1:this.getVWidth(),O),I=this.getLength("fy",D?1:this.getVHeight(),B),R<0&&_e("SvgElemGradient: negative r value");var X=Math.sqrt(Math.pow(O-P,2)+Math.pow(B-I,2)),K=1;X>R&&(P=O+(P-O)*(K=R/X),I=B+(I-B)*K),R=Math.max(R,X*K*1.000001)}if("reflect"===W||"repeat"===W){var Y=inverseMatrix(N),J=transformPoint([i[0],i[1]],Y),$=transformPoint([i[2],i[1]],Y),ee=transformPoint([i[2],i[3]],Y),te=transformPoint([i[0],i[3]],Y);"linearGradient"===this.name?(U=Math.max((J[0]-O)*(O-P)+(J[1]-B)*(B-I),($[0]-O)*(O-P)+($[1]-B)*(B-I),(ee[0]-O)*(O-P)+(ee[1]-B)*(B-I),(te[0]-O)*(O-P)+(te[1]-B)*(B-I))/(Math.pow(O-P,2)+Math.pow(B-I,2)),j=Math.max((J[0]-P)*(P-O)+(J[1]-I)*(I-B),($[0]-P)*(P-O)+($[1]-I)*(I-B),(ee[0]-P)*(P-O)+(ee[1]-I)*(I-B),(te[0]-P)*(P-O)+(te[1]-I)*(I-B))/(Math.pow(O-P,2)+Math.pow(B-I,2))):U=Math.sqrt(Math.max(Math.pow(J[0]-O,2)+Math.pow(J[1]-B,2),Math.pow($[0]-O,2)+Math.pow($[1]-B,2),Math.pow(ee[0]-O,2)+Math.pow(ee[1]-B,2),Math.pow(te[0]-O,2)+Math.pow(te[1]-B,2)))/R-1,U=Math.ceil(U+.5),G=(j=Math.ceil(j+.5))+1+U}k="linearGradient"===this.name?r.linearGradient(P-j*(O-P),I-j*(B-I),O+U*(O-P),B+U*(B-I)):r.radialGradient(P,I,0,O,B,R+U*R);for(var re=0;re0&&k.stop((re+0)/G,se[0],se[1]),k.stop((re+ne)/(U+j+1),se[0],se[1]),oe===w.length-1&&ne<1&&k.stop((re+1)/G,se[0],se[1])}return k.setTransform.apply(k,N),[k,1]}return u?[u[0],u[1]*o]:void 0}}},ee=function SvgElemBasicShape(i,o){D.call(this,i,o),this.dashScale=1,this.getBoundingShape=function(){return this.shape},this.getTransformation=function(){return this.get("transform")},this.drawInDocument=function(i,o){if("hidden"!==this.get("visibility")&&this.shape){if(r.save(),this.transform(),this.clip(),i)this.shape.insertInDocument(),docFillColor(y.white),r.fill(this.get("clip-rule"));else{var u;this.mask()&&(u=docBeginGroup(getPageBBox()));var p=this.shape.getSubPaths(),g=this.getFill(i,o),w=this.getStroke(i,o),_=this.get("stroke-width"),x=this.get("stroke-linecap");if(g||w){if(g&&docFillColor(g),w){for(var k=0;k0&&p[k].startPoint&&p[k].startPoint.length>1){var P=p[k].startPoint[0],O=p[k].startPoint[1];docFillColor(w),"square"===x?r.rect(P-.5*_,O-.5*_,_,_):"round"===x&&r.circle(P,O,.5*_),r.fill()}var I=this.get("stroke-dasharray"),B=this.get("stroke-dashoffset");if(isNotEqual(this.dashScale,1)){for(var R=0;R0&&p[D].insertInDocument();g&&w?r.fillAndStroke(this.get("fill-rule")):g?r.fill(this.get("fill-rule")):w&&r.stroke()}var N=this.get("marker-start"),W=this.get("marker-mid"),U=this.get("marker-end");if("none"!==N||"none"!==W||"none"!==U){var j=this.shape.getMarkers();if("none"!==N&&new ce(N,null).drawMarker(!1,o,j[0],_),"none"!==W)for(var G=1;G0&&g>0?y&&w?(y=Math.min(y,.5*p),w=Math.min(w,.5*g),this.shape=(new B).M(o+y,u).L(o+p-y,u).A(y,w,0,0,1,o+p,u+w).L(o+p,u+g-w).A(y,w,0,0,1,o+p-y,u+g).L(o+y,u+g).A(y,w,0,0,1,o,u+g-w).L(o,u+w).A(y,w,0,0,1,o+y,u).Z()):this.shape=(new B).M(o,u).L(o+p,u).L(o+p,u+g).L(o,u+g).Z():this.shape=new B},re=function SvgElemCircle(r,i){ee.call(this,r,i);var o=this.getLength("cx",this.getVWidth(),0),u=this.getLength("cy",this.getVHeight(),0),p=this.getLength("r",this.getViewport(),0);this.shape=p>0?(new B).M(o+p,u).A(p,p,0,0,1,o-p,u).A(p,p,0,0,1,o+p,u).Z():new B},ne=function SvgElemEllipse(r,i){ee.call(this,r,i);var o=this.getLength("cx",this.getVWidth(),0),u=this.getLength("cy",this.getVHeight(),0),p=this.getLength("rx",this.getVWidth(),0),g=this.getLength("ry",this.getVHeight(),0);this.shape=p>0&&g>0?(new B).M(o+p,u).A(p,g,0,0,1,o-p,u).A(p,g,0,0,1,o+p,u).Z():new B},ie=function SvgElemLine(r,i){ee.call(this,r,i);var o=this.getLength("x1",this.getVWidth(),0),u=this.getLength("y1",this.getVHeight(),0),p=this.getLength("x2",this.getVWidth(),0),g=this.getLength("y2",this.getVHeight(),0);this.shape=(new B).M(o,u).L(p,g)},oe=function SvgElemPolyline(r,i){ee.call(this,r,i);var o=this.getNumberList("points");this.shape=new B;for(var u=0;u0?o:void 0,this.dashScale=void 0!==this.pathLength?this.shape.totalLength/this.pathLength:1},ce=function SvgElemMarker(i,o){N.call(this,i,o);var u=this.getLength("markerWidth",this.getParentVWidth(),3),p=this.getLength("markerHeight",this.getParentVHeight(),3),g=this.getViewbox("viewBox",[0,0,u,p]);this.getVWidth=function(){return g[2]},this.getVHeight=function(){return g[3]},this.drawMarker=function(i,o,y,w){r.save();var _=this.attr("orient"),x=this.attr("markerUnits"),k="auto"===_?y[2]:(parseFloat(_)||0)*Math.PI/180,P="userSpaceOnUse"===x?1:w;r.transform(Math.cos(k)*P,Math.sin(k)*P,-Math.sin(k)*P,Math.cos(k)*P,y[0],y[1]);var O,I=this.getLength("refX",this.getVWidth(),0),B=this.getLength("refY",this.getVHeight(),0),R=parseAspectRatio(this.attr("preserveAspectRatio"),u,p,g[2],g[3],.5);"hidden"===this.get("overflow")&&r.rect(R[0]*(g[0]+g[2]/2-I)-u/2,R[3]*(g[1]+g[3]/2-B)-p/2,u,p).clip(),r.transform.apply(r,R),r.translate(-I,-B),this.get("opacity")<1&&!i&&(O=docBeginGroup(getPageBBox())),this.drawChildren(i,o),O&&(docEndGroup(O),r.fillOpacity(this.get("opacity")),docInsertGroup(O)),r.restore()}},le=function SvgElemClipPath(i,o){N.call(this,i,o),this.useMask=function(i){var o=docBeginGroup(getPageBBox());r.save(),"objectBoundingBox"===this.attr("clipPathUnits")&&r.transform(i[2]-i[0],0,0,i[3]-i[1],i[0],i[1]),this.clip(),this.drawChildren(!0,!1),r.restore(),docEndGroup(o),docApplyMask(o,!0)}},ue=function SvgElemMask(i,o){N.call(this,i,o),this.useMask=function(i){var o,u,p,g,y=docBeginGroup(getPageBBox());r.save(),"userSpaceOnUse"===this.attr("maskUnits")?(o=this.getLength("x",this.getVWidth(),-.1*(i[2]-i[0])+i[0]),u=this.getLength("y",this.getVHeight(),-.1*(i[3]-i[1])+i[1]),p=this.getLength("width",this.getVWidth(),1.2*(i[2]-i[0])),g=this.getLength("height",this.getVHeight(),1.2*(i[3]-i[1]))):(o=this.getLength("x",this.getVWidth(),-.1)*(i[2]-i[0])+i[0],u=this.getLength("y",this.getVHeight(),-.1)*(i[3]-i[1])+i[1],p=this.getLength("width",this.getVWidth(),1.2)*(i[2]-i[0]),g=this.getLength("height",this.getVHeight(),1.2)*(i[3]-i[1])),r.rect(o,u,p,g).clip(),"objectBoundingBox"===this.attr("maskContentUnits")&&r.transform(i[2]-i[0],0,0,i[3]-i[1],i[0],i[1]),this.clip(),this.drawChildren(!1,!0),r.restore(),docEndGroup(y),docApplyMask(y,!0)}},fe=function SvgElemTextContainer(i,o){D.call(this,i,o),this.allowedChildren=["tspan","#text","#cdata-section","a"],this.isText=!0,this.getBoundingShape=function(){for(var r=new B,i=0;i Tj")}r.addContent("ET")}}}"line-through"===this.get("text-decoration")&&this.decorate(.05*this._font.size,.5*(getAscent(this._font.font,this._font.size)+getDescent(this._font.font,this._font.size)),i,o)},this.decorate=function(i,o,u,p){var g=this.getFill(u,p),y=this.getStroke(u,p);g&&docFillColor(g),y&&(docStrokeColor(y),r.lineWidth(this.get("stroke-width")).miterLimit(this.get("stroke-miterlimit")).lineJoin(this.get("stroke-linejoin")).lineCap(this.get("stroke-linecap")).dash(this.get("stroke-dasharray"),{phase:this.get("stroke-dashoffset")}));for(var w=0,_=this._pos;w<_.length;w++)if(!_[w].hidden&&isNotEqual(_[w].width,0)){var x=(o+i/2)*Math.sin(_[w].rotate),k=-(o+i/2)*Math.cos(_[w].rotate),P=(o-i/2)*Math.sin(_[w].rotate),O=-(o-i/2)*Math.cos(_[w].rotate),I=_[w].width*Math.cos(_[w].rotate),R=_[w].width*Math.sin(_[w].rotate);(new B).M(_[w].x+x,_[w].y+k).L(_[w].x+x+I,_[w].y+k+R).L(_[w].x+P+I,_[w].y+O+R).L(_[w].x+P,_[w].y+O).Z().insertInDocument(),g&&y?r.fillAndStroke():g?r.fill():y&&r.stroke()}}},he=function SvgElemTextNode(r,i){this.name=r.nodeName,this.textContent=r.nodeValue},de=function SvgElemTspan(r,i){fe.call(this,r,i)},pe=function SvgElemTextPath(r,i){var o;if(fe.call(this,r,i),(o=this.attr("path"))&&""!==o.trim()){var u=this.getLength("pathLength",this.getViewport());this.pathObject=(new B).path(o),this.pathLength=u>0?u:this.pathObject.totalLength,this.pathScale=this.pathObject.totalLength/this.pathLength}else if((o=this.getUrl("href")||this.getUrl("xlink:href"))&&"path"===o.nodeName){var p=new se(o,this);this.pathObject=p.shape.clone().transform(p.get("transform")),this.pathLength=this.chooseValue(p.pathLength,this.pathObject.totalLength),this.pathScale=this.pathObject.totalLength/this.pathLength}},ge=function SvgElemText(i,o){fe.call(this,i,o),this.allowedChildren=["textPath","tspan","#text","#cdata-section","a"],function(o){var u,p,g="",y=i.textContent,w=[],_=[],x=0,k=0;function doAnchoring(){if(_.length)for(var r=_[_.length-1],i=_[0],o=r.x+r.width-i.x,g={startltr:0,middleltr:.5,endltr:1,startrtl:1,middlertl:.5,endrtl:0}[u+p]*o||0,y=0;y<_.length;y++)_[y].x-=g;_=[]}function textOnPath(r){var i=r.pathObject,o=r.pathLength,u=r.pathScale;if(i)for(var p=r.getLength("startOffset",o,0),g=0;go||y<0)r._pos[g].hidden=!0;else{var w=i.getPointAtLength(y*u);isNotEqual(u,1)&&(r._pos[g].scale*=u,r._pos[g].width*=u),r._pos[g].x=w[0]-.5*r._pos[g].width*Math.cos(w[2])-r._pos[g].y*Math.sin(w[2]),r._pos[g].y=w[1]-.5*r._pos[g].width*Math.sin(w[2])+r._pos[g].y*Math.cos(w[2]),r._pos[g].rotate=w[2]+r._pos[g].rotate,r._pos[g].continuous=!1}}else for(var _=0;_0&&w<1/0)for(var _=0;_=2)for(var k=(i-(y-g))/(r.length-1),P=0;P0?y-4:y;for(o=0;o>16&255,_[x++]=i>>8&255,_[x++]=255&i;2===w&&(i=u[r.charCodeAt(o)]<<2|u[r.charCodeAt(o+1)]>>4,_[x++]=255&i);1===w&&(i=u[r.charCodeAt(o)]<<10|u[r.charCodeAt(o+1)]<<4|u[r.charCodeAt(o+2)]>>2,_[x++]=i>>8&255,_[x++]=255&i);return _},i.fromByteArray=function fromByteArray(r){for(var i,u=r.length,p=u%3,g=[],y=16383,w=0,_=u-p;w<_;w+=y)g.push(encodeChunk(r,w,w+y>_?_:w+y));1===p?(i=r[u-1],g.push(o[i>>2]+o[i<<4&63]+"==")):2===p&&(i=(r[u-2]<<8)+r[u-1],g.push(o[i>>10]+o[i>>4&63]+o[i<<2&63]+"="));return g.join("")};for(var o=[],u=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,w=g.length;y0)throw new Error("Invalid string. Length must be a multiple of 4");var o=r.indexOf("=");return-1===o&&(o=i),[o,o===i?0:4-o%4]}function encodeChunk(r,i,u){for(var p,g,y=[],w=i;w>18&63]+o[g>>12&63]+o[g>>6&63]+o[63&g]);return y.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},4181:function(r){var i=4096,o=new Uint32Array([0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215]);function BrotliBitReader(r){this.buf_=new Uint8Array(8224),this.input_=r,this.reset()}BrotliBitReader.READ_SIZE=i,BrotliBitReader.IBUF_MASK=8191,BrotliBitReader.prototype.reset=function(){this.buf_ptr_=0,this.val_=0,this.pos_=0,this.bit_pos_=0,this.bit_end_pos_=0,this.eos_=0,this.readMoreInput();for(var r=0;r<4;r++)this.val_|=this.buf_[this.pos_]<<8*r,++this.pos_;return this.bit_end_pos_>0},BrotliBitReader.prototype.readMoreInput=function(){if(!(this.bit_end_pos_>256))if(this.eos_){if(this.bit_pos_>this.bit_end_pos_)throw new Error("Unexpected end of input "+this.bit_pos_+" "+this.bit_end_pos_)}else{var r=this.buf_ptr_,o=this.input_.read(this.buf_,r,i);if(o<0)throw new Error("Unexpected end of input");if(o=8;)this.val_>>>=8,this.val_|=this.buf_[8191&this.pos_]<<24,++this.pos_,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},BrotliBitReader.prototype.readBits=function(r){32-this.bit_pos_>>this.bit_pos_&o[r];return this.bit_pos_+=r,i},r.exports=BrotliBitReader},7080:function(r,i){i.lookup=new Uint8Array([0,0,0,0,0,0,0,0,0,4,4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,12,16,12,12,20,12,16,24,28,12,12,32,12,36,12,44,44,44,44,44,44,44,44,44,44,32,32,24,40,28,12,12,48,52,52,52,48,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,24,12,28,12,12,12,56,60,60,60,56,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,24,12,28,12,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,40,40,40,40,41,41,41,41,42,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),i.lookupOffsets=new Uint16Array([1024,1536,1280,1536,0,256,768,512])},6450:function(r,i,o){var u=o(6154).g,p=o(6154).j,g=o(4181),y=o(5139),w=o(966).h,_=o(966).g,x=o(7080),k=o(8435),P=o(2973),O=1080,I=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),B=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),R=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),D=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function DecodeWindowBits(r){var i;return 0===r.readBits(1)?16:(i=r.readBits(3))>0?17+i:(i=r.readBits(3))>0?8+i:17}function DecodeVarLenUint8(r){if(r.readBits(1)){var i=r.readBits(3);return 0===i?1:r.readBits(i)+(1<1&&0===g)throw new Error("Invalid size byte");p.meta_block_length|=g<<8*u}}else for(u=0;u4&&0===y)throw new Error("Invalid size nibble");p.meta_block_length|=y<<4*u}return++p.meta_block_length,p.input_end||p.is_metadata||(p.is_uncompressed=r.readBits(1)),p}function ReadSymbol(r,i,o){var u;return o.fillBitWindow(),(u=r[i+=o.val_>>>o.bit_pos_&255].bits-8)>0&&(o.bit_pos_+=8,i+=r[i].value,i+=o.val_>>>o.bit_pos_&(1<>=1,++k;for(B=0;B0;++B){var U,j=I[B],G=0;u.fillBitWindow(),G+=u.val_>>>u.bit_pos_&15,u.bit_pos_+=W[G].bits,U=W[G].value,R[j]=U,0!==U&&(D-=32>>U,++N)}if(1!==N&&0!==D)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function ReadHuffmanCodeLengths(r,i,o,u){for(var p=0,g=8,y=0,x=0,k=32768,P=[],O=0;O<32;O++)P.push(new w(0,0));for(_(P,0,5,r,18);p0;){var I,B=0;if(u.readMoreInput(),u.fillBitWindow(),B+=u.val_>>>u.bit_pos_&31,u.bit_pos_+=P[B].bits,(I=255&P[B].value)<16)y=0,o[p++]=I,0!==I&&(g=I,k-=32768>>I);else{var R,D,N=I-14,W=0;if(16===I&&(W=g),x!==W&&(y=0,x=W),R=y,y>0&&(y-=2,y<<=N),p+(D=(y+=u.readBits(N)+3)-R)>i)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var U=0;U>>5]),this.htrees=new Uint32Array(i)}function DecodeContextMap(r,i){var o,u,p={num_htrees:null,context_map:null},g=0;i.readMoreInput();var y=p.num_htrees=DecodeVarLenUint8(i)+1,_=p.context_map=new Uint8Array(r);if(y<=1)return p;for(i.readBits(1)&&(g=i.readBits(4)+1),o=[],u=0;u=r)throw new Error("[DecodeContextMap] i >= context_map_size");_[u]=0,++u}else _[u]=x-g,++u}return i.readBits(1)&&function InverseMoveToFrontTransform(r,i){var o,u=new Uint8Array(256);for(o=0;o<256;++o)u[o]=o;for(o=0;o=r&&(w-=r),u[o]=w,p[_+(1&g[x])]=w,++g[x]}function CopyUncompressedBlockToOutput(r,i,o,u,p,y){var w,_=p+1,x=o&p,k=y.pos_&g.IBUF_MASK;if(i<8||y.bit_pos_+(i<<3)0;)y.readMoreInput(),u[x++]=y.readBits(8),x===_&&(r.write(u,_),x=0);else{if(y.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;y.bit_pos_<32;)u[x]=y.val_>>>y.bit_pos_,y.bit_pos_+=8,++x,--i;if(k+(w=y.bit_end_pos_-y.bit_pos_>>3)>g.IBUF_MASK){for(var P=g.IBUF_MASK+1-k,O=0;O=_){r.write(u,_),x-=_;for(O=0;O=_;){if(w=_-x,y.input_.read(u,x,w)i.buffer.length){var Ae=new Uint8Array(U+de);Ae.set(i.buffer),i.buffer=Ae}if(j=Pe.input_end,re=Pe.is_uncompressed,Pe.is_metadata)for(JumpToByteBoundary(W);de>0;--de)W.readMoreInput(),W.readBits(8);else if(0!==de)if(re)W.bit_pos_=W.bit_pos_+7&-8,CopyUncompressedBlockToOutput(i,de,U,B,I,W),U+=de;else{for(o=0;o<3;++o)ye[o]=DecodeVarLenUint8(W)+1,ye[o]>=2&&(ReadHuffmanCode(ye[o]+2,D,o*O,W),ReadHuffmanCode(26,N,o*O,W),pe[o]=ReadBlockLength(N,o*O,W),me[o]=1);for(W.readMoreInput(),oe=(1<<(ne=W.readBits(2)))-1,ae=(ie=16+(W.readBits(4)<0;){var Oe,Ie,Be,Fe,Le,Re,De,Me,Ne,We,Ue,ze;for(W.readMoreInput(),0===pe[1]&&(DecodeBlockType(ye[1],D,1,ge,ve,me,W),pe[1]=ReadBlockLength(N,O,W),he=$[1].htrees[ge[1]]),--pe[1],(Ie=(Oe=ReadSymbol($[1].codes,he,W))>>6)>=2?(Ie-=2,De=-1):De=0,Be=k.kInsertRangeLut[Ie]+(Oe>>3&7),Fe=k.kCopyRangeLut[Ie]+(7&Oe),Le=k.kInsertLengthPrefixCode[Be].offset+W.readBits(k.kInsertLengthPrefixCode[Be].nbits),Re=k.kCopyLengthPrefixCode[Fe].offset+W.readBits(k.kCopyLengthPrefixCode[Fe].nbits),Y=B[U-1&I],J=B[U-2&I],Ne=0;Ne4?3:Re-2))],(De=ReadSymbol($[2].codes,$[2].htrees[xe],W))>=ie)ze=(De-=ie)&oe,De=ie+((je=(2+(1&(De>>=ne))<<(Ue=1+(De>>1)))-4)+W.readBits(Ue)<(G=U=y.minDictionaryWordLength&&Re<=y.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+U+" distance: "+Me+" len: "+Re+" bytes left: "+de);var je=y.offsetsByLength[Re],Ge=Me-G-1,Ve=y.sizeBitsByLength[Re],He=Ge>>Ve;if(je+=(Ge&(1<=R){i.write(B,_);for(var Xe=0;Xe0&&(X[3&K]=Me,++K),Re>de)throw new Error("Invalid backward reference. pos: "+U+" distance: "+Me+" len: "+Re+" bytes left: "+de);for(Ne=0;Ne>=1;return(r&o-1)+o}function ReplicateValue(r,i,o,u,p){do{r[i+(u-=o)]=new HuffmanCode(p.bits,p.value)}while(u>0)}function NextTableBitSize(r,i,u){for(var p=1<0;--N[y])ReplicateValue(r,i+_,x,I,new HuffmanCode(255&y,65535&R[w++])),_=GetNextKey(_,y);for(P=B-1,k=-1,y=u+1,x=2;y<=o;++y,x<<=1)for(;N[y]>0;--N[y])(_&P)!==k&&(i+=I,B+=I=1<<(O=NextTableBitSize(N,y,u)),r[D+(k=_&P)]=new HuffmanCode(O+u&255,i-D-k&65535)),ReplicateValue(r,i+(_>>u),x,I,new HuffmanCode(y-u&255,65535&R[w++])),_=GetNextKey(_,y);return B}},8435:function(r,i){function PrefixCodeRange(r,i){this.offset=r,this.nbits=i}i.kBlockLengthPrefixCode=[new PrefixCodeRange(1,2),new PrefixCodeRange(5,2),new PrefixCodeRange(9,2),new PrefixCodeRange(13,2),new PrefixCodeRange(17,3),new PrefixCodeRange(25,3),new PrefixCodeRange(33,3),new PrefixCodeRange(41,3),new PrefixCodeRange(49,4),new PrefixCodeRange(65,4),new PrefixCodeRange(81,4),new PrefixCodeRange(97,4),new PrefixCodeRange(113,5),new PrefixCodeRange(145,5),new PrefixCodeRange(177,5),new PrefixCodeRange(209,5),new PrefixCodeRange(241,6),new PrefixCodeRange(305,6),new PrefixCodeRange(369,7),new PrefixCodeRange(497,8),new PrefixCodeRange(753,9),new PrefixCodeRange(1265,10),new PrefixCodeRange(2289,11),new PrefixCodeRange(4337,12),new PrefixCodeRange(8433,13),new PrefixCodeRange(16625,24)],i.kInsertLengthPrefixCode=[new PrefixCodeRange(0,0),new PrefixCodeRange(1,0),new PrefixCodeRange(2,0),new PrefixCodeRange(3,0),new PrefixCodeRange(4,0),new PrefixCodeRange(5,0),new PrefixCodeRange(6,1),new PrefixCodeRange(8,1),new PrefixCodeRange(10,2),new PrefixCodeRange(14,2),new PrefixCodeRange(18,3),new PrefixCodeRange(26,3),new PrefixCodeRange(34,4),new PrefixCodeRange(50,4),new PrefixCodeRange(66,5),new PrefixCodeRange(98,5),new PrefixCodeRange(130,6),new PrefixCodeRange(194,7),new PrefixCodeRange(322,8),new PrefixCodeRange(578,9),new PrefixCodeRange(1090,10),new PrefixCodeRange(2114,12),new PrefixCodeRange(6210,14),new PrefixCodeRange(22594,24)],i.kCopyLengthPrefixCode=[new PrefixCodeRange(2,0),new PrefixCodeRange(3,0),new PrefixCodeRange(4,0),new PrefixCodeRange(5,0),new PrefixCodeRange(6,0),new PrefixCodeRange(7,0),new PrefixCodeRange(8,0),new PrefixCodeRange(9,0),new PrefixCodeRange(10,1),new PrefixCodeRange(12,1),new PrefixCodeRange(14,2),new PrefixCodeRange(18,2),new PrefixCodeRange(22,3),new PrefixCodeRange(30,3),new PrefixCodeRange(38,4),new PrefixCodeRange(54,4),new PrefixCodeRange(70,5),new PrefixCodeRange(102,5),new PrefixCodeRange(134,6),new PrefixCodeRange(198,7),new PrefixCodeRange(326,8),new PrefixCodeRange(582,9),new PrefixCodeRange(1094,10),new PrefixCodeRange(2118,24)],i.kInsertRangeLut=[0,0,8,8,0,16,8,16,16],i.kCopyRangeLut=[0,8,0,8,16,0,16,8,16]},6154:function(r,i){function BrotliInput(r){this.buffer=r,this.pos=0}function BrotliOutput(r){this.buffer=r,this.pos=0}BrotliInput.prototype.read=function(r,i,o){this.pos+o>this.buffer.length&&(o=this.buffer.length-this.pos);for(var u=0;uthis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(r.subarray(0,i),this.pos),this.pos+=i,i},i.j=BrotliOutput},2973:function(r,i,o){var u=o(5139),p=10,g=11;function Transform(r,i,o){this.prefix=new Uint8Array(r.length),this.transform=i,this.suffix=new Uint8Array(o.length);for(var u=0;u'),new Transform("",0,"\n"),new Transform("",3,""),new Transform("",0,"]"),new Transform("",0," for "),new Transform("",14,""),new Transform("",2,""),new Transform("",0," a "),new Transform("",0," that "),new Transform(" ",p,""),new Transform("",0,". "),new Transform(".",0,""),new Transform(" ",0,", "),new Transform("",15,""),new Transform("",0," with "),new Transform("",0,"'"),new Transform("",0," from "),new Transform("",0," by "),new Transform("",16,""),new Transform("",17,""),new Transform(" the ",0,""),new Transform("",4,""),new Transform("",0,". The "),new Transform("",g,""),new Transform("",0," on "),new Transform("",0," as "),new Transform("",0," is "),new Transform("",7,""),new Transform("",1,"ing "),new Transform("",0,"\n\t"),new Transform("",0,":"),new Transform(" ",0,". "),new Transform("",0,"ed "),new Transform("",20,""),new Transform("",18,""),new Transform("",6,""),new Transform("",0,"("),new Transform("",p,", "),new Transform("",8,""),new Transform("",0," at "),new Transform("",0,"ly "),new Transform(" the ",0," of "),new Transform("",5,""),new Transform("",9,""),new Transform(" ",p,", "),new Transform("",p,'"'),new Transform(".",0,"("),new Transform("",g," "),new Transform("",p,'">'),new Transform("",0,'="'),new Transform(" ",0,"."),new Transform(".com/",0,""),new Transform(" the ",0," of the "),new Transform("",p,"'"),new Transform("",0,". This "),new Transform("",0,","),new Transform(".",0," "),new Transform("",p,"("),new Transform("",p,"."),new Transform("",0," not "),new Transform(" ",0,'="'),new Transform("",0,"er "),new Transform(" ",g," "),new Transform("",0,"al "),new Transform(" ",g,""),new Transform("",0,"='"),new Transform("",g,'"'),new Transform("",p,". "),new Transform(" ",0,"("),new Transform("",0,"ful "),new Transform(" ",p,". "),new Transform("",0,"ive "),new Transform("",0,"less "),new Transform("",g,"'"),new Transform("",0,"est "),new Transform(" ",p,"."),new Transform("",g,'">'),new Transform(" ",0,"='"),new Transform("",p,","),new Transform("",0,"ize "),new Transform("",g,"."),new Transform(" ",0,""),new Transform(" ",0,","),new Transform("",p,'="'),new Transform("",g,'="'),new Transform("",0,"ous "),new Transform("",g,", "),new Transform("",p,"='"),new Transform(" ",p,","),new Transform(" ",g,'="'),new Transform(" ",g,", "),new Transform("",g,","),new Transform("",g,"("),new Transform("",g,". "),new Transform(" ",g,"."),new Transform("",g,"='"),new Transform(" ",g,". "),new Transform(" ",p,'="'),new Transform(" ",g,"='"),new Transform(" ",p,"='")];function ToUpperCase(r,i){return r[i]<192?(r[i]>=97&&r[i]<=122&&(r[i]^=32),1):r[i]<224?(r[i+1]^=32,2):(r[i+2]^=5,3)}i.kTransforms=y,i.kNumTransforms=y.length,i.transformDictionaryWord=function(r,i,o,w,_){var x,k=y[_].prefix,P=y[_].suffix,O=y[_].transform,I=O<12?0:O-11,B=0,R=i;I>w&&(I=w);for(var D=0;D0;){var N=ToUpperCase(r,x);x+=N,w-=N}for(var W=0;Wi.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=r,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}Zlib.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,g(this.init_done,"close before init"),g(this.mode<=i.UNZIP),this.mode===i.DEFLATE||this.mode===i.GZIP||this.mode===i.DEFLATERAW?w.deflateEnd(this.strm):this.mode!==i.INFLATE&&this.mode!==i.GUNZIP&&this.mode!==i.INFLATERAW&&this.mode!==i.UNZIP||_.inflateEnd(this.strm),this.mode=i.NONE,this.dictionary=null)},Zlib.prototype.write=function(r,i,o,u,p,g,y){return this._write(!0,r,i,o,u,p,g,y)},Zlib.prototype.writeSync=function(r,i,o,u,p,g,y){return this._write(!1,r,i,o,u,p,g,y)},Zlib.prototype._write=function(r,o,y,w,_,x,k,P){if(g.equal(arguments.length,8),g(this.init_done,"write before init"),g(this.mode!==i.NONE,"already finalized"),g.equal(!1,this.write_in_progress,"write already in progress"),g.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,g.equal(!1,void 0===o,"must provide flush value"),this.write_in_progress=!0,o!==i.Z_NO_FLUSH&&o!==i.Z_PARTIAL_FLUSH&&o!==i.Z_SYNC_FLUSH&&o!==i.Z_FULL_FLUSH&&o!==i.Z_FINISH&&o!==i.Z_BLOCK)throw new Error("Invalid flush value");if(null==y&&(y=u.alloc(0),_=0,w=0),this.strm.avail_in=_,this.strm.input=y,this.strm.next_in=w,this.strm.avail_out=P,this.strm.output=x,this.strm.next_out=k,this.flush=o,!r)return this._process(),this._checkError()?this._afterSync():void 0;var O=this;return p.nextTick((function(){O._process(),O._after()})),this},Zlib.prototype._afterSync=function(){var r=this.strm.avail_out,i=this.strm.avail_in;return this.write_in_progress=!1,[i,r]},Zlib.prototype._process=function(){var r=null;switch(this.mode){case i.DEFLATE:case i.GZIP:case i.DEFLATERAW:this.err=w.deflate(this.strm,this.flush);break;case i.UNZIP:switch(this.strm.avail_in>0&&(r=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===r)break;if(31!==this.strm.input[r]){this.mode=i.INFLATE;break}if(this.gzip_id_bytes_read=1,r++,1===this.strm.avail_in)break;case 1:if(null===r)break;139===this.strm.input[r]?(this.gzip_id_bytes_read=2,this.mode=i.GUNZIP):this.mode=i.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case i.INFLATE:case i.GUNZIP:case i.INFLATERAW:for(this.err=_.inflate(this.strm,this.flush),this.err===i.Z_NEED_DICT&&this.dictionary&&(this.err=_.inflateSetDictionary(this.strm,this.dictionary),this.err===i.Z_OK?this.err=_.inflate(this.strm,this.flush):this.err===i.Z_DATA_ERROR&&(this.err=i.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===i.GUNZIP&&this.err===i.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=_.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},Zlib.prototype._checkError=function(){switch(this.err){case i.Z_OK:case i.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===i.Z_FINISH)return this._error("unexpected end of file"),!1;break;case i.Z_STREAM_END:break;case i.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},Zlib.prototype._after=function(){if(this._checkError()){var r=this.strm.avail_out,i=this.strm.avail_in;this.write_in_progress=!1,this.callback(i,r),this.pending_close&&this.close()}},Zlib.prototype._error=function(r){this.strm.msg&&(r=this.strm.msg),this.onerror(r,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},Zlib.prototype.init=function(r,o,u,p,y){g(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),g(r>=8&&r<=15,"invalid windowBits"),g(o>=-1&&o<=9,"invalid compression level"),g(u>=1&&u<=9,"invalid memlevel"),g(p===i.Z_FILTERED||p===i.Z_HUFFMAN_ONLY||p===i.Z_RLE||p===i.Z_FIXED||p===i.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(o,r,u,p,y),this._setDictionary()},Zlib.prototype.params=function(){throw new Error("deflateParams Not supported")},Zlib.prototype.reset=function(){this._reset(),this._setDictionary()},Zlib.prototype._init=function(r,o,u,p,g){switch(this.level=r,this.windowBits=o,this.memLevel=u,this.strategy=p,this.flush=i.Z_NO_FLUSH,this.err=i.Z_OK,this.mode!==i.GZIP&&this.mode!==i.GUNZIP||(this.windowBits+=16),this.mode===i.UNZIP&&(this.windowBits+=32),this.mode!==i.DEFLATERAW&&this.mode!==i.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new y,this.mode){case i.DEFLATE:case i.GZIP:case i.DEFLATERAW:this.err=w.deflateInit2(this.strm,this.level,i.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case i.INFLATE:case i.GUNZIP:case i.INFLATERAW:case i.UNZIP:this.err=_.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==i.Z_OK&&this._error("Init error"),this.dictionary=g,this.write_in_progress=!1,this.init_done=!0},Zlib.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=i.Z_OK,this.mode){case i.DEFLATE:case i.DEFLATERAW:this.err=w.deflateSetDictionary(this.strm,this.dictionary)}this.err!==i.Z_OK&&this._error("Failed to set dictionary")}},Zlib.prototype._reset=function(){switch(this.err=i.Z_OK,this.mode){case i.DEFLATE:case i.DEFLATERAW:case i.GZIP:this.err=w.deflateReset(this.strm);break;case i.INFLATE:case i.INFLATERAW:case i.GUNZIP:this.err=_.inflateReset(this.strm)}this.err!==i.Z_OK&&this._error("Failed to reset stream")},i.Zlib=Zlib},2635:function(r,i,o){"use strict";var u=o(4155),p=o(8823).Buffer,g=o(2830).Transform,y=o(4505),w=o(9539),_=o(9282).ok,x=o(8823).kMaxLength,k="Cannot create final Buffer. It would be larger than 0x"+x.toString(16)+" bytes";y.Z_MIN_WINDOWBITS=8,y.Z_MAX_WINDOWBITS=15,y.Z_DEFAULT_WINDOWBITS=15,y.Z_MIN_CHUNK=64,y.Z_MAX_CHUNK=1/0,y.Z_DEFAULT_CHUNK=16384,y.Z_MIN_MEMLEVEL=1,y.Z_MAX_MEMLEVEL=9,y.Z_DEFAULT_MEMLEVEL=8,y.Z_MIN_LEVEL=-1,y.Z_MAX_LEVEL=9,y.Z_DEFAULT_LEVEL=y.Z_DEFAULT_COMPRESSION;for(var P=Object.keys(y),O=0;O=x?y=new RangeError(k):i=p.concat(u,g),u=[],r.close(),o(y,i)}r.on("error",(function onError(i){r.removeListener("end",onEnd),r.removeListener("readable",flow),o(i)})),r.on("end",onEnd),r.end(i),flow()}function zlibBufferSync(r,i){if("string"==typeof i&&(i=p.from(i)),!p.isBuffer(i))throw new TypeError("Not a string or buffer");var o=r._finishFlushFlag;return r._processChunk(i,o)}function Deflate(r){if(!(this instanceof Deflate))return new Deflate(r);Zlib.call(this,r,y.DEFLATE)}function Inflate(r){if(!(this instanceof Inflate))return new Inflate(r);Zlib.call(this,r,y.INFLATE)}function Gzip(r){if(!(this instanceof Gzip))return new Gzip(r);Zlib.call(this,r,y.GZIP)}function Gunzip(r){if(!(this instanceof Gunzip))return new Gunzip(r);Zlib.call(this,r,y.GUNZIP)}function DeflateRaw(r){if(!(this instanceof DeflateRaw))return new DeflateRaw(r);Zlib.call(this,r,y.DEFLATERAW)}function InflateRaw(r){if(!(this instanceof InflateRaw))return new InflateRaw(r);Zlib.call(this,r,y.INFLATERAW)}function Unzip(r){if(!(this instanceof Unzip))return new Unzip(r);Zlib.call(this,r,y.UNZIP)}function isValidFlushFlag(r){return r===y.Z_NO_FLUSH||r===y.Z_PARTIAL_FLUSH||r===y.Z_SYNC_FLUSH||r===y.Z_FULL_FLUSH||r===y.Z_FINISH||r===y.Z_BLOCK}function Zlib(r,o){var u=this;if(this._opts=r=r||{},this._chunkSize=r.chunkSize||i.Z_DEFAULT_CHUNK,g.call(this,r),r.flush&&!isValidFlushFlag(r.flush))throw new Error("Invalid flush flag: "+r.flush);if(r.finishFlush&&!isValidFlushFlag(r.finishFlush))throw new Error("Invalid flush flag: "+r.finishFlush);if(this._flushFlag=r.flush||y.Z_NO_FLUSH,this._finishFlushFlag=void 0!==r.finishFlush?r.finishFlush:y.Z_FINISH,r.chunkSize&&(r.chunkSizei.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+r.chunkSize);if(r.windowBits&&(r.windowBitsi.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+r.windowBits);if(r.level&&(r.leveli.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+r.level);if(r.memLevel&&(r.memLeveli.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+r.memLevel);if(r.strategy&&r.strategy!=i.Z_FILTERED&&r.strategy!=i.Z_HUFFMAN_ONLY&&r.strategy!=i.Z_RLE&&r.strategy!=i.Z_FIXED&&r.strategy!=i.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+r.strategy);if(r.dictionary&&!p.isBuffer(r.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new y.Zlib(o);var w=this;this._hadError=!1,this._handle.onerror=function(r,o){_close(w),w._hadError=!0;var u=new Error(r);u.errno=o,u.code=i.codes[o],w.emit("error",u)};var _=i.Z_DEFAULT_COMPRESSION;"number"==typeof r.level&&(_=r.level);var x=i.Z_DEFAULT_STRATEGY;"number"==typeof r.strategy&&(x=r.strategy),this._handle.init(r.windowBits||i.Z_DEFAULT_WINDOWBITS,_,r.memLevel||i.Z_DEFAULT_MEMLEVEL,x,r.dictionary),this._buffer=p.allocUnsafe(this._chunkSize),this._offset=0,this._level=_,this._strategy=x,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!u._handle},configurable:!0,enumerable:!0})}function _close(r,i){i&&u.nextTick(i),r._handle&&(r._handle.close(),r._handle=null)}function emitCloseNT(r){r.emit("close")}Object.defineProperty(i,"codes",{enumerable:!0,value:Object.freeze(B),writable:!1}),i.Deflate=Deflate,i.Inflate=Inflate,i.Gzip=Gzip,i.Gunzip=Gunzip,i.DeflateRaw=DeflateRaw,i.InflateRaw=InflateRaw,i.Unzip=Unzip,i.createDeflate=function(r){return new Deflate(r)},i.createInflate=function(r){return new Inflate(r)},i.createDeflateRaw=function(r){return new DeflateRaw(r)},i.createInflateRaw=function(r){return new InflateRaw(r)},i.createGzip=function(r){return new Gzip(r)},i.createGunzip=function(r){return new Gunzip(r)},i.createUnzip=function(r){return new Unzip(r)},i.deflate=function(r,i,o){return"function"==typeof i&&(o=i,i={}),zlibBuffer(new Deflate(i),r,o)},i.deflateSync=function(r,i){return zlibBufferSync(new Deflate(i),r)},i.gzip=function(r,i,o){return"function"==typeof i&&(o=i,i={}),zlibBuffer(new Gzip(i),r,o)},i.gzipSync=function(r,i){return zlibBufferSync(new Gzip(i),r)},i.deflateRaw=function(r,i,o){return"function"==typeof i&&(o=i,i={}),zlibBuffer(new DeflateRaw(i),r,o)},i.deflateRawSync=function(r,i){return zlibBufferSync(new DeflateRaw(i),r)},i.unzip=function(r,i,o){return"function"==typeof i&&(o=i,i={}),zlibBuffer(new Unzip(i),r,o)},i.unzipSync=function(r,i){return zlibBufferSync(new Unzip(i),r)},i.inflate=function(r,i,o){return"function"==typeof i&&(o=i,i={}),zlibBuffer(new Inflate(i),r,o)},i.inflateSync=function(r,i){return zlibBufferSync(new Inflate(i),r)},i.gunzip=function(r,i,o){return"function"==typeof i&&(o=i,i={}),zlibBuffer(new Gunzip(i),r,o)},i.gunzipSync=function(r,i){return zlibBufferSync(new Gunzip(i),r)},i.inflateRaw=function(r,i,o){return"function"==typeof i&&(o=i,i={}),zlibBuffer(new InflateRaw(i),r,o)},i.inflateRawSync=function(r,i){return zlibBufferSync(new InflateRaw(i),r)},w.inherits(Zlib,g),Zlib.prototype.params=function(r,o,p){if(ri.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+r);if(o!=i.Z_FILTERED&&o!=i.Z_HUFFMAN_ONLY&&o!=i.Z_RLE&&o!=i.Z_FIXED&&o!=i.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+o);if(this._level!==r||this._strategy!==o){var g=this;this.flush(y.Z_SYNC_FLUSH,(function(){_(g._handle,"zlib binding closed"),g._handle.params(r,o),g._hadError||(g._level=r,g._strategy=o,p&&p())}))}else u.nextTick(p)},Zlib.prototype.reset=function(){return _(this._handle,"zlib binding closed"),this._handle.reset()},Zlib.prototype._flush=function(r){this._transform(p.alloc(0),"",r)},Zlib.prototype.flush=function(r,i){var o=this,g=this._writableState;("function"==typeof r||void 0===r&&!i)&&(i=r,r=y.Z_FULL_FLUSH),g.ended?i&&u.nextTick(i):g.ending?i&&this.once("end",i):g.needDrain?i&&this.once("drain",(function(){return o.flush(r,i)})):(this._flushFlag=r,this.write(p.alloc(0),"",i))},Zlib.prototype.close=function(r){_close(this,r),u.nextTick(emitCloseNT,this)},Zlib.prototype._transform=function(r,i,o){var u,g=this._writableState,w=(g.ending||g.ended)&&(!r||g.length===r.length);return null===r||p.isBuffer(r)?this._handle?(w?u=this._finishFlushFlag:(u=this._flushFlag,r.length>=g.length&&(this._flushFlag=this._opts.flush||y.Z_NO_FLUSH)),void this._processChunk(r,u,o)):o(new Error("zlib binding closed")):o(new Error("invalid input"))},Zlib.prototype._processChunk=function(r,i,o){var u=r&&r.length,g=this._chunkSize-this._offset,y=0,w=this,P="function"==typeof o;if(!P){var O,I=[],B=0;this.on("error",(function(r){O=r})),_(this._handle,"zlib binding closed");do{var R=this._handle.writeSync(i,r,y,u,this._buffer,this._offset,g)}while(!this._hadError&&callback(R[0],R[1]));if(this._hadError)throw O;if(B>=x)throw _close(this),new RangeError(k);var D=p.concat(I,B);return _close(this),D}_(this._handle,"zlib binding closed");var N=this._handle.write(i,r,y,u,this._buffer,this._offset,g);function callback(x,k){if(this&&(this.buffer=null,this.callback=null),!w._hadError){var O=g-k;if(_(O>=0,"have should not go down"),O>0){var R=w._buffer.slice(w._offset,w._offset+O);w._offset+=O,P?w.push(R):(I.push(R),B+=R.length)}if((0===k||w._offset>=w._chunkSize)&&(g=w._chunkSize,w._offset=0,w._buffer=p.allocUnsafe(w._chunkSize)),0===k){if(y+=u-x,u=x,!P)return!0;var D=w._handle.write(i,r,y,u,w._buffer,w._offset,w._chunkSize);return D.callback=callback,void(D.buffer=r)}if(!P)return!1;o()}}N.buffer=r,N.callback=callback},w.inherits(Deflate,Zlib),w.inherits(Inflate,Zlib),w.inherits(Gzip,Zlib),w.inherits(Gunzip,Zlib),w.inherits(DeflateRaw,Zlib),w.inherits(InflateRaw,Zlib),w.inherits(Unzip,Zlib)},1924:function(r,i,o){"use strict";var u=o(210),p=o(5559),g=p(u("String.prototype.indexOf"));r.exports=function callBoundIntrinsic(r,i){var o=u(r,!!i);return"function"==typeof o&&g(r,".prototype.")>-1?p(o):o}},5559:function(r,i,o){"use strict";var u=o(8612),p=o(210),g=p("%Function.prototype.apply%"),y=p("%Function.prototype.call%"),w=p("%Reflect.apply%",!0)||u.call(y,g),_=p("%Object.getOwnPropertyDescriptor%",!0),x=p("%Object.defineProperty%",!0),k=p("%Math.max%");if(x)try{x({},"a",{value:1})}catch(r){x=null}r.exports=function callBind(r){var i=w(u,y,arguments);if(_&&x){var o=_(i,"length");o.configurable&&x(i,"length",{value:1+k(0,r.length-(arguments.length-1))})}return i};var P=function applyBind(){return w(u,g,arguments)};x?x(r.exports,"apply",{value:P}):r.exports.apply=P},6313:function(r,i,o){var u=o(8823).Buffer,p=function(){"use strict";function clone(r,i,o,p){"object"==typeof i&&(o=i.depth,p=i.prototype,i.filter,i=i.circular);var g=[],y=[],w=void 0!==u;return void 0===i&&(i=!0),void 0===o&&(o=1/0),function _clone(r,o){if(null===r)return null;if(0==o)return r;var _,x;if("object"!=typeof r)return r;if(clone.__isArray(r))_=[];else if(clone.__isRegExp(r))_=new RegExp(r.source,__getRegExpFlags(r)),r.lastIndex&&(_.lastIndex=r.lastIndex);else if(clone.__isDate(r))_=new Date(r.getTime());else{if(w&&u.isBuffer(r))return _=u.allocUnsafe?u.allocUnsafe(r.length):new u(r.length),r.copy(_),_;void 0===p?(x=Object.getPrototypeOf(r),_=Object.create(x)):(_=Object.create(p),x=p)}if(i){var k=g.indexOf(r);if(-1!=k)return y[k];g.push(r),y.push(_)}for(var P in r){var O;x&&(O=Object.getOwnPropertyDescriptor(x,P)),O&&null==O.set||(_[P]=_clone(r[P],o-1))}return _}(r,o)}function __objToStr(r){return Object.prototype.toString.call(r)}function __getRegExpFlags(r){var i="";return r.global&&(i+="g"),r.ignoreCase&&(i+="i"),r.multiline&&(i+="m"),i}return clone.clonePrototype=function clonePrototype(r){if(null===r)return null;var c=function(){};return c.prototype=r,new c},clone.__objToStr=__objToStr,clone.__isDate=function __isDate(r){return"object"==typeof r&&"[object Date]"===__objToStr(r)},clone.__isArray=function __isArray(r){return"object"==typeof r&&"[object Array]"===__objToStr(r)},clone.__isRegExp=function __isRegExp(r){return"object"==typeof r&&"[object RegExp]"===__objToStr(r)},clone.__getRegExpFlags=__getRegExpFlags,clone}();r.exports&&(r.exports=p)},4667:function(r,i,o){o(2479);var u=o(857);r.exports=u.Object.values},7633:function(r,i,o){o(9170),o(6992),o(1539),o(8674),o(7922),o(4668),o(7727),o(8783);var u=o(857);r.exports=u.Promise},3867:function(r,i,o){var u=o(1150);o(8628),o(7314),o(7479),o(6290),r.exports=u},9662:function(r,i,o){var u=o(7854),p=o(614),g=o(6330),y=u.TypeError;r.exports=function(r){if(p(r))return r;throw y(g(r)+" is not a function")}},9483:function(r,i,o){var u=o(7854),p=o(4411),g=o(6330),y=u.TypeError;r.exports=function(r){if(p(r))return r;throw y(g(r)+" is not a constructor")}},6077:function(r,i,o){var u=o(7854),p=o(614),g=u.String,y=u.TypeError;r.exports=function(r){if("object"==typeof r||p(r))return r;throw y("Can't set "+g(r)+" as a prototype")}},1223:function(r,i,o){var u=o(5112),p=o(30),g=o(3070),y=u("unscopables"),w=Array.prototype;null==w[y]&&g.f(w,y,{configurable:!0,value:p(null)}),r.exports=function(r){w[y][r]=!0}},1530:function(r,i,o){"use strict";var u=o(8710).charAt;r.exports=function(r,i,o){return i+(o?u(r,i).length:1)}},5787:function(r,i,o){var u=o(7854),p=o(7976),g=u.TypeError;r.exports=function(r,i){if(p(i,r))return r;throw g("Incorrect invocation")}},9670:function(r,i,o){var u=o(7854),p=o(111),g=u.String,y=u.TypeError;r.exports=function(r){if(p(r))return r;throw y(g(r)+" is not an object")}},1048:function(r,i,o){"use strict";var u=o(7908),p=o(1400),g=o(6244),y=Math.min;r.exports=[].copyWithin||function copyWithin(r,i){var o=u(this),w=g(o),_=p(r,w),x=p(i,w),k=arguments.length>2?arguments[2]:void 0,P=y((void 0===k?w:p(k,w))-x,w-_),O=1;for(x<_&&_0;)x in o?o[_]=o[x]:delete o[_],_+=O,x+=O;return o}},1285:function(r,i,o){"use strict";var u=o(7908),p=o(1400),g=o(6244);r.exports=function fill(r){for(var i=u(this),o=g(i),y=arguments.length,w=p(y>1?arguments[1]:void 0,o),_=y>2?arguments[2]:void 0,x=void 0===_?o:p(_,o);x>w;)i[w++]=r;return i}},8533:function(r,i,o){"use strict";var u=o(2092).forEach,p=o(9341)("forEach");r.exports=p?[].forEach:function forEach(r){return u(this,r,arguments.length>1?arguments[1]:void 0)}},7745:function(r){r.exports=function(r,i){for(var o=0,u=i.length,p=new r(u);u>o;)p[o]=i[o++];return p}},8457:function(r,i,o){"use strict";var u=o(7854),p=o(9974),g=o(6916),y=o(7908),w=o(3411),_=o(7659),x=o(4411),k=o(6244),P=o(6135),O=o(8554),I=o(1246),B=u.Array;r.exports=function from(r){var i=y(r),o=x(this),u=arguments.length,R=u>1?arguments[1]:void 0,D=void 0!==R;D&&(R=p(R,u>2?arguments[2]:void 0));var N,W,U,j,G,X,K=I(i),Y=0;if(!K||this==B&&_(K))for(N=k(i),W=o?new this(N):B(N);N>Y;Y++)X=D?R(i[Y],Y):i[Y],P(W,Y,X);else for(G=(j=O(i,K)).next,W=o?new this:[];!(U=g(G,j)).done;Y++)X=D?w(j,R,[U.value,Y],!0):U.value,P(W,Y,X);return W.length=Y,W}},1318:function(r,i,o){var u=o(5656),p=o(1400),g=o(6244),createMethod=function(r){return function(i,o,y){var w,_=u(i),x=g(_),k=p(y,x);if(r&&o!=o){for(;x>k;)if((w=_[k++])!=w)return!0}else for(;x>k;k++)if((r||k in _)&&_[k]===o)return r||k||0;return!r&&-1}};r.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},2092:function(r,i,o){var u=o(9974),p=o(1702),g=o(8361),y=o(7908),w=o(6244),_=o(5417),x=p([].push),createMethod=function(r){var i=1==r,o=2==r,p=3==r,k=4==r,P=6==r,O=7==r,I=5==r||P;return function(B,R,D,N){for(var W,U,j=y(B),G=g(j),X=u(R,D),K=w(G),Y=0,J=N||_,$=i?J(B,K):o||O?J(B,0):void 0;K>Y;Y++)if((I||Y in G)&&(U=X(W=G[Y],Y,j),r))if(i)$[Y]=U;else if(U)switch(r){case 3:return!0;case 5:return W;case 6:return Y;case 2:x($,W)}else switch(r){case 4:return!1;case 7:x($,W)}return P?-1:p||k?k:$}};r.exports={forEach:createMethod(0),map:createMethod(1),filter:createMethod(2),some:createMethod(3),every:createMethod(4),find:createMethod(5),findIndex:createMethod(6),filterReject:createMethod(7)}},6583:function(r,i,o){"use strict";var u=o(2104),p=o(5656),g=o(9303),y=o(6244),w=o(9341),_=Math.min,x=[].lastIndexOf,k=!!x&&1/[1].lastIndexOf(1,-0)<0,P=w("lastIndexOf"),O=k||!P;r.exports=O?function lastIndexOf(r){if(k)return u(x,this,arguments)||0;var i=p(this),o=y(i),w=o-1;for(arguments.length>1&&(w=_(w,g(arguments[1]))),w<0&&(w=o+w);w>=0;w--)if(w in i&&i[w]===r)return w||0;return-1}:x},1194:function(r,i,o){var u=o(7293),p=o(5112),g=o(7392),y=p("species");r.exports=function(r){return g>=51||!u((function(){var i=[];return(i.constructor={})[y]=function(){return{foo:1}},1!==i[r](Boolean).foo}))}},9341:function(r,i,o){"use strict";var u=o(7293);r.exports=function(r,i){var o=[][r];return!!o&&u((function(){o.call(null,i||function(){throw 1},1)}))}},3671:function(r,i,o){var u=o(7854),p=o(9662),g=o(7908),y=o(8361),w=o(6244),_=u.TypeError,createMethod=function(r){return function(i,o,u,x){p(o);var k=g(i),P=y(k),O=w(k),I=r?O-1:0,B=r?-1:1;if(u<2)for(;;){if(I in P){x=P[I],I+=B;break}if(I+=B,r?I<0:O<=I)throw _("Reduce of empty array with no initial value")}for(;r?I>=0:O>I;I+=B)I in P&&(x=o(x,P[I],I,k));return x}};r.exports={left:createMethod(!1),right:createMethod(!0)}},206:function(r,i,o){var u=o(1702);r.exports=u([].slice)},4362:function(r,i,o){var u=o(206),p=Math.floor,mergeSort=function(r,i){var o=r.length,g=p(o/2);return o<8?insertionSort(r,i):merge(r,mergeSort(u(r,0,g),i),mergeSort(u(r,g),i),i)},insertionSort=function(r,i){for(var o,u,p=r.length,g=1;g0;)r[u]=r[--u];u!==g++&&(r[u]=o)}return r},merge=function(r,i,o,u){for(var p=i.length,g=o.length,y=0,w=0;y1?arguments[1]:void 0);i=i?i.next:o.first;)for(u(i.value,i.key,this);i&&i.removed;)i=i.previous},has:function has(r){return!!getEntry(this,r)}}),g(I,o?{get:function get(r){var i=getEntry(this,r);return i&&i.value},set:function set(r,i){return define(this,0===r?0:r,i)}}:{add:function add(r){return define(this,r=0===r?0:r,r)}}),P&&u(I,"size",{get:function(){return D(this).size}}),k},setStrong:function(r,i,o){var u=i+" Iterator",p=R(i),g=R(u);x(r,i,(function(r,i){B(this,{type:u,target:r,state:p(r),kind:i,last:void 0})}),(function(){for(var r=g(this),i=r.kind,o=r.last;o&&o.removed;)o=o.previous;return r.target&&(r.last=o=o?o.next:r.state.first)?"keys"==i?{value:o.key,done:!1}:"values"==i?{value:o.value,done:!1}:{value:[o.key,o.value],done:!1}:(r.target=void 0,{value:void 0,done:!0})}),o?"entries":"values",!o,!0),k(i)}}},7710:function(r,i,o){"use strict";var u=o(2109),p=o(7854),g=o(1702),y=o(4705),w=o(1320),_=o(2423),x=o(408),k=o(5787),P=o(614),O=o(111),I=o(7293),B=o(7072),R=o(8003),D=o(9587);r.exports=function(r,i,o){var N=-1!==r.indexOf("Map"),W=-1!==r.indexOf("Weak"),U=N?"set":"add",j=p[r],G=j&&j.prototype,X=j,K={},fixMethod=function(r){var i=g(G[r]);w(G,r,"add"==r?function add(r){return i(this,0===r?0:r),this}:"delete"==r?function(r){return!(W&&!O(r))&&i(this,0===r?0:r)}:"get"==r?function get(r){return W&&!O(r)?void 0:i(this,0===r?0:r)}:"has"==r?function has(r){return!(W&&!O(r))&&i(this,0===r?0:r)}:function set(r,o){return i(this,0===r?0:r,o),this})};if(y(r,!P(j)||!(W||G.forEach&&!I((function(){(new j).entries().next()})))))X=o.getConstructor(i,r,N,U),_.enable();else if(y(r,!0)){var Y=new X,J=Y[U](W?{}:-0,1)!=Y,$=I((function(){Y.has(1)})),ee=B((function(r){new j(r)})),te=!W&&I((function(){for(var r=new j,i=5;i--;)r[U](i,i);return!r.has(-0)}));ee||((X=i((function(r,i){k(r,G);var o=D(new j,r,X);return null!=i&&x(i,o[U],{that:o,AS_ENTRIES:N}),o}))).prototype=G,G.constructor=X),($||te)&&(fixMethod("delete"),fixMethod("has"),N&&fixMethod("get")),(te||J)&&fixMethod(U),W&&G.clear&&delete G.clear}return K[r]=X,u({global:!0,forced:X!=j},K),R(X,r),W||o.setStrong(X,r,N),X}},9920:function(r,i,o){var u=o(2597),p=o(3887),g=o(1236),y=o(3070);r.exports=function(r,i){for(var o=p(i),w=y.f,_=g.f,x=0;x"+_+""}},4994:function(r,i,o){"use strict";var u=o(3383).IteratorPrototype,p=o(30),g=o(9114),y=o(8003),w=o(7497),returnThis=function(){return this};r.exports=function(r,i,o){var _=i+" Iterator";return r.prototype=p(u,{next:g(1,o)}),y(r,_,!1,!0),w[_]=returnThis,r}},8880:function(r,i,o){var u=o(9781),p=o(3070),g=o(9114);r.exports=u?function(r,i,o){return p.f(r,i,g(1,o))}:function(r,i,o){return r[i]=o,r}},9114:function(r){r.exports=function(r,i){return{enumerable:!(1&r),configurable:!(2&r),writable:!(4&r),value:i}}},6135:function(r,i,o){"use strict";var u=o(4948),p=o(3070),g=o(9114);r.exports=function(r,i,o){var y=u(i);y in r?p.f(r,y,g(0,o)):r[y]=o}},8709:function(r,i,o){"use strict";var u=o(7854),p=o(9670),g=o(2140),y=u.TypeError;r.exports=function(r){if(p(this),"string"===r||"default"===r)r="string";else if("number"!==r)throw y("Incorrect hint");return g(this,r)}},654:function(r,i,o){"use strict";var u=o(2109),p=o(6916),g=o(1913),y=o(6530),w=o(614),_=o(4994),x=o(9518),k=o(7674),P=o(8003),O=o(8880),I=o(1320),B=o(5112),R=o(7497),D=o(3383),N=y.PROPER,W=y.CONFIGURABLE,U=D.IteratorPrototype,j=D.BUGGY_SAFARI_ITERATORS,G=B("iterator"),X="keys",K="values",Y="entries",returnThis=function(){return this};r.exports=function(r,i,o,y,B,D,J){_(o,i,y);var $,ee,te,getIterationMethod=function(r){if(r===B&&ae)return ae;if(!j&&r in ie)return ie[r];switch(r){case X:return function keys(){return new o(this,r)};case K:return function values(){return new o(this,r)};case Y:return function entries(){return new o(this,r)}}return function(){return new o(this)}},re=i+" Iterator",ne=!1,ie=r.prototype,oe=ie[G]||ie["@@iterator"]||B&&ie[B],ae=!j&&oe||getIterationMethod(B),se="Array"==i&&ie.entries||oe;if(se&&($=x(se.call(new r)))!==Object.prototype&&$.next&&(g||x($)===U||(k?k($,U):w($[G])||I($,G,returnThis)),P($,re,!0,!0),g&&(R[re]=returnThis)),N&&B==K&&oe&&oe.name!==K&&(!g&&W?O(ie,"name",K):(ne=!0,ae=function values(){return p(oe,this)})),B)if(ee={values:getIterationMethod(K),keys:D?ae:getIterationMethod(X),entries:getIterationMethod(Y)},J)for(te in ee)(j||ne||!(te in ie))&&I(ie,te,ee[te]);else u({target:i,proto:!0,forced:j||ne},ee);return g&&!J||ie[G]===ae||I(ie,G,ae,{name:B}),R[i]=ae,ee}},7235:function(r,i,o){var u=o(857),p=o(2597),g=o(6061),y=o(3070).f;r.exports=function(r){var i=u.Symbol||(u.Symbol={});p(i,r)||y(i,r,{value:g.f(r)})}},9781:function(r,i,o){var u=o(7293);r.exports=!u((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:function(r,i,o){var u=o(7854),p=o(111),g=u.document,y=p(g)&&p(g.createElement);r.exports=function(r){return y?g.createElement(r):{}}},8324:function(r){r.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},8509:function(r,i,o){var u=o(317)("span").classList,p=u&&u.constructor&&u.constructor.prototype;r.exports=p===Object.prototype?void 0:p},8886:function(r,i,o){var u=o(8113).match(/firefox\/(\d+)/i);r.exports=!!u&&+u[1]},7871:function(r){r.exports="object"==typeof window},256:function(r,i,o){var u=o(8113);r.exports=/MSIE|Trident/.test(u)},1528:function(r,i,o){var u=o(8113),p=o(7854);r.exports=/ipad|iphone|ipod/i.test(u)&&void 0!==p.Pebble},6833:function(r,i,o){var u=o(8113);r.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(u)},5268:function(r,i,o){var u=o(4326),p=o(7854);r.exports="process"==u(p.process)},1036:function(r,i,o){var u=o(8113);r.exports=/web0s(?!.*chrome)/i.test(u)},8113:function(r,i,o){var u=o(5005);r.exports=u("navigator","userAgent")||""},7392:function(r,i,o){var u,p,g=o(7854),y=o(8113),w=g.process,_=g.Deno,x=w&&w.versions||_&&_.version,k=x&&x.v8;k&&(p=(u=k.split("."))[0]>0&&u[0]<4?1:+(u[0]+u[1])),!p&&y&&(!(u=y.match(/Edge\/(\d+)/))||u[1]>=74)&&(u=y.match(/Chrome\/(\d+)/))&&(p=+u[1]),r.exports=p},8008:function(r,i,o){var u=o(8113).match(/AppleWebKit\/(\d+)\./);r.exports=!!u&&+u[1]},748:function(r){r.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2914:function(r,i,o){var u=o(7293),p=o(9114);r.exports=!u((function(){var r=Error("a");return!("stack"in r)||(Object.defineProperty(r,"stack",p(1,7)),7!==r.stack)}))},2109:function(r,i,o){var u=o(7854),p=o(1236).f,g=o(8880),y=o(1320),w=o(3505),_=o(9920),x=o(4705);r.exports=function(r,i){var o,k,P,O,I,B=r.target,R=r.global,D=r.stat;if(o=R?u:D?u[B]||w(B,{}):(u[B]||{}).prototype)for(k in i){if(O=i[k],P=r.noTargetGet?(I=p(o,k))&&I.value:o[k],!x(R?k:B+(D?".":"#")+k,r.forced)&&void 0!==P){if(typeof O==typeof P)continue;_(O,P)}(r.sham||P&&P.sham)&&g(O,"sham",!0),y(o,k,O,r)}}},7293:function(r){r.exports=function(r){try{return!!r()}catch(r){return!0}}},7007:function(r,i,o){"use strict";o(4916);var u=o(1702),p=o(1320),g=o(2261),y=o(7293),w=o(5112),_=o(8880),x=w("species"),k=RegExp.prototype;r.exports=function(r,i,o,P){var O=w(r),I=!y((function(){var i={};return i[O]=function(){return 7},7!=""[r](i)})),B=I&&!y((function(){var i=!1,o=/a/;return"split"===r&&((o={}).constructor={},o.constructor[x]=function(){return o},o.flags="",o[O]=/./[O]),o.exec=function(){return i=!0,null},o[O](""),!i}));if(!I||!B||o){var R=u(/./[O]),D=i(O,""[r],(function(r,i,o,p,y){var w=u(r),_=i.exec;return _===g||_===k.exec?I&&!y?{done:!0,value:R(i,o,p)}:{done:!0,value:w(o,i,p)}:{done:!1}}));p(String.prototype,r,D[0]),p(k,O,D[1])}P&&_(k[O],"sham",!0)}},6677:function(r,i,o){var u=o(7293);r.exports=!u((function(){return Object.isExtensible(Object.preventExtensions({}))}))},2104:function(r){var i=Function.prototype,o=i.apply,u=i.bind,p=i.call;r.exports="object"==typeof Reflect&&Reflect.apply||(u?p.bind(o):function(){return p.apply(o,arguments)})},9974:function(r,i,o){var u=o(1702),p=o(9662),g=u(u.bind);r.exports=function(r,i){return p(r),void 0===i?r:g?g(r,i):function(){return r.apply(i,arguments)}}},7065:function(r,i,o){"use strict";var u=o(7854),p=o(1702),g=o(9662),y=o(111),w=o(2597),_=o(206),x=u.Function,k=p([].concat),P=p([].join),O={},construct=function(r,i,o){if(!w(O,i)){for(var u=[],p=0;p]*>)/g,k=/\$([$&'`]|\d{1,2})/g;r.exports=function(r,i,o,u,P,O){var I=o+r.length,B=u.length,R=k;return void 0!==P&&(P=p(P),R=x),w(O,R,(function(p,w){var x;switch(y(w,0)){case"$":return"$";case"&":return r;case"`":return _(i,0,o);case"'":return _(i,I);case"<":x=P[_(w,1,-1)];break;default:var k=+w;if(0===k)return p;if(k>B){var O=g(k/10);return 0===O?p:O<=B?void 0===u[O-1]?y(w,1):u[O-1]+y(w,1):p}x=u[k-1]}return void 0===x?"":x}))}},7854:function(r,i,o){var check=function(r){return r&&r.Math==Math&&r};r.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof o.g&&o.g)||function(){return this}()||Function("return this")()},2597:function(r,i,o){var u=o(1702),p=o(7908),g=u({}.hasOwnProperty);r.exports=Object.hasOwn||function hasOwn(r,i){return g(p(r),i)}},3501:function(r){r.exports={}},842:function(r,i,o){var u=o(7854);r.exports=function(r,i){var o=u.console;o&&o.error&&(1==arguments.length?o.error(r):o.error(r,i))}},490:function(r,i,o){var u=o(5005);r.exports=u("document","documentElement")},4664:function(r,i,o){var u=o(9781),p=o(7293),g=o(317);r.exports=!u&&!p((function(){return 7!=Object.defineProperty(g("div"),"a",{get:function(){return 7}}).a}))},1179:function(r,i,o){var u=o(7854).Array,p=Math.abs,g=Math.pow,y=Math.floor,w=Math.log,_=Math.LN2;r.exports={pack:function(r,i,o){var x,k,P,O=u(o),I=8*o-i-1,B=(1<>1,D=23===i?g(2,-24)-g(2,-77):0,N=r<0||0===r&&1/r<0?1:0,W=0;for((r=p(r))!=r||r===1/0?(k=r!=r?1:0,x=B):(x=y(w(r)/_),r*(P=g(2,-x))<1&&(x--,P*=2),(r+=x+R>=1?D/P:D*g(2,1-R))*P>=2&&(x++,P/=2),x+R>=B?(k=0,x=B):x+R>=1?(k=(r*P-1)*g(2,i),x+=R):(k=r*g(2,R-1)*g(2,i),x=0));i>=8;O[W++]=255&k,k/=256,i-=8);for(x=x<0;O[W++]=255&x,x/=256,I-=8);return O[--W]|=128*N,O},unpack:function(r,i){var o,u=r.length,p=8*u-i-1,y=(1<>1,_=p-7,x=u-1,k=r[x--],P=127&k;for(k>>=7;_>0;P=256*P+r[x],x--,_-=8);for(o=P&(1<<-_)-1,P>>=-_,_+=i;_>0;o=256*o+r[x],x--,_-=8);if(0===P)P=1-w;else{if(P===y)return o?NaN:k?-1/0:1/0;o+=g(2,i),P-=w}return(k?-1:1)*o*g(2,P-i)}}},8361:function(r,i,o){var u=o(7854),p=o(1702),g=o(7293),y=o(4326),w=u.Object,_=p("".split);r.exports=g((function(){return!w("z").propertyIsEnumerable(0)}))?function(r){return"String"==y(r)?_(r,""):w(r)}:w},9587:function(r,i,o){var u=o(614),p=o(111),g=o(7674);r.exports=function(r,i,o){var y,w;return g&&u(y=i.constructor)&&y!==o&&p(w=y.prototype)&&w!==o.prototype&&g(r,w),r}},2788:function(r,i,o){var u=o(1702),p=o(614),g=o(5465),y=u(Function.toString);p(g.inspectSource)||(g.inspectSource=function(r){return y(r)}),r.exports=g.inspectSource},8340:function(r,i,o){var u=o(111),p=o(8880);r.exports=function(r,i){u(i)&&"cause"in i&&p(r,"cause",i.cause)}},2423:function(r,i,o){var u=o(2109),p=o(1702),g=o(3501),y=o(111),w=o(2597),_=o(3070).f,x=o(8006),k=o(1156),P=o(9711),O=o(6677),I=!1,B=P("meta"),R=0,D=Object.isExtensible||function(){return!0},setMetadata=function(r){_(r,B,{value:{objectID:"O"+R++,weakData:{}}})},N=r.exports={enable:function(){N.enable=function(){},I=!0;var r=x.f,i=p([].splice),o={};o[B]=1,r(o).length&&(x.f=function(o){for(var u=r(o),p=0,g=u.length;pN;N++)if((U=callFn(r[N]))&&k(R,U))return U;return new Result(!1)}u=P(r,D)}for(j=u.next;!(G=g(j,u)).done;){try{U=callFn(G.value)}catch(r){I(u,"throw",r)}if("object"==typeof U&&U&&k(R,U))return U}return new Result(!1)}},9212:function(r,i,o){var u=o(6916),p=o(9670),g=o(8173);r.exports=function(r,i,o){var y,w;p(r);try{if(!(y=g(r,"return"))){if("throw"===i)throw o;return o}y=u(y,r)}catch(r){w=!0,y=r}if("throw"===i)throw o;if(w)throw y;return p(y),o}},3383:function(r,i,o){"use strict";var u,p,g,y=o(7293),w=o(614),_=o(30),x=o(9518),k=o(1320),P=o(5112),O=o(1913),I=P("iterator"),B=!1;[].keys&&("next"in(g=[].keys())?(p=x(x(g)))!==Object.prototype&&(u=p):B=!0),null==u||y((function(){var r={};return u[I].call(r)!==r}))?u={}:O&&(u=_(u)),w(u[I])||k(u,I,(function(){return this})),r.exports={IteratorPrototype:u,BUGGY_SAFARI_ITERATORS:B}},7497:function(r){r.exports={}},6244:function(r,i,o){var u=o(7466);r.exports=function(r){return u(r.length)}},5948:function(r,i,o){var u,p,g,y,w,_,x,k,P=o(7854),O=o(9974),I=o(1236).f,B=o(261).set,R=o(6833),D=o(1528),N=o(1036),W=o(5268),U=P.MutationObserver||P.WebKitMutationObserver,j=P.document,G=P.process,X=P.Promise,K=I(P,"queueMicrotask"),Y=K&&K.value;Y||(u=function(){var r,i;for(W&&(r=G.domain)&&r.exit();p;){i=p.fn,p=p.next;try{i()}catch(r){throw p?y():g=void 0,r}}g=void 0,r&&r.enter()},R||W||N||!U||!j?!D&&X&&X.resolve?((x=X.resolve(void 0)).constructor=X,k=O(x.then,x),y=function(){k(u)}):W?y=function(){G.nextTick(u)}:(B=O(B,P),y=function(){B(u)}):(w=!0,_=j.createTextNode(""),new U(u).observe(_,{characterData:!0}),y=function(){_.data=w=!w})),r.exports=Y||function(r){var i={fn:r,next:void 0};g&&(g.next=i),p||(p=i,y()),g=i}},3366:function(r,i,o){var u=o(7854);r.exports=u.Promise},133:function(r,i,o){var u=o(7392),p=o(7293);r.exports=!!Object.getOwnPropertySymbols&&!p((function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&u&&u<41}))},8536:function(r,i,o){var u=o(7854),p=o(614),g=o(2788),y=u.WeakMap;r.exports=p(y)&&/native code/.test(g(y))},8523:function(r,i,o){"use strict";var u=o(9662),PromiseCapability=function(r){var i,o;this.promise=new r((function(r,u){if(void 0!==i||void 0!==o)throw TypeError("Bad Promise constructor");i=r,o=u})),this.resolve=u(i),this.reject=u(o)};r.exports.f=function(r){return new PromiseCapability(r)}},6277:function(r,i,o){var u=o(1340);r.exports=function(r,i){return void 0===r?arguments.length<2?"":i:u(r)}},3929:function(r,i,o){var u=o(7854),p=o(7850),g=u.TypeError;r.exports=function(r){if(p(r))throw g("The method doesn't accept regular expressions");return r}},7023:function(r,i,o){var u=o(7854).isFinite;r.exports=Number.isFinite||function isFinite(r){return"number"==typeof r&&u(r)}},1574:function(r,i,o){"use strict";var u=o(9781),p=o(1702),g=o(6916),y=o(7293),w=o(1956),_=o(5181),x=o(5296),k=o(7908),P=o(8361),O=Object.assign,I=Object.defineProperty,B=p([].concat);r.exports=!O||y((function(){if(u&&1!==O({b:1},O(I({},"a",{enumerable:!0,get:function(){I(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var r={},i={},o=Symbol(),p="abcdefghijklmnopqrst";return r[o]=7,p.split("").forEach((function(r){i[r]=r})),7!=O({},r)[o]||w(O({},i)).join("")!=p}))?function assign(r,i){for(var o=k(r),p=arguments.length,y=1,O=_.f,I=x.f;p>y;)for(var R,D=P(arguments[y++]),N=O?B(w(D),O(D)):w(D),W=N.length,U=0;W>U;)R=N[U++],u&&!g(I,D,R)||(o[R]=D[R]);return o}:O},30:function(r,i,o){var u,p=o(9670),g=o(6048),y=o(748),w=o(3501),_=o(490),x=o(317),k=o(6200),P=k("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(r){return"'; + }; + var dataToHtml = function (editor, dataIn) { + var data = global$8.extend({}, dataIn); + if (!data.source) { + global$8.extend(data, htmlToData(getScripts(editor), data.embed)); + if (!data.source) { + return ''; + } + } + if (!data.altsource) { + data.altsource = ''; + } + if (!data.poster) { + data.poster = ''; + } + data.source = editor.convertURL(data.source, 'source'); + data.altsource = editor.convertURL(data.altsource, 'source'); + data.sourcemime = guess(data.source); + data.altsourcemime = guess(data.altsource); + data.poster = editor.convertURL(data.poster, 'poster'); + var pattern = matchPattern(data.source); + if (pattern) { + data.source = pattern.url; + data.type = pattern.type; + data.allowfullscreen = pattern.allowFullscreen; + data.width = data.width || String(pattern.w); + data.height = data.height || String(pattern.h); + } + if (data.embed) { + return updateHtml(data.embed, data, true); + } else { + var videoScript = getVideoScriptMatch(getScripts(editor), data.source); + if (videoScript) { + data.type = 'script'; + data.width = String(videoScript.width); + data.height = String(videoScript.height); + } + var audioTemplateCallback = getAudioTemplateCallback(editor); + var videoTemplateCallback = getVideoTemplateCallback(editor); + data.width = data.width || '300'; + data.height = data.height || '150'; + global$8.each(data, function (value, key) { + data[key] = editor.dom.encode('' + value); + }); + if (data.type === 'iframe') { + return getIframeHtml(data); + } else if (data.sourcemime === 'application/x-shockwave-flash') { + return getFlashHtml(data); + } else if (data.sourcemime.indexOf('audio') !== -1) { + return getAudioHtml(data, audioTemplateCallback); + } else if (data.type === 'script') { + return getScriptHtml(data); + } else { + return getVideoHtml(data, videoTemplateCallback); + } + } + }; + + var isMediaElement = function (element) { + return element.hasAttribute('data-mce-object') || element.hasAttribute('data-ephox-embed-iri'); + }; + var setup$2 = function (editor) { + editor.on('click keyup touchend', function () { + var selectedNode = editor.selection.getNode(); + if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) { + if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) { + selectedNode.setAttribute('data-mce-selected', '2'); + } + } + }); + editor.on('ObjectSelected', function (e) { + var objectType = e.target.getAttribute('data-mce-object'); + if (objectType === 'script') { + e.preventDefault(); + } + }); + editor.on('ObjectResized', function (e) { + var target = e.target; + if (target.getAttribute('data-mce-object')) { + var html = target.getAttribute('data-mce-html'); + if (html) { + html = unescape(html); + target.setAttribute('data-mce-html', escape(updateHtml(html, { + width: String(e.width), + height: String(e.height) + }))); + } + } + }); + }; + + var global$3 = tinymce.util.Tools.resolve('tinymce.util.Promise'); + + var cache = {}; + var embedPromise = function (data, dataToHtml, handler) { + return new global$3(function (res, rej) { + var wrappedResolve = function (response) { + if (response.html) { + cache[data.source] = response; + } + return res({ + url: data.source, + html: response.html ? response.html : dataToHtml(data) + }); + }; + if (cache[data.source]) { + wrappedResolve(cache[data.source]); + } else { + handler({ url: data.source }, wrappedResolve, rej); + } + }); + }; + var defaultPromise = function (data, dataToHtml) { + return global$3.resolve({ + html: dataToHtml(data), + url: data.source + }); + }; + var loadedData = function (editor) { + return function (data) { + return dataToHtml(editor, data); + }; + }; + var getEmbedHtml = function (editor, data) { + var embedHandler = getUrlResolver(editor); + return embedHandler ? embedPromise(data, loadedData(editor), embedHandler) : defaultPromise(data, loadedData(editor)); + }; + var isCached = function (url) { + return has(cache, url); + }; + + var extractMeta = function (sourceInput, data) { + return get$1(data, sourceInput).bind(function (mainData) { + return get$1(mainData, 'meta'); + }); + }; + var getValue = function (data, metaData, sourceInput) { + return function (prop) { + var _a; + var getFromData = function () { + return get$1(data, prop); + }; + var getFromMetaData = function () { + return get$1(metaData, prop); + }; + var getNonEmptyValue = function (c) { + return get$1(c, 'value').bind(function (v) { + return v.length > 0 ? Optional.some(v) : Optional.none(); + }); + }; + var getFromValueFirst = function () { + return getFromData().bind(function (child) { + return isObject(child) ? getNonEmptyValue(child).orThunk(getFromMetaData) : getFromMetaData().orThunk(function () { + return Optional.from(child); + }); + }); + }; + var getFromMetaFirst = function () { + return getFromMetaData().orThunk(function () { + return getFromData().bind(function (child) { + return isObject(child) ? getNonEmptyValue(child) : Optional.from(child); + }); + }); + }; + return _a = {}, _a[prop] = (prop === sourceInput ? getFromValueFirst() : getFromMetaFirst()).getOr(''), _a; + }; + }; + var getDimensions = function (data, metaData) { + var dimensions = {}; + get$1(data, 'dimensions').each(function (dims) { + each$1([ + 'width', + 'height' + ], function (prop) { + get$1(metaData, prop).orThunk(function () { + return get$1(dims, prop); + }).each(function (value) { + return dimensions[prop] = value; + }); + }); + }); + return dimensions; + }; + var unwrap = function (data, sourceInput) { + var metaData = sourceInput ? extractMeta(sourceInput, data).getOr({}) : {}; + var get = getValue(data, metaData, sourceInput); + return __assign(__assign(__assign(__assign(__assign({}, get('source')), get('altsource')), get('poster')), get('embed')), getDimensions(data, metaData)); + }; + var wrap = function (data) { + var wrapped = __assign(__assign({}, data), { + source: { value: get$1(data, 'source').getOr('') }, + altsource: { value: get$1(data, 'altsource').getOr('') }, + poster: { value: get$1(data, 'poster').getOr('') } + }); + each$1([ + 'width', + 'height' + ], function (prop) { + get$1(data, prop).each(function (value) { + var dimensions = wrapped.dimensions || {}; + dimensions[prop] = value; + wrapped.dimensions = dimensions; + }); + }); + return wrapped; + }; + var handleError = function (editor) { + return function (error) { + var errorMessage = error && error.msg ? 'Media embed handler error: ' + error.msg : 'Media embed handler threw unknown error.'; + editor.notificationManager.open({ + type: 'error', + text: errorMessage + }); + }; + }; + var snippetToData = function (editor, embedSnippet) { + return htmlToData(getScripts(editor), embedSnippet); + }; + var getEditorData = function (editor) { + var element = editor.selection.getNode(); + var snippet = isMediaElement(element) ? editor.serializer.serialize(element, { selection: true }) : ''; + return __assign({ embed: snippet }, htmlToData(getScripts(editor), snippet)); + }; + var addEmbedHtml = function (api, editor) { + return function (response) { + if (isString(response.url) && response.url.trim().length > 0) { + var html = response.html; + var snippetData = snippetToData(editor, html); + var nuData = __assign(__assign({}, snippetData), { + source: response.url, + embed: html + }); + api.setData(wrap(nuData)); + } + }; + }; + var selectPlaceholder = function (editor, beforeObjects) { + var afterObjects = editor.dom.select('*[data-mce-object]'); + for (var i = 0; i < beforeObjects.length; i++) { + for (var y = afterObjects.length - 1; y >= 0; y--) { + if (beforeObjects[i] === afterObjects[y]) { + afterObjects.splice(y, 1); + } + } + } + editor.selection.select(afterObjects[0]); + }; + var handleInsert = function (editor, html) { + var beforeObjects = editor.dom.select('*[data-mce-object]'); + editor.insertContent(html); + selectPlaceholder(editor, beforeObjects); + editor.nodeChanged(); + }; + var submitForm = function (prevData, newData, editor) { + newData.embed = updateHtml(newData.embed, newData); + if (newData.embed && (prevData.source === newData.source || isCached(newData.source))) { + handleInsert(editor, newData.embed); + } else { + getEmbedHtml(editor, newData).then(function (response) { + handleInsert(editor, response.html); + }).catch(handleError(editor)); + } + }; + var showDialog = function (editor) { + var editorData = getEditorData(editor); + var currentData = Cell(editorData); + var initialData = wrap(editorData); + var handleSource = function (prevData, api) { + var serviceData = unwrap(api.getData(), 'source'); + if (prevData.source !== serviceData.source) { + addEmbedHtml(win, editor)({ + url: serviceData.source, + html: '' + }); + getEmbedHtml(editor, serviceData).then(addEmbedHtml(win, editor)).catch(handleError(editor)); + } + }; + var handleEmbed = function (api) { + var data = unwrap(api.getData()); + var dataFromEmbed = snippetToData(editor, data.embed); + api.setData(wrap(dataFromEmbed)); + }; + var handleUpdate = function (api, sourceInput) { + var data = unwrap(api.getData(), sourceInput); + var embed = dataToHtml(editor, data); + api.setData(wrap(__assign(__assign({}, data), { embed: embed }))); + }; + var mediaInput = [{ + name: 'source', + type: 'urlinput', + filetype: 'media', + label: 'Source' + }]; + var sizeInput = !hasDimensions(editor) ? [] : [{ + type: 'sizeinput', + name: 'dimensions', + label: 'Constrain proportions', + constrain: true + }]; + var generalTab = { + title: 'General', + name: 'general', + items: flatten([ + mediaInput, + sizeInput + ]) + }; + var embedTextarea = { + type: 'textarea', + name: 'embed', + label: 'Paste your embed code below:' + }; + var embedTab = { + title: 'Embed', + items: [embedTextarea] + }; + var advancedFormItems = []; + if (hasAltSource(editor)) { + advancedFormItems.push({ + name: 'altsource', + type: 'urlinput', + filetype: 'media', + label: 'Alternative source URL' + }); + } + if (hasPoster(editor)) { + advancedFormItems.push({ + name: 'poster', + type: 'urlinput', + filetype: 'image', + label: 'Media poster (Image URL)' + }); + } + var advancedTab = { + title: 'Advanced', + name: 'advanced', + items: advancedFormItems + }; + var tabs = [ + generalTab, + embedTab + ]; + if (advancedFormItems.length > 0) { + tabs.push(advancedTab); + } + var body = { + type: 'tabpanel', + tabs: tabs + }; + var win = editor.windowManager.open({ + title: 'Insert/Edit Media', + size: 'normal', + body: body, + buttons: [ + { + type: 'cancel', + name: 'cancel', + text: 'Cancel' + }, + { + type: 'submit', + name: 'save', + text: 'Save', + primary: true + } + ], + onSubmit: function (api) { + var serviceData = unwrap(api.getData()); + submitForm(currentData.get(), serviceData, editor); + api.close(); + }, + onChange: function (api, detail) { + switch (detail.name) { + case 'source': + handleSource(currentData.get(), api); + break; + case 'embed': + handleEmbed(api); + break; + case 'dimensions': + case 'altsource': + case 'poster': + handleUpdate(api, detail.name); + break; + } + currentData.set(unwrap(api.getData())); + }, + initialData: initialData + }); + }; + + var get = function (editor) { + var showDialog$1 = function () { + showDialog(editor); + }; + return { showDialog: showDialog$1 }; + }; + + var register$1 = function (editor) { + var showDialog$1 = function () { + showDialog(editor); + }; + editor.addCommand('mceMedia', showDialog$1); + }; + + var global$2 = tinymce.util.Tools.resolve('tinymce.html.Node'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); + + var global = tinymce.util.Tools.resolve('tinymce.html.DomParser'); + + var sanitize = function (editor, html) { + if (shouldFilterHtml(editor) === false) { + return html; + } + var writer = global$4(); + var blocked; + global$6({ + validate: false, + allow_conditional_comments: false, + comment: function (text) { + if (!blocked) { + writer.comment(text); + } + }, + cdata: function (text) { + if (!blocked) { + writer.cdata(text); + } + }, + text: function (text, raw) { + if (!blocked) { + writer.text(text, raw); + } + }, + start: function (name, attrs, empty) { + blocked = true; + if (name === 'script' || name === 'noscript' || name === 'svg') { + return; + } + for (var i = attrs.length - 1; i >= 0; i--) { + var attrName = attrs[i].name; + if (attrName.indexOf('on') === 0) { + delete attrs.map[attrName]; + attrs.splice(i, 1); + } + if (attrName === 'style') { + attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name); + } + } + writer.start(name, attrs, empty); + blocked = false; + }, + end: function (name) { + if (blocked) { + return; + } + writer.end(name); + } + }, global$5({})).parse(html); + return writer.getContent(); + }; + + var isLiveEmbedNode = function (node) { + var name = node.name; + return name === 'iframe' || name === 'video' || name === 'audio'; + }; + var getDimension = function (node, styles, dimension, defaultValue) { + if (defaultValue === void 0) { + defaultValue = null; + } + var value = node.attr(dimension); + if (isNonNullable(value)) { + return value; + } else if (!has(styles, dimension)) { + return defaultValue; + } else { + return null; + } + }; + var setDimensions = function (node, previewNode, styles) { + var useDefaults = previewNode.name === 'img' || node.name === 'video'; + var defaultWidth = useDefaults ? '300' : null; + var fallbackHeight = node.name === 'audio' ? '30' : '150'; + var defaultHeight = useDefaults ? fallbackHeight : null; + previewNode.attr({ + width: getDimension(node, styles, 'width', defaultWidth), + height: getDimension(node, styles, 'height', defaultHeight) + }); + }; + var appendNodeContent = function (editor, nodeName, previewNode, html) { + var newNode = global({ + forced_root_block: false, + validate: false + }, editor.schema).parse(html, { context: nodeName }); + while (newNode.firstChild) { + previewNode.append(newNode.firstChild); + } + }; + var createPlaceholderNode = function (editor, node) { + var name = node.name; + var placeHolder = new global$2('img', 1); + placeHolder.shortEnded = true; + retainAttributesAndInnerHtml(editor, node, placeHolder); + setDimensions(node, placeHolder, {}); + placeHolder.attr({ + 'style': node.attr('style'), + 'src': global$1.transparentSrc, + 'data-mce-object': name, + 'class': 'mce-object mce-object-' + name + }); + return placeHolder; + }; + var createPreviewNode = function (editor, node) { + var name = node.name; + var previewWrapper = new global$2('span', 1); + previewWrapper.attr({ + 'contentEditable': 'false', + 'style': node.attr('style'), + 'data-mce-object': name, + 'class': 'mce-preview-object mce-object-' + name + }); + retainAttributesAndInnerHtml(editor, node, previewWrapper); + var styles = editor.dom.parseStyle(node.attr('style')); + var previewNode = new global$2(name, 1); + setDimensions(node, previewNode, styles); + previewNode.attr({ + src: node.attr('src'), + style: node.attr('style'), + class: node.attr('class') + }); + if (name === 'iframe') { + previewNode.attr({ + allowfullscreen: node.attr('allowfullscreen'), + frameborder: '0' + }); + } else { + var attrs = [ + 'controls', + 'crossorigin', + 'currentTime', + 'loop', + 'muted', + 'poster', + 'preload' + ]; + each$1(attrs, function (attrName) { + previewNode.attr(attrName, node.attr(attrName)); + }); + var sanitizedHtml = previewWrapper.attr('data-mce-html'); + if (isNonNullable(sanitizedHtml)) { + appendNodeContent(editor, name, previewNode, unescape(sanitizedHtml)); + } + } + var shimNode = new global$2('span', 1); + shimNode.attr('class', 'mce-shim'); + previewWrapper.append(previewNode); + previewWrapper.append(shimNode); + return previewWrapper; + }; + var retainAttributesAndInnerHtml = function (editor, sourceNode, targetNode) { + var attribs = sourceNode.attributes; + var ai = attribs.length; + while (ai--) { + var attrName = attribs[ai].name; + var attrValue = attribs[ai].value; + if (attrName !== 'width' && attrName !== 'height' && attrName !== 'style') { + if (attrName === 'data' || attrName === 'src') { + attrValue = editor.convertURL(attrValue, attrName); + } + targetNode.attr('data-mce-p-' + attrName, attrValue); + } + } + var innerHtml = sourceNode.firstChild && sourceNode.firstChild.value; + if (innerHtml) { + targetNode.attr('data-mce-html', escape(sanitize(editor, innerHtml))); + targetNode.firstChild = null; + } + }; + var isPageEmbedWrapper = function (node) { + var nodeClass = node.attr('class'); + return nodeClass && /\btiny-pageembed\b/.test(nodeClass); + }; + var isWithinEmbedWrapper = function (node) { + while (node = node.parent) { + if (node.attr('data-ephox-embed-iri') || isPageEmbedWrapper(node)) { + return true; + } + } + return false; + }; + var placeHolderConverter = function (editor) { + return function (nodes) { + var i = nodes.length; + var node; + var videoScript; + while (i--) { + node = nodes[i]; + if (!node.parent) { + continue; + } + if (node.parent.attr('data-mce-object')) { + continue; + } + if (node.name === 'script') { + videoScript = getVideoScriptMatch(getScripts(editor), node.attr('src')); + if (!videoScript) { + continue; + } + } + if (videoScript) { + if (videoScript.width) { + node.attr('width', videoScript.width.toString()); + } + if (videoScript.height) { + node.attr('height', videoScript.height.toString()); + } + } + if (isLiveEmbedNode(node) && hasLiveEmbeds(editor) && global$1.ceFalse) { + if (!isWithinEmbedWrapper(node)) { + node.replace(createPreviewNode(editor, node)); + } + } else { + if (!isWithinEmbedWrapper(node)) { + node.replace(createPlaceholderNode(editor, node)); + } + } + } + }; + }; + + var setup$1 = function (editor) { + editor.on('preInit', function () { + var specialElements = editor.schema.getSpecialElements(); + global$8.each('video audio iframe object'.split(' '), function (name) { + specialElements[name] = new RegExp(']*>', 'gi'); + }); + var boolAttrs = editor.schema.getBoolAttrs(); + global$8.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function (name) { + boolAttrs[name] = {}; + }); + editor.parser.addNodeFilter('iframe,video,audio,object,embed,script', placeHolderConverter(editor)); + editor.serializer.addAttributeFilter('data-mce-object', function (nodes, name) { + var i = nodes.length; + var node; + var realElm; + var ai; + var attribs; + var innerHtml; + var innerNode; + var realElmName; + var className; + while (i--) { + node = nodes[i]; + if (!node.parent) { + continue; + } + realElmName = node.attr(name); + realElm = new global$2(realElmName, 1); + if (realElmName !== 'audio' && realElmName !== 'script') { + className = node.attr('class'); + if (className && className.indexOf('mce-preview-object') !== -1) { + realElm.attr({ + width: node.firstChild.attr('width'), + height: node.firstChild.attr('height') + }); + } else { + realElm.attr({ + width: node.attr('width'), + height: node.attr('height') + }); + } + } + realElm.attr({ style: node.attr('style') }); + attribs = node.attributes; + ai = attribs.length; + while (ai--) { + var attrName = attribs[ai].name; + if (attrName.indexOf('data-mce-p-') === 0) { + realElm.attr(attrName.substr(11), attribs[ai].value); + } + } + if (realElmName === 'script') { + realElm.attr('type', 'text/javascript'); + } + innerHtml = node.attr('data-mce-html'); + if (innerHtml) { + innerNode = new global$2('#text', 3); + innerNode.raw = true; + innerNode.value = sanitize(editor, unescape(innerHtml)); + realElm.append(innerNode); + } + node.replace(realElm); + } + }); + }); + editor.on('SetContent', function () { + editor.$('span.mce-preview-object').each(function (index, elm) { + var $elm = editor.$(elm); + if ($elm.find('span.mce-shim').length === 0) { + $elm.append(''); + } + }); + }); + }; + + var setup = function (editor) { + editor.on('ResolveName', function (e) { + var name; + if (e.target.nodeType === 1 && (name = e.target.getAttribute('data-mce-object'))) { + e.name = name; + } + }); + }; + + var register = function (editor) { + var onAction = function () { + return editor.execCommand('mceMedia'); + }; + editor.ui.registry.addToggleButton('media', { + tooltip: 'Insert/edit media', + icon: 'embed', + onAction: onAction, + onSetup: function (buttonApi) { + var selection = editor.selection; + buttonApi.setActive(isMediaElement(selection.getNode())); + return selection.selectorChangedWithUnbind('img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]', buttonApi.setActive).unbind; + } + }); + editor.ui.registry.addMenuItem('media', { + icon: 'embed', + text: 'Media...', + onAction: onAction + }); + }; + + function Plugin () { + global$9.add('media', function (editor) { + register$1(editor); + register(editor); + setup(editor); + setup$1(editor); + setup$2(editor); + return get(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var getKeyboardSpaces = function (editor) { + var spaces = editor.getParam('nonbreaking_force_tab', 0); + if (typeof spaces === 'boolean') { + return spaces === true ? 3 : 0; + } else { + return spaces; + } + }; + var wrapNbsps = function (editor) { + return editor.getParam('nonbreaking_wrap', true, 'boolean'); + }; + + var stringRepeat = function (string, repeats) { + var str = ''; + for (var index = 0; index < repeats; index++) { + str += string; + } + return str; + }; + var isVisualCharsEnabled = function (editor) { + return editor.plugins.visualchars ? editor.plugins.visualchars.isEnabled() : false; + }; + var insertNbsp = function (editor, times) { + var classes = function () { + return isVisualCharsEnabled(editor) ? 'mce-nbsp-wrap mce-nbsp' : 'mce-nbsp-wrap'; + }; + var nbspSpan = function () { + return '' + stringRepeat(' ', times) + ''; + }; + var shouldWrap = wrapNbsps(editor); + var html = shouldWrap || editor.plugins.visualchars ? nbspSpan() : stringRepeat(' ', times); + editor.undoManager.transact(function () { + return editor.insertContent(html); + }); + }; + + var register$1 = function (editor) { + editor.addCommand('mceNonBreaking', function () { + insertNbsp(editor, 1); + }); + }; + + var global = tinymce.util.Tools.resolve('tinymce.util.VK'); + + var setup = function (editor) { + var spaces = getKeyboardSpaces(editor); + if (spaces > 0) { + editor.on('keydown', function (e) { + if (e.keyCode === global.TAB && !e.isDefaultPrevented()) { + if (e.shiftKey) { + return; + } + e.preventDefault(); + e.stopImmediatePropagation(); + insertNbsp(editor, spaces); + } + }); + } + }; + + var register = function (editor) { + var onAction = function () { + return editor.execCommand('mceNonBreaking'); + }; + editor.ui.registry.addButton('nonbreaking', { + icon: 'non-breaking', + tooltip: 'Nonbreaking space', + onAction: onAction + }); + editor.ui.registry.addMenuItem('nonbreaking', { + icon: 'non-breaking', + text: 'Nonbreaking space', + onAction: onAction + }); + }; + + function Plugin () { + global$1.add('nonbreaking', function (editor) { + register$1(editor); + register(editor); + setup(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var getNonEditableClass = function (editor) { + return editor.getParam('noneditable_noneditable_class', 'mceNonEditable'); + }; + var getEditableClass = function (editor) { + return editor.getParam('noneditable_editable_class', 'mceEditable'); + }; + var getNonEditableRegExps = function (editor) { + var nonEditableRegExps = editor.getParam('noneditable_regexp', []); + if (nonEditableRegExps && nonEditableRegExps.constructor === RegExp) { + return [nonEditableRegExps]; + } else { + return nonEditableRegExps; + } + }; + + var hasClass = function (checkClassName) { + return function (node) { + return (' ' + node.attr('class') + ' ').indexOf(checkClassName) !== -1; + }; + }; + var replaceMatchWithSpan = function (editor, content, cls) { + return function (match) { + var args = arguments, index = args[args.length - 2]; + var prevChar = index > 0 ? content.charAt(index - 1) : ''; + if (prevChar === '"') { + return match; + } + if (prevChar === '>') { + var findStartTagIndex = content.lastIndexOf('<', index); + if (findStartTagIndex !== -1) { + var tagHtml = content.substring(findStartTagIndex, index); + if (tagHtml.indexOf('contenteditable="false"') !== -1) { + return match; + } + } + } + return '' + editor.dom.encode(typeof args[1] === 'string' ? args[1] : args[0]) + ''; + }; + }; + var convertRegExpsToNonEditable = function (editor, nonEditableRegExps, e) { + var i = nonEditableRegExps.length, content = e.content; + if (e.format === 'raw') { + return; + } + while (i--) { + content = content.replace(nonEditableRegExps[i], replaceMatchWithSpan(editor, content, getNonEditableClass(editor))); + } + e.content = content; + }; + var setup = function (editor) { + var contentEditableAttrName = 'contenteditable'; + var editClass = ' ' + global.trim(getEditableClass(editor)) + ' '; + var nonEditClass = ' ' + global.trim(getNonEditableClass(editor)) + ' '; + var hasEditClass = hasClass(editClass); + var hasNonEditClass = hasClass(nonEditClass); + var nonEditableRegExps = getNonEditableRegExps(editor); + editor.on('PreInit', function () { + if (nonEditableRegExps.length > 0) { + editor.on('BeforeSetContent', function (e) { + convertRegExpsToNonEditable(editor, nonEditableRegExps, e); + }); + } + editor.parser.addAttributeFilter('class', function (nodes) { + var i = nodes.length, node; + while (i--) { + node = nodes[i]; + if (hasEditClass(node)) { + node.attr(contentEditableAttrName, 'true'); + } else if (hasNonEditClass(node)) { + node.attr(contentEditableAttrName, 'false'); + } + } + }); + editor.serializer.addAttributeFilter(contentEditableAttrName, function (nodes) { + var i = nodes.length, node; + while (i--) { + node = nodes[i]; + if (!hasEditClass(node) && !hasNonEditClass(node)) { + continue; + } + if (nonEditableRegExps.length > 0 && node.attr('data-mce-content')) { + node.name = '#text'; + node.type = 3; + node.raw = true; + node.value = node.attr('data-mce-content'); + } else { + node.attr(contentEditableAttrName, null); + } + } + }); + }); + }; + + function Plugin () { + global$1.add('noneditable', function (editor) { + setup(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var global = tinymce.util.Tools.resolve('tinymce.Env'); + + var getSeparatorHtml = function (editor) { + return editor.getParam('pagebreak_separator', ''); + }; + var shouldSplitBlock = function (editor) { + return editor.getParam('pagebreak_split_block', false); + }; + + var pageBreakClass = 'mce-pagebreak'; + var getPlaceholderHtml = function (shouldSplitBlock) { + var html = ''; + return shouldSplitBlock ? '

' + html + '

' : html; + }; + var setup$1 = function (editor) { + var separatorHtml = getSeparatorHtml(editor); + var shouldSplitBlock$1 = function () { + return shouldSplitBlock(editor); + }; + var pageBreakSeparatorRegExp = new RegExp(separatorHtml.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function (a) { + return '\\' + a; + }), 'gi'); + editor.on('BeforeSetContent', function (e) { + e.content = e.content.replace(pageBreakSeparatorRegExp, getPlaceholderHtml(shouldSplitBlock$1())); + }); + editor.on('PreInit', function () { + editor.serializer.addNodeFilter('img', function (nodes) { + var i = nodes.length, node, className; + while (i--) { + node = nodes[i]; + className = node.attr('class'); + if (className && className.indexOf(pageBreakClass) !== -1) { + var parentNode = node.parent; + if (editor.schema.getBlockElements()[parentNode.name] && shouldSplitBlock$1()) { + parentNode.type = 3; + parentNode.value = separatorHtml; + parentNode.raw = true; + node.remove(); + continue; + } + node.type = 3; + node.value = separatorHtml; + node.raw = true; + } + } + }); + }); + }; + + var register$1 = function (editor) { + editor.addCommand('mcePageBreak', function () { + editor.insertContent(getPlaceholderHtml(shouldSplitBlock(editor))); + }); + }; + + var setup = function (editor) { + editor.on('ResolveName', function (e) { + if (e.target.nodeName === 'IMG' && editor.dom.hasClass(e.target, pageBreakClass)) { + e.name = 'pagebreak'; + } + }); + }; + + var register = function (editor) { + var onAction = function () { + return editor.execCommand('mcePageBreak'); + }; + editor.ui.registry.addButton('pagebreak', { + icon: 'page-break', + tooltip: 'Page break', + onAction: onAction + }); + editor.ui.registry.addMenuItem('pagebreak', { + text: 'Page break', + icon: 'page-break', + onAction: onAction + }); + }; + + function Plugin () { + global$1.add('pagebreak', function (editor) { + register$1(editor); + register(editor); + setup$1(editor); + setup(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; + }; + var set = function (v) { + value = v; + }; + return { + get: get, + set: set + }; + }; + + var global$b = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var hasProPlugin = function (editor) { + if (editor.hasPlugin('powerpaste', true)) { + if (typeof window.console !== 'undefined' && window.console.log) { + window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.'); + } + return true; + } else { + return false; + } + }; + + var get = function (clipboard) { + return { clipboard: clipboard }; + }; + + var typeOf = function (x) { + var t = typeof x; + if (x === null) { + return 'null'; + } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { + return 'array'; + } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { + return 'string'; + } else { + return t; + } + }; + var isType = function (type) { + return function (value) { + return typeOf(value) === type; + }; + }; + var isSimpleType = function (type) { + return function (value) { + return typeof value === type; + }; + }; + var isArray = isType('array'); + var isNullable = function (a) { + return a === null || a === undefined; + }; + var isNonNullable = function (a) { + return !isNullable(a); + }; + var isFunction = isSimpleType('function'); + + var noop = function () { + }; + var constant = function (value) { + return function () { + return value; + }; + }; + var identity = function (x) { + return x; + }; + var never = constant(false); + var always = constant(true); + + var none = function () { + return NONE; + }; + var NONE = function () { + var call = function (thunk) { + return thunk(); + }; + var id = identity; + var me = { + fold: function (n, _s) { + return n(); + }, + isSome: never, + isNone: always, + getOr: id, + getOrThunk: call, + getOrDie: function (msg) { + throw new Error(msg || 'error: getOrDie called on none.'); + }, + getOrNull: constant(null), + getOrUndefined: constant(undefined), + or: id, + orThunk: call, + map: none, + each: noop, + bind: none, + exists: never, + forall: always, + filter: function () { + return none(); + }, + toArray: function () { + return []; + }, + toString: constant('none()') + }; + return me; + }(); + var some = function (a) { + var constant_a = constant(a); + var self = function () { + return me; + }; + var bind = function (f) { + return f(a); + }; + var me = { + fold: function (n, s) { + return s(a); + }, + isSome: always, + isNone: never, + getOr: constant_a, + getOrThunk: constant_a, + getOrDie: constant_a, + getOrNull: constant_a, + getOrUndefined: constant_a, + or: self, + orThunk: self, + map: function (f) { + return some(f(a)); + }, + each: function (f) { + f(a); + }, + bind: bind, + exists: bind, + forall: bind, + filter: function (f) { + return f(a) ? me : NONE; + }, + toArray: function () { + return [a]; + }, + toString: function () { + return 'some(' + a + ')'; + } + }; + return me; + }; + var from$1 = function (value) { + return value === null || value === undefined ? NONE : some(value); + }; + var Optional = { + some: some, + none: none, + from: from$1 + }; + + var nativeSlice = Array.prototype.slice; + var nativePush = Array.prototype.push; + var exists = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + return true; + } + } + return false; + }; + var map = function (xs, f) { + var len = xs.length; + var r = new Array(len); + for (var i = 0; i < len; i++) { + var x = xs[i]; + r[i] = f(x, i); + } + return r; + }; + var each = function (xs, f) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + f(x, i); + } + }; + var filter$1 = function (xs, pred) { + var r = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + r.push(x); + } + } + return r; + }; + var foldl = function (xs, f, acc) { + each(xs, function (x, i) { + acc = f(acc, x, i); + }); + return acc; + }; + var flatten = function (xs) { + var r = []; + for (var i = 0, len = xs.length; i < len; ++i) { + if (!isArray(xs[i])) { + throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs); + } + nativePush.apply(r, xs[i]); + } + return r; + }; + var bind = function (xs, f) { + return flatten(map(xs, f)); + }; + var from = isFunction(Array.from) ? Array.from : function (x) { + return nativeSlice.call(x); + }; + + var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + var singleton = function (doRevoke) { + var subject = Cell(Optional.none()); + var revoke = function () { + return subject.get().each(doRevoke); + }; + var clear = function () { + revoke(); + subject.set(Optional.none()); + }; + var isSet = function () { + return subject.get().isSome(); + }; + var get = function () { + return subject.get(); + }; + var set = function (s) { + revoke(); + subject.set(Optional.some(s)); + }; + return { + clear: clear, + isSet: isSet, + get: get, + set: set + }; + }; + var value = function () { + var subject = singleton(noop); + var on = function (f) { + return subject.get().each(f); + }; + return __assign(__assign({}, subject), { on: on }); + }; + + var checkRange = function (str, substr, start) { + return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr; + }; + var startsWith = function (str, prefix) { + return checkRange(str, prefix, 0); + }; + var endsWith = function (str, suffix) { + return checkRange(str, suffix, str.length - suffix.length); + }; + var repeat = function (s, count) { + return count <= 0 ? '' : new Array(count + 1).join(s); + }; + + var global$a = tinymce.util.Tools.resolve('tinymce.Env'); + + var global$9 = tinymce.util.Tools.resolve('tinymce.util.Delay'); + + var global$8 = tinymce.util.Tools.resolve('tinymce.util.Promise'); + + var global$7 = tinymce.util.Tools.resolve('tinymce.util.VK'); + + var firePastePreProcess = function (editor, html, internal, isWordHtml) { + return editor.fire('PastePreProcess', { + content: html, + internal: internal, + wordContent: isWordHtml + }); + }; + var firePastePostProcess = function (editor, node, internal, isWordHtml) { + return editor.fire('PastePostProcess', { + node: node, + internal: internal, + wordContent: isWordHtml + }); + }; + var firePastePlainTextToggle = function (editor, state) { + return editor.fire('PastePlainTextToggle', { state: state }); + }; + var firePaste = function (editor, ieFake) { + return editor.fire('paste', { ieFake: ieFake }); + }; + + var global$6 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var shouldBlockDrop = function (editor) { + return editor.getParam('paste_block_drop', false); + }; + var shouldPasteDataImages = function (editor) { + return editor.getParam('paste_data_images', false); + }; + var shouldFilterDrop = function (editor) { + return editor.getParam('paste_filter_drop', true); + }; + var getPreProcess = function (editor) { + return editor.getParam('paste_preprocess'); + }; + var getPostProcess = function (editor) { + return editor.getParam('paste_postprocess'); + }; + var getWebkitStyles = function (editor) { + return editor.getParam('paste_webkit_styles'); + }; + var shouldRemoveWebKitStyles = function (editor) { + return editor.getParam('paste_remove_styles_if_webkit', true); + }; + var shouldMergeFormats = function (editor) { + return editor.getParam('paste_merge_formats', true); + }; + var isSmartPasteEnabled = function (editor) { + return editor.getParam('smart_paste', true); + }; + var isPasteAsTextEnabled = function (editor) { + return editor.getParam('paste_as_text', false); + }; + var getRetainStyleProps = function (editor) { + return editor.getParam('paste_retain_style_properties'); + }; + var getWordValidElements = function (editor) { + var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody'; + return editor.getParam('paste_word_valid_elements', defaultValidElements); + }; + var shouldConvertWordFakeLists = function (editor) { + return editor.getParam('paste_convert_word_fake_lists', true); + }; + var shouldUseDefaultFilters = function (editor) { + return editor.getParam('paste_enable_default_filters', true); + }; + var getValidate = function (editor) { + return editor.getParam('validate'); + }; + var getAllowHtmlDataUrls = function (editor) { + return editor.getParam('allow_html_data_urls', false, 'boolean'); + }; + var getPasteDataImages = function (editor) { + return editor.getParam('paste_data_images', false, 'boolean'); + }; + var getImagesDataImgFilter = function (editor) { + return editor.getParam('images_dataimg_filter'); + }; + var getImagesReuseFilename = function (editor) { + return editor.getParam('images_reuse_filename'); + }; + var getForcedRootBlock = function (editor) { + return editor.getParam('forced_root_block'); + }; + var getForcedRootBlockAttrs = function (editor) { + return editor.getParam('forced_root_block_attrs'); + }; + var getTabSpaces = function (editor) { + return editor.getParam('paste_tab_spaces', 4, 'number'); + }; + var getAllowedImageFileTypes = function (editor) { + var defaultImageFileTypes = 'jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp'; + return global$6.explode(editor.getParam('images_file_types', defaultImageFileTypes, 'string')); + }; + + var internalMimeType = 'x-tinymce/html'; + var internalMark = ''; + var mark = function (html) { + return internalMark + html; + }; + var unmark = function (html) { + return html.replace(internalMark, ''); + }; + var isMarked = function (html) { + return html.indexOf(internalMark) !== -1; + }; + var internalHtmlMime = constant(internalMimeType); + + var hasOwnProperty = Object.hasOwnProperty; + var has = function (obj, key) { + return hasOwnProperty.call(obj, key); + }; + + var global$5 = tinymce.util.Tools.resolve('tinymce.html.Entities'); + + var isPlainText = function (text) { + return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text); + }; + var toBRs = function (text) { + return text.replace(/\r?\n/g, '
'); + }; + var openContainer = function (rootTag, rootAttrs) { + var attrs = []; + var tag = '<' + rootTag; + if (typeof rootAttrs === 'object') { + for (var key in rootAttrs) { + if (has(rootAttrs, key)) { + attrs.push(key + '="' + global$5.encodeAllRaw(rootAttrs[key]) + '"'); + } + } + if (attrs.length) { + tag += ' ' + attrs.join(' '); + } + } + return tag + '>'; + }; + var toBlockElements = function (text, rootTag, rootAttrs) { + var blocks = text.split(/\n\n/); + var tagOpen = openContainer(rootTag, rootAttrs); + var tagClose = ''; + var paragraphs = global$6.map(blocks, function (p) { + return p.split(/\n/).join('
'); + }); + var stitch = function (p) { + return tagOpen + p + tagClose; + }; + return paragraphs.length === 1 ? paragraphs[0] : global$6.map(paragraphs, stitch).join(''); + }; + var convert = function (text, rootTag, rootAttrs) { + return rootTag ? toBlockElements(text, rootTag === true ? 'p' : rootTag, rootAttrs) : toBRs(text); + }; + + var global$4 = tinymce.util.Tools.resolve('tinymce.html.DomParser'); + + var global$3 = tinymce.util.Tools.resolve('tinymce.html.Serializer'); + + var nbsp = '\xA0'; + + var global$2 = tinymce.util.Tools.resolve('tinymce.html.Node'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.html.Schema'); + + var isRegExp = function (val) { + return val.constructor === RegExp; + }; + var filter = function (content, items) { + global$6.each(items, function (v) { + if (isRegExp(v)) { + content = content.replace(v, ''); + } else { + content = content.replace(v[0], v[1]); + } + }); + return content; + }; + var innerText = function (html) { + var schema = global$1(); + var domParser = global$4({}, schema); + var text = ''; + var shortEndedElements = schema.getShortEndedElements(); + var ignoreElements = global$6.makeMap('script noscript style textarea video audio iframe object', ' '); + var blockElements = schema.getBlockElements(); + var walk = function (node) { + var name = node.name, currentNode = node; + if (name === 'br') { + text += '\n'; + return; + } + if (name === 'wbr') { + return; + } + if (shortEndedElements[name]) { + text += ' '; + } + if (ignoreElements[name]) { + text += ' '; + return; + } + if (node.type === 3) { + text += node.value; + } + if (!node.shortEnded) { + if (node = node.firstChild) { + do { + walk(node); + } while (node = node.next); + } + } + if (blockElements[name] && currentNode.next) { + text += '\n'; + if (name === 'p') { + text += '\n'; + } + } + }; + html = filter(html, [//g]); + walk(domParser.parse(html)); + return text; + }; + var trimHtml = function (html) { + var trimSpaces = function (all, s1, s2) { + if (!s1 && !s2) { + return ' '; + } + return nbsp; + }; + html = filter(html, [ + /^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig, + /|/g, + [ + /( ?)\u00a0<\/span>( ?)/g, + trimSpaces + ], + /
/g, + /
$/i + ]); + return html; + }; + var createIdGenerator = function (prefix) { + var count = 0; + return function () { + return prefix + count++; + }; + }; + var getImageMimeType = function (ext) { + var lowerExt = ext.toLowerCase(); + var mimeOverrides = { + jpg: 'jpeg', + jpe: 'jpeg', + jfi: 'jpeg', + jif: 'jpeg', + jfif: 'jpeg', + pjpeg: 'jpeg', + pjp: 'jpeg', + svg: 'svg+xml' + }; + return global$6.hasOwn(mimeOverrides, lowerExt) ? 'image/' + mimeOverrides[lowerExt] : 'image/' + lowerExt; + }; + + var isWordContent = function (content) { + return / 1) { + currentListNode.attr('start', '' + start); + } + paragraphNode.wrap(currentListNode); + } else { + currentListNode.append(paragraphNode); + } + paragraphNode.name = 'li'; + if (level > lastLevel && prevListNode) { + prevListNode.lastChild.append(currentListNode); + } + lastLevel = level; + removeIgnoredNodes(paragraphNode); + trimListStart(paragraphNode, /^\u00a0+/); + trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/); + trimListStart(paragraphNode, /^\u00a0+/); + }; + var elements = []; + var child = node.firstChild; + while (typeof child !== 'undefined' && child !== null) { + elements.push(child); + child = child.walk(); + if (child !== null) { + while (typeof child !== 'undefined' && child.parent !== node) { + child = child.walk(); + } + } + } + for (var i = 0; i < elements.length; i++) { + node = elements[i]; + if (node.name === 'p' && node.firstChild) { + var nodeText = getText(node); + if (isBulletList(nodeText)) { + convertParagraphToLi(node, 'ul'); + continue; + } + if (isNumericList(nodeText)) { + var matches = /([0-9]+)\./.exec(nodeText); + var start = 1; + if (matches) { + start = parseInt(matches[1], 10); + } + convertParagraphToLi(node, 'ol', start); + continue; + } + if (node._listLevel) { + convertParagraphToLi(node, 'ul', 1); + continue; + } + currentListNode = null; + } else { + prevListNode = currentListNode; + currentListNode = null; + } + } + }; + var filterStyles = function (editor, validStyles, node, styleValue) { + var outputStyles = {}; + var styles = editor.dom.parseStyle(styleValue); + global$6.each(styles, function (value, name) { + switch (name) { + case 'mso-list': + var matches = /\w+ \w+([0-9]+)/i.exec(styleValue); + if (matches) { + node._listLevel = parseInt(matches[1], 10); + } + if (/Ignore/i.test(value) && node.firstChild) { + node._listIgnore = true; + node.firstChild._listIgnore = true; + } + break; + case 'horiz-align': + name = 'text-align'; + break; + case 'vert-align': + name = 'vertical-align'; + break; + case 'font-color': + case 'mso-foreground': + name = 'color'; + break; + case 'mso-background': + case 'mso-highlight': + name = 'background'; + break; + case 'font-weight': + case 'font-style': + if (value !== 'normal') { + outputStyles[name] = value; + } + return; + case 'mso-element': + if (/^(comment|comment-list)$/i.test(value)) { + node.remove(); + return; + } + break; + } + if (name.indexOf('mso-comment') === 0) { + node.remove(); + return; + } + if (name.indexOf('mso-') === 0) { + return; + } + if (getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) { + outputStyles[name] = value; + } + }); + if (/(bold)/i.test(outputStyles['font-weight'])) { + delete outputStyles['font-weight']; + node.wrap(new global$2('b', 1)); + } + if (/(italic)/i.test(outputStyles['font-style'])) { + delete outputStyles['font-style']; + node.wrap(new global$2('i', 1)); + } + var outputStyle = editor.dom.serializeStyle(outputStyles, node.name); + if (outputStyle) { + return outputStyle; + } + return null; + }; + var filterWordContent = function (editor, content) { + var validStyles; + var retainStyleProperties = getRetainStyleProps(editor); + if (retainStyleProperties) { + validStyles = global$6.makeMap(retainStyleProperties.split(/[, ]/)); + } + content = filter(content, [ + /
/gi, + /]+id="?docs-internal-[^>]*>/gi, + //gi, + /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi, + [ + /<(\/?)s>/gi, + '<$1strike>' + ], + [ + / /gi, + nbsp + ], + [ + /([\s\u00a0]*)<\/span>/gi, + function (str, spaces) { + return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join(nbsp) : ''; + } + ] + ]); + var validElements = getWordValidElements(editor); + var schema = global$1({ + valid_elements: validElements, + valid_children: '-li[p]' + }); + global$6.each(schema.elements, function (rule) { + if (!rule.attributes.class) { + rule.attributes.class = {}; + rule.attributesOrder.push('class'); + } + if (!rule.attributes.style) { + rule.attributes.style = {}; + rule.attributesOrder.push('style'); + } + }); + var domParser = global$4({}, schema); + domParser.addAttributeFilter('style', function (nodes) { + var i = nodes.length, node; + while (i--) { + node = nodes[i]; + node.attr('style', filterStyles(editor, validStyles, node, node.attr('style'))); + if (node.name === 'span' && node.parent && !node.attributes.length) { + node.unwrap(); + } + } + }); + domParser.addAttributeFilter('class', function (nodes) { + var i = nodes.length, node, className; + while (i--) { + node = nodes[i]; + className = node.attr('class'); + if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) { + node.remove(); + } + node.attr('class', null); + } + }); + domParser.addNodeFilter('del', function (nodes) { + var i = nodes.length; + while (i--) { + nodes[i].remove(); + } + }); + domParser.addNodeFilter('a', function (nodes) { + var i = nodes.length, node, href, name; + while (i--) { + node = nodes[i]; + href = node.attr('href'); + name = node.attr('name'); + if (href && href.indexOf('#_msocom_') !== -1) { + node.remove(); + continue; + } + if (href && href.indexOf('file://') === 0) { + href = href.split('#')[1]; + if (href) { + href = '#' + href; + } + } + if (!href && !name) { + node.unwrap(); + } else { + if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) { + node.unwrap(); + continue; + } + node.attr({ + href: href, + name: name + }); + } + } + }); + var rootNode = domParser.parse(content); + if (shouldConvertWordFakeLists(editor)) { + convertFakeListsToProperLists(rootNode); + } + content = global$3({ validate: getValidate(editor) }, schema).serialize(rootNode); + return content; + }; + var preProcess$1 = function (editor, content) { + return shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content; + }; + + var preProcess = function (editor, html) { + var parser = global$4({}, editor.schema); + parser.addNodeFilter('meta', function (nodes) { + global$6.each(nodes, function (node) { + node.remove(); + }); + }); + var fragment = parser.parse(html, { + forced_root_block: false, + isRootContent: true + }); + return global$3({ validate: getValidate(editor) }, editor.schema).serialize(fragment); + }; + var processResult = function (content, cancelled) { + return { + content: content, + cancelled: cancelled + }; + }; + var postProcessFilter = function (editor, html, internal, isWordHtml) { + var tempBody = editor.dom.create('div', { style: 'display:none' }, html); + var postProcessArgs = firePastePostProcess(editor, tempBody, internal, isWordHtml); + return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented()); + }; + var filterContent = function (editor, content, internal, isWordHtml) { + var preProcessArgs = firePastePreProcess(editor, content, internal, isWordHtml); + var filteredContent = preProcess(editor, preProcessArgs.content); + if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) { + return postProcessFilter(editor, filteredContent, internal, isWordHtml); + } else { + return processResult(filteredContent, preProcessArgs.isDefaultPrevented()); + } + }; + var process = function (editor, html, internal) { + var isWordHtml = isWordContent(html); + var content = isWordHtml ? preProcess$1(editor, html) : html; + return filterContent(editor, content, internal, isWordHtml); + }; + + var pasteHtml$1 = function (editor, html) { + editor.insertContent(html, { + merge: shouldMergeFormats(editor), + paste: true + }); + return true; + }; + var isAbsoluteUrl = function (url) { + return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url); + }; + var isImageUrl = function (editor, url) { + return isAbsoluteUrl(url) && exists(getAllowedImageFileTypes(editor), function (type) { + return endsWith(url.toLowerCase(), '.' + type.toLowerCase()); + }); + }; + var createImage = function (editor, url, pasteHtmlFn) { + editor.undoManager.extra(function () { + pasteHtmlFn(editor, url); + }, function () { + editor.insertContent(''); + }); + return true; + }; + var createLink = function (editor, url, pasteHtmlFn) { + editor.undoManager.extra(function () { + pasteHtmlFn(editor, url); + }, function () { + editor.execCommand('mceInsertLink', false, url); + }); + return true; + }; + var linkSelection = function (editor, html, pasteHtmlFn) { + return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false; + }; + var insertImage = function (editor, html, pasteHtmlFn) { + return isImageUrl(editor, html) ? createImage(editor, html, pasteHtmlFn) : false; + }; + var smartInsertContent = function (editor, html) { + global$6.each([ + linkSelection, + insertImage, + pasteHtml$1 + ], function (action) { + return action(editor, html, pasteHtml$1) !== true; + }); + }; + var insertContent = function (editor, html, pasteAsText) { + if (pasteAsText || isSmartPasteEnabled(editor) === false) { + pasteHtml$1(editor, html); + } else { + smartInsertContent(editor, html); + } + }; + + var isCollapsibleWhitespace = function (c) { + return ' \f\t\x0B'.indexOf(c) !== -1; + }; + var isNewLineChar = function (c) { + return c === '\n' || c === '\r'; + }; + var isNewline = function (text, idx) { + return idx < text.length && idx >= 0 ? isNewLineChar(text[idx]) : false; + }; + var normalizeWhitespace = function (editor, text) { + var tabSpace = repeat(' ', getTabSpaces(editor)); + var normalizedText = text.replace(/\t/g, tabSpace); + var result = foldl(normalizedText, function (acc, c) { + if (isCollapsibleWhitespace(c) || c === nbsp) { + if (acc.pcIsSpace || acc.str === '' || acc.str.length === normalizedText.length - 1 || isNewline(normalizedText, acc.str.length + 1)) { + return { + pcIsSpace: false, + str: acc.str + nbsp + }; + } else { + return { + pcIsSpace: true, + str: acc.str + ' ' + }; + } + } else { + return { + pcIsSpace: isNewLineChar(c), + str: acc.str + c + }; + } + }, { + pcIsSpace: false, + str: '' + }); + return result.str; + }; + + var doPaste = function (editor, content, internal, pasteAsText) { + var args = process(editor, content, internal); + if (args.cancelled === false) { + insertContent(editor, args.content, pasteAsText); + } + }; + var pasteHtml = function (editor, html, internalFlag) { + var internal = internalFlag ? internalFlag : isMarked(html); + doPaste(editor, unmark(html), internal, false); + }; + var pasteText = function (editor, text) { + var encodedText = editor.dom.encode(text).replace(/\r\n/g, '\n'); + var normalizedText = normalizeWhitespace(editor, encodedText); + var html = convert(normalizedText, getForcedRootBlock(editor), getForcedRootBlockAttrs(editor)); + doPaste(editor, html, false, true); + }; + var getDataTransferItems = function (dataTransfer) { + var items = {}; + var mceInternalUrlPrefix = 'data:text/mce-internal,'; + if (dataTransfer) { + if (dataTransfer.getData) { + var legacyText = dataTransfer.getData('Text'); + if (legacyText && legacyText.length > 0) { + if (legacyText.indexOf(mceInternalUrlPrefix) === -1) { + items['text/plain'] = legacyText; + } + } + } + if (dataTransfer.types) { + for (var i = 0; i < dataTransfer.types.length; i++) { + var contentType = dataTransfer.types[i]; + try { + items[contentType] = dataTransfer.getData(contentType); + } catch (ex) { + items[contentType] = ''; + } + } + } + } + return items; + }; + var getClipboardContent = function (editor, clipboardEvent) { + return getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer); + }; + var hasContentType = function (clipboardContent, mimeType) { + return mimeType in clipboardContent && clipboardContent[mimeType].length > 0; + }; + var hasHtmlOrText = function (content) { + return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain'); + }; + var parseDataUri = function (uri) { + var matches = /data:([^;]+);base64,([a-z0-9\+\/=]+)/i.exec(uri); + if (matches) { + return { + type: matches[1], + data: decodeURIComponent(matches[2]) + }; + } else { + return { + type: null, + data: null + }; + } + }; + var isValidDataUriImage = function (editor, imgElm) { + var filter = getImagesDataImgFilter(editor); + return filter ? filter(imgElm) : true; + }; + var extractFilename = function (editor, str) { + var m = str.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i); + return isNonNullable(m) ? editor.dom.encode(m[1]) : null; + }; + var uniqueId = createIdGenerator('mceclip'); + var pasteImage = function (editor, imageItem) { + var _a = parseDataUri(imageItem.uri), base64 = _a.data, type = _a.type; + var id = uniqueId(); + var file = imageItem.blob; + var img = new Image(); + img.src = imageItem.uri; + if (isValidDataUriImage(editor, img)) { + var blobCache = editor.editorUpload.blobCache; + var blobInfo = void 0; + var existingBlobInfo = blobCache.getByData(base64, type); + if (!existingBlobInfo) { + var useFileName = getImagesReuseFilename(editor) && isNonNullable(file.name); + var name_1 = useFileName ? extractFilename(editor, file.name) : id; + var filename = useFileName ? file.name : undefined; + blobInfo = blobCache.create(id, file, base64, name_1, filename); + blobCache.add(blobInfo); + } else { + blobInfo = existingBlobInfo; + } + pasteHtml(editor, '', false); + } else { + pasteHtml(editor, '', false); + } + }; + var isClipboardEvent = function (event) { + return event.type === 'paste'; + }; + var isDataTransferItem = function (item) { + return isNonNullable(item.getAsFile); + }; + var readFilesAsDataUris = function (items) { + return global$8.all(map(items, function (item) { + return new global$8(function (resolve) { + var blob = isDataTransferItem(item) ? item.getAsFile() : item; + var reader = new window.FileReader(); + reader.onload = function () { + resolve({ + blob: blob, + uri: reader.result + }); + }; + reader.readAsDataURL(blob); + }); + })); + }; + var isImage = function (editor) { + var allowedExtensions = getAllowedImageFileTypes(editor); + return function (file) { + return startsWith(file.type, 'image/') && exists(allowedExtensions, function (extension) { + return getImageMimeType(extension) === file.type; + }); + }; + }; + var getImagesFromDataTransfer = function (editor, dataTransfer) { + var items = dataTransfer.items ? bind(from(dataTransfer.items), function (item) { + return item.kind === 'file' ? [item.getAsFile()] : []; + }) : []; + var files = dataTransfer.files ? from(dataTransfer.files) : []; + return filter$1(items.length > 0 ? items : files, isImage(editor)); + }; + var pasteImageData = function (editor, e, rng) { + var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer; + if (getPasteDataImages(editor) && dataTransfer) { + var images = getImagesFromDataTransfer(editor, dataTransfer); + if (images.length > 0) { + e.preventDefault(); + readFilesAsDataUris(images).then(function (fileResults) { + if (rng) { + editor.selection.setRng(rng); + } + each(fileResults, function (result) { + pasteImage(editor, result); + }); + }); + return true; + } + } + return false; + }; + var isBrokenAndroidClipboardEvent = function (e) { + var clipboardData = e.clipboardData; + return navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0; + }; + var isKeyboardPasteEvent = function (e) { + return global$7.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45; + }; + var registerEventHandlers = function (editor, pasteBin, pasteFormat) { + var keyboardPasteEvent = value(); + var keyboardPastePressed = value(); + var keyboardPastePlainTextState; + editor.on('keyup', keyboardPastePressed.clear); + editor.on('keydown', function (e) { + var removePasteBinOnKeyUp = function (e) { + if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { + pasteBin.remove(); + } + }; + if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { + keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86; + if (keyboardPastePlainTextState && global$a.webkit && navigator.userAgent.indexOf('Version/') !== -1) { + return; + } + e.stopImmediatePropagation(); + keyboardPasteEvent.set(e); + keyboardPastePressed.set(true); + if (global$a.ie && keyboardPastePlainTextState) { + e.preventDefault(); + firePaste(editor, true); + return; + } + pasteBin.remove(); + pasteBin.create(); + editor.once('keyup', removePasteBinOnKeyUp); + editor.once('paste', function () { + editor.off('keyup', removePasteBinOnKeyUp); + }); + } + }); + var insertClipboardContent = function (editor, clipboardContent, isKeyBoardPaste, plainTextMode, internal) { + var content; + if (hasContentType(clipboardContent, 'text/html')) { + content = clipboardContent['text/html']; + } else { + content = pasteBin.getHtml(); + internal = internal ? internal : isMarked(content); + if (pasteBin.isDefaultContent(content)) { + plainTextMode = true; + } + } + content = trimHtml(content); + pasteBin.remove(); + var isPlainTextHtml = internal === false && isPlainText(content); + var isAbsoluteUrl$1 = isAbsoluteUrl(content); + if (!content.length || isPlainTextHtml && !isAbsoluteUrl$1) { + plainTextMode = true; + } + if (plainTextMode || isAbsoluteUrl$1) { + if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) { + content = clipboardContent['text/plain']; + } else { + content = innerText(content); + } + } + if (pasteBin.isDefaultContent(content)) { + if (!isKeyBoardPaste) { + editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.'); + } + return; + } + if (plainTextMode) { + pasteText(editor, content); + } else { + pasteHtml(editor, content, internal); + } + }; + var getLastRng = function () { + return pasteBin.getLastRng() || editor.selection.getRng(); + }; + editor.on('paste', function (e) { + var isKeyboardPaste = keyboardPasteEvent.isSet() || keyboardPastePressed.isSet(); + if (isKeyboardPaste) { + keyboardPasteEvent.clear(); + } + var clipboardContent = getClipboardContent(editor, e); + var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState; + var internal = hasContentType(clipboardContent, internalHtmlMime()); + keyboardPastePlainTextState = false; + if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) { + pasteBin.remove(); + return; + } + if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) { + pasteBin.remove(); + return; + } + if (!isKeyboardPaste) { + e.preventDefault(); + } + if (global$a.ie && (!isKeyboardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) { + pasteBin.create(); + editor.dom.bind(pasteBin.getEl(), 'paste', function (e) { + e.stopPropagation(); + }); + editor.getDoc().execCommand('Paste', false, null); + clipboardContent['text/html'] = pasteBin.getHtml(); + } + if (hasContentType(clipboardContent, 'text/html')) { + e.preventDefault(); + if (!internal) { + internal = isMarked(clipboardContent['text/html']); + } + insertClipboardContent(editor, clipboardContent, isKeyboardPaste, plainTextMode, internal); + } else { + global$9.setEditorTimeout(editor, function () { + insertClipboardContent(editor, clipboardContent, isKeyboardPaste, plainTextMode, internal); + }, 0); + } + }); + }; + var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) { + registerEventHandlers(editor, pasteBin, pasteFormat); + var src; + editor.parser.addNodeFilter('img', function (nodes, name, args) { + var isPasteInsert = function (args) { + return args.data && args.data.paste === true; + }; + var remove = function (node) { + if (!node.attr('data-mce-object') && src !== global$a.transparentSrc) { + node.remove(); + } + }; + var isWebKitFakeUrl = function (src) { + return src.indexOf('webkit-fake-url') === 0; + }; + var isDataUri = function (src) { + return src.indexOf('data:') === 0; + }; + if (!getPasteDataImages(editor) && isPasteInsert(args)) { + var i = nodes.length; + while (i--) { + src = nodes[i].attr('src'); + if (!src) { + continue; + } + if (isWebKitFakeUrl(src)) { + remove(nodes[i]); + } else if (!getAllowHtmlDataUrls(editor) && isDataUri(src)) { + remove(nodes[i]); + } + } + } + }); + }; + + var getPasteBinParent = function (editor) { + return global$a.ie && editor.inline ? document.body : editor.getBody(); + }; + var isExternalPasteBin = function (editor) { + return getPasteBinParent(editor) !== editor.getBody(); + }; + var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) { + if (isExternalPasteBin(editor)) { + editor.dom.bind(pasteBinElm, 'paste keyup', function (_e) { + if (!isDefault(editor, pasteBinDefaultContent)) { + editor.fire('paste'); + } + }); + } + }; + var create = function (editor, lastRngCell, pasteBinDefaultContent) { + var dom = editor.dom, body = editor.getBody(); + lastRngCell.set(editor.selection.getRng()); + var pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', { + 'id': 'mcepastebin', + 'class': 'mce-pastebin', + 'contentEditable': true, + 'data-mce-bogus': 'all', + 'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0' + }, pasteBinDefaultContent); + if (global$a.ie || global$a.gecko) { + dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535); + } + dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) { + e.stopPropagation(); + }); + delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent); + pasteBinElm.focus(); + editor.selection.select(pasteBinElm, true); + }; + var remove = function (editor, lastRngCell) { + if (getEl(editor)) { + var pasteBinClone = void 0; + var lastRng = lastRngCell.get(); + while (pasteBinClone = editor.dom.get('mcepastebin')) { + editor.dom.remove(pasteBinClone); + editor.dom.unbind(pasteBinClone); + } + if (lastRng) { + editor.selection.setRng(lastRng); + } + } + lastRngCell.set(null); + }; + var getEl = function (editor) { + return editor.dom.get('mcepastebin'); + }; + var getHtml = function (editor) { + var copyAndRemove = function (toElm, fromElm) { + toElm.appendChild(fromElm); + editor.dom.remove(fromElm, true); + }; + var pasteBinClones = global$6.grep(getPasteBinParent(editor).childNodes, function (elm) { + return elm.id === 'mcepastebin'; + }); + var pasteBinElm = pasteBinClones.shift(); + global$6.each(pasteBinClones, function (pasteBinClone) { + copyAndRemove(pasteBinElm, pasteBinClone); + }); + var dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm); + for (var i = dirtyWrappers.length - 1; i >= 0; i--) { + var cleanWrapper = editor.dom.create('div'); + pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]); + copyAndRemove(cleanWrapper, dirtyWrappers[i]); + } + return pasteBinElm ? pasteBinElm.innerHTML : ''; + }; + var isDefaultContent = function (pasteBinDefaultContent, content) { + return content === pasteBinDefaultContent; + }; + var isPasteBin = function (elm) { + return elm && elm.id === 'mcepastebin'; + }; + var isDefault = function (editor, pasteBinDefaultContent) { + var pasteBinElm = getEl(editor); + return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML); + }; + var PasteBin = function (editor) { + var lastRng = Cell(null); + var pasteBinDefaultContent = '%MCEPASTEBIN%'; + return { + create: function () { + return create(editor, lastRng, pasteBinDefaultContent); + }, + remove: function () { + return remove(editor, lastRng); + }, + getEl: function () { + return getEl(editor); + }, + getHtml: function () { + return getHtml(editor); + }, + getLastRng: lastRng.get, + isDefault: function () { + return isDefault(editor, pasteBinDefaultContent); + }, + isDefaultContent: function (content) { + return isDefaultContent(pasteBinDefaultContent, content); + } + }; + }; + + var Clipboard = function (editor, pasteFormat) { + var pasteBin = PasteBin(editor); + editor.on('PreInit', function () { + return registerEventsAndFilters(editor, pasteBin, pasteFormat); + }); + return { + pasteFormat: pasteFormat, + pasteHtml: function (html, internalFlag) { + return pasteHtml(editor, html, internalFlag); + }, + pasteText: function (text) { + return pasteText(editor, text); + }, + pasteImageData: function (e, rng) { + return pasteImageData(editor, e, rng); + }, + getDataTransferItems: getDataTransferItems, + hasHtmlOrText: hasHtmlOrText, + hasContentType: hasContentType + }; + }; + + var togglePlainTextPaste = function (editor, clipboard) { + if (clipboard.pasteFormat.get() === 'text') { + clipboard.pasteFormat.set('html'); + firePastePlainTextToggle(editor, false); + } else { + clipboard.pasteFormat.set('text'); + firePastePlainTextToggle(editor, true); + } + editor.focus(); + }; + + var register$2 = function (editor, clipboard) { + editor.addCommand('mceTogglePlainTextPaste', function () { + togglePlainTextPaste(editor, clipboard); + }); + editor.addCommand('mceInsertClipboardContent', function (ui, value) { + if (value.content) { + clipboard.pasteHtml(value.content, value.internal); + } + if (value.text) { + clipboard.pasteText(value.text); + } + }); + }; + + var hasWorkingClipboardApi = function (clipboardData) { + return global$a.iOS === false && typeof (clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.setData) === 'function'; + }; + var setHtml5Clipboard = function (clipboardData, html, text) { + if (hasWorkingClipboardApi(clipboardData)) { + try { + clipboardData.clearData(); + clipboardData.setData('text/html', html); + clipboardData.setData('text/plain', text); + clipboardData.setData(internalHtmlMime(), html); + return true; + } catch (e) { + return false; + } + } else { + return false; + } + }; + var setClipboardData = function (evt, data, fallback, done) { + if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) { + evt.preventDefault(); + done(); + } else { + fallback(data.html, done); + } + }; + var fallback = function (editor) { + return function (html, done) { + var markedHtml = mark(html); + var outer = editor.dom.create('div', { + 'contenteditable': 'false', + 'data-mce-bogus': 'all' + }); + var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml); + editor.dom.setStyles(outer, { + position: 'fixed', + top: '0', + left: '-3000px', + width: '1000px', + overflow: 'hidden' + }); + outer.appendChild(inner); + editor.dom.add(editor.getBody(), outer); + var range = editor.selection.getRng(); + inner.focus(); + var offscreenRange = editor.dom.createRng(); + offscreenRange.selectNodeContents(inner); + editor.selection.setRng(offscreenRange); + global$9.setTimeout(function () { + editor.selection.setRng(range); + outer.parentNode.removeChild(outer); + done(); + }, 0); + }; + }; + var getData = function (editor) { + return { + html: editor.selection.getContent({ contextual: true }), + text: editor.selection.getContent({ format: 'text' }) + }; + }; + var isTableSelection = function (editor) { + return !!editor.dom.getParent(editor.selection.getStart(), 'td[data-mce-selected],th[data-mce-selected]', editor.getBody()); + }; + var hasSelectedContent = function (editor) { + return !editor.selection.isCollapsed() || isTableSelection(editor); + }; + var cut = function (editor) { + return function (evt) { + if (hasSelectedContent(editor)) { + setClipboardData(evt, getData(editor), fallback(editor), function () { + if (global$a.browser.isChrome() || global$a.browser.isFirefox()) { + var rng_1 = editor.selection.getRng(); + global$9.setEditorTimeout(editor, function () { + editor.selection.setRng(rng_1); + editor.execCommand('Delete'); + }, 0); + } else { + editor.execCommand('Delete'); + } + }); + } + }; + }; + var copy = function (editor) { + return function (evt) { + if (hasSelectedContent(editor)) { + setClipboardData(evt, getData(editor), fallback(editor), noop); + } + }; + }; + var register$1 = function (editor) { + editor.on('cut', cut(editor)); + editor.on('copy', copy(editor)); + }; + + var global = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils'); + + var getCaretRangeFromEvent = function (editor, e) { + return global.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc()); + }; + var isPlainTextFileUrl = function (content) { + var plainTextContent = content['text/plain']; + return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false; + }; + var setFocusedRange = function (editor, rng) { + editor.focus(); + editor.selection.setRng(rng); + }; + var setup$2 = function (editor, clipboard, draggingInternallyState) { + if (shouldBlockDrop(editor)) { + editor.on('dragend dragover draggesture dragdrop drop drag', function (e) { + e.preventDefault(); + e.stopPropagation(); + }); + } + if (!shouldPasteDataImages(editor)) { + editor.on('drop', function (e) { + var dataTransfer = e.dataTransfer; + if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) { + e.preventDefault(); + } + }); + } + editor.on('drop', function (e) { + var rng = getCaretRangeFromEvent(editor, e); + if (e.isDefaultPrevented() || draggingInternallyState.get()) { + return; + } + var dropContent = clipboard.getDataTransferItems(e.dataTransfer); + var internal = clipboard.hasContentType(dropContent, internalHtmlMime()); + if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) { + return; + } + if (rng && shouldFilterDrop(editor)) { + var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain']; + if (content_1) { + e.preventDefault(); + global$9.setEditorTimeout(editor, function () { + editor.undoManager.transact(function () { + if (dropContent['mce-internal']) { + editor.execCommand('Delete'); + } + setFocusedRange(editor, rng); + content_1 = trimHtml(content_1); + if (!dropContent['text/html']) { + clipboard.pasteText(content_1); + } else { + clipboard.pasteHtml(content_1, internal); + } + }); + }); + } + } + }); + editor.on('dragstart', function (_e) { + draggingInternallyState.set(true); + }); + editor.on('dragover dragend', function (e) { + if (shouldPasteDataImages(editor) && draggingInternallyState.get() === false) { + e.preventDefault(); + setFocusedRange(editor, getCaretRangeFromEvent(editor, e)); + } + if (e.type === 'dragend') { + draggingInternallyState.set(false); + } + }); + }; + + var setup$1 = function (editor) { + var plugin = editor.plugins.paste; + var preProcess = getPreProcess(editor); + if (preProcess) { + editor.on('PastePreProcess', function (e) { + preProcess.call(plugin, plugin, e); + }); + } + var postProcess = getPostProcess(editor); + if (postProcess) { + editor.on('PastePostProcess', function (e) { + postProcess.call(plugin, plugin, e); + }); + } + }; + + var addPreProcessFilter = function (editor, filterFunc) { + editor.on('PastePreProcess', function (e) { + e.content = filterFunc(editor, e.content, e.internal, e.wordContent); + }); + }; + var addPostProcessFilter = function (editor, filterFunc) { + editor.on('PastePostProcess', function (e) { + filterFunc(editor, e.node); + }); + }; + var removeExplorerBrElementsAfterBlocks = function (editor, html) { + if (!isWordContent(html)) { + return html; + } + var blockElements = []; + global$6.each(editor.schema.getBlockElements(), function (block, blockName) { + blockElements.push(blockName); + }); + var explorerBlocksRegExp = new RegExp('(?:
 [\\s\\r\\n]+|
)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:
 [\\s\\r\\n]+|
)*', 'g'); + html = filter(html, [[ + explorerBlocksRegExp, + '$1' + ]]); + html = filter(html, [ + [ + /

/g, + '

' + ], + [ + /
/g, + ' ' + ], + [ + /

/g, + '
' + ] + ]); + return html; + }; + var removeWebKitStyles = function (editor, content, internal, isWordHtml) { + if (isWordHtml || internal) { + return content; + } + var webKitStylesSetting = getWebkitStyles(editor); + var webKitStyles; + if (shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') { + return content; + } + if (webKitStylesSetting) { + webKitStyles = webKitStylesSetting.split(/[, ]/); + } + if (webKitStyles) { + var dom_1 = editor.dom, node_1 = editor.selection.getNode(); + content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) { + var inputStyles = dom_1.parseStyle(dom_1.decode(value)); + var outputStyles = {}; + if (webKitStyles === 'none') { + return before + after; + } + for (var i = 0; i < webKitStyles.length; i++) { + var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true); + if (/color/.test(webKitStyles[i])) { + inputValue = dom_1.toHex(inputValue); + currentValue = dom_1.toHex(currentValue); + } + if (currentValue !== inputValue) { + outputStyles[webKitStyles[i]] = inputValue; + } + } + var outputStyle = dom_1.serializeStyle(outputStyles, 'span'); + if (outputStyle) { + return before + ' style="' + outputStyle + '"' + after; + } + return before + after; + }); + } else { + content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3'); + } + content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) { + return before + ' style="' + value + '"' + after; + }); + return content; + }; + var removeUnderlineAndFontInAnchor = function (editor, root) { + editor.$('a', root).find('font,u').each(function (i, node) { + editor.dom.remove(node, true); + }); + }; + var setup = function (editor) { + if (global$a.webkit) { + addPreProcessFilter(editor, removeWebKitStyles); + } + if (global$a.ie) { + addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks); + addPostProcessFilter(editor, removeUnderlineAndFontInAnchor); + } + }; + + var makeSetupHandler = function (editor, clipboard) { + return function (api) { + api.setActive(clipboard.pasteFormat.get() === 'text'); + var pastePlainTextToggleHandler = function (e) { + return api.setActive(e.state); + }; + editor.on('PastePlainTextToggle', pastePlainTextToggleHandler); + return function () { + return editor.off('PastePlainTextToggle', pastePlainTextToggleHandler); + }; + }; + }; + var register = function (editor, clipboard) { + var onAction = function () { + return editor.execCommand('mceTogglePlainTextPaste'); + }; + editor.ui.registry.addToggleButton('pastetext', { + active: false, + icon: 'paste-text', + tooltip: 'Paste as text', + onAction: onAction, + onSetup: makeSetupHandler(editor, clipboard) + }); + editor.ui.registry.addToggleMenuItem('pastetext', { + text: 'Paste as text', + icon: 'paste-text', + onAction: onAction, + onSetup: makeSetupHandler(editor, clipboard) + }); + }; + + function Plugin () { + global$b.add('paste', function (editor) { + if (hasProPlugin(editor) === false) { + var draggingInternallyState = Cell(false); + var pasteFormat = Cell(isPasteAsTextEnabled(editor) ? 'text' : 'html'); + var clipboard = Clipboard(editor, pasteFormat); + setup(editor); + register(editor, clipboard); + register$2(editor, clipboard); + setup$1(editor); + register$1(editor); + setup$2(editor, clipboard, draggingInternallyState); + return get(clipboard); + } + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var global = tinymce.util.Tools.resolve('tinymce.Env'); + + var register$1 = function (editor) { + editor.addCommand('mcePrint', function () { + if (global.browser.isIE()) { + editor.getDoc().execCommand('print', false, null); + } else { + editor.getWin().print(); + } + }); + }; + + var register = function (editor) { + var onAction = function () { + return editor.execCommand('mcePrint'); + }; + editor.ui.registry.addButton('print', { + icon: 'print', + tooltip: 'Print', + onAction: onAction + }); + editor.ui.registry.addMenuItem('print', { + text: 'Print...', + icon: 'print', + onAction: onAction + }); + }; + + function Plugin () { + global$1.add('print', function (editor) { + register$1(editor); + register(editor); + editor.addShortcut('Meta+P', '', 'mcePrint'); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); + + var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var getContentStyle = function (editor) { + return editor.getParam('content_style', '', 'string'); + }; + var shouldUseContentCssCors = function (editor) { + return editor.getParam('content_css_cors', false, 'boolean'); + }; + var getBodyClassByHash = function (editor) { + var bodyClass = editor.getParam('body_class', '', 'hash'); + return bodyClass[editor.id] || ''; + }; + var getBodyClass = function (editor) { + var bodyClass = editor.getParam('body_class', '', 'string'); + if (bodyClass.indexOf('=') === -1) { + return bodyClass; + } else { + return getBodyClassByHash(editor); + } + }; + var getBodyIdByHash = function (editor) { + var bodyId = editor.getParam('body_id', '', 'hash'); + return bodyId[editor.id] || bodyId; + }; + var getBodyId = function (editor) { + var bodyId = editor.getParam('body_id', 'tinymce', 'string'); + if (bodyId.indexOf('=') === -1) { + return bodyId; + } else { + return getBodyIdByHash(editor); + } + }; + + var getPreviewHtml = function (editor) { + var headHtml = ''; + var encode = editor.dom.encode; + var contentStyle = getContentStyle(editor); + headHtml += ''; + var cors = shouldUseContentCssCors(editor) ? ' crossorigin="anonymous"' : ''; + global.each(editor.contentCSS, function (url) { + headHtml += ''; + }); + if (contentStyle) { + headHtml += ''; + } + var bodyId = getBodyId(editor); + var bodyClass = getBodyClass(editor); + var isMetaKeyPressed = global$1.mac ? 'e.metaKey' : 'e.ctrlKey && !e.altKey'; + var preventClicksOnLinksScript = ' '; + var directionality = editor.getBody().dir; + var dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : ''; + var previewHtml = '' + '' + '' + headHtml + '' + '' + editor.getContent() + preventClicksOnLinksScript + '' + ''; + return previewHtml; + }; + + var open = function (editor) { + var content = getPreviewHtml(editor); + var dataApi = editor.windowManager.open({ + title: 'Preview', + size: 'large', + body: { + type: 'panel', + items: [{ + name: 'preview', + type: 'iframe', + sandboxed: true + }] + }, + buttons: [{ + type: 'cancel', + name: 'close', + text: 'Close', + primary: true + }], + initialData: { preview: content } + }); + dataApi.focus('close'); + }; + + var register$1 = function (editor) { + editor.addCommand('mcePreview', function () { + open(editor); + }); + }; + + var register = function (editor) { + var onAction = function () { + return editor.execCommand('mcePreview'); + }; + editor.ui.registry.addButton('preview', { + icon: 'preview', + tooltip: 'Preview', + onAction: onAction + }); + editor.ui.registry.addMenuItem('preview', { + icon: 'preview', + text: 'Preview', + onAction: onAction + }); + }; + + function Plugin () { + global$2.add('preview', function (editor) { + register$1(editor); + register(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); + + var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var enableWhenDirty = function (editor) { + return editor.getParam('save_enablewhendirty', true); + }; + var hasOnSaveCallback = function (editor) { + return !!editor.getParam('save_onsavecallback'); + }; + var hasOnCancelCallback = function (editor) { + return !!editor.getParam('save_oncancelcallback'); + }; + + var displayErrorMessage = function (editor, message) { + editor.notificationManager.open({ + text: message, + type: 'error' + }); + }; + var save = function (editor) { + var formObj = global$1.DOM.getParent(editor.id, 'form'); + if (enableWhenDirty(editor) && !editor.isDirty()) { + return; + } + editor.save(); + if (hasOnSaveCallback(editor)) { + editor.execCallback('save_onsavecallback', editor); + editor.nodeChanged(); + return; + } + if (formObj) { + editor.setDirty(false); + if (!formObj.onsubmit || formObj.onsubmit()) { + if (typeof formObj.submit === 'function') { + formObj.submit(); + } else { + displayErrorMessage(editor, 'Error: Form submit field collision.'); + } + } + editor.nodeChanged(); + } else { + displayErrorMessage(editor, 'Error: No form element found.'); + } + }; + var cancel = function (editor) { + var h = global.trim(editor.startContent); + if (hasOnCancelCallback(editor)) { + editor.execCallback('save_oncancelcallback', editor); + return; + } + editor.resetContent(h); + }; + + var register$1 = function (editor) { + editor.addCommand('mceSave', function () { + save(editor); + }); + editor.addCommand('mceCancel', function () { + cancel(editor); + }); + }; + + var stateToggle = function (editor) { + return function (api) { + var handler = function () { + api.setDisabled(enableWhenDirty(editor) && !editor.isDirty()); + }; + handler(); + editor.on('NodeChange dirty', handler); + return function () { + return editor.off('NodeChange dirty', handler); + }; + }; + }; + var register = function (editor) { + editor.ui.registry.addButton('save', { + icon: 'save', + tooltip: 'Save', + disabled: true, + onAction: function () { + return editor.execCommand('mceSave'); + }, + onSetup: stateToggle(editor) + }); + editor.ui.registry.addButton('cancel', { + icon: 'cancel', + tooltip: 'Cancel', + disabled: true, + onAction: function () { + return editor.execCommand('mceCancel'); + }, + onSetup: stateToggle(editor) + }); + editor.addShortcut('Meta+S', '', 'mceSave'); + }; + + function Plugin () { + global$2.add('save', function (editor) { + register(editor); + register$1(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var unique = 0; + var generate = function (prefix) { + var date = new Date(); + var time = date.getTime(); + var random = Math.floor(Math.random() * 1000000000); + unique++; + return prefix + '_' + random + unique + String(time); + }; + + var createTableHtml = function (cols, rows) { + var html = ''; + html += ''; + for (var y = 0; y < rows; y++) { + html += ''; + for (var x = 0; x < cols; x++) { + html += ''; + } + html += ''; + } + html += ''; + html += '

'; + return html; + }; + var getInsertedElement = function (editor) { + var elms = editor.dom.select('*[data-mce-id]'); + return elms[0]; + }; + var insertTableHtml = function (editor, cols, rows) { + editor.undoManager.transact(function () { + editor.insertContent(createTableHtml(cols, rows)); + var tableElm = getInsertedElement(editor); + tableElm.removeAttribute('data-mce-id'); + var cellElm = editor.dom.select('td,th', tableElm); + editor.selection.setCursorLocation(cellElm[0], 0); + }); + }; + var insertTable = function (editor, cols, rows) { + editor.plugins.table ? editor.plugins.table.insertTable(cols, rows) : insertTableHtml(editor, cols, rows); + }; + var insertBlob = function (editor, base64, blob) { + var blobCache = editor.editorUpload.blobCache; + var blobInfo = blobCache.create(generate('mceu'), blob, base64); + blobCache.add(blobInfo); + editor.insertContent(editor.dom.createHTML('img', { src: blobInfo.blobUri() })); + }; + + var global$2 = tinymce.util.Tools.resolve('tinymce.util.Promise'); + + var blobToBase64 = function (blob) { + return new global$2(function (resolve) { + var reader = new FileReader(); + reader.onloadend = function () { + resolve(reader.result.split(',')[1]); + }; + reader.readAsDataURL(blob); + }); + }; + + var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); + + var global = tinymce.util.Tools.resolve('tinymce.util.Delay'); + + var pickFile = function (editor) { + return new global$2(function (resolve) { + var fileInput = document.createElement('input'); + fileInput.type = 'file'; + fileInput.accept = 'image/*'; + fileInput.style.position = 'fixed'; + fileInput.style.left = '0'; + fileInput.style.top = '0'; + fileInput.style.opacity = '0.001'; + document.body.appendChild(fileInput); + var changeHandler = function (e) { + resolve(Array.prototype.slice.call(e.target.files)); + }; + fileInput.addEventListener('change', changeHandler); + var cancelHandler = function (e) { + var cleanup = function () { + resolve([]); + fileInput.parentNode.removeChild(fileInput); + }; + if (global$1.os.isAndroid() && e.type !== 'remove') { + global.setEditorTimeout(editor, cleanup, 0); + } else { + cleanup(); + } + editor.off('focusin remove', cancelHandler); + }; + editor.on('focusin remove', cancelHandler); + fileInput.click(); + }); + }; + + var setupButtons = function (editor) { + editor.ui.registry.addButton('quickimage', { + icon: 'image', + tooltip: 'Insert image', + onAction: function () { + pickFile(editor).then(function (files) { + if (files.length > 0) { + var blob_1 = files[0]; + blobToBase64(blob_1).then(function (base64) { + insertBlob(editor, base64, blob_1); + }); + } + }); + } + }); + editor.ui.registry.addButton('quicktable', { + icon: 'table', + tooltip: 'Insert table', + onAction: function () { + insertTable(editor, 2, 2); + } + }); + }; + + var typeOf = function (x) { + var t = typeof x; + if (x === null) { + return 'null'; + } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { + return 'array'; + } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { + return 'string'; + } else { + return t; + } + }; + var isType = function (type) { + return function (value) { + return typeOf(value) === type; + }; + }; + var isSimpleType = function (type) { + return function (value) { + return typeof value === type; + }; + }; + var eq = function (t) { + return function (a) { + return t === a; + }; + }; + var isString = isType('string'); + var isObject = isType('object'); + var isArray = isType('array'); + var isBoolean = isSimpleType('boolean'); + var isUndefined = eq(undefined); + var isFunction = isSimpleType('function'); + + var noop = function () { + }; + var constant = function (value) { + return function () { + return value; + }; + }; + var identity = function (x) { + return x; + }; + var never = constant(false); + var always = constant(true); + + var none = function () { + return NONE; + }; + var NONE = function () { + var call = function (thunk) { + return thunk(); + }; + var id = identity; + var me = { + fold: function (n, _s) { + return n(); + }, + isSome: never, + isNone: always, + getOr: id, + getOrThunk: call, + getOrDie: function (msg) { + throw new Error(msg || 'error: getOrDie called on none.'); + }, + getOrNull: constant(null), + getOrUndefined: constant(undefined), + or: id, + orThunk: call, + map: none, + each: noop, + bind: none, + exists: never, + forall: always, + filter: function () { + return none(); + }, + toArray: function () { + return []; + }, + toString: constant('none()') + }; + return me; + }(); + var some = function (a) { + var constant_a = constant(a); + var self = function () { + return me; + }; + var bind = function (f) { + return f(a); + }; + var me = { + fold: function (n, s) { + return s(a); + }, + isSome: always, + isNone: never, + getOr: constant_a, + getOrThunk: constant_a, + getOrDie: constant_a, + getOrNull: constant_a, + getOrUndefined: constant_a, + or: self, + orThunk: self, + map: function (f) { + return some(f(a)); + }, + each: function (f) { + f(a); + }, + bind: bind, + exists: bind, + forall: bind, + filter: function (f) { + return f(a) ? me : NONE; + }, + toArray: function () { + return [a]; + }, + toString: function () { + return 'some(' + a + ')'; + } + }; + return me; + }; + var from = function (value) { + return value === null || value === undefined ? NONE : some(value); + }; + var Optional = { + some: some, + none: none, + from: from + }; + + function ClosestOrAncestor (is, ancestor, scope, a, isRoot) { + if (is(scope, a)) { + return Optional.some(scope); + } else if (isFunction(isRoot) && isRoot(scope)) { + return Optional.none(); + } else { + return ancestor(scope, a, isRoot); + } + } + + var ELEMENT = 1; + + var fromHtml = function (html, scope) { + var doc = scope || document; + var div = doc.createElement('div'); + div.innerHTML = html; + if (!div.hasChildNodes() || div.childNodes.length > 1) { + console.error('HTML does not have a single root node', html); + throw new Error('HTML must have a single root node'); + } + return fromDom(div.childNodes[0]); + }; + var fromTag = function (tag, scope) { + var doc = scope || document; + var node = doc.createElement(tag); + return fromDom(node); + }; + var fromText = function (text, scope) { + var doc = scope || document; + var node = doc.createTextNode(text); + return fromDom(node); + }; + var fromDom = function (node) { + if (node === null || node === undefined) { + throw new Error('Node cannot be null or undefined'); + } + return { dom: node }; + }; + var fromPoint = function (docElm, x, y) { + return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom); + }; + var SugarElement = { + fromHtml: fromHtml, + fromTag: fromTag, + fromText: fromText, + fromDom: fromDom, + fromPoint: fromPoint + }; + + var is = function (element, selector) { + var dom = element.dom; + if (dom.nodeType !== ELEMENT) { + return false; + } else { + var elem = dom; + if (elem.matches !== undefined) { + return elem.matches(selector); + } else if (elem.msMatchesSelector !== undefined) { + return elem.msMatchesSelector(selector); + } else if (elem.webkitMatchesSelector !== undefined) { + return elem.webkitMatchesSelector(selector); + } else if (elem.mozMatchesSelector !== undefined) { + return elem.mozMatchesSelector(selector); + } else { + throw new Error('Browser lacks native selectors'); + } + } + }; + + typeof window !== 'undefined' ? window : Function('return this;')(); + + var name = function (element) { + var r = element.dom.nodeName; + return r.toLowerCase(); + }; + + var ancestor$1 = function (scope, predicate, isRoot) { + var element = scope.dom; + var stop = isFunction(isRoot) ? isRoot : never; + while (element.parentNode) { + element = element.parentNode; + var el = SugarElement.fromDom(element); + if (predicate(el)) { + return Optional.some(el); + } else if (stop(el)) { + break; + } + } + return Optional.none(); + }; + var closest$1 = function (scope, predicate, isRoot) { + var is = function (s, test) { + return test(s); + }; + return ClosestOrAncestor(is, ancestor$1, scope, predicate, isRoot); + }; + + var ancestor = function (scope, selector, isRoot) { + return ancestor$1(scope, function (e) { + return is(e, selector); + }, isRoot); + }; + var closest = function (scope, selector, isRoot) { + var is$1 = function (element, selector) { + return is(element, selector); + }; + return ClosestOrAncestor(is$1, ancestor, scope, selector, isRoot); + }; + + var validDefaultOrDie = function (value, predicate) { + if (predicate(value)) { + return true; + } + throw new Error('Default value doesn\'t match requested type.'); + }; + var items = function (value, defaultValue) { + if (isArray(value) || isObject(value)) { + throw new Error('expected a string but found: ' + value); + } + if (isUndefined(value)) { + return defaultValue; + } + if (isBoolean(value)) { + return value === false ? '' : defaultValue; + } + return value; + }; + var getToolbarItemsOr_ = function (predicate) { + return function (editor, name, defaultValue) { + validDefaultOrDie(defaultValue, predicate); + var value = editor.getParam(name, defaultValue); + return items(value, defaultValue); + }; + }; + var getToolbarItemsOr = getToolbarItemsOr_(isString); + + var getTextSelectionToolbarItems = function (editor) { + return getToolbarItemsOr(editor, 'quickbars_selection_toolbar', 'bold italic | quicklink h2 h3 blockquote'); + }; + var getInsertToolbarItems = function (editor) { + return getToolbarItemsOr(editor, 'quickbars_insert_toolbar', 'quickimage quicktable'); + }; + var getImageToolbarItems = function (editor) { + return getToolbarItemsOr(editor, 'quickbars_image_toolbar', 'alignleft aligncenter alignright'); + }; + + var addToEditor$1 = function (editor) { + var insertToolbarItems = getInsertToolbarItems(editor); + if (insertToolbarItems.trim().length > 0) { + editor.ui.registry.addContextToolbar('quickblock', { + predicate: function (node) { + var sugarNode = SugarElement.fromDom(node); + var textBlockElementsMap = editor.schema.getTextBlockElements(); + var isRoot = function (elem) { + return elem.dom === editor.getBody(); + }; + return closest(sugarNode, 'table', isRoot).fold(function () { + return closest$1(sugarNode, function (elem) { + return name(elem) in textBlockElementsMap && editor.dom.isEmpty(elem.dom); + }, isRoot).isSome(); + }, never); + }, + items: insertToolbarItems, + position: 'line', + scope: 'editor' + }); + } + }; + + var addToEditor = function (editor) { + var isEditable = function (node) { + return editor.dom.getContentEditableParent(node) !== 'false'; + }; + var isImage = function (node) { + return node.nodeName === 'IMG' || node.nodeName === 'FIGURE' && /image/i.test(node.className); + }; + var imageToolbarItems = getImageToolbarItems(editor); + if (imageToolbarItems.trim().length > 0) { + editor.ui.registry.addContextToolbar('imageselection', { + predicate: isImage, + items: imageToolbarItems, + position: 'node' + }); + } + var textToolbarItems = getTextSelectionToolbarItems(editor); + if (textToolbarItems.trim().length > 0) { + editor.ui.registry.addContextToolbar('textselection', { + predicate: function (node) { + return !isImage(node) && !editor.selection.isCollapsed() && isEditable(node); + }, + items: textToolbarItems, + position: 'selection', + scope: 'editor' + }); + } + }; + + function Plugin () { + global$3.add('quickbars', function (editor) { + setupButtons(editor); + addToEditor$1(editor); + addToEditor(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; + }; + var set = function (v) { + value = v; + }; + return { + get: get, + set: set + }; + }; + + var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + var typeOf = function (x) { + var t = typeof x; + if (x === null) { + return 'null'; + } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { + return 'array'; + } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { + return 'string'; + } else { + return t; + } + }; + var isType$1 = function (type) { + return function (value) { + return typeOf(value) === type; + }; + }; + var isSimpleType = function (type) { + return function (value) { + return typeof value === type; + }; + }; + var isString = isType$1('string'); + var isArray = isType$1('array'); + var isBoolean = isSimpleType('boolean'); + var isNumber = isSimpleType('number'); + + var noop = function () { + }; + var constant = function (value) { + return function () { + return value; + }; + }; + var identity = function (x) { + return x; + }; + var never = constant(false); + var always = constant(true); + + var punctuationStr = '[!-#%-*,-\\/:;?@\\[-\\]_{}\xA1\xAB\xB7\xBB\xBF;\xB7\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1361-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u3008\u3009\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30\u2E31\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uff3f\uFF5B\uFF5D\uFF5F-\uFF65]'; + + var punctuation$1 = constant(punctuationStr); + + var none = function () { + return NONE; + }; + var NONE = function () { + var call = function (thunk) { + return thunk(); + }; + var id = identity; + var me = { + fold: function (n, _s) { + return n(); + }, + isSome: never, + isNone: always, + getOr: id, + getOrThunk: call, + getOrDie: function (msg) { + throw new Error(msg || 'error: getOrDie called on none.'); + }, + getOrNull: constant(null), + getOrUndefined: constant(undefined), + or: id, + orThunk: call, + map: none, + each: noop, + bind: none, + exists: never, + forall: always, + filter: function () { + return none(); + }, + toArray: function () { + return []; + }, + toString: constant('none()') + }; + return me; + }(); + var some = function (a) { + var constant_a = constant(a); + var self = function () { + return me; + }; + var bind = function (f) { + return f(a); + }; + var me = { + fold: function (n, s) { + return s(a); + }, + isSome: always, + isNone: never, + getOr: constant_a, + getOrThunk: constant_a, + getOrDie: constant_a, + getOrNull: constant_a, + getOrUndefined: constant_a, + or: self, + orThunk: self, + map: function (f) { + return some(f(a)); + }, + each: function (f) { + f(a); + }, + bind: bind, + exists: bind, + forall: bind, + filter: function (f) { + return f(a) ? me : NONE; + }, + toArray: function () { + return [a]; + }, + toString: function () { + return 'some(' + a + ')'; + } + }; + return me; + }; + var from = function (value) { + return value === null || value === undefined ? NONE : some(value); + }; + var Optional = { + some: some, + none: none, + from: from + }; + + var punctuation = punctuation$1; + + var global$2 = tinymce.util.Tools.resolve('tinymce.Env'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var nativeSlice = Array.prototype.slice; + var nativePush = Array.prototype.push; + var map = function (xs, f) { + var len = xs.length; + var r = new Array(len); + for (var i = 0; i < len; i++) { + var x = xs[i]; + r[i] = f(x, i); + } + return r; + }; + var each = function (xs, f) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + f(x, i); + } + }; + var eachr = function (xs, f) { + for (var i = xs.length - 1; i >= 0; i--) { + var x = xs[i]; + f(x, i); + } + }; + var groupBy = function (xs, f) { + if (xs.length === 0) { + return []; + } else { + var wasType = f(xs[0]); + var r = []; + var group = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + var type = f(x); + if (type !== wasType) { + r.push(group); + group = []; + } + wasType = type; + group.push(x); + } + if (group.length !== 0) { + r.push(group); + } + return r; + } + }; + var foldl = function (xs, f, acc) { + each(xs, function (x, i) { + acc = f(acc, x, i); + }); + return acc; + }; + var flatten = function (xs) { + var r = []; + for (var i = 0, len = xs.length; i < len; ++i) { + if (!isArray(xs[i])) { + throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs); + } + nativePush.apply(r, xs[i]); + } + return r; + }; + var bind = function (xs, f) { + return flatten(map(xs, f)); + }; + var sort = function (xs, comparator) { + var copy = nativeSlice.call(xs, 0); + copy.sort(comparator); + return copy; + }; + + var hasOwnProperty = Object.hasOwnProperty; + var has = function (obj, key) { + return hasOwnProperty.call(obj, key); + }; + + typeof window !== 'undefined' ? window : Function('return this;')(); + + var DOCUMENT = 9; + var DOCUMENT_FRAGMENT = 11; + var ELEMENT = 1; + var TEXT = 3; + + var type = function (element) { + return element.dom.nodeType; + }; + var isType = function (t) { + return function (element) { + return type(element) === t; + }; + }; + var isText$1 = isType(TEXT); + + var rawSet = function (dom, key, value) { + if (isString(value) || isBoolean(value) || isNumber(value)) { + dom.setAttribute(key, value + ''); + } else { + console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom); + throw new Error('Attribute value was not simple'); + } + }; + var set = function (element, key, value) { + rawSet(element.dom, key, value); + }; + + var compareDocumentPosition = function (a, b, match) { + return (a.compareDocumentPosition(b) & match) !== 0; + }; + var documentPositionPreceding = function (a, b) { + return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_PRECEDING); + }; + + var fromHtml = function (html, scope) { + var doc = scope || document; + var div = doc.createElement('div'); + div.innerHTML = html; + if (!div.hasChildNodes() || div.childNodes.length > 1) { + console.error('HTML does not have a single root node', html); + throw new Error('HTML must have a single root node'); + } + return fromDom(div.childNodes[0]); + }; + var fromTag = function (tag, scope) { + var doc = scope || document; + var node = doc.createElement(tag); + return fromDom(node); + }; + var fromText = function (text, scope) { + var doc = scope || document; + var node = doc.createTextNode(text); + return fromDom(node); + }; + var fromDom = function (node) { + if (node === null || node === undefined) { + throw new Error('Node cannot be null or undefined'); + } + return { dom: node }; + }; + var fromPoint = function (docElm, x, y) { + return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom); + }; + var SugarElement = { + fromHtml: fromHtml, + fromTag: fromTag, + fromText: fromText, + fromDom: fromDom, + fromPoint: fromPoint + }; + + var bypassSelector = function (dom) { + return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0; + }; + var all = function (selector, scope) { + var base = scope === undefined ? document : scope.dom; + return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), SugarElement.fromDom); + }; + + var parent = function (element) { + return Optional.from(element.dom.parentNode).map(SugarElement.fromDom); + }; + var children = function (element) { + return map(element.dom.childNodes, SugarElement.fromDom); + }; + var spot = function (element, offset) { + return { + element: element, + offset: offset + }; + }; + var leaf = function (element, offset) { + var cs = children(element); + return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset); + }; + + var before = function (marker, element) { + var parent$1 = parent(marker); + parent$1.each(function (v) { + v.dom.insertBefore(element.dom, marker.dom); + }); + }; + var append = function (parent, element) { + parent.dom.appendChild(element.dom); + }; + var wrap = function (element, wrapper) { + before(element, wrapper); + append(wrapper, element); + }; + + var NodeValue = function (is, name) { + var get = function (element) { + if (!is(element)) { + throw new Error('Can only get ' + name + ' value of a ' + name + ' node'); + } + return getOption(element).getOr(''); + }; + var getOption = function (element) { + return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none(); + }; + var set = function (element, value) { + if (!is(element)) { + throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node'); + } + element.dom.nodeValue = value; + }; + return { + get: get, + getOption: getOption, + set: set + }; + }; + + var api = NodeValue(isText$1, 'text'); + var get$1 = function (element) { + return api.get(element); + }; + + var descendants = function (scope, selector) { + return all(selector, scope); + }; + + var global = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker'); + + var isSimpleBoundary = function (dom, node) { + return dom.isBlock(node) || has(dom.schema.getShortEndedElements(), node.nodeName); + }; + var isContentEditableFalse = function (dom, node) { + return dom.getContentEditable(node) === 'false'; + }; + var isContentEditableTrueInCef = function (dom, node) { + return dom.getContentEditable(node) === 'true' && dom.getContentEditableParent(node.parentNode) === 'false'; + }; + var isHidden = function (dom, node) { + return !dom.isBlock(node) && has(dom.schema.getWhiteSpaceElements(), node.nodeName); + }; + var isBoundary = function (dom, node) { + return isSimpleBoundary(dom, node) || isContentEditableFalse(dom, node) || isHidden(dom, node) || isContentEditableTrueInCef(dom, node); + }; + var isText = function (node) { + return node.nodeType === 3; + }; + var nuSection = function () { + return { + sOffset: 0, + fOffset: 0, + elements: [] + }; + }; + var toLeaf = function (node, offset) { + return leaf(SugarElement.fromDom(node), offset); + }; + var walk = function (dom, walkerFn, startNode, callbacks, endNode, skipStart) { + if (skipStart === void 0) { + skipStart = true; + } + var next = skipStart ? walkerFn(false) : startNode; + while (next) { + var isCefNode = isContentEditableFalse(dom, next); + if (isCefNode || isHidden(dom, next)) { + var stopWalking = isCefNode ? callbacks.cef(next) : callbacks.boundary(next); + if (stopWalking) { + break; + } else { + next = walkerFn(true); + continue; + } + } else if (isSimpleBoundary(dom, next)) { + if (callbacks.boundary(next)) { + break; + } + } else if (isText(next)) { + callbacks.text(next); + } + if (next === endNode) { + break; + } else { + next = walkerFn(false); + } + } + }; + var collectTextToBoundary = function (dom, section, node, rootNode, forwards) { + if (isBoundary(dom, node)) { + return; + } + var rootBlock = dom.getParent(rootNode, dom.isBlock); + var walker = new global(node, rootBlock); + var walkerFn = forwards ? walker.next.bind(walker) : walker.prev.bind(walker); + walk(dom, walkerFn, node, { + boundary: always, + cef: always, + text: function (next) { + if (forwards) { + section.fOffset += next.length; + } else { + section.sOffset += next.length; + } + section.elements.push(SugarElement.fromDom(next)); + } + }); + }; + var collect = function (dom, rootNode, startNode, endNode, callbacks, skipStart) { + if (skipStart === void 0) { + skipStart = true; + } + var walker = new global(startNode, rootNode); + var sections = []; + var current = nuSection(); + collectTextToBoundary(dom, current, startNode, rootNode, false); + var finishSection = function () { + if (current.elements.length > 0) { + sections.push(current); + current = nuSection(); + } + return false; + }; + walk(dom, walker.next.bind(walker), startNode, { + boundary: finishSection, + cef: function (node) { + finishSection(); + if (callbacks) { + sections.push.apply(sections, callbacks.cef(node)); + } + return false; + }, + text: function (next) { + current.elements.push(SugarElement.fromDom(next)); + if (callbacks) { + callbacks.text(next, current); + } + } + }, endNode, skipStart); + if (endNode) { + collectTextToBoundary(dom, current, endNode, rootNode, true); + } + finishSection(); + return sections; + }; + var collectRangeSections = function (dom, rng) { + var start = toLeaf(rng.startContainer, rng.startOffset); + var startNode = start.element.dom; + var end = toLeaf(rng.endContainer, rng.endOffset); + var endNode = end.element.dom; + return collect(dom, rng.commonAncestorContainer, startNode, endNode, { + text: function (node, section) { + if (node === endNode) { + section.fOffset += node.length - end.offset; + } else if (node === startNode) { + section.sOffset += start.offset; + } + }, + cef: function (node) { + var sections = bind(descendants(SugarElement.fromDom(node), '*[contenteditable=true]'), function (e) { + var ceTrueNode = e.dom; + return collect(dom, ceTrueNode, ceTrueNode); + }); + return sort(sections, function (a, b) { + return documentPositionPreceding(a.elements[0].dom, b.elements[0].dom) ? 1 : -1; + }); + } + }, false); + }; + var fromRng = function (dom, rng) { + return rng.collapsed ? [] : collectRangeSections(dom, rng); + }; + var fromNode = function (dom, node) { + var rng = dom.createRng(); + rng.selectNode(node); + return fromRng(dom, rng); + }; + var fromNodes = function (dom, nodes) { + return bind(nodes, function (node) { + return fromNode(dom, node); + }); + }; + + var find$2 = function (text, pattern, start, finish) { + if (start === void 0) { + start = 0; + } + if (finish === void 0) { + finish = text.length; + } + var regex = pattern.regex; + regex.lastIndex = start; + var results = []; + var match; + while (match = regex.exec(text)) { + var matchedText = match[pattern.matchIndex]; + var matchStart = match.index + match[0].indexOf(matchedText); + var matchFinish = matchStart + matchedText.length; + if (matchFinish > finish) { + break; + } + results.push({ + start: matchStart, + finish: matchFinish + }); + regex.lastIndex = matchFinish; + } + return results; + }; + var extract = function (elements, matches) { + var nodePositions = foldl(elements, function (acc, element) { + var content = get$1(element); + var start = acc.last; + var finish = start + content.length; + var positions = bind(matches, function (match, matchIdx) { + if (match.start < finish && match.finish > start) { + return [{ + element: element, + start: Math.max(start, match.start) - start, + finish: Math.min(finish, match.finish) - start, + matchId: matchIdx + }]; + } else { + return []; + } + }); + return { + results: acc.results.concat(positions), + last: finish + }; + }, { + results: [], + last: 0 + }).results; + return groupBy(nodePositions, function (position) { + return position.matchId; + }); + }; + + var find$1 = function (pattern, sections) { + return bind(sections, function (section) { + var elements = section.elements; + var content = map(elements, get$1).join(''); + var positions = find$2(content, pattern, section.sOffset, content.length - section.fOffset); + return extract(elements, positions); + }); + }; + var mark = function (matches, replacementNode) { + eachr(matches, function (match, idx) { + eachr(match, function (pos) { + var wrapper = SugarElement.fromDom(replacementNode.cloneNode(false)); + set(wrapper, 'data-mce-index', idx); + var textNode = pos.element.dom; + if (textNode.length === pos.finish && pos.start === 0) { + wrap(pos.element, wrapper); + } else { + if (textNode.length !== pos.finish) { + textNode.splitText(pos.finish); + } + var matchNode = textNode.splitText(pos.start); + wrap(SugarElement.fromDom(matchNode), wrapper); + } + }); + }); + }; + var findAndMark = function (dom, pattern, node, replacementNode) { + var textSections = fromNode(dom, node); + var matches = find$1(pattern, textSections); + mark(matches, replacementNode); + return matches.length; + }; + var findAndMarkInSelection = function (dom, pattern, selection, replacementNode) { + var bookmark = selection.getBookmark(); + var nodes = dom.select('td[data-mce-selected],th[data-mce-selected]'); + var textSections = nodes.length > 0 ? fromNodes(dom, nodes) : fromRng(dom, selection.getRng()); + var matches = find$1(pattern, textSections); + mark(matches, replacementNode); + selection.moveToBookmark(bookmark); + return matches.length; + }; + + var getElmIndex = function (elm) { + var value = elm.getAttribute('data-mce-index'); + if (typeof value === 'number') { + return '' + value; + } + return value; + }; + var markAllMatches = function (editor, currentSearchState, pattern, inSelection) { + var marker = editor.dom.create('span', { 'data-mce-bogus': 1 }); + marker.className = 'mce-match-marker'; + var node = editor.getBody(); + done(editor, currentSearchState, false); + if (inSelection) { + return findAndMarkInSelection(editor.dom, pattern, editor.selection, marker); + } else { + return findAndMark(editor.dom, pattern, node, marker); + } + }; + var unwrap = function (node) { + var parentNode = node.parentNode; + if (node.firstChild) { + parentNode.insertBefore(node.firstChild, node); + } + node.parentNode.removeChild(node); + }; + var findSpansByIndex = function (editor, index) { + var spans = []; + var nodes = global$1.toArray(editor.getBody().getElementsByTagName('span')); + if (nodes.length) { + for (var i = 0; i < nodes.length; i++) { + var nodeIndex = getElmIndex(nodes[i]); + if (nodeIndex === null || !nodeIndex.length) { + continue; + } + if (nodeIndex === index.toString()) { + spans.push(nodes[i]); + } + } + } + return spans; + }; + var moveSelection = function (editor, currentSearchState, forward) { + var searchState = currentSearchState.get(); + var testIndex = searchState.index; + var dom = editor.dom; + forward = forward !== false; + if (forward) { + if (testIndex + 1 === searchState.count) { + testIndex = 0; + } else { + testIndex++; + } + } else { + if (testIndex - 1 === -1) { + testIndex = searchState.count - 1; + } else { + testIndex--; + } + } + dom.removeClass(findSpansByIndex(editor, searchState.index), 'mce-match-marker-selected'); + var spans = findSpansByIndex(editor, testIndex); + if (spans.length) { + dom.addClass(findSpansByIndex(editor, testIndex), 'mce-match-marker-selected'); + editor.selection.scrollIntoView(spans[0]); + return testIndex; + } + return -1; + }; + var removeNode = function (dom, node) { + var parent = node.parentNode; + dom.remove(node); + if (dom.isEmpty(parent)) { + dom.remove(parent); + } + }; + var escapeSearchText = function (text, wholeWord) { + var escapedText = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&').replace(/\s/g, '[^\\S\\r\\n\\uFEFF]'); + var wordRegex = '(' + escapedText + ')'; + return wholeWord ? '(?:^|\\s|' + punctuation() + ')' + wordRegex + ('(?=$|\\s|' + punctuation() + ')') : wordRegex; + }; + var find = function (editor, currentSearchState, text, matchCase, wholeWord, inSelection) { + var selection = editor.selection; + var escapedText = escapeSearchText(text, wholeWord); + var isForwardSelection = selection.isForward(); + var pattern = { + regex: new RegExp(escapedText, matchCase ? 'g' : 'gi'), + matchIndex: 1 + }; + var count = markAllMatches(editor, currentSearchState, pattern, inSelection); + if (global$2.browser.isSafari()) { + selection.setRng(selection.getRng(), isForwardSelection); + } + if (count) { + var newIndex = moveSelection(editor, currentSearchState, true); + currentSearchState.set({ + index: newIndex, + count: count, + text: text, + matchCase: matchCase, + wholeWord: wholeWord, + inSelection: inSelection + }); + } + return count; + }; + var next = function (editor, currentSearchState) { + var index = moveSelection(editor, currentSearchState, true); + currentSearchState.set(__assign(__assign({}, currentSearchState.get()), { index: index })); + }; + var prev = function (editor, currentSearchState) { + var index = moveSelection(editor, currentSearchState, false); + currentSearchState.set(__assign(__assign({}, currentSearchState.get()), { index: index })); + }; + var isMatchSpan = function (node) { + var matchIndex = getElmIndex(node); + return matchIndex !== null && matchIndex.length > 0; + }; + var replace = function (editor, currentSearchState, text, forward, all) { + var searchState = currentSearchState.get(); + var currentIndex = searchState.index; + var currentMatchIndex, nextIndex = currentIndex; + forward = forward !== false; + var node = editor.getBody(); + var nodes = global$1.grep(global$1.toArray(node.getElementsByTagName('span')), isMatchSpan); + for (var i = 0; i < nodes.length; i++) { + var nodeIndex = getElmIndex(nodes[i]); + var matchIndex = currentMatchIndex = parseInt(nodeIndex, 10); + if (all || matchIndex === searchState.index) { + if (text.length) { + nodes[i].firstChild.nodeValue = text; + unwrap(nodes[i]); + } else { + removeNode(editor.dom, nodes[i]); + } + while (nodes[++i]) { + matchIndex = parseInt(getElmIndex(nodes[i]), 10); + if (matchIndex === currentMatchIndex) { + removeNode(editor.dom, nodes[i]); + } else { + i--; + break; + } + } + if (forward) { + nextIndex--; + } + } else if (currentMatchIndex > currentIndex) { + nodes[i].setAttribute('data-mce-index', String(currentMatchIndex - 1)); + } + } + currentSearchState.set(__assign(__assign({}, searchState), { + count: all ? 0 : searchState.count - 1, + index: nextIndex + })); + if (forward) { + next(editor, currentSearchState); + } else { + prev(editor, currentSearchState); + } + return !all && currentSearchState.get().count > 0; + }; + var done = function (editor, currentSearchState, keepEditorSelection) { + var startContainer, endContainer; + var searchState = currentSearchState.get(); + var nodes = global$1.toArray(editor.getBody().getElementsByTagName('span')); + for (var i = 0; i < nodes.length; i++) { + var nodeIndex = getElmIndex(nodes[i]); + if (nodeIndex !== null && nodeIndex.length) { + if (nodeIndex === searchState.index.toString()) { + if (!startContainer) { + startContainer = nodes[i].firstChild; + } + endContainer = nodes[i].firstChild; + } + unwrap(nodes[i]); + } + } + currentSearchState.set(__assign(__assign({}, searchState), { + index: -1, + count: 0, + text: '' + })); + if (startContainer && endContainer) { + var rng = editor.dom.createRng(); + rng.setStart(startContainer, 0); + rng.setEnd(endContainer, endContainer.data.length); + if (keepEditorSelection !== false) { + editor.selection.setRng(rng); + } + return rng; + } + }; + var hasNext = function (editor, currentSearchState) { + return currentSearchState.get().count > 1; + }; + var hasPrev = function (editor, currentSearchState) { + return currentSearchState.get().count > 1; + }; + + var get = function (editor, currentState) { + var done$1 = function (keepEditorSelection) { + return done(editor, currentState, keepEditorSelection); + }; + var find$1 = function (text, matchCase, wholeWord, inSelection) { + if (inSelection === void 0) { + inSelection = false; + } + return find(editor, currentState, text, matchCase, wholeWord, inSelection); + }; + var next$1 = function () { + return next(editor, currentState); + }; + var prev$1 = function () { + return prev(editor, currentState); + }; + var replace$1 = function (text, forward, all) { + return replace(editor, currentState, text, forward, all); + }; + return { + done: done$1, + find: find$1, + next: next$1, + prev: prev$1, + replace: replace$1 + }; + }; + + var singleton = function (doRevoke) { + var subject = Cell(Optional.none()); + var revoke = function () { + return subject.get().each(doRevoke); + }; + var clear = function () { + revoke(); + subject.set(Optional.none()); + }; + var isSet = function () { + return subject.get().isSome(); + }; + var get = function () { + return subject.get(); + }; + var set = function (s) { + revoke(); + subject.set(Optional.some(s)); + }; + return { + clear: clear, + isSet: isSet, + get: get, + set: set + }; + }; + var value = function () { + var subject = singleton(noop); + var on = function (f) { + return subject.get().each(f); + }; + return __assign(__assign({}, subject), { on: on }); + }; + + var open = function (editor, currentSearchState) { + var dialogApi = value(); + editor.undoManager.add(); + var selectedText = global$1.trim(editor.selection.getContent({ format: 'text' })); + var updateButtonStates = function (api) { + var updateNext = hasNext(editor, currentSearchState) ? api.enable : api.disable; + updateNext('next'); + var updatePrev = hasPrev(editor, currentSearchState) ? api.enable : api.disable; + updatePrev('prev'); + }; + var updateSearchState = function (api) { + var data = api.getData(); + var current = currentSearchState.get(); + currentSearchState.set(__assign(__assign({}, current), { + matchCase: data.matchcase, + wholeWord: data.wholewords, + inSelection: data.inselection + })); + }; + var disableAll = function (api, disable) { + var buttons = [ + 'replace', + 'replaceall', + 'prev', + 'next' + ]; + var toggle = disable ? api.disable : api.enable; + each(buttons, toggle); + }; + var notFoundAlert = function (api) { + editor.windowManager.alert('Could not find the specified string.', function () { + api.focus('findtext'); + }); + }; + var focusButtonIfRequired = function (api, name) { + if (global$2.browser.isSafari() && global$2.deviceType.isTouch() && (name === 'find' || name === 'replace' || name === 'replaceall')) { + api.focus(name); + } + }; + var reset = function (api) { + done(editor, currentSearchState, false); + disableAll(api, true); + updateButtonStates(api); + }; + var doFind = function (api) { + var data = api.getData(); + var last = currentSearchState.get(); + if (!data.findtext.length) { + reset(api); + return; + } + if (last.text === data.findtext && last.matchCase === data.matchcase && last.wholeWord === data.wholewords) { + next(editor, currentSearchState); + } else { + var count = find(editor, currentSearchState, data.findtext, data.matchcase, data.wholewords, data.inselection); + if (count <= 0) { + notFoundAlert(api); + } + disableAll(api, count === 0); + } + updateButtonStates(api); + }; + var initialState = currentSearchState.get(); + var initialData = { + findtext: selectedText, + replacetext: '', + wholewords: initialState.wholeWord, + matchcase: initialState.matchCase, + inselection: initialState.inSelection + }; + var spec = { + title: 'Find and Replace', + size: 'normal', + body: { + type: 'panel', + items: [ + { + type: 'bar', + items: [ + { + type: 'input', + name: 'findtext', + placeholder: 'Find', + maximized: true, + inputMode: 'search' + }, + { + type: 'button', + name: 'prev', + text: 'Previous', + icon: 'action-prev', + disabled: true, + borderless: true + }, + { + type: 'button', + name: 'next', + text: 'Next', + icon: 'action-next', + disabled: true, + borderless: true + } + ] + }, + { + type: 'input', + name: 'replacetext', + placeholder: 'Replace with', + inputMode: 'search' + } + ] + }, + buttons: [ + { + type: 'menu', + name: 'options', + icon: 'preferences', + tooltip: 'Preferences', + align: 'start', + items: [ + { + type: 'togglemenuitem', + name: 'matchcase', + text: 'Match case' + }, + { + type: 'togglemenuitem', + name: 'wholewords', + text: 'Find whole words only' + }, + { + type: 'togglemenuitem', + name: 'inselection', + text: 'Find in selection' + } + ] + }, + { + type: 'custom', + name: 'find', + text: 'Find', + primary: true + }, + { + type: 'custom', + name: 'replace', + text: 'Replace', + disabled: true + }, + { + type: 'custom', + name: 'replaceall', + text: 'Replace all', + disabled: true + } + ], + initialData: initialData, + onChange: function (api, details) { + if (details.name === 'findtext' && currentSearchState.get().count > 0) { + reset(api); + } + }, + onAction: function (api, details) { + var data = api.getData(); + switch (details.name) { + case 'find': + doFind(api); + break; + case 'replace': + if (!replace(editor, currentSearchState, data.replacetext)) { + reset(api); + } else { + updateButtonStates(api); + } + break; + case 'replaceall': + replace(editor, currentSearchState, data.replacetext, true, true); + reset(api); + break; + case 'prev': + prev(editor, currentSearchState); + updateButtonStates(api); + break; + case 'next': + next(editor, currentSearchState); + updateButtonStates(api); + break; + case 'matchcase': + case 'wholewords': + case 'inselection': + updateSearchState(api); + reset(api); + break; + } + focusButtonIfRequired(api, details.name); + }, + onSubmit: function (api) { + doFind(api); + focusButtonIfRequired(api, 'find'); + }, + onClose: function () { + editor.focus(); + done(editor, currentSearchState); + editor.undoManager.add(); + } + }; + dialogApi.set(editor.windowManager.open(spec, { inline: 'toolbar' })); + }; + + var register$1 = function (editor, currentSearchState) { + editor.addCommand('SearchReplace', function () { + open(editor, currentSearchState); + }); + }; + + var showDialog = function (editor, currentSearchState) { + return function () { + open(editor, currentSearchState); + }; + }; + var register = function (editor, currentSearchState) { + editor.ui.registry.addMenuItem('searchreplace', { + text: 'Find and replace...', + shortcut: 'Meta+F', + onAction: showDialog(editor, currentSearchState), + icon: 'search' + }); + editor.ui.registry.addButton('searchreplace', { + tooltip: 'Find and replace', + onAction: showDialog(editor, currentSearchState), + icon: 'search' + }); + editor.shortcuts.add('Meta+F', '', showDialog(editor, currentSearchState)); + }; + + function Plugin () { + global$3.add('searchreplace', function (editor) { + var currentSearchState = Cell({ + index: -1, + count: 0, + text: '', + matchCase: false, + wholeWord: false, + inSelection: false + }); + register$1(editor, currentSearchState); + register(editor, currentSearchState); + return get(editor, currentSearchState); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; + }; + var set = function (v) { + value = v; + }; + return { + get: get, + set: set + }; + }; + + var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var hasProPlugin = function (editor) { + if (editor.hasPlugin('tinymcespellchecker', true)) { + if (typeof window.console !== 'undefined' && window.console.log) { + window.console.log('Spell Checker Pro is incompatible with Spell Checker plugin! ' + 'Remove \'spellchecker\' from the \'plugins\' option.'); + } + return true; + } else { + return false; + } + }; + + var hasOwnProperty = Object.hasOwnProperty; + var isEmpty = function (r) { + for (var x in r) { + if (hasOwnProperty.call(r, x)) { + return false; + } + } + return true; + }; + + var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.util.URI'); + + var global = tinymce.util.Tools.resolve('tinymce.util.XHR'); + + var fireSpellcheckStart = function (editor) { + return editor.fire('SpellcheckStart'); + }; + var fireSpellcheckEnd = function (editor) { + return editor.fire('SpellcheckEnd'); + }; + + var getLanguages = function (editor) { + var defaultLanguages = 'English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,German=de,Italian=it,Polish=pl,Portuguese=pt_BR,Spanish=es,Swedish=sv'; + return editor.getParam('spellchecker_languages', defaultLanguages); + }; + var getLanguage = function (editor) { + var defaultLanguage = editor.getParam('language', 'en'); + return editor.getParam('spellchecker_language', defaultLanguage); + }; + var getRpcUrl = function (editor) { + return editor.getParam('spellchecker_rpc_url'); + }; + var getSpellcheckerCallback = function (editor) { + return editor.getParam('spellchecker_callback'); + }; + var getSpellcheckerWordcharPattern = function (editor) { + var defaultPattern = new RegExp('[^' + '\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`' + '\xA7\xA9\xAB\xAE\xB1\xB6\xB7\xB8\xBB' + '\xBC\xBD\xBE\xBF\xD7\xF7\xA4\u201D\u201C\u201E\xA0\u2002\u2003\u2009' + ']+', 'g'); + return editor.getParam('spellchecker_wordchar_pattern', defaultPattern); + }; + + var isContentEditableFalse = function (node) { + return node && node.nodeType === 1 && node.contentEditable === 'false'; + }; + var DomTextMatcher = function (node, editor) { + var m, matches = []; + var dom = editor.dom; + var blockElementsMap = editor.schema.getBlockElements(); + var hiddenTextElementsMap = editor.schema.getWhiteSpaceElements(); + var shortEndedElementsMap = editor.schema.getShortEndedElements(); + var createMatch = function (m, data) { + if (!m[0]) { + throw new Error('findAndReplaceDOMText cannot handle zero-length matches'); + } + return { + start: m.index, + end: m.index + m[0].length, + text: m[0], + data: data + }; + }; + var getText = function (node) { + if (node.nodeType === 3) { + return node.data; + } + if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) { + return ''; + } + if (isContentEditableFalse(node)) { + return '\n'; + } + var txt = ''; + if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) { + txt += '\n'; + } + if (node = node.firstChild) { + do { + txt += getText(node); + } while (node = node.nextSibling); + } + return txt; + }; + var stepThroughMatches = function (node, matches, replaceFn) { + var startNode, endNode, startNodeIndex, endNodeIndex, innerNodes = [], atIndex = 0, curNode = node, matchLocation, matchIndex = 0; + matches = matches.slice(0); + matches.sort(function (a, b) { + return a.start - b.start; + }); + matchLocation = matches.shift(); + out: + while (true) { + if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName] || isContentEditableFalse(curNode)) { + atIndex++; + } + if (curNode.nodeType === 3) { + if (!endNode && curNode.length + atIndex >= matchLocation.end) { + endNode = curNode; + endNodeIndex = matchLocation.end - atIndex; + } else if (startNode) { + innerNodes.push(curNode); + } + if (!startNode && curNode.length + atIndex > matchLocation.start) { + startNode = curNode; + startNodeIndex = matchLocation.start - atIndex; + } + atIndex += curNode.length; + } + if (startNode && endNode) { + curNode = replaceFn({ + startNode: startNode, + startNodeIndex: startNodeIndex, + endNode: endNode, + endNodeIndex: endNodeIndex, + innerNodes: innerNodes, + match: matchLocation.text, + matchIndex: matchIndex + }); + atIndex -= endNode.length - endNodeIndex; + startNode = null; + endNode = null; + innerNodes = []; + matchLocation = matches.shift(); + matchIndex++; + if (!matchLocation) { + break; + } + } else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) { + if (!isContentEditableFalse(curNode)) { + curNode = curNode.firstChild; + continue; + } + } else if (curNode.nextSibling) { + curNode = curNode.nextSibling; + continue; + } + while (true) { + if (curNode.nextSibling) { + curNode = curNode.nextSibling; + break; + } else if (curNode.parentNode !== node) { + curNode = curNode.parentNode; + } else { + break out; + } + } + } + }; + var genReplacer = function (callback) { + var makeReplacementNode = function (fill, matchIndex) { + var match = matches[matchIndex]; + if (!match.stencil) { + match.stencil = callback(match); + } + var clone = match.stencil.cloneNode(false); + clone.setAttribute('data-mce-index', '' + matchIndex); + if (fill) { + clone.appendChild(dom.doc.createTextNode(fill)); + } + return clone; + }; + return function (range) { + var before; + var after; + var parentNode; + var startNode = range.startNode; + var endNode = range.endNode; + var matchIndex = range.matchIndex; + var doc = dom.doc; + if (startNode === endNode) { + var node_1 = startNode; + parentNode = node_1.parentNode; + if (range.startNodeIndex > 0) { + before = doc.createTextNode(node_1.data.substring(0, range.startNodeIndex)); + parentNode.insertBefore(before, node_1); + } + var el = makeReplacementNode(range.match, matchIndex); + parentNode.insertBefore(el, node_1); + if (range.endNodeIndex < node_1.length) { + after = doc.createTextNode(node_1.data.substring(range.endNodeIndex)); + parentNode.insertBefore(after, node_1); + } + node_1.parentNode.removeChild(node_1); + return el; + } + before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex)); + after = doc.createTextNode(endNode.data.substring(range.endNodeIndex)); + var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex); + for (var i = 0, l = range.innerNodes.length; i < l; ++i) { + var innerNode = range.innerNodes[i]; + var innerEl = makeReplacementNode(innerNode.data, matchIndex); + innerNode.parentNode.replaceChild(innerEl, innerNode); + } + var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex); + parentNode = startNode.parentNode; + parentNode.insertBefore(before, startNode); + parentNode.insertBefore(elA, startNode); + parentNode.removeChild(startNode); + parentNode = endNode.parentNode; + parentNode.insertBefore(elB, endNode); + parentNode.insertBefore(after, endNode); + parentNode.removeChild(endNode); + return elB; + }; + }; + var unwrapElement = function (element) { + var parentNode = element.parentNode; + while (element.childNodes.length > 0) { + parentNode.insertBefore(element.childNodes[0], element); + } + parentNode.removeChild(element); + }; + var hasClass = function (elm) { + return elm.className.indexOf('mce-spellchecker-word') !== -1; + }; + var getWrappersByIndex = function (index) { + var elements = node.getElementsByTagName('*'), wrappers = []; + index = typeof index === 'number' ? '' + index : null; + for (var i = 0; i < elements.length; i++) { + var element = elements[i], dataIndex = element.getAttribute('data-mce-index'); + if (dataIndex !== null && dataIndex.length && hasClass(element)) { + if (dataIndex === index || index === null) { + wrappers.push(element); + } + } + } + return wrappers; + }; + var indexOf = function (match) { + var i = matches.length; + while (i--) { + if (matches[i] === match) { + return i; + } + } + return -1; + }; + function filter(callback) { + var filteredMatches = []; + each(function (match, i) { + if (callback(match, i)) { + filteredMatches.push(match); + } + }); + matches = filteredMatches; + return this; + } + function each(callback) { + for (var i = 0, l = matches.length; i < l; i++) { + if (callback(matches[i], i) === false) { + break; + } + } + return this; + } + function wrap(callback) { + if (matches.length) { + stepThroughMatches(node, matches, genReplacer(callback)); + } + return this; + } + function find(regex, data) { + if (text && regex.global) { + while (m = regex.exec(text)) { + matches.push(createMatch(m, data)); + } + } + return this; + } + function unwrap(match) { + var i; + var elements = getWrappersByIndex(match ? indexOf(match) : null); + i = elements.length; + while (i--) { + unwrapElement(elements[i]); + } + return this; + } + var matchFromElement = function (element) { + return matches[element.getAttribute('data-mce-index')]; + }; + var elementFromMatch = function (match) { + return getWrappersByIndex(indexOf(match))[0]; + }; + function add(start, length, data) { + matches.push({ + start: start, + end: start + length, + text: text.substr(start, length), + data: data + }); + return this; + } + var rangeFromMatch = function (match) { + var wrappers = getWrappersByIndex(indexOf(match)); + var rng = editor.dom.createRng(); + rng.setStartBefore(wrappers[0]); + rng.setEndAfter(wrappers[wrappers.length - 1]); + return rng; + }; + var replace = function (match, text) { + var rng = rangeFromMatch(match); + rng.deleteContents(); + if (text.length > 0) { + rng.insertNode(editor.dom.doc.createTextNode(text)); + } + return rng; + }; + function reset() { + matches.splice(0, matches.length); + unwrap(); + return this; + } + var text = getText(node); + return { + text: text, + matches: matches, + each: each, + filter: filter, + reset: reset, + matchFromElement: matchFromElement, + elementFromMatch: elementFromMatch, + find: find, + add: add, + wrap: wrap, + unwrap: unwrap, + replace: replace, + rangeFromMatch: rangeFromMatch, + indexOf: indexOf + }; + }; + + var getTextMatcher = function (editor, textMatcherState) { + if (!textMatcherState.get()) { + var textMatcher = DomTextMatcher(editor.getBody(), editor); + textMatcherState.set(textMatcher); + } + return textMatcherState.get(); + }; + var defaultSpellcheckCallback = function (editor, pluginUrl, currentLanguageState) { + return function (method, text, doneCallback, errorCallback) { + var data = { + method: method, + lang: currentLanguageState.get() + }; + var postData = ''; + data[method === 'addToDictionary' ? 'word' : 'text'] = text; + global$2.each(data, function (value, key) { + if (postData) { + postData += '&'; + } + postData += key + '=' + encodeURIComponent(value); + }); + global.send({ + url: new global$1(pluginUrl).toAbsolute(getRpcUrl(editor)), + type: 'post', + content_type: 'application/x-www-form-urlencoded', + data: postData, + success: function (result) { + var parseResult = JSON.parse(result); + if (!parseResult) { + var message = editor.translate('Server response wasn\'t proper JSON.'); + errorCallback(message); + } else if (parseResult.error) { + errorCallback(parseResult.error); + } else { + doneCallback(parseResult); + } + }, + error: function () { + var message = editor.translate('The spelling service was not found: (') + getRpcUrl(editor) + editor.translate(')'); + errorCallback(message); + } + }); + }; + }; + var sendRpcCall = function (editor, pluginUrl, currentLanguageState, name, data, successCallback, errorCallback) { + var userSpellcheckCallback = getSpellcheckerCallback(editor); + var spellCheckCallback = userSpellcheckCallback ? userSpellcheckCallback : defaultSpellcheckCallback(editor, pluginUrl, currentLanguageState); + spellCheckCallback.call(editor.plugins.spellchecker, name, data, successCallback, errorCallback); + }; + var spellcheck = function (editor, pluginUrl, startedState, textMatcherState, lastSuggestionsState, currentLanguageState) { + if (finish(editor, startedState, textMatcherState)) { + return; + } + var errorCallback = function (message) { + editor.notificationManager.open({ + text: message, + type: 'error' + }); + editor.setProgressState(false); + finish(editor, startedState, textMatcherState); + }; + var successCallback = function (data) { + markErrors(editor, startedState, textMatcherState, lastSuggestionsState, data); + }; + editor.setProgressState(true); + sendRpcCall(editor, pluginUrl, currentLanguageState, 'spellcheck', getTextMatcher(editor, textMatcherState).text, successCallback, errorCallback); + editor.focus(); + }; + var checkIfFinished = function (editor, startedState, textMatcherState) { + if (!editor.dom.select('span.mce-spellchecker-word').length) { + finish(editor, startedState, textMatcherState); + } + }; + var addToDictionary = function (editor, pluginUrl, startedState, textMatcherState, currentLanguageState, word, spans) { + editor.setProgressState(true); + sendRpcCall(editor, pluginUrl, currentLanguageState, 'addToDictionary', word, function () { + editor.setProgressState(false); + editor.dom.remove(spans, true); + checkIfFinished(editor, startedState, textMatcherState); + }, function (message) { + editor.notificationManager.open({ + text: message, + type: 'error' + }); + editor.setProgressState(false); + }); + }; + var ignoreWord = function (editor, startedState, textMatcherState, word, spans, all) { + editor.selection.collapse(); + if (all) { + global$2.each(editor.dom.select('span.mce-spellchecker-word'), function (span) { + if (span.getAttribute('data-mce-word') === word) { + editor.dom.remove(span, true); + } + }); + } else { + editor.dom.remove(spans, true); + } + checkIfFinished(editor, startedState, textMatcherState); + }; + var finish = function (editor, startedState, textMatcherState) { + var bookmark = editor.selection.getBookmark(); + getTextMatcher(editor, textMatcherState).reset(); + editor.selection.moveToBookmark(bookmark); + textMatcherState.set(null); + if (startedState.get()) { + startedState.set(false); + fireSpellcheckEnd(editor); + return true; + } + }; + var getElmIndex = function (elm) { + var value = elm.getAttribute('data-mce-index'); + if (typeof value === 'number') { + return '' + value; + } + return value; + }; + var findSpansByIndex = function (editor, index) { + var spans = []; + var nodes = global$2.toArray(editor.getBody().getElementsByTagName('span')); + if (nodes.length) { + for (var i = 0; i < nodes.length; i++) { + var nodeIndex = getElmIndex(nodes[i]); + if (nodeIndex === null || !nodeIndex.length) { + continue; + } + if (nodeIndex === index.toString()) { + spans.push(nodes[i]); + } + } + } + return spans; + }; + var markErrors = function (editor, startedState, textMatcherState, lastSuggestionsState, data) { + var hasDictionarySupport = !!data.dictionary; + var suggestions = data.words; + editor.setProgressState(false); + if (isEmpty(suggestions)) { + var message = editor.translate('No misspellings found.'); + editor.notificationManager.open({ + text: message, + type: 'info' + }); + startedState.set(false); + return; + } + lastSuggestionsState.set({ + suggestions: suggestions, + hasDictionarySupport: hasDictionarySupport + }); + var bookmark = editor.selection.getBookmark(); + getTextMatcher(editor, textMatcherState).find(getSpellcheckerWordcharPattern(editor)).filter(function (match) { + return !!suggestions[match.text]; + }).wrap(function (match) { + return editor.dom.create('span', { + 'class': 'mce-spellchecker-word', + 'aria-invalid': 'spelling', + 'data-mce-bogus': 1, + 'data-mce-word': match.text + }); + }); + editor.selection.moveToBookmark(bookmark); + startedState.set(true); + fireSpellcheckStart(editor); + }; + + var get = function (editor, startedState, lastSuggestionsState, textMatcherState, currentLanguageState) { + var getWordCharPattern = function () { + return getSpellcheckerWordcharPattern(editor); + }; + var markErrors$1 = function (data) { + markErrors(editor, startedState, textMatcherState, lastSuggestionsState, data); + }; + return { + getTextMatcher: textMatcherState.get, + getWordCharPattern: getWordCharPattern, + markErrors: markErrors$1, + getLanguage: currentLanguageState.get + }; + }; + + var register$1 = function (editor, pluginUrl, startedState, textMatcherState, lastSuggestionsState, currentLanguageState) { + editor.addCommand('mceSpellCheck', function () { + spellcheck(editor, pluginUrl, startedState, textMatcherState, lastSuggestionsState, currentLanguageState); + }); + }; + + var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + var spellcheckerEvents = 'SpellcheckStart SpellcheckEnd'; + var buildMenuItems = function (listName, languageValues) { + var items = []; + global$2.each(languageValues, function (languageValue) { + items.push({ + selectable: true, + text: languageValue.name, + data: languageValue.value + }); + }); + return items; + }; + var getItems = function (editor) { + return global$2.map(getLanguages(editor).split(','), function (langPair) { + var langPairs = langPair.split('='); + return { + name: langPairs[0], + value: langPairs[1] + }; + }); + }; + var register = function (editor, pluginUrl, startedState, textMatcherState, currentLanguageState, lastSuggestionsState) { + var languageMenuItems = buildMenuItems('Language', getItems(editor)); + var startSpellchecking = function () { + spellcheck(editor, pluginUrl, startedState, textMatcherState, lastSuggestionsState, currentLanguageState); + }; + var buttonArgs = { + tooltip: 'Spellcheck', + onAction: startSpellchecking, + icon: 'spell-check', + onSetup: function (buttonApi) { + var setButtonState = function () { + buttonApi.setActive(startedState.get()); + }; + editor.on(spellcheckerEvents, setButtonState); + return function () { + editor.off(spellcheckerEvents, setButtonState); + }; + } + }; + var splitButtonArgs = __assign(__assign({}, buttonArgs), { + type: 'splitbutton', + select: function (value) { + return value === currentLanguageState.get(); + }, + fetch: function (callback) { + var items = global$2.map(languageMenuItems, function (languageItem) { + return { + type: 'choiceitem', + value: languageItem.data, + text: languageItem.text + }; + }); + callback(items); + }, + onItemAction: function (splitButtonApi, value) { + currentLanguageState.set(value); + } + }); + if (languageMenuItems.length > 1) { + editor.ui.registry.addSplitButton('spellchecker', splitButtonArgs); + } else { + editor.ui.registry.addToggleButton('spellchecker', buttonArgs); + } + editor.ui.registry.addToggleMenuItem('spellchecker', { + text: 'Spellcheck', + icon: 'spell-check', + onSetup: function (menuApi) { + menuApi.setActive(startedState.get()); + var setMenuItemCheck = function () { + menuApi.setActive(startedState.get()); + }; + editor.on(spellcheckerEvents, setMenuItemCheck); + return function () { + editor.off(spellcheckerEvents, setMenuItemCheck); + }; + }, + onAction: startSpellchecking + }); + }; + + var ignoreAll = true; + var getSuggestions = function (editor, pluginUrl, lastSuggestionsState, startedState, textMatcherState, currentLanguageState, word, spans) { + var items = []; + var suggestions = lastSuggestionsState.get().suggestions[word]; + global$2.each(suggestions, function (suggestion) { + items.push({ + text: suggestion, + onAction: function () { + editor.insertContent(editor.dom.encode(suggestion)); + editor.dom.remove(spans); + checkIfFinished(editor, startedState, textMatcherState); + } + }); + }); + var hasDictionarySupport = lastSuggestionsState.get().hasDictionarySupport; + if (hasDictionarySupport) { + items.push({ type: 'separator' }); + items.push({ + text: 'Add to dictionary', + onAction: function () { + addToDictionary(editor, pluginUrl, startedState, textMatcherState, currentLanguageState, word, spans); + } + }); + } + items.push.apply(items, [ + { type: 'separator' }, + { + text: 'Ignore', + onAction: function () { + ignoreWord(editor, startedState, textMatcherState, word, spans); + } + }, + { + text: 'Ignore all', + onAction: function () { + ignoreWord(editor, startedState, textMatcherState, word, spans, ignoreAll); + } + } + ]); + return items; + }; + var setup = function (editor, pluginUrl, lastSuggestionsState, startedState, textMatcherState, currentLanguageState) { + var update = function (element) { + var target = element; + if (target.className === 'mce-spellchecker-word') { + var spans = findSpansByIndex(editor, getElmIndex(target)); + if (spans.length > 0) { + var rng = editor.dom.createRng(); + rng.setStartBefore(spans[0]); + rng.setEndAfter(spans[spans.length - 1]); + editor.selection.setRng(rng); + return getSuggestions(editor, pluginUrl, lastSuggestionsState, startedState, textMatcherState, currentLanguageState, target.getAttribute('data-mce-word'), spans); + } + } else { + return []; + } + }; + editor.ui.registry.addContextMenu('spellchecker', { update: update }); + }; + + function Plugin () { + global$3.add('spellchecker', function (editor, pluginUrl) { + if (hasProPlugin(editor) === false) { + var startedState = Cell(false); + var currentLanguageState = Cell(getLanguage(editor)); + var textMatcherState = Cell(null); + var lastSuggestionsState = Cell(null); + register(editor, pluginUrl, startedState, textMatcherState, currentLanguageState, lastSuggestionsState); + setup(editor, pluginUrl, lastSuggestionsState, startedState, textMatcherState, currentLanguageState); + register$1(editor, pluginUrl, startedState, textMatcherState, lastSuggestionsState, currentLanguageState); + return get(editor, startedState, lastSuggestionsState, textMatcherState, currentLanguageState); + } + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$6 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var global$5 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); + + var global$4 = tinymce.util.Tools.resolve('tinymce.EditorManager'); + + var global$3 = tinymce.util.Tools.resolve('tinymce.Env'); + + var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var global = tinymce.util.Tools.resolve('tinymce.util.VK'); + + var getTabFocusElements = function (editor) { + return editor.getParam('tabfocus_elements', ':prev,:next'); + }; + var getTabFocus = function (editor) { + return editor.getParam('tab_focus', getTabFocusElements(editor)); + }; + + var DOM = global$5.DOM; + var tabCancel = function (e) { + if (e.keyCode === global.TAB && !e.ctrlKey && !e.altKey && !e.metaKey) { + e.preventDefault(); + } + }; + var setup = function (editor) { + var tabHandler = function (e) { + var x; + if (e.keyCode !== global.TAB || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) { + return; + } + var find = function (direction) { + var el = DOM.select(':input:enabled,*[tabindex]:not(iframe)'); + var canSelectRecursive = function (e) { + var castElem = e; + return e.nodeName === 'BODY' || castElem.type !== 'hidden' && castElem.style.display !== 'none' && castElem.style.visibility !== 'hidden' && canSelectRecursive(e.parentNode); + }; + var canSelect = function (el) { + return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && global$4.get(e.id) && el.tabIndex !== -1 && canSelectRecursive(el); + }; + global$1.each(el, function (e, i) { + if (e.id === editor.id) { + x = i; + return false; + } + }); + if (direction > 0) { + for (var i = x + 1; i < el.length; i++) { + if (canSelect(el[i])) { + return el[i]; + } + } + } else { + for (var i = x - 1; i >= 0; i--) { + if (canSelect(el[i])) { + return el[i]; + } + } + } + return null; + }; + var v = global$1.explode(getTabFocus(editor)); + if (v.length === 1) { + v[1] = v[0]; + v[0] = ':prev'; + } + var el; + if (e.shiftKey) { + if (v[0] === ':prev') { + el = find(-1); + } else { + el = DOM.get(v[0]); + } + } else { + if (v[1] === ':next') { + el = find(1); + } else { + el = DOM.get(v[1]); + } + } + if (el) { + var focusEditor = global$4.get(el.id || el.name); + if (el.id && focusEditor) { + focusEditor.focus(); + } else { + global$2.setTimeout(function () { + if (!global$3.webkit) { + window.focus(); + } + el.focus(); + }, 10); + } + e.preventDefault(); + } + }; + editor.on('init', function () { + if (editor.inline) { + DOM.setAttrib(editor.getBody(), 'tabIndex', null); + } + editor.on('keyup', tabCancel); + if (global$3.gecko) { + editor.on('keypress keydown', tabHandler); + } else { + editor.on('keydown', tabHandler); + } + }); + }; + + function Plugin () { + global$6.add('tabfocus', function (editor) { + setup(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var typeOf = function (x) { + var t = typeof x; + if (x === null) { + return 'null'; + } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { + return 'array'; + } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { + return 'string'; + } else { + return t; + } + }; + var isType$1 = function (type) { + return function (value) { + return typeOf(value) === type; + }; + }; + var isSimpleType = function (type) { + return function (value) { + return typeof value === type; + }; + }; + var eq$2 = function (t) { + return function (a) { + return t === a; + }; + }; + var isString = isType$1('string'); + var isObject = isType$1('object'); + var isArray = isType$1('array'); + var isNull = eq$2(null); + var isBoolean = isSimpleType('boolean'); + var isUndefined = eq$2(undefined); + var isNullable = function (a) { + return a === null || a === undefined; + }; + var isNonNullable = function (a) { + return !isNullable(a); + }; + var isFunction = isSimpleType('function'); + var isNumber = isSimpleType('number'); + + var noop = function () { + }; + var compose = function (fa, fb) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fa(fb.apply(null, args)); + }; + }; + var compose1 = function (fbc, fab) { + return function (a) { + return fbc(fab(a)); + }; + }; + var constant = function (value) { + return function () { + return value; + }; + }; + var identity = function (x) { + return x; + }; + var tripleEquals = function (a, b) { + return a === b; + }; + function curry(fn) { + var initialArgs = []; + for (var _i = 1; _i < arguments.length; _i++) { + initialArgs[_i - 1] = arguments[_i]; + } + return function () { + var restArgs = []; + for (var _i = 0; _i < arguments.length; _i++) { + restArgs[_i] = arguments[_i]; + } + var all = initialArgs.concat(restArgs); + return fn.apply(null, all); + }; + } + var not = function (f) { + return function (t) { + return !f(t); + }; + }; + var die = function (msg) { + return function () { + throw new Error(msg); + }; + }; + var never = constant(false); + var always = constant(true); + + var none$2 = function () { + return NONE; + }; + var NONE = function () { + var call = function (thunk) { + return thunk(); + }; + var id = identity; + var me = { + fold: function (n, _s) { + return n(); + }, + isSome: never, + isNone: always, + getOr: id, + getOrThunk: call, + getOrDie: function (msg) { + throw new Error(msg || 'error: getOrDie called on none.'); + }, + getOrNull: constant(null), + getOrUndefined: constant(undefined), + or: id, + orThunk: call, + map: none$2, + each: noop, + bind: none$2, + exists: never, + forall: always, + filter: function () { + return none$2(); + }, + toArray: function () { + return []; + }, + toString: constant('none()') + }; + return me; + }(); + var some = function (a) { + var constant_a = constant(a); + var self = function () { + return me; + }; + var bind = function (f) { + return f(a); + }; + var me = { + fold: function (n, s) { + return s(a); + }, + isSome: always, + isNone: never, + getOr: constant_a, + getOrThunk: constant_a, + getOrDie: constant_a, + getOrNull: constant_a, + getOrUndefined: constant_a, + or: self, + orThunk: self, + map: function (f) { + return some(f(a)); + }, + each: function (f) { + f(a); + }, + bind: bind, + exists: bind, + forall: bind, + filter: function (f) { + return f(a) ? me : NONE; + }, + toArray: function () { + return [a]; + }, + toString: function () { + return 'some(' + a + ')'; + } + }; + return me; + }; + var from$1 = function (value) { + return value === null || value === undefined ? NONE : some(value); + }; + var Optional = { + some: some, + none: none$2, + from: from$1 + }; + + var nativeSlice = Array.prototype.slice; + var nativeIndexOf = Array.prototype.indexOf; + var nativePush = Array.prototype.push; + var rawIndexOf = function (ts, t) { + return nativeIndexOf.call(ts, t); + }; + var contains$2 = function (xs, x) { + return rawIndexOf(xs, x) > -1; + }; + var exists = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + return true; + } + } + return false; + }; + var range$1 = function (num, f) { + var r = []; + for (var i = 0; i < num; i++) { + r.push(f(i)); + } + return r; + }; + var map$1 = function (xs, f) { + var len = xs.length; + var r = new Array(len); + for (var i = 0; i < len; i++) { + var x = xs[i]; + r[i] = f(x, i); + } + return r; + }; + var each$2 = function (xs, f) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + f(x, i); + } + }; + var eachr = function (xs, f) { + for (var i = xs.length - 1; i >= 0; i--) { + var x = xs[i]; + f(x, i); + } + }; + var partition = function (xs, pred) { + var pass = []; + var fail = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + var arr = pred(x, i) ? pass : fail; + arr.push(x); + } + return { + pass: pass, + fail: fail + }; + }; + var filter$2 = function (xs, pred) { + var r = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + r.push(x); + } + } + return r; + }; + var foldr = function (xs, f, acc) { + eachr(xs, function (x, i) { + acc = f(acc, x, i); + }); + return acc; + }; + var foldl = function (xs, f, acc) { + each$2(xs, function (x, i) { + acc = f(acc, x, i); + }); + return acc; + }; + var findUntil = function (xs, pred, until) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + return Optional.some(x); + } else if (until(x, i)) { + break; + } + } + return Optional.none(); + }; + var find$1 = function (xs, pred) { + return findUntil(xs, pred, never); + }; + var findIndex = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + return Optional.some(i); + } + } + return Optional.none(); + }; + var flatten$1 = function (xs) { + var r = []; + for (var i = 0, len = xs.length; i < len; ++i) { + if (!isArray(xs[i])) { + throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs); + } + nativePush.apply(r, xs[i]); + } + return r; + }; + var bind$2 = function (xs, f) { + return flatten$1(map$1(xs, f)); + }; + var forall = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; ++i) { + var x = xs[i]; + if (pred(x, i) !== true) { + return false; + } + } + return true; + }; + var reverse = function (xs) { + var r = nativeSlice.call(xs, 0); + r.reverse(); + return r; + }; + var mapToObject = function (xs, f) { + var r = {}; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + r[String(x)] = f(x, i); + } + return r; + }; + var pure = function (x) { + return [x]; + }; + var sort$1 = function (xs, comparator) { + var copy = nativeSlice.call(xs, 0); + copy.sort(comparator); + return copy; + }; + var get$d = function (xs, i) { + return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none(); + }; + var head = function (xs) { + return get$d(xs, 0); + }; + var last$2 = function (xs) { + return get$d(xs, xs.length - 1); + }; + var findMap = function (arr, f) { + for (var i = 0; i < arr.length; i++) { + var r = f(arr[i], i); + if (r.isSome()) { + return r; + } + } + return Optional.none(); + }; + + var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + } + + var cached = function (f) { + var called = false; + var r; + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (!called) { + called = true; + r = f.apply(null, args); + } + return r; + }; + }; + + var DeviceType = function (os, browser, userAgent, mediaMatch) { + var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true; + var isiPhone = os.isiOS() && !isiPad; + var isMobile = os.isiOS() || os.isAndroid(); + var isTouch = isMobile || mediaMatch('(pointer:coarse)'); + var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)'); + var isPhone = isiPhone || isMobile && !isTablet; + var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false; + var isDesktop = !isPhone && !isTablet && !iOSwebview; + return { + isiPad: constant(isiPad), + isiPhone: constant(isiPhone), + isTablet: constant(isTablet), + isPhone: constant(isPhone), + isTouch: constant(isTouch), + isAndroid: os.isAndroid, + isiOS: os.isiOS, + isWebView: constant(iOSwebview), + isDesktop: constant(isDesktop) + }; + }; + + var firstMatch = function (regexes, s) { + for (var i = 0; i < regexes.length; i++) { + var x = regexes[i]; + if (x.test(s)) { + return x; + } + } + return undefined; + }; + var find = function (regexes, agent) { + var r = firstMatch(regexes, agent); + if (!r) { + return { + major: 0, + minor: 0 + }; + } + var group = function (i) { + return Number(agent.replace(r, '$' + i)); + }; + return nu$2(group(1), group(2)); + }; + var detect$6 = function (versionRegexes, agent) { + var cleanedAgent = String(agent).toLowerCase(); + if (versionRegexes.length === 0) { + return unknown$2(); + } + return find(versionRegexes, cleanedAgent); + }; + var unknown$2 = function () { + return nu$2(0, 0); + }; + var nu$2 = function (major, minor) { + return { + major: major, + minor: minor + }; + }; + var Version = { + nu: nu$2, + detect: detect$6, + unknown: unknown$2 + }; + + var detectBrowser$1 = function (browsers, userAgentData) { + return findMap(userAgentData.brands, function (uaBrand) { + var lcBrand = uaBrand.brand.toLowerCase(); + return find$1(browsers, function (browser) { + var _a; + return lcBrand === ((_a = browser.brand) === null || _a === void 0 ? void 0 : _a.toLowerCase()); + }).map(function (info) { + return { + current: info.name, + version: Version.nu(parseInt(uaBrand.version, 10), 0) + }; + }); + }); + }; + + var detect$5 = function (candidates, userAgent) { + var agent = String(userAgent).toLowerCase(); + return find$1(candidates, function (candidate) { + return candidate.search(agent); + }); + }; + var detectBrowser = function (browsers, userAgent) { + return detect$5(browsers, userAgent).map(function (browser) { + var version = Version.detect(browser.versionRegexes, userAgent); + return { + current: browser.name, + version: version + }; + }); + }; + var detectOs = function (oses, userAgent) { + return detect$5(oses, userAgent).map(function (os) { + var version = Version.detect(os.versionRegexes, userAgent); + return { + current: os.name, + version: version + }; + }); + }; + + var removeFromStart = function (str, numChars) { + return str.substring(numChars); + }; + + var checkRange = function (str, substr, start) { + return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr; + }; + var removeLeading = function (str, prefix) { + return startsWith(str, prefix) ? removeFromStart(str, prefix.length) : str; + }; + var contains$1 = function (str, substr) { + return str.indexOf(substr) !== -1; + }; + var startsWith = function (str, prefix) { + return checkRange(str, prefix, 0); + }; + var endsWith = function (str, suffix) { + return checkRange(str, suffix, str.length - suffix.length); + }; + var blank = function (r) { + return function (s) { + return s.replace(r, ''); + }; + }; + var trim = blank(/^\s+|\s+$/g); + var isNotEmpty = function (s) { + return s.length > 0; + }; + var isEmpty$1 = function (s) { + return !isNotEmpty(s); + }; + var toFloat = function (value) { + var num = parseFloat(value); + return isNaN(num) ? Optional.none() : Optional.some(num); + }; + + var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/; + var checkContains = function (target) { + return function (uastring) { + return contains$1(uastring, target); + }; + }; + var browsers = [ + { + name: 'Edge', + versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/], + search: function (uastring) { + return contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit'); + } + }, + { + name: 'Chrome', + brand: 'Chromium', + versionRegexes: [ + /.*?chrome\/([0-9]+)\.([0-9]+).*/, + normalVersionRegex + ], + search: function (uastring) { + return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe'); + } + }, + { + name: 'IE', + versionRegexes: [ + /.*?msie\ ?([0-9]+)\.([0-9]+).*/, + /.*?rv:([0-9]+)\.([0-9]+).*/ + ], + search: function (uastring) { + return contains$1(uastring, 'msie') || contains$1(uastring, 'trident'); + } + }, + { + name: 'Opera', + versionRegexes: [ + normalVersionRegex, + /.*?opera\/([0-9]+)\.([0-9]+).*/ + ], + search: checkContains('opera') + }, + { + name: 'Firefox', + versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/], + search: checkContains('firefox') + }, + { + name: 'Safari', + versionRegexes: [ + normalVersionRegex, + /.*?cpu os ([0-9]+)_([0-9]+).*/ + ], + search: function (uastring) { + return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit'); + } + } + ]; + var oses = [ + { + name: 'Windows', + search: checkContains('win'), + versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/] + }, + { + name: 'iOS', + search: function (uastring) { + return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad'); + }, + versionRegexes: [ + /.*?version\/\ ?([0-9]+)\.([0-9]+).*/, + /.*cpu os ([0-9]+)_([0-9]+).*/, + /.*cpu iphone os ([0-9]+)_([0-9]+).*/ + ] + }, + { + name: 'Android', + search: checkContains('android'), + versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/] + }, + { + name: 'OSX', + search: checkContains('mac os x'), + versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/] + }, + { + name: 'Linux', + search: checkContains('linux'), + versionRegexes: [] + }, + { + name: 'Solaris', + search: checkContains('sunos'), + versionRegexes: [] + }, + { + name: 'FreeBSD', + search: checkContains('freebsd'), + versionRegexes: [] + }, + { + name: 'ChromeOS', + search: checkContains('cros'), + versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/] + } + ]; + var PlatformInfo = { + browsers: constant(browsers), + oses: constant(oses) + }; + + var edge = 'Edge'; + var chrome = 'Chrome'; + var ie = 'IE'; + var opera = 'Opera'; + var firefox = 'Firefox'; + var safari = 'Safari'; + var unknown$1 = function () { + return nu$1({ + current: undefined, + version: Version.unknown() + }); + }; + var nu$1 = function (info) { + var current = info.current; + var version = info.version; + var isBrowser = function (name) { + return function () { + return current === name; + }; + }; + return { + current: current, + version: version, + isEdge: isBrowser(edge), + isChrome: isBrowser(chrome), + isIE: isBrowser(ie), + isOpera: isBrowser(opera), + isFirefox: isBrowser(firefox), + isSafari: isBrowser(safari) + }; + }; + var Browser = { + unknown: unknown$1, + nu: nu$1, + edge: constant(edge), + chrome: constant(chrome), + ie: constant(ie), + opera: constant(opera), + firefox: constant(firefox), + safari: constant(safari) + }; + + var windows = 'Windows'; + var ios = 'iOS'; + var android = 'Android'; + var linux = 'Linux'; + var osx = 'OSX'; + var solaris = 'Solaris'; + var freebsd = 'FreeBSD'; + var chromeos = 'ChromeOS'; + var unknown = function () { + return nu({ + current: undefined, + version: Version.unknown() + }); + }; + var nu = function (info) { + var current = info.current; + var version = info.version; + var isOS = function (name) { + return function () { + return current === name; + }; + }; + return { + current: current, + version: version, + isWindows: isOS(windows), + isiOS: isOS(ios), + isAndroid: isOS(android), + isOSX: isOS(osx), + isLinux: isOS(linux), + isSolaris: isOS(solaris), + isFreeBSD: isOS(freebsd), + isChromeOS: isOS(chromeos) + }; + }; + var OperatingSystem = { + unknown: unknown, + nu: nu, + windows: constant(windows), + ios: constant(ios), + android: constant(android), + linux: constant(linux), + osx: constant(osx), + solaris: constant(solaris), + freebsd: constant(freebsd), + chromeos: constant(chromeos) + }; + + var detect$4 = function (userAgent, userAgentDataOpt, mediaMatch) { + var browsers = PlatformInfo.browsers(); + var oses = PlatformInfo.oses(); + var browser = userAgentDataOpt.bind(function (userAgentData) { + return detectBrowser$1(browsers, userAgentData); + }).orThunk(function () { + return detectBrowser(browsers, userAgent); + }).fold(Browser.unknown, Browser.nu); + var os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu); + var deviceType = DeviceType(os, browser, userAgent, mediaMatch); + return { + browser: browser, + os: os, + deviceType: deviceType + }; + }; + var PlatformDetection = { detect: detect$4 }; + + var mediaMatch = function (query) { + return window.matchMedia(query).matches; + }; + var platform = cached(function () { + return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch); + }); + var detect$3 = function () { + return platform(); + }; + + var compareDocumentPosition = function (a, b, match) { + return (a.compareDocumentPosition(b) & match) !== 0; + }; + var documentPositionContainedBy = function (a, b) { + return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY); + }; + + var COMMENT = 8; + var DOCUMENT = 9; + var DOCUMENT_FRAGMENT = 11; + var ELEMENT = 1; + var TEXT = 3; + + var fromHtml$1 = function (html, scope) { + var doc = scope || document; + var div = doc.createElement('div'); + div.innerHTML = html; + if (!div.hasChildNodes() || div.childNodes.length > 1) { + console.error('HTML does not have a single root node', html); + throw new Error('HTML must have a single root node'); + } + return fromDom$1(div.childNodes[0]); + }; + var fromTag = function (tag, scope) { + var doc = scope || document; + var node = doc.createElement(tag); + return fromDom$1(node); + }; + var fromText = function (text, scope) { + var doc = scope || document; + var node = doc.createTextNode(text); + return fromDom$1(node); + }; + var fromDom$1 = function (node) { + if (node === null || node === undefined) { + throw new Error('Node cannot be null or undefined'); + } + return { dom: node }; + }; + var fromPoint$1 = function (docElm, x, y) { + return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom$1); + }; + var SugarElement = { + fromHtml: fromHtml$1, + fromTag: fromTag, + fromText: fromText, + fromDom: fromDom$1, + fromPoint: fromPoint$1 + }; + + var is$2 = function (element, selector) { + var dom = element.dom; + if (dom.nodeType !== ELEMENT) { + return false; + } else { + var elem = dom; + if (elem.matches !== undefined) { + return elem.matches(selector); + } else if (elem.msMatchesSelector !== undefined) { + return elem.msMatchesSelector(selector); + } else if (elem.webkitMatchesSelector !== undefined) { + return elem.webkitMatchesSelector(selector); + } else if (elem.mozMatchesSelector !== undefined) { + return elem.mozMatchesSelector(selector); + } else { + throw new Error('Browser lacks native selectors'); + } + } + }; + var bypassSelector = function (dom) { + return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0; + }; + var all$1 = function (selector, scope) { + var base = scope === undefined ? document : scope.dom; + return bypassSelector(base) ? [] : map$1(base.querySelectorAll(selector), SugarElement.fromDom); + }; + var one = function (selector, scope) { + var base = scope === undefined ? document : scope.dom; + return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector)).map(SugarElement.fromDom); + }; + + var eq$1 = function (e1, e2) { + return e1.dom === e2.dom; + }; + var regularContains = function (e1, e2) { + var d1 = e1.dom; + var d2 = e2.dom; + return d1 === d2 ? false : d1.contains(d2); + }; + var ieContains = function (e1, e2) { + return documentPositionContainedBy(e1.dom, e2.dom); + }; + var contains = function (e1, e2) { + return detect$3().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2); + }; + var is$1 = is$2; + + var keys = Object.keys; + var hasOwnProperty = Object.hasOwnProperty; + var each$1 = function (obj, f) { + var props = keys(obj); + for (var k = 0, len = props.length; k < len; k++) { + var i = props[k]; + var x = obj[i]; + f(x, i); + } + }; + var map = function (obj, f) { + return tupleMap(obj, function (x, i) { + return { + k: i, + v: f(x, i) + }; + }); + }; + var tupleMap = function (obj, f) { + var r = {}; + each$1(obj, function (x, i) { + var tuple = f(x, i); + r[tuple.k] = tuple.v; + }); + return r; + }; + var objAcc = function (r) { + return function (x, i) { + r[i] = x; + }; + }; + var internalFilter = function (obj, pred, onTrue, onFalse) { + var r = {}; + each$1(obj, function (x, i) { + (pred(x, i) ? onTrue : onFalse)(x, i); + }); + return r; + }; + var filter$1 = function (obj, pred) { + var t = {}; + internalFilter(obj, pred, objAcc(t), noop); + return t; + }; + var mapToArray = function (obj, f) { + var r = []; + each$1(obj, function (value, name) { + r.push(f(value, name)); + }); + return r; + }; + var values = function (obj) { + return mapToArray(obj, identity); + }; + var size = function (obj) { + return keys(obj).length; + }; + var get$c = function (obj, key) { + return has$1(obj, key) ? Optional.from(obj[key]) : Optional.none(); + }; + var has$1 = function (obj, key) { + return hasOwnProperty.call(obj, key); + }; + var hasNonNullableKey = function (obj, key) { + return has$1(obj, key) && obj[key] !== undefined && obj[key] !== null; + }; + var isEmpty = function (r) { + for (var x in r) { + if (hasOwnProperty.call(r, x)) { + return false; + } + } + return true; + }; + + var validSectionList = [ + 'tfoot', + 'thead', + 'tbody', + 'colgroup' + ]; + var isValidSection = function (parentName) { + return contains$2(validSectionList, parentName); + }; + var grid = function (rows, columns) { + return { + rows: rows, + columns: columns + }; + }; + var address = function (row, column) { + return { + row: row, + column: column + }; + }; + var detail = function (element, rowspan, colspan) { + return { + element: element, + rowspan: rowspan, + colspan: colspan + }; + }; + var detailnew = function (element, rowspan, colspan, isNew) { + return { + element: element, + rowspan: rowspan, + colspan: colspan, + isNew: isNew + }; + }; + var extended = function (element, rowspan, colspan, row, column, isLocked) { + return { + element: element, + rowspan: rowspan, + colspan: colspan, + row: row, + column: column, + isLocked: isLocked + }; + }; + var rowdetail = function (element, cells, section) { + return { + element: element, + cells: cells, + section: section + }; + }; + var rowdetailnew = function (element, cells, section, isNew) { + return { + element: element, + cells: cells, + section: section, + isNew: isNew + }; + }; + var elementnew = function (element, isNew, isLocked) { + return { + element: element, + isNew: isNew, + isLocked: isLocked + }; + }; + var rowcells = function (element, cells, section, isNew) { + return { + element: element, + cells: cells, + section: section, + isNew: isNew + }; + }; + var bounds = function (startRow, startCol, finishRow, finishCol) { + return { + startRow: startRow, + startCol: startCol, + finishRow: finishRow, + finishCol: finishCol + }; + }; + var columnext = function (element, colspan, column) { + return { + element: element, + colspan: colspan, + column: column + }; + }; + var colgroup = function (element, columns) { + return { + element: element, + columns: columns + }; + }; + + typeof window !== 'undefined' ? window : Function('return this;')(); + + var name = function (element) { + var r = element.dom.nodeName; + return r.toLowerCase(); + }; + var type$1 = function (element) { + return element.dom.nodeType; + }; + var isType = function (t) { + return function (element) { + return type$1(element) === t; + }; + }; + var isComment = function (element) { + return type$1(element) === COMMENT || name(element) === '#comment'; + }; + var isElement = isType(ELEMENT); + var isText = isType(TEXT); + var isDocument = isType(DOCUMENT); + var isDocumentFragment = isType(DOCUMENT_FRAGMENT); + var isTag = function (tag) { + return function (e) { + return isElement(e) && name(e) === tag; + }; + }; + + var owner = function (element) { + return SugarElement.fromDom(element.dom.ownerDocument); + }; + var documentOrOwner = function (dos) { + return isDocument(dos) ? dos : owner(dos); + }; + var defaultView = function (element) { + return SugarElement.fromDom(documentOrOwner(element).dom.defaultView); + }; + var parent = function (element) { + return Optional.from(element.dom.parentNode).map(SugarElement.fromDom); + }; + var parentElement = function (element) { + return Optional.from(element.dom.parentElement).map(SugarElement.fromDom); + }; + var parents = function (element, isRoot) { + var stop = isFunction(isRoot) ? isRoot : never; + var dom = element.dom; + var ret = []; + while (dom.parentNode !== null && dom.parentNode !== undefined) { + var rawParent = dom.parentNode; + var p = SugarElement.fromDom(rawParent); + ret.push(p); + if (stop(p) === true) { + break; + } else { + dom = rawParent; + } + } + return ret; + }; + var prevSibling = function (element) { + return Optional.from(element.dom.previousSibling).map(SugarElement.fromDom); + }; + var nextSibling = function (element) { + return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom); + }; + var children$3 = function (element) { + return map$1(element.dom.childNodes, SugarElement.fromDom); + }; + var child$3 = function (element, index) { + var cs = element.dom.childNodes; + return Optional.from(cs[index]).map(SugarElement.fromDom); + }; + var firstChild = function (element) { + return child$3(element, 0); + }; + + var isShadowRoot = function (dos) { + return isDocumentFragment(dos) && isNonNullable(dos.dom.host); + }; + var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode); + var isSupported$1 = constant(supported); + var getRootNode = supported ? function (e) { + return SugarElement.fromDom(e.dom.getRootNode()); + } : documentOrOwner; + var getShadowRoot = function (e) { + var r = getRootNode(e); + return isShadowRoot(r) ? Optional.some(r) : Optional.none(); + }; + var getShadowHost = function (e) { + return SugarElement.fromDom(e.dom.host); + }; + var getOriginalEventTarget = function (event) { + if (isSupported$1() && isNonNullable(event.target)) { + var el = SugarElement.fromDom(event.target); + if (isElement(el) && isOpenShadowHost(el)) { + if (event.composed && event.composedPath) { + var composedPath = event.composedPath(); + if (composedPath) { + return head(composedPath); + } + } + } + } + return Optional.from(event.target); + }; + var isOpenShadowHost = function (element) { + return isNonNullable(element.dom.shadowRoot); + }; + + var inBody = function (element) { + var dom = isText(element) ? element.dom.parentNode : element.dom; + if (dom === undefined || dom === null || dom.ownerDocument === null) { + return false; + } + var doc = dom.ownerDocument; + return getShadowRoot(SugarElement.fromDom(dom)).fold(function () { + return doc.body.contains(dom); + }, compose1(inBody, getShadowHost)); + }; + var body$1 = function () { + return getBody$1(SugarElement.fromDom(document)); + }; + var getBody$1 = function (doc) { + var b = doc.dom.body; + if (b === null || b === undefined) { + throw new Error('Body is not available yet'); + } + return SugarElement.fromDom(b); + }; + + var ancestors$4 = function (scope, predicate, isRoot) { + return filter$2(parents(scope, isRoot), predicate); + }; + var children$2 = function (scope, predicate) { + return filter$2(children$3(scope), predicate); + }; + var descendants$1 = function (scope, predicate) { + var result = []; + each$2(children$3(scope), function (x) { + if (predicate(x)) { + result = result.concat([x]); + } + result = result.concat(descendants$1(x, predicate)); + }); + return result; + }; + + var ancestors$3 = function (scope, selector, isRoot) { + return ancestors$4(scope, function (e) { + return is$2(e, selector); + }, isRoot); + }; + var children$1 = function (scope, selector) { + return children$2(scope, function (e) { + return is$2(e, selector); + }); + }; + var descendants = function (scope, selector) { + return all$1(selector, scope); + }; + + function ClosestOrAncestor (is, ancestor, scope, a, isRoot) { + if (is(scope, a)) { + return Optional.some(scope); + } else if (isFunction(isRoot) && isRoot(scope)) { + return Optional.none(); + } else { + return ancestor(scope, a, isRoot); + } + } + + var ancestor$2 = function (scope, predicate, isRoot) { + var element = scope.dom; + var stop = isFunction(isRoot) ? isRoot : never; + while (element.parentNode) { + element = element.parentNode; + var el = SugarElement.fromDom(element); + if (predicate(el)) { + return Optional.some(el); + } else if (stop(el)) { + break; + } + } + return Optional.none(); + }; + var closest$2 = function (scope, predicate, isRoot) { + var is = function (s, test) { + return test(s); + }; + return ClosestOrAncestor(is, ancestor$2, scope, predicate, isRoot); + }; + var child$2 = function (scope, predicate) { + var pred = function (node) { + return predicate(SugarElement.fromDom(node)); + }; + var result = find$1(scope.dom.childNodes, pred); + return result.map(SugarElement.fromDom); + }; + var descendant$1 = function (scope, predicate) { + var descend = function (node) { + for (var i = 0; i < node.childNodes.length; i++) { + var child_1 = SugarElement.fromDom(node.childNodes[i]); + if (predicate(child_1)) { + return Optional.some(child_1); + } + var res = descend(node.childNodes[i]); + if (res.isSome()) { + return res; + } + } + return Optional.none(); + }; + return descend(scope.dom); + }; + + var ancestor$1 = function (scope, selector, isRoot) { + return ancestor$2(scope, function (e) { + return is$2(e, selector); + }, isRoot); + }; + var child$1 = function (scope, selector) { + return child$2(scope, function (e) { + return is$2(e, selector); + }); + }; + var descendant = function (scope, selector) { + return one(selector, scope); + }; + var closest$1 = function (scope, selector, isRoot) { + var is = function (element, selector) { + return is$2(element, selector); + }; + return ClosestOrAncestor(is, ancestor$1, scope, selector, isRoot); + }; + + var rawSet = function (dom, key, value) { + if (isString(value) || isBoolean(value) || isNumber(value)) { + dom.setAttribute(key, value + ''); + } else { + console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom); + throw new Error('Attribute value was not simple'); + } + }; + var set$2 = function (element, key, value) { + rawSet(element.dom, key, value); + }; + var setAll$1 = function (element, attrs) { + var dom = element.dom; + each$1(attrs, function (v, k) { + rawSet(dom, k, v); + }); + }; + var setOptions = function (element, attrs) { + each$1(attrs, function (v, k) { + v.fold(function () { + remove$7(element, k); + }, function (value) { + rawSet(element.dom, k, value); + }); + }); + }; + var get$b = function (element, key) { + var v = element.dom.getAttribute(key); + return v === null ? undefined : v; + }; + var getOpt = function (element, key) { + return Optional.from(get$b(element, key)); + }; + var remove$7 = function (element, key) { + element.dom.removeAttribute(key); + }; + var clone$2 = function (element) { + return foldl(element.dom.attributes, function (acc, attr) { + acc[attr.name] = attr.value; + return acc; + }, {}); + }; + + var is = function (lhs, rhs, comparator) { + if (comparator === void 0) { + comparator = tripleEquals; + } + return lhs.exists(function (left) { + return comparator(left, rhs); + }); + }; + var cat = function (arr) { + var r = []; + var push = function (x) { + r.push(x); + }; + for (var i = 0; i < arr.length; i++) { + arr[i].each(push); + } + return r; + }; + var lift2 = function (oa, ob, f) { + return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none(); + }; + var bindFrom = function (a, f) { + return a !== undefined && a !== null ? f(a) : Optional.none(); + }; + var flatten = function (oot) { + return oot.bind(identity); + }; + var someIf = function (b, a) { + return b ? Optional.some(a) : Optional.none(); + }; + + var isSupported = function (dom) { + return dom.style !== undefined && isFunction(dom.style.getPropertyValue); + }; + + var internalSet = function (dom, property, value) { + if (!isString(value)) { + console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom); + throw new Error('CSS value must be a string: ' + value); + } + if (isSupported(dom)) { + dom.style.setProperty(property, value); + } + }; + var internalRemove = function (dom, property) { + if (isSupported(dom)) { + dom.style.removeProperty(property); + } + }; + var set$1 = function (element, property, value) { + var dom = element.dom; + internalSet(dom, property, value); + }; + var setAll = function (element, css) { + var dom = element.dom; + each$1(css, function (v, k) { + internalSet(dom, k, v); + }); + }; + var get$a = function (element, property) { + var dom = element.dom; + var styles = window.getComputedStyle(dom); + var r = styles.getPropertyValue(property); + return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r; + }; + var getUnsafeProperty = function (dom, property) { + return isSupported(dom) ? dom.style.getPropertyValue(property) : ''; + }; + var getRaw$2 = function (element, property) { + var dom = element.dom; + var raw = getUnsafeProperty(dom, property); + return Optional.from(raw).filter(function (r) { + return r.length > 0; + }); + }; + var remove$6 = function (element, property) { + var dom = element.dom; + internalRemove(dom, property); + if (is(getOpt(element, 'style').map(trim), '')) { + remove$7(element, 'style'); + } + }; + var copy$2 = function (source, target) { + var sourceDom = source.dom; + var targetDom = target.dom; + if (isSupported(sourceDom) && isSupported(targetDom)) { + targetDom.style.cssText = sourceDom.style.cssText; + } + }; + + var getAttrValue = function (cell, name, fallback) { + if (fallback === void 0) { + fallback = 0; + } + return getOpt(cell, name).map(function (value) { + return parseInt(value, 10); + }).getOr(fallback); + }; + var getSpan = function (cell, type) { + return getAttrValue(cell, type, 1); + }; + var hasColspan = function (cellOrCol) { + if (isTag('col')(cellOrCol)) { + return getAttrValue(cellOrCol, 'span', 1) > 1; + } else { + return getSpan(cellOrCol, 'colspan') > 1; + } + }; + var hasRowspan = function (cell) { + return getSpan(cell, 'rowspan') > 1; + }; + var getCssValue = function (element, property) { + return parseInt(get$a(element, property), 10); + }; + var minWidth = constant(10); + var minHeight = constant(10); + + var firstLayer = function (scope, selector) { + return filterFirstLayer(scope, selector, always); + }; + var filterFirstLayer = function (scope, selector, predicate) { + return bind$2(children$3(scope), function (x) { + if (is$2(x, selector)) { + return predicate(x) ? [x] : []; + } else { + return filterFirstLayer(x, selector, predicate); + } + }); + }; + + var lookup = function (tags, element, isRoot) { + if (isRoot === void 0) { + isRoot = never; + } + if (isRoot(element)) { + return Optional.none(); + } + if (contains$2(tags, name(element))) { + return Optional.some(element); + } + var isRootOrUpperTable = function (elm) { + return is$2(elm, 'table') || isRoot(elm); + }; + return ancestor$1(element, tags.join(','), isRootOrUpperTable); + }; + var cell = function (element, isRoot) { + return lookup([ + 'td', + 'th' + ], element, isRoot); + }; + var cells$1 = function (ancestor) { + return firstLayer(ancestor, 'th,td'); + }; + var columns$1 = function (ancestor) { + if (is$2(ancestor, 'colgroup')) { + return children$1(ancestor, 'col'); + } else { + return bind$2(columnGroups(ancestor), function (columnGroup) { + return children$1(columnGroup, 'col'); + }); + } + }; + var table = function (element, isRoot) { + return closest$1(element, 'table', isRoot); + }; + var rows$1 = function (ancestor) { + return firstLayer(ancestor, 'tr'); + }; + var columnGroups = function (ancestor) { + return table(ancestor).fold(constant([]), function (table) { + return children$1(table, 'colgroup'); + }); + }; + + var fromRowsOrColGroups = function (elems, getSection) { + return map$1(elems, function (row) { + if (name(row) === 'colgroup') { + var cells = map$1(columns$1(row), function (column) { + var colspan = getAttrValue(column, 'span', 1); + return detail(column, 1, colspan); + }); + return rowdetail(row, cells, 'colgroup'); + } else { + var cells = map$1(cells$1(row), function (cell) { + var rowspan = getAttrValue(cell, 'rowspan', 1); + var colspan = getAttrValue(cell, 'colspan', 1); + return detail(cell, rowspan, colspan); + }); + return rowdetail(row, cells, getSection(row)); + } + }); + }; + var getParentSection = function (group) { + return parent(group).map(function (parent) { + var parentName = name(parent); + return isValidSection(parentName) ? parentName : 'tbody'; + }).getOr('tbody'); + }; + var fromTable$1 = function (table) { + var rows = rows$1(table); + var columnGroups$1 = columnGroups(table); + var elems = __spreadArray(__spreadArray([], columnGroups$1, true), rows, true); + return fromRowsOrColGroups(elems, getParentSection); + }; + var fromPastedRows = function (elems, section) { + return fromRowsOrColGroups(elems, function () { + return section; + }); + }; + + var addCells = function (gridRow, index, cells) { + var existingCells = gridRow.cells; + var before = existingCells.slice(0, index); + var after = existingCells.slice(index); + var newCells = before.concat(cells).concat(after); + return setCells(gridRow, newCells); + }; + var addCell = function (gridRow, index, cell) { + return addCells(gridRow, index, [cell]); + }; + var mutateCell = function (gridRow, index, cell) { + var cells = gridRow.cells; + cells[index] = cell; + }; + var setCells = function (gridRow, cells) { + return rowcells(gridRow.element, cells, gridRow.section, gridRow.isNew); + }; + var mapCells = function (gridRow, f) { + var cells = gridRow.cells; + var r = map$1(cells, f); + return rowcells(gridRow.element, r, gridRow.section, gridRow.isNew); + }; + var getCell = function (gridRow, index) { + return gridRow.cells[index]; + }; + var getCellElement = function (gridRow, index) { + return getCell(gridRow, index).element; + }; + var cellLength = function (gridRow) { + return gridRow.cells.length; + }; + var extractGridDetails = function (grid) { + var result = partition(grid, function (row) { + return row.section === 'colgroup'; + }); + return { + rows: result.fail, + cols: result.pass + }; + }; + var clone$1 = function (gridRow, cloneRow, cloneCell) { + var newCells = map$1(gridRow.cells, cloneCell); + return rowcells(cloneRow(gridRow.element), newCells, gridRow.section, true); + }; + + var LOCKED_COL_ATTR = 'data-snooker-locked-cols'; + var getLockedColumnsFromTable = function (table) { + return getOpt(table, LOCKED_COL_ATTR).bind(function (lockedColStr) { + return Optional.from(lockedColStr.match(/\d+/g)); + }).map(function (lockedCols) { + return mapToObject(lockedCols, always); + }); + }; + var getLockedColumnsFromGrid = function (grid) { + var locked = foldl(extractGridDetails(grid).rows, function (acc, row) { + each$2(row.cells, function (cell, idx) { + if (cell.isLocked) { + acc[idx] = true; + } + }); + return acc; + }, {}); + var lockedArr = mapToArray(locked, function (_val, key) { + return parseInt(key, 10); + }); + return sort$1(lockedArr); + }; + + var key = function (row, column) { + return row + ',' + column; + }; + var getAt = function (warehouse, row, column) { + return Optional.from(warehouse.access[key(row, column)]); + }; + var findItem = function (warehouse, item, comparator) { + var filtered = filterItems(warehouse, function (detail) { + return comparator(item, detail.element); + }); + return filtered.length > 0 ? Optional.some(filtered[0]) : Optional.none(); + }; + var filterItems = function (warehouse, predicate) { + var all = bind$2(warehouse.all, function (r) { + return r.cells; + }); + return filter$2(all, predicate); + }; + var generateColumns = function (rowData) { + var columnsGroup = {}; + var index = 0; + each$2(rowData.cells, function (column) { + var colspan = column.colspan; + range$1(colspan, function (columnIndex) { + var colIndex = index + columnIndex; + columnsGroup[colIndex] = columnext(column.element, colspan, colIndex); + }); + index += colspan; + }); + return columnsGroup; + }; + var generate$1 = function (list) { + var access = {}; + var cells = []; + var tableOpt = head(list).map(function (rowData) { + return rowData.element; + }).bind(table); + var lockedColumns = tableOpt.bind(getLockedColumnsFromTable).getOr({}); + var maxRows = 0; + var maxColumns = 0; + var rowCount = 0; + var _a = partition(list, function (rowData) { + return rowData.section === 'colgroup'; + }), colgroupRows = _a.pass, rows = _a.fail; + each$2(rows, function (rowData) { + var currentRow = []; + each$2(rowData.cells, function (rowCell) { + var start = 0; + while (access[key(rowCount, start)] !== undefined) { + start++; + } + var isLocked = hasNonNullableKey(lockedColumns, start.toString()); + var current = extended(rowCell.element, rowCell.rowspan, rowCell.colspan, rowCount, start, isLocked); + for (var occupiedColumnPosition = 0; occupiedColumnPosition < rowCell.colspan; occupiedColumnPosition++) { + for (var occupiedRowPosition = 0; occupiedRowPosition < rowCell.rowspan; occupiedRowPosition++) { + var rowPosition = rowCount + occupiedRowPosition; + var columnPosition = start + occupiedColumnPosition; + var newpos = key(rowPosition, columnPosition); + access[newpos] = current; + maxColumns = Math.max(maxColumns, columnPosition + 1); + } + } + currentRow.push(current); + }); + maxRows++; + cells.push(rowdetail(rowData.element, currentRow, rowData.section)); + rowCount++; + }); + var _b = last$2(colgroupRows).map(function (rowData) { + var columns = generateColumns(rowData); + var colgroup$1 = colgroup(rowData.element, values(columns)); + return { + colgroups: [colgroup$1], + columns: columns + }; + }).getOrThunk(function () { + return { + colgroups: [], + columns: {} + }; + }), columns = _b.columns, colgroups = _b.colgroups; + var grid$1 = grid(maxRows, maxColumns); + return { + grid: grid$1, + access: access, + all: cells, + columns: columns, + colgroups: colgroups + }; + }; + var fromTable = function (table) { + var list = fromTable$1(table); + return generate$1(list); + }; + var justCells = function (warehouse) { + return bind$2(warehouse.all, function (w) { + return w.cells; + }); + }; + var justColumns = function (warehouse) { + return values(warehouse.columns); + }; + var hasColumns = function (warehouse) { + return keys(warehouse.columns).length > 0; + }; + var getColumnAt = function (warehouse, columnIndex) { + return Optional.from(warehouse.columns[columnIndex]); + }; + var Warehouse = { + fromTable: fromTable, + generate: generate$1, + getAt: getAt, + findItem: findItem, + filterItems: filterItems, + justCells: justCells, + justColumns: justColumns, + hasColumns: hasColumns, + getColumnAt: getColumnAt + }; + + var inSelection = function (bounds, detail) { + var leftEdge = detail.column; + var rightEdge = detail.column + detail.colspan - 1; + var topEdge = detail.row; + var bottomEdge = detail.row + detail.rowspan - 1; + return leftEdge <= bounds.finishCol && rightEdge >= bounds.startCol && (topEdge <= bounds.finishRow && bottomEdge >= bounds.startRow); + }; + var isWithin = function (bounds, detail) { + return detail.column >= bounds.startCol && detail.column + detail.colspan - 1 <= bounds.finishCol && detail.row >= bounds.startRow && detail.row + detail.rowspan - 1 <= bounds.finishRow; + }; + var isRectangular = function (warehouse, bounds) { + var isRect = true; + var detailIsWithin = curry(isWithin, bounds); + for (var i = bounds.startRow; i <= bounds.finishRow; i++) { + for (var j = bounds.startCol; j <= bounds.finishCol; j++) { + isRect = isRect && Warehouse.getAt(warehouse, i, j).exists(detailIsWithin); + } + } + return isRect ? Optional.some(bounds) : Optional.none(); + }; + + var getBounds = function (detailA, detailB) { + return bounds(Math.min(detailA.row, detailB.row), Math.min(detailA.column, detailB.column), Math.max(detailA.row + detailA.rowspan - 1, detailB.row + detailB.rowspan - 1), Math.max(detailA.column + detailA.colspan - 1, detailB.column + detailB.colspan - 1)); + }; + var getAnyBox = function (warehouse, startCell, finishCell) { + var startCoords = Warehouse.findItem(warehouse, startCell, eq$1); + var finishCoords = Warehouse.findItem(warehouse, finishCell, eq$1); + return startCoords.bind(function (sc) { + return finishCoords.map(function (fc) { + return getBounds(sc, fc); + }); + }); + }; + var getBox$1 = function (warehouse, startCell, finishCell) { + return getAnyBox(warehouse, startCell, finishCell).bind(function (bounds) { + return isRectangular(warehouse, bounds); + }); + }; + + var moveBy$1 = function (warehouse, cell, row, column) { + return Warehouse.findItem(warehouse, cell, eq$1).bind(function (detail) { + var startRow = row > 0 ? detail.row + detail.rowspan - 1 : detail.row; + var startCol = column > 0 ? detail.column + detail.colspan - 1 : detail.column; + var dest = Warehouse.getAt(warehouse, startRow + row, startCol + column); + return dest.map(function (d) { + return d.element; + }); + }); + }; + var intercepts$1 = function (warehouse, start, finish) { + return getAnyBox(warehouse, start, finish).map(function (bounds) { + var inside = Warehouse.filterItems(warehouse, curry(inSelection, bounds)); + return map$1(inside, function (detail) { + return detail.element; + }); + }); + }; + var parentCell = function (warehouse, innerCell) { + var isContainedBy = function (c1, c2) { + return contains(c2, c1); + }; + return Warehouse.findItem(warehouse, innerCell, isContainedBy).map(function (detail) { + return detail.element; + }); + }; + + var moveBy = function (cell, deltaRow, deltaColumn) { + return table(cell).bind(function (table) { + var warehouse = getWarehouse(table); + return moveBy$1(warehouse, cell, deltaRow, deltaColumn); + }); + }; + var intercepts = function (table, first, last) { + var warehouse = getWarehouse(table); + return intercepts$1(warehouse, first, last); + }; + var nestedIntercepts = function (table, first, firstTable, last, lastTable) { + var warehouse = getWarehouse(table); + var optStartCell = eq$1(table, firstTable) ? Optional.some(first) : parentCell(warehouse, first); + var optLastCell = eq$1(table, lastTable) ? Optional.some(last) : parentCell(warehouse, last); + return optStartCell.bind(function (startCell) { + return optLastCell.bind(function (lastCell) { + return intercepts$1(warehouse, startCell, lastCell); + }); + }); + }; + var getBox = function (table, first, last) { + var warehouse = getWarehouse(table); + return getBox$1(warehouse, first, last); + }; + var getWarehouse = Warehouse.fromTable; + + var before$4 = function (marker, element) { + var parent$1 = parent(marker); + parent$1.each(function (v) { + v.dom.insertBefore(element.dom, marker.dom); + }); + }; + var after$5 = function (marker, element) { + var sibling = nextSibling(marker); + sibling.fold(function () { + var parent$1 = parent(marker); + parent$1.each(function (v) { + append$1(v, element); + }); + }, function (v) { + before$4(v, element); + }); + }; + var prepend = function (parent, element) { + var firstChild$1 = firstChild(parent); + firstChild$1.fold(function () { + append$1(parent, element); + }, function (v) { + parent.dom.insertBefore(element.dom, v.dom); + }); + }; + var append$1 = function (parent, element) { + parent.dom.appendChild(element.dom); + }; + var appendAt = function (parent, element, index) { + child$3(parent, index).fold(function () { + append$1(parent, element); + }, function (v) { + before$4(v, element); + }); + }; + var wrap = function (element, wrapper) { + before$4(element, wrapper); + append$1(wrapper, element); + }; + + var before$3 = function (marker, elements) { + each$2(elements, function (x) { + before$4(marker, x); + }); + }; + var after$4 = function (marker, elements) { + each$2(elements, function (x, i) { + var e = i === 0 ? marker : elements[i - 1]; + after$5(e, x); + }); + }; + var append = function (parent, elements) { + each$2(elements, function (x) { + append$1(parent, x); + }); + }; + + var empty = function (element) { + element.dom.textContent = ''; + each$2(children$3(element), function (rogue) { + remove$5(rogue); + }); + }; + var remove$5 = function (element) { + var dom = element.dom; + if (dom.parentNode !== null) { + dom.parentNode.removeChild(dom); + } + }; + var unwrap = function (wrapper) { + var children = children$3(wrapper); + if (children.length > 0) { + before$3(wrapper, children); + } + remove$5(wrapper); + }; + + var NodeValue = function (is, name) { + var get = function (element) { + if (!is(element)) { + throw new Error('Can only get ' + name + ' value of a ' + name + ' node'); + } + return getOption(element).getOr(''); + }; + var getOption = function (element) { + return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none(); + }; + var set = function (element, value) { + if (!is(element)) { + throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node'); + } + element.dom.nodeValue = value; + }; + return { + get: get, + getOption: getOption, + set: set + }; + }; + + var api$2 = NodeValue(isText, 'text'); + var get$9 = function (element) { + return api$2.get(element); + }; + var getOption = function (element) { + return api$2.getOption(element); + }; + var set = function (element, value) { + return api$2.set(element, value); + }; + + var TagBoundaries = [ + 'body', + 'p', + 'div', + 'article', + 'aside', + 'figcaption', + 'figure', + 'footer', + 'header', + 'nav', + 'section', + 'ol', + 'ul', + 'li', + 'table', + 'thead', + 'tbody', + 'tfoot', + 'caption', + 'tr', + 'td', + 'th', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'blockquote', + 'pre', + 'address' + ]; + + function DomUniverse () { + var clone = function (element) { + return SugarElement.fromDom(element.dom.cloneNode(false)); + }; + var document = function (element) { + return documentOrOwner(element).dom; + }; + var isBoundary = function (element) { + if (!isElement(element)) { + return false; + } + if (name(element) === 'body') { + return true; + } + return contains$2(TagBoundaries, name(element)); + }; + var isEmptyTag = function (element) { + if (!isElement(element)) { + return false; + } + return contains$2([ + 'br', + 'img', + 'hr', + 'input' + ], name(element)); + }; + var isNonEditable = function (element) { + return isElement(element) && get$b(element, 'contenteditable') === 'false'; + }; + var comparePosition = function (element, other) { + return element.dom.compareDocumentPosition(other.dom); + }; + var copyAttributesTo = function (source, destination) { + var as = clone$2(source); + setAll$1(destination, as); + }; + var isSpecial = function (element) { + var tag = name(element); + return contains$2([ + 'script', + 'noscript', + 'iframe', + 'noframes', + 'noembed', + 'title', + 'style', + 'textarea', + 'xmp' + ], tag); + }; + var getLanguage = function (element) { + return isElement(element) ? getOpt(element, 'lang') : Optional.none(); + }; + return { + up: constant({ + selector: ancestor$1, + closest: closest$1, + predicate: ancestor$2, + all: parents + }), + down: constant({ + selector: descendants, + predicate: descendants$1 + }), + styles: constant({ + get: get$a, + getRaw: getRaw$2, + set: set$1, + remove: remove$6 + }), + attrs: constant({ + get: get$b, + set: set$2, + remove: remove$7, + copyTo: copyAttributesTo + }), + insert: constant({ + before: before$4, + after: after$5, + afterAll: after$4, + append: append$1, + appendAll: append, + prepend: prepend, + wrap: wrap + }), + remove: constant({ + unwrap: unwrap, + remove: remove$5 + }), + create: constant({ + nu: SugarElement.fromTag, + clone: clone, + text: SugarElement.fromText + }), + query: constant({ + comparePosition: comparePosition, + prevSibling: prevSibling, + nextSibling: nextSibling + }), + property: constant({ + children: children$3, + name: name, + parent: parent, + document: document, + isText: isText, + isComment: isComment, + isElement: isElement, + isSpecial: isSpecial, + getLanguage: getLanguage, + getText: get$9, + setText: set, + isBoundary: isBoundary, + isEmptyTag: isEmptyTag, + isNonEditable: isNonEditable + }), + eq: eq$1, + is: is$1 + }; + } + + var all = function (universe, look, elements, f) { + var head = elements[0]; + var tail = elements.slice(1); + return f(universe, look, head, tail); + }; + var oneAll = function (universe, look, elements) { + return elements.length > 0 ? all(universe, look, elements, unsafeOne) : Optional.none(); + }; + var unsafeOne = function (universe, look, head, tail) { + var start = look(universe, head); + return foldr(tail, function (b, a) { + var current = look(universe, a); + return commonElement(universe, b, current); + }, start); + }; + var commonElement = function (universe, start, end) { + return start.bind(function (s) { + return end.filter(curry(universe.eq, s)); + }); + }; + + var eq = function (universe, item) { + return curry(universe.eq, item); + }; + var ancestors$2 = function (universe, start, end, isRoot) { + if (isRoot === void 0) { + isRoot = never; + } + var ps1 = [start].concat(universe.up().all(start)); + var ps2 = [end].concat(universe.up().all(end)); + var prune = function (path) { + var index = findIndex(path, isRoot); + return index.fold(function () { + return path; + }, function (ind) { + return path.slice(0, ind + 1); + }); + }; + var pruned1 = prune(ps1); + var pruned2 = prune(ps2); + var shared = find$1(pruned1, function (x) { + return exists(pruned2, eq(universe, x)); + }); + return { + firstpath: pruned1, + secondpath: pruned2, + shared: shared + }; + }; + + var sharedOne$1 = oneAll; + var ancestors$1 = ancestors$2; + + var universe$3 = DomUniverse(); + var sharedOne = function (look, elements) { + return sharedOne$1(universe$3, function (_universe, element) { + return look(element); + }, elements); + }; + var ancestors = function (start, finish, isRoot) { + return ancestors$1(universe$3, start, finish, isRoot); + }; + + var lookupTable = function (container) { + return ancestor$1(container, 'table'); + }; + var identify = function (start, finish, isRoot) { + var getIsRoot = function (rootTable) { + return function (element) { + return isRoot !== undefined && isRoot(element) || eq$1(element, rootTable); + }; + }; + if (eq$1(start, finish)) { + return Optional.some({ + boxes: Optional.some([start]), + start: start, + finish: finish + }); + } else { + return lookupTable(start).bind(function (startTable) { + return lookupTable(finish).bind(function (finishTable) { + if (eq$1(startTable, finishTable)) { + return Optional.some({ + boxes: intercepts(startTable, start, finish), + start: start, + finish: finish + }); + } else if (contains(startTable, finishTable)) { + var ancestorCells = ancestors$3(finish, 'td,th', getIsRoot(startTable)); + var finishCell = ancestorCells.length > 0 ? ancestorCells[ancestorCells.length - 1] : finish; + return Optional.some({ + boxes: nestedIntercepts(startTable, start, startTable, finish, finishTable), + start: start, + finish: finishCell + }); + } else if (contains(finishTable, startTable)) { + var ancestorCells = ancestors$3(start, 'td,th', getIsRoot(finishTable)); + var startCell = ancestorCells.length > 0 ? ancestorCells[ancestorCells.length - 1] : start; + return Optional.some({ + boxes: nestedIntercepts(finishTable, start, startTable, finish, finishTable), + start: start, + finish: startCell + }); + } else { + return ancestors(start, finish).shared.bind(function (lca) { + return closest$1(lca, 'table', isRoot).bind(function (lcaTable) { + var finishAncestorCells = ancestors$3(finish, 'td,th', getIsRoot(lcaTable)); + var finishCell = finishAncestorCells.length > 0 ? finishAncestorCells[finishAncestorCells.length - 1] : finish; + var startAncestorCells = ancestors$3(start, 'td,th', getIsRoot(lcaTable)); + var startCell = startAncestorCells.length > 0 ? startAncestorCells[startAncestorCells.length - 1] : start; + return Optional.some({ + boxes: nestedIntercepts(lcaTable, start, startTable, finish, finishTable), + start: startCell, + finish: finishCell + }); + }); + }); + } + }); + }); + } + }; + var retrieve$1 = function (container, selector) { + var sels = descendants(container, selector); + return sels.length > 0 ? Optional.some(sels) : Optional.none(); + }; + var getLast = function (boxes, lastSelectedSelector) { + return find$1(boxes, function (box) { + return is$2(box, lastSelectedSelector); + }); + }; + var getEdges = function (container, firstSelectedSelector, lastSelectedSelector) { + return descendant(container, firstSelectedSelector).bind(function (first) { + return descendant(container, lastSelectedSelector).bind(function (last) { + return sharedOne(lookupTable, [ + first, + last + ]).map(function (table) { + return { + first: first, + last: last, + table: table + }; + }); + }); + }); + }; + var expandTo = function (finish, firstSelectedSelector) { + return ancestor$1(finish, 'table').bind(function (table) { + return descendant(table, firstSelectedSelector).bind(function (start) { + return identify(start, finish).bind(function (identified) { + return identified.boxes.map(function (boxes) { + return { + boxes: boxes, + start: identified.start, + finish: identified.finish + }; + }); + }); + }); + }); + }; + var shiftSelection = function (boxes, deltaRow, deltaColumn, firstSelectedSelector, lastSelectedSelector) { + return getLast(boxes, lastSelectedSelector).bind(function (last) { + return moveBy(last, deltaRow, deltaColumn).bind(function (finish) { + return expandTo(finish, firstSelectedSelector); + }); + }); + }; + + var retrieve = function (container, selector) { + return retrieve$1(container, selector); + }; + var retrieveBox = function (container, firstSelectedSelector, lastSelectedSelector) { + return getEdges(container, firstSelectedSelector, lastSelectedSelector).bind(function (edges) { + var isRoot = function (ancestor) { + return eq$1(container, ancestor); + }; + var sectionSelector = 'thead,tfoot,tbody,table'; + var firstAncestor = ancestor$1(edges.first, sectionSelector, isRoot); + var lastAncestor = ancestor$1(edges.last, sectionSelector, isRoot); + return firstAncestor.bind(function (fA) { + return lastAncestor.bind(function (lA) { + return eq$1(fA, lA) ? getBox(edges.table, edges.first, edges.last) : Optional.none(); + }); + }); + }); + }; + + var generate = function (cases) { + if (!isArray(cases)) { + throw new Error('cases must be an array'); + } + if (cases.length === 0) { + throw new Error('there must be at least one case'); + } + var constructors = []; + var adt = {}; + each$2(cases, function (acase, count) { + var keys$1 = keys(acase); + if (keys$1.length !== 1) { + throw new Error('one and only one name per case'); + } + var key = keys$1[0]; + var value = acase[key]; + if (adt[key] !== undefined) { + throw new Error('duplicate key detected:' + key); + } else if (key === 'cata') { + throw new Error('cannot have a case named cata (sorry)'); + } else if (!isArray(value)) { + throw new Error('case arguments must be an array'); + } + constructors.push(key); + adt[key] = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var argLength = args.length; + if (argLength !== value.length) { + throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength); + } + var match = function (branches) { + var branchKeys = keys(branches); + if (constructors.length !== branchKeys.length) { + throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\nActual: ' + branchKeys.join(',')); + } + var allReqd = forall(constructors, function (reqKey) { + return contains$2(branchKeys, reqKey); + }); + if (!allReqd) { + throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\nRequired: ' + constructors.join(', ')); + } + return branches[key].apply(null, args); + }; + return { + fold: function () { + var foldArgs = []; + for (var _i = 0; _i < arguments.length; _i++) { + foldArgs[_i] = arguments[_i]; + } + if (foldArgs.length !== cases.length) { + throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + foldArgs.length); + } + var target = foldArgs[count]; + return target.apply(null, args); + }, + match: match, + log: function (label) { + console.log(label, { + constructors: constructors, + constructor: key, + params: args + }); + } + }; + }; + }); + return adt; + }; + var Adt = { generate: generate }; + + var type = Adt.generate([ + { none: [] }, + { multiple: ['elements'] }, + { single: ['element'] } + ]); + var cata$2 = function (subject, onNone, onMultiple, onSingle) { + return subject.fold(onNone, onMultiple, onSingle); + }; + var none$1 = type.none; + var multiple = type.multiple; + var single = type.single; + + var Selections = function (lazyRoot, getStart, selectedSelector) { + var get = function () { + return retrieve(lazyRoot(), selectedSelector).fold(function () { + return getStart().fold(none$1, single); + }, function (cells) { + return multiple(cells); + }); + }; + return { get: get }; + }; + + var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var clone = function (original, isDeep) { + return SugarElement.fromDom(original.dom.cloneNode(isDeep)); + }; + var shallow = function (original) { + return clone(original, false); + }; + var deep = function (original) { + return clone(original, true); + }; + var shallowAs = function (original, tag) { + var nu = SugarElement.fromTag(tag); + var attributes = clone$2(original); + setAll$1(nu, attributes); + return nu; + }; + var copy$1 = function (original, tag) { + var nu = shallowAs(original, tag); + var cloneChildren = children$3(deep(original)); + append(nu, cloneChildren); + return nu; + }; + var mutate$1 = function (original, tag) { + var nu = shallowAs(original, tag); + before$4(original, nu); + var children = children$3(original); + append(nu, children); + remove$5(original); + return nu; + }; + + var Dimension = function (name, getOffset) { + var set = function (element, h) { + if (!isNumber(h) && !h.match(/^[0-9]+$/)) { + throw new Error(name + '.set accepts only positive integer values. Value was ' + h); + } + var dom = element.dom; + if (isSupported(dom)) { + dom.style[name] = h + 'px'; + } + }; + var get = function (element) { + var r = getOffset(element); + if (r <= 0 || r === null) { + var css = get$a(element, name); + return parseFloat(css) || 0; + } + return r; + }; + var getOuter = get; + var aggregate = function (element, properties) { + return foldl(properties, function (acc, property) { + var val = get$a(element, property); + var value = val === undefined ? 0 : parseInt(val, 10); + return isNaN(value) ? acc : acc + value; + }, 0); + }; + var max = function (element, value, properties) { + var cumulativeInclusions = aggregate(element, properties); + var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0; + return absoluteMax; + }; + return { + set: set, + get: get, + getOuter: getOuter, + aggregate: aggregate, + max: max + }; + }; + + var needManualCalc = function () { + var browser = detect$3().browser; + return browser.isIE() || browser.isEdge(); + }; + var toNumber = function (px, fallback) { + return toFloat(px).getOr(fallback); + }; + var getProp = function (element, name, fallback) { + return toNumber(get$a(element, name), fallback); + }; + var getBoxSizing = function (element) { + return get$a(element, 'box-sizing'); + }; + var calcContentBoxSize = function (element, size, upper, lower) { + var paddingUpper = getProp(element, 'padding-' + upper, 0); + var paddingLower = getProp(element, 'padding-' + lower, 0); + var borderUpper = getProp(element, 'border-' + upper + '-width', 0); + var borderLower = getProp(element, 'border-' + lower + '-width', 0); + return size - paddingUpper - paddingLower - borderUpper - borderLower; + }; + var getCalculatedHeight = function (element, boxSizing) { + var dom = element.dom; + var height = dom.getBoundingClientRect().height || dom.offsetHeight; + return boxSizing === 'border-box' ? height : calcContentBoxSize(element, height, 'top', 'bottom'); + }; + var getCalculatedWidth = function (element, boxSizing) { + var dom = element.dom; + var width = dom.getBoundingClientRect().width || dom.offsetWidth; + return boxSizing === 'border-box' ? width : calcContentBoxSize(element, width, 'left', 'right'); + }; + var getHeight$1 = function (element) { + return needManualCalc() ? getCalculatedHeight(element, getBoxSizing(element)) : getProp(element, 'height', element.dom.offsetHeight); + }; + var getWidth = function (element) { + return needManualCalc() ? getCalculatedWidth(element, getBoxSizing(element)) : getProp(element, 'width', element.dom.offsetWidth); + }; + var getInnerWidth = function (element) { + return getCalculatedWidth(element, 'content-box'); + }; + + var api$1 = Dimension('width', function (element) { + return element.dom.offsetWidth; + }); + var get$8 = function (element) { + return api$1.get(element); + }; + var getOuter$2 = function (element) { + return api$1.getOuter(element); + }; + var getInner = getInnerWidth; + var getRuntime$1 = getWidth; + + var columns = function (warehouse, isValidCell) { + if (isValidCell === void 0) { + isValidCell = always; + } + var grid = warehouse.grid; + var cols = range$1(grid.columns, identity); + var rowsArr = range$1(grid.rows, identity); + return map$1(cols, function (col) { + var getBlock = function () { + return bind$2(rowsArr, function (r) { + return Warehouse.getAt(warehouse, r, col).filter(function (detail) { + return detail.column === col; + }).toArray(); + }); + }; + var isValid = function (detail) { + return detail.colspan === 1 && isValidCell(detail.element); + }; + var getFallback = function () { + return Warehouse.getAt(warehouse, 0, col); + }; + return decide(getBlock, isValid, getFallback); + }); + }; + var decide = function (getBlock, isValid, getFallback) { + var inBlock = getBlock(); + var validInBlock = find$1(inBlock, isValid); + var detailOption = validInBlock.orThunk(function () { + return Optional.from(inBlock[0]).orThunk(getFallback); + }); + return detailOption.map(function (detail) { + return detail.element; + }); + }; + var rows = function (warehouse) { + var grid = warehouse.grid; + var rowsArr = range$1(grid.rows, identity); + var cols = range$1(grid.columns, identity); + return map$1(rowsArr, function (row) { + var getBlock = function () { + return bind$2(cols, function (c) { + return Warehouse.getAt(warehouse, row, c).filter(function (detail) { + return detail.row === row; + }).fold(constant([]), function (detail) { + return [detail]; + }); + }); + }; + var isSingle = function (detail) { + return detail.rowspan === 1; + }; + var getFallback = function () { + return Warehouse.getAt(warehouse, row, 0); + }; + return decide(getBlock, isSingle, getFallback); + }); + }; + + var deduce = function (xs, index) { + if (index < 0 || index >= xs.length - 1) { + return Optional.none(); + } + var current = xs[index].fold(function () { + var rest = reverse(xs.slice(0, index)); + return findMap(rest, function (a, i) { + return a.map(function (aa) { + return { + value: aa, + delta: i + 1 + }; + }); + }); + }, function (c) { + return Optional.some({ + value: c, + delta: 0 + }); + }); + var next = xs[index + 1].fold(function () { + var rest = xs.slice(index + 1); + return findMap(rest, function (a, i) { + return a.map(function (aa) { + return { + value: aa, + delta: i + 1 + }; + }); + }); + }, function (n) { + return Optional.some({ + value: n, + delta: 1 + }); + }); + return current.bind(function (c) { + return next.map(function (n) { + var extras = n.delta + c.delta; + return Math.abs(n.value - c.value) / extras; + }); + }); + }; + + var onDirection = function (isLtr, isRtl) { + return function (element) { + return getDirection(element) === 'rtl' ? isRtl : isLtr; + }; + }; + var getDirection = function (element) { + return get$a(element, 'direction') === 'rtl' ? 'rtl' : 'ltr'; + }; + + var api = Dimension('height', function (element) { + var dom = element.dom; + return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight; + }); + var get$7 = function (element) { + return api.get(element); + }; + var getOuter$1 = function (element) { + return api.getOuter(element); + }; + var getRuntime = getHeight$1; + + var r = function (left, top) { + var translate = function (x, y) { + return r(left + x, top + y); + }; + return { + left: left, + top: top, + translate: translate + }; + }; + var SugarPosition = r; + + var boxPosition = function (dom) { + var box = dom.getBoundingClientRect(); + return SugarPosition(box.left, box.top); + }; + var firstDefinedOrZero = function (a, b) { + if (a !== undefined) { + return a; + } else { + return b !== undefined ? b : 0; + } + }; + var absolute = function (element) { + var doc = element.dom.ownerDocument; + var body = doc.body; + var win = doc.defaultView; + var html = doc.documentElement; + if (body === element.dom) { + return SugarPosition(body.offsetLeft, body.offsetTop); + } + var scrollTop = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop); + var scrollLeft = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft); + var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop); + var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft); + return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop); + }; + var viewport = function (element) { + var dom = element.dom; + var doc = dom.ownerDocument; + var body = doc.body; + if (body === dom) { + return SugarPosition(body.offsetLeft, body.offsetTop); + } + if (!inBody(element)) { + return SugarPosition(0, 0); + } + return boxPosition(dom); + }; + + var rowInfo = function (row, y) { + return { + row: row, + y: y + }; + }; + var colInfo = function (col, x) { + return { + col: col, + x: x + }; + }; + var rtlEdge = function (cell) { + var pos = absolute(cell); + return pos.left + getOuter$2(cell); + }; + var ltrEdge = function (cell) { + return absolute(cell).left; + }; + var getLeftEdge = function (index, cell) { + return colInfo(index, ltrEdge(cell)); + }; + var getRightEdge = function (index, cell) { + return colInfo(index, rtlEdge(cell)); + }; + var getTop$1 = function (cell) { + return absolute(cell).top; + }; + var getTopEdge = function (index, cell) { + return rowInfo(index, getTop$1(cell)); + }; + var getBottomEdge = function (index, cell) { + return rowInfo(index, getTop$1(cell) + getOuter$1(cell)); + }; + var findPositions = function (getInnerEdge, getOuterEdge, array) { + if (array.length === 0) { + return []; + } + var lines = map$1(array.slice(1), function (cellOption, index) { + return cellOption.map(function (cell) { + return getInnerEdge(index, cell); + }); + }); + var lastLine = array[array.length - 1].map(function (cell) { + return getOuterEdge(array.length - 1, cell); + }); + return lines.concat([lastLine]); + }; + var negate = function (step) { + return -step; + }; + var height = { + delta: identity, + positions: function (optElements) { + return findPositions(getTopEdge, getBottomEdge, optElements); + }, + edge: getTop$1 + }; + var ltr$1 = { + delta: identity, + edge: ltrEdge, + positions: function (optElements) { + return findPositions(getLeftEdge, getRightEdge, optElements); + } + }; + var rtl$1 = { + delta: negate, + edge: rtlEdge, + positions: function (optElements) { + return findPositions(getRightEdge, getLeftEdge, optElements); + } + }; + var detect$2 = onDirection(ltr$1, rtl$1); + var width = { + delta: function (amount, table) { + return detect$2(table).delta(amount, table); + }, + positions: function (cols, table) { + return detect$2(table).positions(cols, table); + }, + edge: function (cell) { + return detect$2(cell).edge(cell); + } + }; + + var units = { + unsupportedLength: [ + 'em', + 'ex', + 'cap', + 'ch', + 'ic', + 'rem', + 'lh', + 'rlh', + 'vw', + 'vh', + 'vi', + 'vb', + 'vmin', + 'vmax', + 'cm', + 'mm', + 'Q', + 'in', + 'pc', + 'pt', + 'px' + ], + fixed: [ + 'px', + 'pt' + ], + relative: ['%'], + empty: [''] + }; + var pattern = function () { + var decimalDigits = '[0-9]+'; + var signedInteger = '[+-]?' + decimalDigits; + var exponentPart = '[eE]' + signedInteger; + var dot = '\\.'; + var opt = function (input) { + return '(?:' + input + ')?'; + }; + var unsignedDecimalLiteral = [ + 'Infinity', + decimalDigits + dot + opt(decimalDigits) + opt(exponentPart), + dot + decimalDigits + opt(exponentPart), + decimalDigits + opt(exponentPart) + ].join('|'); + var float = '[+-]?(?:' + unsignedDecimalLiteral + ')'; + return new RegExp('^(' + float + ')(.*)$'); + }(); + var isUnit = function (unit, accepted) { + return exists(accepted, function (acc) { + return exists(units[acc], function (check) { + return unit === check; + }); + }); + }; + var parse = function (input, accepted) { + var match = Optional.from(pattern.exec(input)); + return match.bind(function (array) { + var value = Number(array[1]); + var unitRaw = array[2]; + if (isUnit(unitRaw, accepted)) { + return Optional.some({ + value: value, + unit: unitRaw + }); + } else { + return Optional.none(); + } + }); + }; + + var rPercentageBasedSizeRegex = /(\d+(\.\d+)?)%/; + var rPixelBasedSizeRegex = /(\d+(\.\d+)?)px|em/; + var isCol$2 = isTag('col'); + var getPercentSize = function (elm, outerGetter, innerGetter) { + var relativeParent = parentElement(elm).getOrThunk(function () { + return getBody$1(owner(elm)); + }); + return outerGetter(elm) / innerGetter(relativeParent) * 100; + }; + var setPixelWidth = function (cell, amount) { + set$1(cell, 'width', amount + 'px'); + }; + var setPercentageWidth = function (cell, amount) { + set$1(cell, 'width', amount + '%'); + }; + var setHeight = function (cell, amount) { + set$1(cell, 'height', amount + 'px'); + }; + var getHeightValue = function (cell) { + return getRuntime(cell) + 'px'; + }; + var convert = function (cell, number, getter, setter) { + var newSize = table(cell).map(function (table) { + var total = getter(table); + return Math.floor(number / 100 * total); + }).getOr(number); + setter(cell, newSize); + return newSize; + }; + var normalizePixelSize = function (value, cell, getter, setter) { + var number = parseFloat(value); + return endsWith(value, '%') && name(cell) !== 'table' ? convert(cell, number, getter, setter) : number; + }; + var getTotalHeight = function (cell) { + var value = getHeightValue(cell); + if (!value) { + return get$7(cell); + } + return normalizePixelSize(value, cell, get$7, setHeight); + }; + var get$6 = function (cell, type, f) { + var v = f(cell); + var span = getSpan(cell, type); + return v / span; + }; + var getRaw$1 = function (element, prop) { + return getRaw$2(element, prop).orThunk(function () { + return getOpt(element, prop).map(function (val) { + return val + 'px'; + }); + }); + }; + var getRawWidth$1 = function (element) { + return getRaw$1(element, 'width'); + }; + var getRawHeight = function (element) { + return getRaw$1(element, 'height'); + }; + var getPercentageWidth = function (cell) { + return getPercentSize(cell, get$8, getInner); + }; + var getPixelWidth$1 = function (cell) { + return isCol$2(cell) ? get$8(cell) : getRuntime$1(cell); + }; + var getHeight = function (cell) { + return get$6(cell, 'rowspan', getTotalHeight); + }; + var getGenericWidth = function (cell) { + var width = getRawWidth$1(cell); + return width.bind(function (w) { + return parse(w, [ + 'fixed', + 'relative', + 'empty' + ]); + }); + }; + var setGenericWidth = function (cell, amount, unit) { + set$1(cell, 'width', amount + unit); + }; + var getPixelTableWidth = function (table) { + return get$8(table) + 'px'; + }; + var getPercentTableWidth = function (table) { + return getPercentSize(table, get$8, getInner) + '%'; + }; + var isPercentSizing$1 = function (table) { + return getRawWidth$1(table).exists(function (size) { + return rPercentageBasedSizeRegex.test(size); + }); + }; + var isPixelSizing$1 = function (table) { + return getRawWidth$1(table).exists(function (size) { + return rPixelBasedSizeRegex.test(size); + }); + }; + var isNoneSizing$1 = function (table) { + return getRawWidth$1(table).isNone(); + }; + var percentageBasedSizeRegex = constant(rPercentageBasedSizeRegex); + + var isCol$1 = isTag('col'); + var getRawW = function (cell) { + return getRawWidth$1(cell).getOrThunk(function () { + return getPixelWidth$1(cell) + 'px'; + }); + }; + var getRawH = function (cell) { + return getRawHeight(cell).getOrThunk(function () { + return getHeight(cell) + 'px'; + }); + }; + var justCols = function (warehouse) { + return map$1(Warehouse.justColumns(warehouse), function (column) { + return Optional.from(column.element); + }); + }; + var isValidColumn = function (cell) { + var browser = detect$3().browser; + var supportsColWidths = browser.isChrome() || browser.isFirefox(); + return isCol$1(cell) ? supportsColWidths : true; + }; + var getDimension = function (cellOpt, index, backups, filter, getter, fallback) { + return cellOpt.filter(filter).fold(function () { + return fallback(deduce(backups, index)); + }, function (cell) { + return getter(cell); + }); + }; + var getWidthFrom = function (warehouse, table, getWidth, fallback) { + var columnCells = columns(warehouse); + var columns$1 = Warehouse.hasColumns(warehouse) ? justCols(warehouse) : columnCells; + var backups = [Optional.some(width.edge(table))].concat(map$1(width.positions(columnCells, table), function (pos) { + return pos.map(function (p) { + return p.x; + }); + })); + var colFilter = not(hasColspan); + return map$1(columns$1, function (cellOption, c) { + return getDimension(cellOption, c, backups, colFilter, function (column) { + if (isValidColumn(column)) { + return getWidth(column); + } else { + var cell = bindFrom(columnCells[c], identity); + return getDimension(cell, c, backups, colFilter, function (cell) { + return fallback(Optional.some(get$8(cell))); + }, fallback); + } + }, fallback); + }); + }; + var getDeduced = function (deduced) { + return deduced.map(function (d) { + return d + 'px'; + }).getOr(''); + }; + var getRawWidths = function (warehouse, table) { + return getWidthFrom(warehouse, table, getRawW, getDeduced); + }; + var getPercentageWidths = function (warehouse, table, tableSize) { + return getWidthFrom(warehouse, table, getPercentageWidth, function (deduced) { + return deduced.fold(function () { + return tableSize.minCellWidth(); + }, function (cellWidth) { + return cellWidth / tableSize.pixelWidth() * 100; + }); + }); + }; + var getPixelWidths = function (warehouse, table, tableSize) { + return getWidthFrom(warehouse, table, getPixelWidth$1, function (deduced) { + return deduced.getOrThunk(tableSize.minCellWidth); + }); + }; + var getHeightFrom = function (warehouse, table, direction, getHeight, fallback) { + var rows$1 = rows(warehouse); + var backups = [Optional.some(direction.edge(table))].concat(map$1(direction.positions(rows$1, table), function (pos) { + return pos.map(function (p) { + return p.y; + }); + })); + return map$1(rows$1, function (cellOption, c) { + return getDimension(cellOption, c, backups, not(hasRowspan), getHeight, fallback); + }); + }; + var getPixelHeights = function (warehouse, table, direction) { + return getHeightFrom(warehouse, table, direction, getHeight, function (deduced) { + return deduced.getOrThunk(minHeight); + }); + }; + var getRawHeights = function (warehouse, table, direction) { + return getHeightFrom(warehouse, table, direction, getRawH, getDeduced); + }; + + var widthLookup = function (table, getter) { + return function () { + if (inBody(table)) { + return getter(table); + } else { + return parseFloat(getRaw$2(table, 'width').getOr('0')); + } + }; + }; + var noneSize = function (table) { + var getWidth = widthLookup(table, get$8); + var zero = constant(0); + var getWidths = function (warehouse, tableSize) { + return getPixelWidths(warehouse, table, tableSize); + }; + return { + width: getWidth, + pixelWidth: getWidth, + getWidths: getWidths, + getCellDelta: zero, + singleColumnWidth: constant([0]), + minCellWidth: zero, + setElementWidth: noop, + adjustTableWidth: noop, + isRelative: true, + label: 'none' + }; + }; + var percentageSize = function (table) { + var getFloatWidth = widthLookup(table, function (elem) { + return parseFloat(getPercentTableWidth(elem)); + }); + var getWidth = widthLookup(table, get$8); + var getCellDelta = function (delta) { + return delta / getWidth() * 100; + }; + var singleColumnWidth = function (w, _delta) { + return [100 - w]; + }; + var minCellWidth = function () { + return minWidth() / getWidth() * 100; + }; + var adjustTableWidth = function (delta) { + var currentWidth = getFloatWidth(); + var change = delta / 100 * currentWidth; + var newWidth = currentWidth + change; + setPercentageWidth(table, newWidth); + }; + var getWidths = function (warehouse, tableSize) { + return getPercentageWidths(warehouse, table, tableSize); + }; + return { + width: getFloatWidth, + pixelWidth: getWidth, + getWidths: getWidths, + getCellDelta: getCellDelta, + singleColumnWidth: singleColumnWidth, + minCellWidth: minCellWidth, + setElementWidth: setPercentageWidth, + adjustTableWidth: adjustTableWidth, + isRelative: true, + label: 'percent' + }; + }; + var pixelSize = function (table) { + var getWidth = widthLookup(table, get$8); + var getCellDelta = identity; + var singleColumnWidth = function (w, delta) { + var newNext = Math.max(minWidth(), w + delta); + return [newNext - w]; + }; + var adjustTableWidth = function (delta) { + var newWidth = getWidth() + delta; + setPixelWidth(table, newWidth); + }; + var getWidths = function (warehouse, tableSize) { + return getPixelWidths(warehouse, table, tableSize); + }; + return { + width: getWidth, + pixelWidth: getWidth, + getWidths: getWidths, + getCellDelta: getCellDelta, + singleColumnWidth: singleColumnWidth, + minCellWidth: minWidth, + setElementWidth: setPixelWidth, + adjustTableWidth: adjustTableWidth, + isRelative: false, + label: 'pixel' + }; + }; + var chooseSize = function (element, width) { + var percentMatch = percentageBasedSizeRegex().exec(width); + if (percentMatch !== null) { + return percentageSize(element); + } else { + return pixelSize(element); + } + }; + var getTableSize = function (table) { + var width = getRawWidth$1(table); + return width.fold(function () { + return noneSize(table); + }, function (w) { + return chooseSize(table, w); + }); + }; + var TableSize = { + getTableSize: getTableSize, + pixelSize: pixelSize, + percentageSize: percentageSize, + noneSize: noneSize + }; + + var statsStruct = function (minRow, minCol, maxRow, maxCol, allCells, selectedCells) { + return { + minRow: minRow, + minCol: minCol, + maxRow: maxRow, + maxCol: maxCol, + allCells: allCells, + selectedCells: selectedCells + }; + }; + var findSelectedStats = function (house, isSelected) { + var totalColumns = house.grid.columns; + var totalRows = house.grid.rows; + var minRow = totalRows; + var minCol = totalColumns; + var maxRow = 0; + var maxCol = 0; + var allCells = []; + var selectedCells = []; + each$1(house.access, function (detail) { + allCells.push(detail); + if (isSelected(detail)) { + selectedCells.push(detail); + var startRow = detail.row; + var endRow = startRow + detail.rowspan - 1; + var startCol = detail.column; + var endCol = startCol + detail.colspan - 1; + if (startRow < minRow) { + minRow = startRow; + } else if (endRow > maxRow) { + maxRow = endRow; + } + if (startCol < minCol) { + minCol = startCol; + } else if (endCol > maxCol) { + maxCol = endCol; + } + } + }); + return statsStruct(minRow, minCol, maxRow, maxCol, allCells, selectedCells); + }; + var makeCell = function (list, seenSelected, rowIndex) { + var row = list[rowIndex].element; + var td = SugarElement.fromTag('td'); + append$1(td, SugarElement.fromTag('br')); + var f = seenSelected ? append$1 : prepend; + f(row, td); + }; + var fillInGaps = function (list, house, stats, isSelected) { + var totalColumns = house.grid.columns; + var totalRows = house.grid.rows; + for (var i = 0; i < totalRows; i++) { + var seenSelected = false; + for (var j = 0; j < totalColumns; j++) { + if (!(i < stats.minRow || i > stats.maxRow || j < stats.minCol || j > stats.maxCol)) { + var needCell = Warehouse.getAt(house, i, j).filter(isSelected).isNone(); + if (needCell) { + makeCell(list, seenSelected, i); + } else { + seenSelected = true; + } + } + } + } + }; + var clean = function (replica, stats, house, widthDelta) { + each$1(house.columns, function (col) { + if (col.column < stats.minCol || col.column > stats.maxCol) { + remove$5(col.element); + } + }); + var emptyRows = filter$2(firstLayer(replica, 'tr'), function (row) { + return row.dom.childElementCount === 0; + }); + each$2(emptyRows, remove$5); + if (stats.minCol === stats.maxCol || stats.minRow === stats.maxRow) { + each$2(firstLayer(replica, 'th,td'), function (cell) { + remove$7(cell, 'rowspan'); + remove$7(cell, 'colspan'); + }); + } + remove$7(replica, LOCKED_COL_ATTR); + remove$7(replica, 'data-snooker-col-series'); + var tableSize = TableSize.getTableSize(replica); + tableSize.adjustTableWidth(widthDelta); + }; + var getTableWidthDelta = function (table, warehouse, tableSize, stats) { + if (stats.minCol === 0 && warehouse.grid.columns === stats.maxCol + 1) { + return 0; + } + var colWidths = getPixelWidths(warehouse, table, tableSize); + var allColsWidth = foldl(colWidths, function (acc, width) { + return acc + width; + }, 0); + var selectedColsWidth = foldl(colWidths.slice(stats.minCol, stats.maxCol + 1), function (acc, width) { + return acc + width; + }, 0); + var newWidth = selectedColsWidth / allColsWidth * tableSize.pixelWidth(); + var delta = newWidth - tableSize.pixelWidth(); + return tableSize.getCellDelta(delta); + }; + var extract$1 = function (table, selectedSelector) { + var isSelected = function (detail) { + return is$2(detail.element, selectedSelector); + }; + var replica = deep(table); + var list = fromTable$1(replica); + var tableSize = TableSize.getTableSize(table); + var replicaHouse = Warehouse.generate(list); + var replicaStats = findSelectedStats(replicaHouse, isSelected); + var selector = 'th:not(' + selectedSelector + ')' + ',td:not(' + selectedSelector + ')'; + var unselectedCells = filterFirstLayer(replica, 'th,td', function (cell) { + return is$2(cell, selector); + }); + each$2(unselectedCells, remove$5); + fillInGaps(list, replicaHouse, replicaStats, isSelected); + var house = Warehouse.fromTable(table); + var widthDelta = getTableWidthDelta(table, house, tableSize, replicaStats); + clean(replica, replicaStats, replicaHouse, widthDelta); + return replica; + }; + + var nbsp = '\xA0'; + + var getEnd = function (element) { + return name(element) === 'img' ? 1 : getOption(element).fold(function () { + return children$3(element).length; + }, function (v) { + return v.length; + }); + }; + var isTextNodeWithCursorPosition = function (el) { + return getOption(el).filter(function (text) { + return text.trim().length !== 0 || text.indexOf(nbsp) > -1; + }).isSome(); + }; + var elementsWithCursorPosition = [ + 'img', + 'br' + ]; + var isCursorPosition = function (elem) { + var hasCursorPosition = isTextNodeWithCursorPosition(elem); + return hasCursorPosition || contains$2(elementsWithCursorPosition, name(elem)); + }; + + var first = function (element) { + return descendant$1(element, isCursorPosition); + }; + var last$1 = function (element) { + return descendantRtl(element, isCursorPosition); + }; + var descendantRtl = function (scope, predicate) { + var descend = function (element) { + var children = children$3(element); + for (var i = children.length - 1; i >= 0; i--) { + var child = children[i]; + if (predicate(child)) { + return Optional.some(child); + } + var res = descend(child); + if (res.isSome()) { + return res; + } + } + return Optional.none(); + }; + return descend(scope); + }; + + var transferableAttributes = { + scope: [ + 'row', + 'col' + ] + }; + var createCell = function (doc) { + return function () { + var td = SugarElement.fromTag('td', doc.dom); + append$1(td, SugarElement.fromTag('br', doc.dom)); + return td; + }; + }; + var createCol = function (doc) { + return function () { + return SugarElement.fromTag('col', doc.dom); + }; + }; + var createColgroup = function (doc) { + return function () { + return SugarElement.fromTag('colgroup', doc.dom); + }; + }; + var createRow$1 = function (doc) { + return function () { + return SugarElement.fromTag('tr', doc.dom); + }; + }; + var replace$1 = function (cell, tag, attrs) { + var replica = copy$1(cell, tag); + each$1(attrs, function (v, k) { + if (v === null) { + remove$7(replica, k); + } else { + set$2(replica, k, v); + } + }); + return replica; + }; + var pasteReplace = function (cell) { + return cell; + }; + var cloneFormats = function (oldCell, newCell, formats) { + var first$1 = first(oldCell); + return first$1.map(function (firstText) { + var formatSelector = formats.join(','); + var parents = ancestors$3(firstText, formatSelector, function (element) { + return eq$1(element, oldCell); + }); + return foldr(parents, function (last, parent) { + var clonedFormat = shallow(parent); + remove$7(clonedFormat, 'contenteditable'); + append$1(last, clonedFormat); + return clonedFormat; + }, newCell); + }).getOr(newCell); + }; + var cloneAppropriateAttributes = function (original, clone) { + each$1(transferableAttributes, function (validAttributes, attributeName) { + return getOpt(original, attributeName).filter(function (attribute) { + return contains$2(validAttributes, attribute); + }).each(function (attribute) { + return set$2(clone, attributeName, attribute); + }); + }); + }; + var cellOperations = function (mutate, doc, formatsToClone) { + var cloneCss = function (prev, clone) { + copy$2(prev.element, clone); + remove$6(clone, 'height'); + if (prev.colspan !== 1) { + remove$6(clone, 'width'); + } + }; + var newCell = function (prev) { + var td = SugarElement.fromTag(name(prev.element), doc.dom); + var formats = formatsToClone.getOr([ + 'strong', + 'em', + 'b', + 'i', + 'span', + 'font', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'p', + 'div' + ]); + var lastNode = formats.length > 0 ? cloneFormats(prev.element, td, formats) : td; + append$1(lastNode, SugarElement.fromTag('br')); + cloneCss(prev, td); + cloneAppropriateAttributes(prev.element, td); + mutate(prev.element, td); + return td; + }; + var newCol = function (prev) { + var col = SugarElement.fromTag(name(prev.element), doc.dom); + cloneCss(prev, col); + mutate(prev.element, col); + return col; + }; + return { + col: newCol, + colgroup: createColgroup(doc), + row: createRow$1(doc), + cell: newCell, + replace: replace$1, + colGap: createCol(doc), + gap: createCell(doc) + }; + }; + var paste$1 = function (doc) { + return { + col: createCol(doc), + colgroup: createColgroup(doc), + row: createRow$1(doc), + cell: createCell(doc), + replace: pasteReplace, + colGap: createCol(doc), + gap: createCell(doc) + }; + }; + + var fromHtml = function (html, scope) { + var doc = scope || document; + var div = doc.createElement('div'); + div.innerHTML = html; + return children$3(SugarElement.fromDom(div)); + }; + var fromDom = function (nodes) { + return map$1(nodes, SugarElement.fromDom); + }; + + var getNodeName = function (elm) { + return elm.nodeName.toLowerCase(); + }; + var getBody = function (editor) { + return SugarElement.fromDom(editor.getBody()); + }; + var getPixelWidth = function (elm) { + return elm.getBoundingClientRect().width; + }; + var getPixelHeight = function (elm) { + return elm.getBoundingClientRect().height; + }; + var getIsRoot = function (editor) { + return function (element) { + return eq$1(element, getBody(editor)); + }; + }; + var removePxSuffix = function (size) { + return size ? size.replace(/px$/, '') : ''; + }; + var addPxSuffix = function (size) { + return /^\d+(\.\d+)?$/.test(size) ? size + 'px' : size; + }; + var removeDataStyle = function (table) { + remove$7(table, 'data-mce-style'); + var removeStyleAttribute = function (element) { + return remove$7(element, 'data-mce-style'); + }; + each$2(cells$1(table), removeStyleAttribute); + each$2(columns$1(table), removeStyleAttribute); + each$2(rows$1(table), removeStyleAttribute); + }; + var getRawWidth = function (editor, elm) { + var raw = editor.dom.getStyle(elm, 'width') || editor.dom.getAttrib(elm, 'width'); + return Optional.from(raw).filter(isNotEmpty); + }; + var isPercentage$1 = function (value) { + return /^(\d+(\.\d+)?)%$/.test(value); + }; + var isPixel = function (value) { + return /^(\d+(\.\d+)?)px$/.test(value); + }; + var getSelectionStart = function (editor) { + return SugarElement.fromDom(editor.selection.getStart()); + }; + var getSelectionEnd = function (editor) { + return SugarElement.fromDom(editor.selection.getEnd()); + }; + + var selection = function (selections) { + return cata$2(selections.get(), constant([]), identity, pure); + }; + var unmergable = function (selections) { + var hasSpan = function (elem, type) { + return getOpt(elem, type).exists(function (span) { + return parseInt(span, 10) > 1; + }); + }; + var hasRowOrColSpan = function (elem) { + return hasSpan(elem, 'rowspan') || hasSpan(elem, 'colspan'); + }; + var candidates = selection(selections); + return candidates.length > 0 && forall(candidates, hasRowOrColSpan) ? Optional.some(candidates) : Optional.none(); + }; + var mergable = function (table, selections, ephemera) { + return cata$2(selections.get(), Optional.none, function (cells) { + if (cells.length <= 1) { + return Optional.none(); + } else { + return retrieveBox(table, ephemera.firstSelectedSelector, ephemera.lastSelectedSelector).map(function (bounds) { + return { + bounds: bounds, + cells: cells + }; + }); + } + }, Optional.none); + }; + + var strSelected = 'data-mce-selected'; + var strSelectedSelector = 'td[' + strSelected + '],th[' + strSelected + ']'; + var strAttributeSelector = '[' + strSelected + ']'; + var strFirstSelected = 'data-mce-first-selected'; + var strFirstSelectedSelector = 'td[' + strFirstSelected + '],th[' + strFirstSelected + ']'; + var strLastSelected = 'data-mce-last-selected'; + var strLastSelectedSelector = 'td[' + strLastSelected + '],th[' + strLastSelected + ']'; + var attributeSelector = strAttributeSelector; + var ephemera = { + selected: strSelected, + selectedSelector: strSelectedSelector, + firstSelected: strFirstSelected, + firstSelectedSelector: strFirstSelectedSelector, + lastSelected: strLastSelected, + lastSelectedSelector: strLastSelectedSelector + }; + + var noMenu = function (cell) { + return { + element: cell, + mergable: Optional.none(), + unmergable: Optional.none(), + selection: [cell] + }; + }; + var forMenu = function (selections, table, cell) { + return { + element: cell, + mergable: mergable(table, selections, ephemera), + unmergable: unmergable(selections), + selection: selection(selections) + }; + }; + var paste = function (element, clipboard, generators) { + return { + element: element, + clipboard: clipboard, + generators: generators + }; + }; + var pasteRows = function (selections, cell, clipboard, generators) { + return { + selection: selection(selections), + clipboard: clipboard, + generators: generators + }; + }; + + var getSelectionCellFallback = function (element) { + return table(element).bind(function (table) { + return retrieve(table, ephemera.firstSelectedSelector); + }).fold(constant(element), function (cells) { + return cells[0]; + }); + }; + var getSelectionFromSelector = function (selector) { + return function (initCell, isRoot) { + var cellName = name(initCell); + var cell = cellName === 'col' || cellName === 'colgroup' ? getSelectionCellFallback(initCell) : initCell; + return closest$1(cell, selector, isRoot); + }; + }; + var getSelectionCellOrCaption = getSelectionFromSelector('th,td,caption'); + var getSelectionCell = getSelectionFromSelector('th,td'); + var getCellsFromSelection = function (selections) { + return selection(selections); + }; + var getRowsFromSelection = function (selected, selector) { + var cellOpt = getSelectionCell(selected); + var rowsOpt = cellOpt.bind(function (cell) { + return table(cell); + }).map(function (table) { + return rows$1(table); + }); + return lift2(cellOpt, rowsOpt, function (cell, rows) { + return filter$2(rows, function (row) { + return exists(fromDom(row.dom.cells), function (rowCell) { + return get$b(rowCell, selector) === '1' || eq$1(rowCell, cell); + }); + }); + }).getOr([]); + }; + + var extractSelected = function (cells) { + return table(cells[0]).map(function (table) { + var replica = extract$1(table, attributeSelector); + removeDataStyle(replica); + return [replica]; + }); + }; + var serializeElements = function (editor, elements) { + return map$1(elements, function (elm) { + return editor.selection.serializer.serialize(elm.dom, {}); + }).join(''); + }; + var getTextContent = function (elements) { + return map$1(elements, function (element) { + return element.dom.innerText; + }).join(''); + }; + var registerEvents = function (editor, selections, actions) { + editor.on('BeforeGetContent', function (e) { + var multiCellContext = function (cells) { + e.preventDefault(); + extractSelected(cells).each(function (elements) { + e.content = e.format === 'text' ? getTextContent(elements) : serializeElements(editor, elements); + }); + }; + if (e.selection === true) { + cata$2(selections.get(), noop, multiCellContext, noop); + } + }); + editor.on('BeforeSetContent', function (e) { + if (e.selection === true && e.paste === true) { + var selectedCells = getCellsFromSelection(selections); + head(selectedCells).each(function (cell) { + table(cell).each(function (table) { + var elements = filter$2(fromHtml(e.content), function (content) { + return name(content) !== 'meta'; + }); + var isTable = isTag('table'); + if (elements.length === 1 && isTable(elements[0])) { + e.preventDefault(); + var doc = SugarElement.fromDom(editor.getDoc()); + var generators = paste$1(doc); + var targets = paste(cell, elements[0], generators); + actions.pasteCells(table, targets).each(function () { + editor.focus(); + }); + } + }); + }); + } + }); + }; + + var adt$7 = Adt.generate([ + { none: [] }, + { only: ['index'] }, + { + left: [ + 'index', + 'next' + ] + }, + { + middle: [ + 'prev', + 'index', + 'next' + ] + }, + { + right: [ + 'prev', + 'index' + ] + } + ]); + var ColumnContext = __assign({}, adt$7); + + var neighbours = function (input, index) { + if (input.length === 0) { + return ColumnContext.none(); + } + if (input.length === 1) { + return ColumnContext.only(0); + } + if (index === 0) { + return ColumnContext.left(0, 1); + } + if (index === input.length - 1) { + return ColumnContext.right(index - 1, index); + } + if (index > 0 && index < input.length - 1) { + return ColumnContext.middle(index - 1, index, index + 1); + } + return ColumnContext.none(); + }; + var determine = function (input, column, step, tableSize, resize) { + var result = input.slice(0); + var context = neighbours(input, column); + var onNone = constant(map$1(result, constant(0))); + var onOnly = function (index) { + return tableSize.singleColumnWidth(result[index], step); + }; + var onLeft = function (index, next) { + return resize.calcLeftEdgeDeltas(result, index, next, step, tableSize.minCellWidth(), tableSize.isRelative); + }; + var onMiddle = function (prev, index, next) { + return resize.calcMiddleDeltas(result, prev, index, next, step, tableSize.minCellWidth(), tableSize.isRelative); + }; + var onRight = function (prev, index) { + return resize.calcRightEdgeDeltas(result, prev, index, step, tableSize.minCellWidth(), tableSize.isRelative); + }; + return context.fold(onNone, onOnly, onLeft, onMiddle, onRight); + }; + + var total = function (start, end, measures) { + var r = 0; + for (var i = start; i < end; i++) { + r += measures[i] !== undefined ? measures[i] : 0; + } + return r; + }; + var recalculateWidthForCells = function (warehouse, widths) { + var all = Warehouse.justCells(warehouse); + return map$1(all, function (cell) { + var width = total(cell.column, cell.column + cell.colspan, widths); + return { + element: cell.element, + width: width, + colspan: cell.colspan + }; + }); + }; + var recalculateWidthForColumns = function (warehouse, widths) { + var groups = Warehouse.justColumns(warehouse); + return map$1(groups, function (column, index) { + return { + element: column.element, + width: widths[index], + colspan: column.colspan + }; + }); + }; + var recalculateHeightForCells = function (warehouse, heights) { + var all = Warehouse.justCells(warehouse); + return map$1(all, function (cell) { + var height = total(cell.row, cell.row + cell.rowspan, heights); + return { + element: cell.element, + height: height, + rowspan: cell.rowspan + }; + }); + }; + var matchRowHeight = function (warehouse, heights) { + return map$1(warehouse.all, function (row, i) { + return { + element: row.element, + height: heights[i] + }; + }); + }; + + var sumUp = function (newSize) { + return foldr(newSize, function (b, a) { + return b + a; + }, 0); + }; + var recalculate = function (warehouse, widths) { + if (Warehouse.hasColumns(warehouse)) { + return recalculateWidthForColumns(warehouse, widths); + } else { + return recalculateWidthForCells(warehouse, widths); + } + }; + var recalculateAndApply = function (warehouse, widths, tableSize) { + var newSizes = recalculate(warehouse, widths); + each$2(newSizes, function (cell) { + tableSize.setElementWidth(cell.element, cell.width); + }); + }; + var adjustWidth = function (table, delta, index, resizing, tableSize) { + var warehouse = Warehouse.fromTable(table); + var step = tableSize.getCellDelta(delta); + var widths = tableSize.getWidths(warehouse, tableSize); + var isLastColumn = index === warehouse.grid.columns - 1; + var clampedStep = resizing.clampTableDelta(widths, index, step, tableSize.minCellWidth(), isLastColumn); + var deltas = determine(widths, index, clampedStep, tableSize, resizing); + var newWidths = map$1(deltas, function (dx, i) { + return dx + widths[i]; + }); + recalculateAndApply(warehouse, newWidths, tableSize); + resizing.resizeTable(tableSize.adjustTableWidth, clampedStep, isLastColumn); + }; + var adjustHeight = function (table, delta, index, direction) { + var warehouse = Warehouse.fromTable(table); + var heights = getPixelHeights(warehouse, table, direction); + var newHeights = map$1(heights, function (dy, i) { + return index === i ? Math.max(delta + dy, minHeight()) : dy; + }); + var newCellSizes = recalculateHeightForCells(warehouse, newHeights); + var newRowSizes = matchRowHeight(warehouse, newHeights); + each$2(newRowSizes, function (row) { + setHeight(row.element, row.height); + }); + each$2(newCellSizes, function (cell) { + setHeight(cell.element, cell.height); + }); + var total = sumUp(newHeights); + setHeight(table, total); + }; + var adjustAndRedistributeWidths$1 = function (_table, list, details, tableSize, resizeBehaviour) { + var warehouse = Warehouse.generate(list); + var sizes = tableSize.getWidths(warehouse, tableSize); + var tablePixelWidth = tableSize.pixelWidth(); + var _a = resizeBehaviour.calcRedestributedWidths(sizes, tablePixelWidth, details.pixelDelta, tableSize.isRelative), newSizes = _a.newSizes, delta = _a.delta; + recalculateAndApply(warehouse, newSizes, tableSize); + tableSize.adjustTableWidth(delta); + }; + var adjustWidthTo = function (_table, list, _info, tableSize) { + var warehouse = Warehouse.generate(list); + var widths = tableSize.getWidths(warehouse, tableSize); + recalculateAndApply(warehouse, widths, tableSize); + }; + + var zero = function (array) { + return map$1(array, constant(0)); + }; + var surround = function (sizes, startIndex, endIndex, results, f) { + return f(sizes.slice(0, startIndex)).concat(results).concat(f(sizes.slice(endIndex))); + }; + var clampDeltaHelper = function (predicate) { + return function (sizes, index, delta, minCellSize) { + if (!predicate(delta)) { + return delta; + } else { + var newSize = Math.max(minCellSize, sizes[index] - Math.abs(delta)); + var diff = Math.abs(newSize - sizes[index]); + return delta >= 0 ? diff : -diff; + } + }; + }; + var clampNegativeDelta = clampDeltaHelper(function (delta) { + return delta < 0; + }); + var clampDelta = clampDeltaHelper(always); + var resizeTable = function () { + var calcFixedDeltas = function (sizes, index, next, delta, minCellSize) { + var clampedDelta = clampNegativeDelta(sizes, index, delta, minCellSize); + return surround(sizes, index, next + 1, [ + clampedDelta, + 0 + ], zero); + }; + var calcRelativeDeltas = function (sizes, index, delta, minCellSize) { + var ratio = (100 + delta) / 100; + var newThis = Math.max(minCellSize, (sizes[index] + delta) / ratio); + return map$1(sizes, function (size, idx) { + var newSize = idx === index ? newThis : size / ratio; + return newSize - size; + }); + }; + var calcLeftEdgeDeltas = function (sizes, index, next, delta, minCellSize, isRelative) { + if (isRelative) { + return calcRelativeDeltas(sizes, index, delta, minCellSize); + } else { + return calcFixedDeltas(sizes, index, next, delta, minCellSize); + } + }; + var calcMiddleDeltas = function (sizes, _prev, index, next, delta, minCellSize, isRelative) { + return calcLeftEdgeDeltas(sizes, index, next, delta, minCellSize, isRelative); + }; + var resizeTable = function (resizer, delta) { + return resizer(delta); + }; + var calcRightEdgeDeltas = function (sizes, _prev, index, delta, minCellSize, isRelative) { + if (isRelative) { + return calcRelativeDeltas(sizes, index, delta, minCellSize); + } else { + var clampedDelta = clampNegativeDelta(sizes, index, delta, minCellSize); + return zero(sizes.slice(0, index)).concat([clampedDelta]); + } + }; + var calcRedestributedWidths = function (sizes, totalWidth, pixelDelta, isRelative) { + if (isRelative) { + var tableWidth = totalWidth + pixelDelta; + var ratio_1 = tableWidth / totalWidth; + var newSizes = map$1(sizes, function (size) { + return size / ratio_1; + }); + return { + delta: ratio_1 * 100 - 100, + newSizes: newSizes + }; + } else { + return { + delta: pixelDelta, + newSizes: sizes + }; + } + }; + return { + resizeTable: resizeTable, + clampTableDelta: clampNegativeDelta, + calcLeftEdgeDeltas: calcLeftEdgeDeltas, + calcMiddleDeltas: calcMiddleDeltas, + calcRightEdgeDeltas: calcRightEdgeDeltas, + calcRedestributedWidths: calcRedestributedWidths + }; + }; + var preserveTable = function () { + var calcLeftEdgeDeltas = function (sizes, index, next, delta, minCellSize) { + var idx = delta >= 0 ? next : index; + var clampedDelta = clampDelta(sizes, idx, delta, minCellSize); + return surround(sizes, index, next + 1, [ + clampedDelta, + -clampedDelta + ], zero); + }; + var calcMiddleDeltas = function (sizes, _prev, index, next, delta, minCellSize) { + return calcLeftEdgeDeltas(sizes, index, next, delta, minCellSize); + }; + var resizeTable = function (resizer, delta, isLastColumn) { + if (isLastColumn) { + resizer(delta); + } + }; + var calcRightEdgeDeltas = function (sizes, _prev, _index, delta, _minCellSize, isRelative) { + if (isRelative) { + return zero(sizes); + } else { + var diff = delta / sizes.length; + return map$1(sizes, constant(diff)); + } + }; + var clampTableDelta = function (sizes, index, delta, minCellSize, isLastColumn) { + if (isLastColumn) { + if (delta >= 0) { + return delta; + } else { + var maxDelta = foldl(sizes, function (a, b) { + return a + b - minCellSize; + }, 0); + return Math.max(-maxDelta, delta); + } + } else { + return clampNegativeDelta(sizes, index, delta, minCellSize); + } + }; + var calcRedestributedWidths = function (sizes, _totalWidth, _pixelDelta, _isRelative) { + return { + delta: 0, + newSizes: sizes + }; + }; + return { + resizeTable: resizeTable, + clampTableDelta: clampTableDelta, + calcLeftEdgeDeltas: calcLeftEdgeDeltas, + calcMiddleDeltas: calcMiddleDeltas, + calcRightEdgeDeltas: calcRightEdgeDeltas, + calcRedestributedWidths: calcRedestributedWidths + }; + }; + + var only = function (element, isResizable) { + var parent = Optional.from(element.dom.documentElement).map(SugarElement.fromDom).getOr(element); + return { + parent: constant(parent), + view: constant(element), + origin: constant(SugarPosition(0, 0)), + isResizable: isResizable + }; + }; + var detached = function (editable, chrome, isResizable) { + var origin = function () { + return absolute(chrome); + }; + return { + parent: constant(chrome), + view: constant(editable), + origin: origin, + isResizable: isResizable + }; + }; + var body = function (editable, chrome, isResizable) { + return { + parent: constant(chrome), + view: constant(editable), + origin: constant(SugarPosition(0, 0)), + isResizable: isResizable + }; + }; + var ResizeWire = { + only: only, + detached: detached, + body: body + }; + + var adt$6 = Adt.generate([ + { invalid: ['raw'] }, + { pixels: ['value'] }, + { percent: ['value'] } + ]); + var validateFor = function (suffix, type, value) { + var rawAmount = value.substring(0, value.length - suffix.length); + var amount = parseFloat(rawAmount); + return rawAmount === amount.toString() ? type(amount) : adt$6.invalid(value); + }; + var from = function (value) { + if (endsWith(value, '%')) { + return validateFor('%', adt$6.percent, value); + } + if (endsWith(value, 'px')) { + return validateFor('px', adt$6.pixels, value); + } + return adt$6.invalid(value); + }; + var Size = __assign(__assign({}, adt$6), { from: from }); + + var redistributeToPercent = function (widths, totalWidth) { + return map$1(widths, function (w) { + var colType = Size.from(w); + return colType.fold(function () { + return w; + }, function (px) { + var ratio = px / totalWidth * 100; + return ratio + '%'; + }, function (pc) { + return pc + '%'; + }); + }); + }; + var redistributeToPx = function (widths, totalWidth, newTotalWidth) { + var scale = newTotalWidth / totalWidth; + return map$1(widths, function (w) { + var colType = Size.from(w); + return colType.fold(function () { + return w; + }, function (px) { + return px * scale + 'px'; + }, function (pc) { + return pc / 100 * newTotalWidth + 'px'; + }); + }); + }; + var redistributeEmpty = function (newWidthType, columns) { + var f = newWidthType.fold(function () { + return constant(''); + }, function (pixels) { + var num = pixels / columns; + return constant(num + 'px'); + }, function () { + var num = 100 / columns; + return constant(num + '%'); + }); + return range$1(columns, f); + }; + var redistributeValues = function (newWidthType, widths, totalWidth) { + return newWidthType.fold(function () { + return widths; + }, function (px) { + return redistributeToPx(widths, totalWidth, px); + }, function (_pc) { + return redistributeToPercent(widths, totalWidth); + }); + }; + var redistribute$1 = function (widths, totalWidth, newWidth) { + var newType = Size.from(newWidth); + var floats = forall(widths, function (s) { + return s === '0px'; + }) ? redistributeEmpty(newType, widths.length) : redistributeValues(newType, widths, totalWidth); + return normalize(floats); + }; + var sum = function (values, fallback) { + if (values.length === 0) { + return fallback; + } + return foldr(values, function (rest, v) { + return Size.from(v).fold(constant(0), identity, identity) + rest; + }, 0); + }; + var roundDown = function (num, unit) { + var floored = Math.floor(num); + return { + value: floored + unit, + remainder: num - floored + }; + }; + var add$3 = function (value, amount) { + return Size.from(value).fold(constant(value), function (px) { + return px + amount + 'px'; + }, function (pc) { + return pc + amount + '%'; + }); + }; + var normalize = function (values) { + if (values.length === 0) { + return values; + } + var scan = foldr(values, function (rest, value) { + var info = Size.from(value).fold(function () { + return { + value: value, + remainder: 0 + }; + }, function (num) { + return roundDown(num, 'px'); + }, function (num) { + return { + value: num + '%', + remainder: 0 + }; + }); + return { + output: [info.value].concat(rest.output), + remainder: rest.remainder + info.remainder + }; + }, { + output: [], + remainder: 0 + }); + var r = scan.output; + return r.slice(0, r.length - 1).concat([add$3(r[r.length - 1], Math.round(scan.remainder))]); + }; + var validate = Size.from; + + var redistributeToW = function (newWidths, cells, unit) { + each$2(cells, function (cell) { + var widths = newWidths.slice(cell.column, cell.colspan + cell.column); + var w = sum(widths, minWidth()); + set$1(cell.element, 'width', w + unit); + }); + }; + var redistributeToColumns = function (newWidths, columns, unit) { + each$2(columns, function (column, index) { + var width = sum([newWidths[index]], minWidth()); + set$1(column.element, 'width', width + unit); + }); + }; + var redistributeToH = function (newHeights, rows, cells, unit) { + each$2(cells, function (cell) { + var heights = newHeights.slice(cell.row, cell.rowspan + cell.row); + var h = sum(heights, minHeight()); + set$1(cell.element, 'height', h + unit); + }); + each$2(rows, function (row, i) { + set$1(row.element, 'height', newHeights[i]); + }); + }; + var getUnit = function (newSize) { + return validate(newSize).fold(constant('px'), constant('px'), constant('%')); + }; + var redistribute = function (table, optWidth, optHeight) { + var warehouse = Warehouse.fromTable(table); + var rows = warehouse.all; + var cells = Warehouse.justCells(warehouse); + var columns = Warehouse.justColumns(warehouse); + optWidth.each(function (newWidth) { + var widthUnit = getUnit(newWidth); + var totalWidth = get$8(table); + var oldWidths = getRawWidths(warehouse, table); + var nuWidths = redistribute$1(oldWidths, totalWidth, newWidth); + if (Warehouse.hasColumns(warehouse)) { + redistributeToColumns(nuWidths, columns, widthUnit); + } else { + redistributeToW(nuWidths, cells, widthUnit); + } + set$1(table, 'width', newWidth); + }); + optHeight.each(function (newHeight) { + var hUnit = getUnit(newHeight); + var totalHeight = get$7(table); + var oldHeights = getRawHeights(warehouse, table, height); + var nuHeights = redistribute$1(oldHeights, totalHeight, newHeight); + redistributeToH(nuHeights, rows, cells, hUnit); + set$1(table, 'height', newHeight); + }); + }; + var isPercentSizing = isPercentSizing$1; + var isPixelSizing = isPixelSizing$1; + var isNoneSizing = isNoneSizing$1; + + var getGridSize = function (table) { + var warehouse = Warehouse.fromTable(table); + return warehouse.grid; + }; + + var Event = function (fields) { + var handlers = []; + var bind = function (handler) { + if (handler === undefined) { + throw new Error('Event bind error: undefined handler'); + } + handlers.push(handler); + }; + var unbind = function (handler) { + handlers = filter$2(handlers, function (h) { + return h !== handler; + }); + }; + var trigger = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var event = {}; + each$2(fields, function (name, i) { + event[name] = args[i]; + }); + each$2(handlers, function (handler) { + handler(event); + }); + }; + return { + bind: bind, + unbind: unbind, + trigger: trigger + }; + }; + + var create$4 = function (typeDefs) { + var registry = map(typeDefs, function (event) { + return { + bind: event.bind, + unbind: event.unbind + }; + }); + var trigger = map(typeDefs, function (event) { + return event.trigger; + }); + return { + registry: registry, + trigger: trigger + }; + }; + + var last = function (fn, rate) { + var timer = null; + var cancel = function () { + if (!isNull(timer)) { + clearTimeout(timer); + timer = null; + } + }; + var throttle = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + cancel(); + timer = setTimeout(function () { + timer = null; + fn.apply(null, args); + }, rate); + }; + return { + cancel: cancel, + throttle: throttle + }; + }; + + var sort = function (arr) { + return arr.slice(0).sort(); + }; + var reqMessage = function (required, keys) { + throw new Error('All required keys (' + sort(required).join(', ') + ') were not specified. Specified keys were: ' + sort(keys).join(', ') + '.'); + }; + var unsuppMessage = function (unsupported) { + throw new Error('Unsupported keys for object: ' + sort(unsupported).join(', ')); + }; + var validateStrArr = function (label, array) { + if (!isArray(array)) { + throw new Error('The ' + label + ' fields must be an array. Was: ' + array + '.'); + } + each$2(array, function (a) { + if (!isString(a)) { + throw new Error('The value ' + a + ' in the ' + label + ' fields was not a string.'); + } + }); + }; + var invalidTypeMessage = function (incorrect, type) { + throw new Error('All values need to be of type: ' + type + '. Keys (' + sort(incorrect).join(', ') + ') were not.'); + }; + var checkDupes = function (everything) { + var sorted = sort(everything); + var dupe = find$1(sorted, function (s, i) { + return i < sorted.length - 1 && s === sorted[i + 1]; + }); + dupe.each(function (d) { + throw new Error('The field: ' + d + ' occurs more than once in the combined fields: [' + sorted.join(', ') + '].'); + }); + }; + + var base = function (handleUnsupported, required) { + return baseWith(handleUnsupported, required, { + validate: isFunction, + label: 'function' + }); + }; + var baseWith = function (handleUnsupported, required, pred) { + if (required.length === 0) { + throw new Error('You must specify at least one required field.'); + } + validateStrArr('required', required); + checkDupes(required); + return function (obj) { + var keys$1 = keys(obj); + var allReqd = forall(required, function (req) { + return contains$2(keys$1, req); + }); + if (!allReqd) { + reqMessage(required, keys$1); + } + handleUnsupported(required, keys$1); + var invalidKeys = filter$2(required, function (key) { + return !pred.validate(obj[key], key); + }); + if (invalidKeys.length > 0) { + invalidTypeMessage(invalidKeys, pred.label); + } + return obj; + }; + }; + var handleExact = function (required, keys) { + var unsupported = filter$2(keys, function (key) { + return !contains$2(required, key); + }); + if (unsupported.length > 0) { + unsuppMessage(unsupported); + } + }; + var exactly = function (required) { + return base(handleExact, required); + }; + + var DragMode = exactly([ + 'compare', + 'extract', + 'mutate', + 'sink' + ]); + var DragSink = exactly([ + 'element', + 'start', + 'stop', + 'destroy' + ]); + var DragApi = exactly([ + 'forceDrop', + 'drop', + 'move', + 'delayDrop' + ]); + + var InDrag = function () { + var previous = Optional.none(); + var reset = function () { + previous = Optional.none(); + }; + var update = function (mode, nu) { + var result = previous.map(function (old) { + return mode.compare(old, nu); + }); + previous = Optional.some(nu); + return result; + }; + var onEvent = function (event, mode) { + var dataOption = mode.extract(event); + dataOption.each(function (data) { + var offset = update(mode, data); + offset.each(function (d) { + events.trigger.move(d); + }); + }); + }; + var events = create$4({ move: Event(['info']) }); + return { + onEvent: onEvent, + reset: reset, + events: events.registry + }; + }; + + var NoDrag = function () { + var events = create$4({ move: Event(['info']) }); + return { + onEvent: noop, + reset: noop, + events: events.registry + }; + }; + + var Movement = function () { + var noDragState = NoDrag(); + var inDragState = InDrag(); + var dragState = noDragState; + var on = function () { + dragState.reset(); + dragState = inDragState; + }; + var off = function () { + dragState.reset(); + dragState = noDragState; + }; + var onEvent = function (event, mode) { + dragState.onEvent(event, mode); + }; + var isOn = function () { + return dragState === inDragState; + }; + return { + on: on, + off: off, + isOn: isOn, + onEvent: onEvent, + events: inDragState.events + }; + }; + + var setup = function (mutation, mode, settings) { + var active = false; + var events = create$4({ + start: Event([]), + stop: Event([]) + }); + var movement = Movement(); + var drop = function () { + sink.stop(); + if (movement.isOn()) { + movement.off(); + events.trigger.stop(); + } + }; + var throttledDrop = last(drop, 200); + var go = function (parent) { + sink.start(parent); + movement.on(); + events.trigger.start(); + }; + var mousemove = function (event) { + throttledDrop.cancel(); + movement.onEvent(event, mode); + }; + movement.events.move.bind(function (event) { + mode.mutate(mutation, event.info); + }); + var on = function () { + active = true; + }; + var off = function () { + active = false; + }; + var runIfActive = function (f) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (active) { + f.apply(null, args); + } + }; + }; + var sink = mode.sink(DragApi({ + forceDrop: drop, + drop: runIfActive(drop), + move: runIfActive(mousemove), + delayDrop: runIfActive(throttledDrop.throttle) + }), settings); + var destroy = function () { + sink.destroy(); + }; + return { + element: sink.element, + go: go, + on: on, + off: off, + destroy: destroy, + events: events.registry + }; + }; + + var mkEvent = function (target, x, y, stop, prevent, kill, raw) { + return { + target: target, + x: x, + y: y, + stop: stop, + prevent: prevent, + kill: kill, + raw: raw + }; + }; + var fromRawEvent$1 = function (rawEvent) { + var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target)); + var stop = function () { + return rawEvent.stopPropagation(); + }; + var prevent = function () { + return rawEvent.preventDefault(); + }; + var kill = compose(prevent, stop); + return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent); + }; + var handle$2 = function (filter, handler) { + return function (rawEvent) { + if (filter(rawEvent)) { + handler(fromRawEvent$1(rawEvent)); + } + }; + }; + var binder = function (element, event, filter, handler, useCapture) { + var wrapped = handle$2(filter, handler); + element.dom.addEventListener(event, wrapped, useCapture); + return { unbind: curry(unbind, element, event, wrapped, useCapture) }; + }; + var bind$1 = function (element, event, filter, handler) { + return binder(element, event, filter, handler, false); + }; + var unbind = function (element, event, handler, useCapture) { + element.dom.removeEventListener(event, handler, useCapture); + }; + + var filter = always; + var bind = function (element, event, handler) { + return bind$1(element, event, filter, handler); + }; + var fromRawEvent = fromRawEvent$1; + + var read = function (element, attr) { + var value = get$b(element, attr); + return value === undefined || value === '' ? [] : value.split(' '); + }; + var add$2 = function (element, attr, id) { + var old = read(element, attr); + var nu = old.concat([id]); + set$2(element, attr, nu.join(' ')); + return true; + }; + var remove$4 = function (element, attr, id) { + var nu = filter$2(read(element, attr), function (v) { + return v !== id; + }); + if (nu.length > 0) { + set$2(element, attr, nu.join(' ')); + } else { + remove$7(element, attr); + } + return false; + }; + + var supports = function (element) { + return element.dom.classList !== undefined; + }; + var get$5 = function (element) { + return read(element, 'class'); + }; + var add$1 = function (element, clazz) { + return add$2(element, 'class', clazz); + }; + var remove$3 = function (element, clazz) { + return remove$4(element, 'class', clazz); + }; + + var add = function (element, clazz) { + if (supports(element)) { + element.dom.classList.add(clazz); + } else { + add$1(element, clazz); + } + }; + var cleanClass = function (element) { + var classList = supports(element) ? element.dom.classList : get$5(element); + if (classList.length === 0) { + remove$7(element, 'class'); + } + }; + var remove$2 = function (element, clazz) { + if (supports(element)) { + var classList = element.dom.classList; + classList.remove(clazz); + } else { + remove$3(element, clazz); + } + cleanClass(element); + }; + var has = function (element, clazz) { + return supports(element) && element.dom.classList.contains(clazz); + }; + + var css = function (namespace) { + var dashNamespace = namespace.replace(/\./g, '-'); + var resolve = function (str) { + return dashNamespace + '-' + str; + }; + return { resolve: resolve }; + }; + + var styles$1 = css('ephox-dragster'); + var resolve$1 = styles$1.resolve; + + var Blocker = function (options) { + var settings = __assign({ layerClass: resolve$1('blocker') }, options); + var div = SugarElement.fromTag('div'); + set$2(div, 'role', 'presentation'); + setAll(div, { + position: 'fixed', + left: '0px', + top: '0px', + width: '100%', + height: '100%' + }); + add(div, resolve$1('blocker')); + add(div, settings.layerClass); + var element = constant(div); + var destroy = function () { + remove$5(div); + }; + return { + element: element, + destroy: destroy + }; + }; + + var compare = function (old, nu) { + return SugarPosition(nu.left - old.left, nu.top - old.top); + }; + var extract = function (event) { + return Optional.some(SugarPosition(event.x, event.y)); + }; + var mutate = function (mutation, info) { + mutation.mutate(info.left, info.top); + }; + var sink = function (dragApi, settings) { + var blocker = Blocker(settings); + var mdown = bind(blocker.element(), 'mousedown', dragApi.forceDrop); + var mup = bind(blocker.element(), 'mouseup', dragApi.drop); + var mmove = bind(blocker.element(), 'mousemove', dragApi.move); + var mout = bind(blocker.element(), 'mouseout', dragApi.delayDrop); + var destroy = function () { + blocker.destroy(); + mup.unbind(); + mmove.unbind(); + mout.unbind(); + mdown.unbind(); + }; + var start = function (parent) { + append$1(parent, blocker.element()); + }; + var stop = function () { + remove$5(blocker.element()); + }; + return DragSink({ + element: blocker.element, + start: start, + stop: stop, + destroy: destroy + }); + }; + var MouseDrag = DragMode({ + compare: compare, + extract: extract, + sink: sink, + mutate: mutate + }); + + var transform$1 = function (mutation, settings) { + if (settings === void 0) { + settings = {}; + } + var mode = settings.mode !== undefined ? settings.mode : MouseDrag; + return setup(mutation, mode, settings); + }; + + var closest = function (target) { + return closest$1(target, '[contenteditable]'); + }; + var isEditable$1 = function (element, assumeEditable) { + if (assumeEditable === void 0) { + assumeEditable = false; + } + if (!detect$3().browser.isIE() && inBody(element)) { + return element.dom.isContentEditable; + } else { + return closest(element).fold(constant(assumeEditable), function (editable) { + return getRaw(editable) === 'true'; + }); + } + }; + var getRaw = function (element) { + return element.dom.contentEditable; + }; + + var styles = css('ephox-snooker'); + var resolve = styles.resolve; + + var Mutation = function () { + var events = create$4({ + drag: Event([ + 'xDelta', + 'yDelta' + ]) + }); + var mutate = function (x, y) { + events.trigger.drag(x, y); + }; + return { + mutate: mutate, + events: events.registry + }; + }; + + var BarMutation = function () { + var events = create$4({ + drag: Event([ + 'xDelta', + 'yDelta', + 'target' + ]) + }); + var target = Optional.none(); + var delegate = Mutation(); + delegate.events.drag.bind(function (event) { + target.each(function (t) { + events.trigger.drag(event.xDelta, event.yDelta, t); + }); + }); + var assign = function (t) { + target = Optional.some(t); + }; + var get = function () { + return target; + }; + return { + assign: assign, + get: get, + mutate: delegate.mutate, + events: events.registry + }; + }; + + var col = function (column, x, y, w, h) { + var bar = SugarElement.fromTag('div'); + setAll(bar, { + position: 'absolute', + left: x - w / 2 + 'px', + top: y + 'px', + height: h + 'px', + width: w + 'px' + }); + setAll$1(bar, { + 'data-column': column, + 'role': 'presentation' + }); + return bar; + }; + var row = function (r, x, y, w, h) { + var bar = SugarElement.fromTag('div'); + setAll(bar, { + position: 'absolute', + left: x + 'px', + top: y - h / 2 + 'px', + height: h + 'px', + width: w + 'px' + }); + setAll$1(bar, { + 'data-row': r, + 'role': 'presentation' + }); + return bar; + }; + + var resizeBar = resolve('resizer-bar'); + var resizeRowBar = resolve('resizer-rows'); + var resizeColBar = resolve('resizer-cols'); + var BAR_THICKNESS = 7; + var resizableRows = function (warehouse, isResizable) { + return bind$2(warehouse.all, function (row, i) { + return isResizable(row.element) ? [i] : []; + }); + }; + var resizableColumns = function (warehouse, isResizable) { + var resizableCols = []; + range$1(warehouse.grid.columns, function (index) { + var colElmOpt = Warehouse.getColumnAt(warehouse, index).map(function (col) { + return col.element; + }); + if (colElmOpt.forall(isResizable)) { + resizableCols.push(index); + } + }); + return filter$2(resizableCols, function (colIndex) { + var columnCells = Warehouse.filterItems(warehouse, function (cell) { + return cell.column === colIndex; + }); + return forall(columnCells, function (cell) { + return isResizable(cell.element); + }); + }); + }; + var destroy = function (wire) { + var previous = descendants(wire.parent(), '.' + resizeBar); + each$2(previous, remove$5); + }; + var drawBar = function (wire, positions, create) { + var origin = wire.origin(); + each$2(positions, function (cpOption) { + cpOption.each(function (cp) { + var bar = create(origin, cp); + add(bar, resizeBar); + append$1(wire.parent(), bar); + }); + }); + }; + var refreshCol = function (wire, colPositions, position, tableHeight) { + drawBar(wire, colPositions, function (origin, cp) { + var colBar = col(cp.col, cp.x - origin.left, position.top - origin.top, BAR_THICKNESS, tableHeight); + add(colBar, resizeColBar); + return colBar; + }); + }; + var refreshRow = function (wire, rowPositions, position, tableWidth) { + drawBar(wire, rowPositions, function (origin, cp) { + var rowBar = row(cp.row, position.left - origin.left, cp.y - origin.top, tableWidth, BAR_THICKNESS); + add(rowBar, resizeRowBar); + return rowBar; + }); + }; + var refreshGrid = function (warhouse, wire, table, rows, cols) { + var position = absolute(table); + var isResizable = wire.isResizable; + var rowPositions = rows.length > 0 ? height.positions(rows, table) : []; + var resizableRowBars = rowPositions.length > 0 ? resizableRows(warhouse, isResizable) : []; + var resizableRowPositions = filter$2(rowPositions, function (_pos, i) { + return exists(resizableRowBars, function (barIndex) { + return i === barIndex; + }); + }); + refreshRow(wire, resizableRowPositions, position, getOuter$2(table)); + var colPositions = cols.length > 0 ? width.positions(cols, table) : []; + var resizableColBars = colPositions.length > 0 ? resizableColumns(warhouse, isResizable) : []; + var resizableColPositions = filter$2(colPositions, function (_pos, i) { + return exists(resizableColBars, function (barIndex) { + return i === barIndex; + }); + }); + refreshCol(wire, resizableColPositions, position, getOuter$1(table)); + }; + var refresh = function (wire, table) { + destroy(wire); + if (wire.isResizable(table)) { + var warehouse = Warehouse.fromTable(table); + var rows$1 = rows(warehouse); + var cols = columns(warehouse); + refreshGrid(warehouse, wire, table, rows$1, cols); + } + }; + var each = function (wire, f) { + var bars = descendants(wire.parent(), '.' + resizeBar); + each$2(bars, f); + }; + var hide = function (wire) { + each(wire, function (bar) { + set$1(bar, 'display', 'none'); + }); + }; + var show = function (wire) { + each(wire, function (bar) { + set$1(bar, 'display', 'block'); + }); + }; + var isRowBar = function (element) { + return has(element, resizeRowBar); + }; + var isColBar = function (element) { + return has(element, resizeColBar); + }; + + var resizeBarDragging = resolve('resizer-bar-dragging'); + var BarManager = function (wire) { + var mutation = BarMutation(); + var resizing = transform$1(mutation, {}); + var hoverTable = Optional.none(); + var getResizer = function (element, type) { + return Optional.from(get$b(element, type)); + }; + mutation.events.drag.bind(function (event) { + getResizer(event.target, 'data-row').each(function (_dataRow) { + var currentRow = getCssValue(event.target, 'top'); + set$1(event.target, 'top', currentRow + event.yDelta + 'px'); + }); + getResizer(event.target, 'data-column').each(function (_dataCol) { + var currentCol = getCssValue(event.target, 'left'); + set$1(event.target, 'left', currentCol + event.xDelta + 'px'); + }); + }); + var getDelta = function (target, dir) { + var newX = getCssValue(target, dir); + var oldX = getAttrValue(target, 'data-initial-' + dir, 0); + return newX - oldX; + }; + resizing.events.stop.bind(function () { + mutation.get().each(function (target) { + hoverTable.each(function (table) { + getResizer(target, 'data-row').each(function (row) { + var delta = getDelta(target, 'top'); + remove$7(target, 'data-initial-top'); + events.trigger.adjustHeight(table, delta, parseInt(row, 10)); + }); + getResizer(target, 'data-column').each(function (column) { + var delta = getDelta(target, 'left'); + remove$7(target, 'data-initial-left'); + events.trigger.adjustWidth(table, delta, parseInt(column, 10)); + }); + refresh(wire, table); + }); + }); + }); + var handler = function (target, dir) { + events.trigger.startAdjust(); + mutation.assign(target); + set$2(target, 'data-initial-' + dir, getCssValue(target, dir)); + add(target, resizeBarDragging); + set$1(target, 'opacity', '0.2'); + resizing.go(wire.parent()); + }; + var mousedown = bind(wire.parent(), 'mousedown', function (event) { + if (isRowBar(event.target)) { + handler(event.target, 'top'); + } + if (isColBar(event.target)) { + handler(event.target, 'left'); + } + }); + var isRoot = function (e) { + return eq$1(e, wire.view()); + }; + var findClosestEditableTable = function (target) { + return closest$1(target, 'table', isRoot).filter(isEditable$1); + }; + var mouseover = bind(wire.view(), 'mouseover', function (event) { + findClosestEditableTable(event.target).fold(function () { + if (inBody(event.target)) { + destroy(wire); + } + }, function (table) { + hoverTable = Optional.some(table); + refresh(wire, table); + }); + }); + var destroy$1 = function () { + mousedown.unbind(); + mouseover.unbind(); + resizing.destroy(); + destroy(wire); + }; + var refresh$1 = function (tbl) { + refresh(wire, tbl); + }; + var events = create$4({ + adjustHeight: Event([ + 'table', + 'delta', + 'row' + ]), + adjustWidth: Event([ + 'table', + 'delta', + 'column' + ]), + startAdjust: Event([]) + }); + return { + destroy: destroy$1, + refresh: refresh$1, + on: resizing.on, + off: resizing.off, + hideBars: curry(hide, wire), + showBars: curry(show, wire), + events: events.registry + }; + }; + + var create$3 = function (wire, resizing, lazySizing) { + var hdirection = height; + var vdirection = width; + var manager = BarManager(wire); + var events = create$4({ + beforeResize: Event([ + 'table', + 'type' + ]), + afterResize: Event([ + 'table', + 'type' + ]), + startDrag: Event([]) + }); + manager.events.adjustHeight.bind(function (event) { + var table = event.table; + events.trigger.beforeResize(table, 'row'); + var delta = hdirection.delta(event.delta, table); + adjustHeight(table, delta, event.row, hdirection); + events.trigger.afterResize(table, 'row'); + }); + manager.events.startAdjust.bind(function (_event) { + events.trigger.startDrag(); + }); + manager.events.adjustWidth.bind(function (event) { + var table = event.table; + events.trigger.beforeResize(table, 'col'); + var delta = vdirection.delta(event.delta, table); + var tableSize = lazySizing(table); + adjustWidth(table, delta, event.column, resizing, tableSize); + events.trigger.afterResize(table, 'col'); + }); + return { + on: manager.on, + off: manager.off, + hideBars: manager.hideBars, + showBars: manager.showBars, + destroy: manager.destroy, + events: events.registry + }; + }; + var TableResize = { create: create$3 }; + + var fireNewRow = function (editor, row) { + return editor.fire('newrow', { node: row }); + }; + var fireNewCell = function (editor, cell) { + return editor.fire('newcell', { node: cell }); + }; + var fireObjectResizeStart = function (editor, target, width, height, origin) { + editor.fire('ObjectResizeStart', { + target: target, + width: width, + height: height, + origin: origin + }); + }; + var fireObjectResized = function (editor, target, width, height, origin) { + editor.fire('ObjectResized', { + target: target, + width: width, + height: height, + origin: origin + }); + }; + var fireTableSelectionChange = function (editor, cells, start, finish, otherCells) { + editor.fire('TableSelectionChange', { + cells: cells, + start: start, + finish: finish, + otherCells: otherCells + }); + }; + var fireTableSelectionClear = function (editor) { + editor.fire('TableSelectionClear'); + }; + var fireTableModified = function (editor, table, data) { + editor.fire('TableModified', __assign(__assign({}, data), { table: table })); + }; + var styleModified = { + structure: false, + style: true + }; + var structureModified = { + structure: true, + style: false + }; + var styleAndStructureModified = { + structure: true, + style: true + }; + + var defaultTableToolbar = 'tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol'; + var defaultStyles = { + 'border-collapse': 'collapse', + 'width': '100%' + }; + var defaultCellBorderWidths = range$1(5, function (i) { + var size = i + 1 + 'px'; + return { + title: size, + value: size + }; + }); + var defaultCellBorderStyles = map$1([ + 'Solid', + 'Dotted', + 'Dashed', + 'Double', + 'Groove', + 'Ridge', + 'Inset', + 'Outset', + 'None', + 'Hidden' + ], function (type) { + return { + title: type, + value: type.toLowerCase() + }; + }); + var determineDefaultStyles = function (editor) { + var _a; + if (isPixelsForced(editor)) { + var dom = editor.dom; + var parentBlock = (_a = dom.getParent(editor.selection.getStart(), dom.isBlock)) !== null && _a !== void 0 ? _a : editor.getBody(); + var contentWidth = getInner(SugarElement.fromDom(parentBlock)); + return __assign(__assign({}, defaultStyles), { width: contentWidth + 'px' }); + } else if (isResponsiveForced(editor)) { + return filter$1(defaultStyles, function (_value, key) { + return key !== 'width'; + }); + } else { + return defaultStyles; + } + }; + var defaultAttributes = { border: '1' }; + var defaultColumnResizingBehaviour = 'preservetable'; + var getTableSizingMode = function (editor) { + return editor.getParam('table_sizing_mode', 'auto'); + }; + var getTableResponseWidth = function (editor) { + return editor.getParam('table_responsive_width'); + }; + var getTableBorderWidths = function (editor) { + return editor.getParam('table_border_widths', defaultCellBorderWidths, 'array'); + }; + var getTableBorderStyles = function (editor) { + return editor.getParam('table_border_styles', defaultCellBorderStyles, 'array'); + }; + var getDefaultAttributes = function (editor) { + return editor.getParam('table_default_attributes', defaultAttributes, 'object'); + }; + var getDefaultStyles = function (editor) { + return editor.getParam('table_default_styles', determineDefaultStyles(editor), 'object'); + }; + var hasTableResizeBars = function (editor) { + return editor.getParam('table_resize_bars', true, 'boolean'); + }; + var hasTabNavigation = function (editor) { + return editor.getParam('table_tab_navigation', true, 'boolean'); + }; + var hasAdvancedCellTab = function (editor) { + return editor.getParam('table_cell_advtab', true, 'boolean'); + }; + var hasAdvancedRowTab = function (editor) { + return editor.getParam('table_row_advtab', true, 'boolean'); + }; + var hasAdvancedTableTab = function (editor) { + return editor.getParam('table_advtab', true, 'boolean'); + }; + var hasAppearanceOptions = function (editor) { + return editor.getParam('table_appearance_options', true, 'boolean'); + }; + var hasTableGrid = function (editor) { + return editor.getParam('table_grid', true, 'boolean'); + }; + var shouldStyleWithCss = function (editor) { + return editor.getParam('table_style_by_css', false, 'boolean'); + }; + var getCellClassList = function (editor) { + return editor.getParam('table_cell_class_list', [], 'array'); + }; + var getRowClassList = function (editor) { + return editor.getParam('table_row_class_list', [], 'array'); + }; + var getTableClassList = function (editor) { + return editor.getParam('table_class_list', [], 'array'); + }; + var isPercentagesForced = function (editor) { + return getTableSizingMode(editor) === 'relative' || getTableResponseWidth(editor) === true; + }; + var isPixelsForced = function (editor) { + return getTableSizingMode(editor) === 'fixed' || getTableResponseWidth(editor) === false; + }; + var isResponsiveForced = function (editor) { + return getTableSizingMode(editor) === 'responsive'; + }; + var getToolbar = function (editor) { + return editor.getParam('table_toolbar', defaultTableToolbar); + }; + var useColumnGroup = function (editor) { + return editor.getParam('table_use_colgroups', false, 'boolean'); + }; + var getTableHeaderType = function (editor) { + var defaultValue = 'section'; + var value = editor.getParam('table_header_type', defaultValue, 'string'); + var validValues = [ + 'section', + 'cells', + 'sectionCells', + 'auto' + ]; + if (!contains$2(validValues, value)) { + return defaultValue; + } else { + return value; + } + }; + var getColumnResizingBehaviour = function (editor) { + var validModes = [ + 'preservetable', + 'resizetable' + ]; + var givenMode = editor.getParam('table_column_resizing', defaultColumnResizingBehaviour, 'string'); + return find$1(validModes, function (mode) { + return mode === givenMode; + }).getOr(defaultColumnResizingBehaviour); + }; + var isPreserveTableColumnResizing = function (editor) { + return getColumnResizingBehaviour(editor) === 'preservetable'; + }; + var isResizeTableColumnResizing = function (editor) { + return getColumnResizingBehaviour(editor) === 'resizetable'; + }; + var getCloneElements = function (editor) { + var cloneElements = editor.getParam('table_clone_elements'); + if (isString(cloneElements)) { + return Optional.some(cloneElements.split(/[ ,]/)); + } else if (Array.isArray(cloneElements)) { + return Optional.some(cloneElements); + } else { + return Optional.none(); + } + }; + var hasObjectResizing = function (editor) { + var objectResizing = editor.getParam('object_resizing', true); + return isString(objectResizing) ? objectResizing === 'table' : objectResizing; + }; + var getTableBackgroundColorMap = function (editor) { + return editor.getParam('table_background_color_map', [], 'array'); + }; + var getTableBorderColorMap = function (editor) { + return editor.getParam('table_border_color_map', [], 'array'); + }; + + var get$4 = function (editor, table) { + if (isPercentagesForced(editor)) { + return TableSize.percentageSize(table); + } else if (isPixelsForced(editor)) { + return TableSize.pixelSize(table); + } else { + return TableSize.getTableSize(table); + } + }; + + var cleanupLegacyAttributes = function (element) { + remove$7(element, 'width'); + }; + var convertToPercentSize = function (table) { + var newWidth = getPercentTableWidth(table); + redistribute(table, Optional.some(newWidth), Optional.none()); + cleanupLegacyAttributes(table); + }; + var convertToPixelSize = function (table) { + var newWidth = getPixelTableWidth(table); + redistribute(table, Optional.some(newWidth), Optional.none()); + cleanupLegacyAttributes(table); + }; + var convertToNoneSize = function (table) { + remove$6(table, 'width'); + var columns = columns$1(table); + var rowElements = columns.length > 0 ? columns : cells$1(table); + each$2(rowElements, function (cell) { + remove$6(cell, 'width'); + cleanupLegacyAttributes(cell); + }); + cleanupLegacyAttributes(table); + }; + + var enforcePercentage = convertToPercentSize; + var enforcePixels = convertToPixelSize; + var enforceNone = convertToNoneSize; + var syncPixels = function (table) { + var warehouse = Warehouse.fromTable(table); + if (!Warehouse.hasColumns(warehouse)) { + each$2(cells$1(table), function (cell) { + var computedWidth = get$a(cell, 'width'); + set$1(cell, 'width', computedWidth); + remove$7(cell, 'width'); + }); + } + }; + + var createContainer = function () { + var container = SugarElement.fromTag('div'); + setAll(container, { + position: 'static', + height: '0', + width: '0', + padding: '0', + margin: '0', + border: '0' + }); + append$1(body$1(), container); + return container; + }; + var get$3 = function (editor, isResizable) { + return editor.inline ? ResizeWire.body(getBody(editor), createContainer(), isResizable) : ResizeWire.only(SugarElement.fromDom(editor.getDoc()), isResizable); + }; + var remove$1 = function (editor, wire) { + if (editor.inline) { + remove$5(wire.parent()); + } + }; + + var barResizerPrefix = 'bar-'; + var isResizable = function (elm) { + return get$b(elm, 'data-mce-resize') !== 'false'; + }; + var getResizeHandler = function (editor) { + var selectionRng = Optional.none(); + var resize = Optional.none(); + var wire = Optional.none(); + var startW; + var startRawW; + var isTable = function (elm) { + return elm.nodeName === 'TABLE'; + }; + var lazyResize = function () { + return resize; + }; + var lazyWire = function () { + return wire.getOr(ResizeWire.only(SugarElement.fromDom(editor.getBody()), isResizable)); + }; + var lazySizing = function (table) { + return get$4(editor, table); + }; + var lazyResizingBehaviour = function () { + return isPreserveTableColumnResizing(editor) ? preserveTable() : resizeTable(); + }; + var getNumColumns = function (table) { + return getGridSize(table).columns; + }; + var afterCornerResize = function (table, origin, width) { + var isRightEdgeResize = endsWith(origin, 'e'); + if (startRawW === '') { + enforcePercentage(table); + } + if (width !== startW && startRawW !== '') { + set$1(table, 'width', startRawW); + var resizing = lazyResizingBehaviour(); + var tableSize = lazySizing(table); + var col = isPreserveTableColumnResizing(editor) || isRightEdgeResize ? getNumColumns(table) - 1 : 0; + adjustWidth(table, width - startW, col, resizing, tableSize); + } else if (isPercentage$1(startRawW)) { + var percentW = parseFloat(startRawW.replace('%', '')); + var targetPercentW = width * percentW / startW; + set$1(table, 'width', targetPercentW + '%'); + } + if (isPixel(startRawW)) { + syncPixels(table); + } + }; + var destroy = function () { + resize.each(function (sz) { + sz.destroy(); + }); + wire.each(function (w) { + remove$1(editor, w); + }); + }; + editor.on('init', function () { + var rawWire = get$3(editor, isResizable); + wire = Optional.some(rawWire); + if (hasObjectResizing(editor) && hasTableResizeBars(editor)) { + var resizing = lazyResizingBehaviour(); + var sz = TableResize.create(rawWire, resizing, lazySizing); + sz.on(); + sz.events.startDrag.bind(function (_event) { + selectionRng = Optional.some(editor.selection.getRng()); + }); + sz.events.beforeResize.bind(function (event) { + var rawTable = event.table.dom; + fireObjectResizeStart(editor, rawTable, getPixelWidth(rawTable), getPixelHeight(rawTable), barResizerPrefix + event.type); + }); + sz.events.afterResize.bind(function (event) { + var table = event.table; + var rawTable = table.dom; + removeDataStyle(table); + selectionRng.each(function (rng) { + editor.selection.setRng(rng); + editor.focus(); + }); + fireObjectResized(editor, rawTable, getPixelWidth(rawTable), getPixelHeight(rawTable), barResizerPrefix + event.type); + editor.undoManager.add(); + }); + resize = Optional.some(sz); + } + }); + editor.on('ObjectResizeStart', function (e) { + var targetElm = e.target; + if (isTable(targetElm)) { + var table = SugarElement.fromDom(targetElm); + each$2(editor.dom.select('.mce-clonedresizable'), function (clone) { + editor.dom.addClass(clone, 'mce-' + getColumnResizingBehaviour(editor) + '-columns'); + }); + if (!isPixelSizing(table) && isPixelsForced(editor)) { + enforcePixels(table); + } else if (!isPercentSizing(table) && isPercentagesForced(editor)) { + enforcePercentage(table); + } + if (isNoneSizing(table) && startsWith(e.origin, barResizerPrefix)) { + enforcePercentage(table); + } + startW = e.width; + startRawW = isResponsiveForced(editor) ? '' : getRawWidth(editor, targetElm).getOr(''); + } + }); + editor.on('ObjectResized', function (e) { + var targetElm = e.target; + if (isTable(targetElm)) { + var table = SugarElement.fromDom(targetElm); + var origin_1 = e.origin; + if (startsWith(origin_1, 'corner-')) { + afterCornerResize(table, origin_1, e.width); + } + removeDataStyle(table); + fireTableModified(editor, table.dom, styleModified); + } + }); + editor.on('SwitchMode', function () { + lazyResize().each(function (resize) { + if (editor.mode.isReadOnly()) { + resize.hideBars(); + } else { + resize.showBars(); + } + }); + }); + return { + lazyResize: lazyResize, + lazyWire: lazyWire, + destroy: destroy + }; + }; + + var point = function (element, offset) { + return { + element: element, + offset: offset + }; + }; + + var scan$1 = function (universe, element, direction) { + if (universe.property().isText(element) && universe.property().getText(element).trim().length === 0 || universe.property().isComment(element)) { + return direction(element).bind(function (elem) { + return scan$1(universe, elem, direction).orThunk(function () { + return Optional.some(elem); + }); + }); + } else { + return Optional.none(); + } + }; + var toEnd = function (universe, element) { + if (universe.property().isText(element)) { + return universe.property().getText(element).length; + } + var children = universe.property().children(element); + return children.length; + }; + var freefallRtl$2 = function (universe, element) { + var candidate = scan$1(universe, element, universe.query().prevSibling).getOr(element); + if (universe.property().isText(candidate)) { + return point(candidate, toEnd(universe, candidate)); + } + var children = universe.property().children(candidate); + return children.length > 0 ? freefallRtl$2(universe, children[children.length - 1]) : point(candidate, toEnd(universe, candidate)); + }; + + var freefallRtl$1 = freefallRtl$2; + + var universe$2 = DomUniverse(); + var freefallRtl = function (element) { + return freefallRtl$1(universe$2, element); + }; + + var halve = function (main, other) { + var colspan = getSpan(main, 'colspan'); + if (colspan === 1) { + var width = getGenericWidth(main); + width.each(function (w) { + var newWidth = w.value / 2; + setGenericWidth(main, newWidth, w.unit); + setGenericWidth(other, newWidth, w.unit); + }); + } + }; + + var isHeaderCell = isTag('th'); + var isHeaderCells = function (cells) { + return forall(cells, function (cell) { + return isHeaderCell(cell.element); + }); + }; + var getRowHeaderType = function (isHeaderRow, isHeaderCells) { + if (isHeaderRow && isHeaderCells) { + return 'sectionCells'; + } else if (isHeaderRow) { + return 'section'; + } else { + return 'cells'; + } + }; + var getRowType$1 = function (row) { + var isHeaderRow = row.section === 'thead'; + var isHeaderCells = is(findCommonCellType(row.cells), 'th'); + if (isHeaderRow || isHeaderCells) { + return { + type: 'header', + subType: getRowHeaderType(isHeaderRow, isHeaderCells) + }; + } else if (row.section === 'tfoot') { + return { type: 'footer' }; + } else { + return { type: 'body' }; + } + }; + var findCommonCellType = function (cells) { + var headerCells = filter$2(cells, function (cell) { + return isHeaderCell(cell.element); + }); + if (headerCells.length === 0) { + return Optional.some('td'); + } else if (headerCells.length === cells.length) { + return Optional.some('th'); + } else { + return Optional.none(); + } + }; + var findCommonRowType = function (rows) { + var rowTypes = map$1(rows, function (row) { + return getRowType$1(row).type; + }); + var hasHeader = contains$2(rowTypes, 'header'); + var hasFooter = contains$2(rowTypes, 'footer'); + if (!hasHeader && !hasFooter) { + return Optional.some('body'); + } else { + var hasBody = contains$2(rowTypes, 'body'); + if (hasHeader && !hasBody && !hasFooter) { + return Optional.some('header'); + } else if (!hasHeader && !hasBody && hasFooter) { + return Optional.some('footer'); + } else { + return Optional.none(); + } + } + }; + var findTableRowHeaderType = function (warehouse) { + return findMap(warehouse.all, function (row) { + var rowType = getRowType$1(row); + return rowType.type === 'header' ? Optional.from(rowType.subType) : Optional.none(); + }); + }; + + var transformCell = function (cell, comparator, substitution) { + return elementnew(substitution(cell.element, comparator), true, cell.isLocked); + }; + var transformRow = function (row, section) { + return row.section !== section ? rowcells(row.element, row.cells, section, row.isNew) : row; + }; + var section = function () { + return { + transformRow: transformRow, + transformCell: function (cell, comparator, substitution) { + var newCell = substitution(cell.element, comparator); + var fixedCell = name(newCell) !== 'td' ? mutate$1(newCell, 'td') : newCell; + return elementnew(fixedCell, cell.isNew, cell.isLocked); + } + }; + }; + var sectionCells = function () { + return { + transformRow: transformRow, + transformCell: transformCell + }; + }; + var cells = function () { + return { + transformRow: function (row, section) { + var newSection = section === 'thead' ? 'tbody' : section; + return transformRow(row, newSection); + }, + transformCell: transformCell + }; + }; + var fallback = function () { + return { + transformRow: identity, + transformCell: transformCell + }; + }; + var getTableSectionType = function (table, fallback) { + var warehouse = Warehouse.fromTable(table); + var type = findTableRowHeaderType(warehouse).getOr(fallback); + switch (type) { + case 'section': + return section(); + case 'sectionCells': + return sectionCells(); + case 'cells': + return cells(); + } + }; + var TableSection = { + getTableSectionType: getTableSectionType, + section: section, + sectionCells: sectionCells, + cells: cells, + fallback: fallback + }; + + var setIfNot = function (element, property, value, ignore) { + if (value === ignore) { + remove$7(element, property); + } else { + set$2(element, property, value); + } + }; + var insert$1 = function (table, selector, element) { + last$2(children$1(table, selector)).fold(function () { + return prepend(table, element); + }, function (child) { + return after$5(child, element); + }); + }; + var generateSection = function (table, sectionName) { + var section = child$1(table, sectionName).getOrThunk(function () { + var newSection = SugarElement.fromTag(sectionName, owner(table).dom); + if (sectionName === 'thead') { + insert$1(table, 'caption,colgroup', newSection); + } else if (sectionName === 'colgroup') { + insert$1(table, 'caption', newSection); + } else { + append$1(table, newSection); + } + return newSection; + }); + empty(section); + return section; + }; + var render$1 = function (table, grid) { + var newRows = []; + var newCells = []; + var syncRows = function (gridSection) { + return map$1(gridSection, function (row) { + if (row.isNew) { + newRows.push(row.element); + } + var tr = row.element; + empty(tr); + each$2(row.cells, function (cell) { + if (cell.isNew) { + newCells.push(cell.element); + } + setIfNot(cell.element, 'colspan', cell.colspan, 1); + setIfNot(cell.element, 'rowspan', cell.rowspan, 1); + append$1(tr, cell.element); + }); + return tr; + }); + }; + var syncColGroup = function (gridSection) { + return bind$2(gridSection, function (colGroup) { + return map$1(colGroup.cells, function (col) { + setIfNot(col.element, 'span', col.colspan, 1); + return col.element; + }); + }); + }; + var renderSection = function (gridSection, sectionName) { + var section = generateSection(table, sectionName); + var sync = sectionName === 'colgroup' ? syncColGroup : syncRows; + var sectionElems = sync(gridSection); + append(section, sectionElems); + }; + var removeSection = function (sectionName) { + child$1(table, sectionName).each(remove$5); + }; + var renderOrRemoveSection = function (gridSection, sectionName) { + if (gridSection.length > 0) { + renderSection(gridSection, sectionName); + } else { + removeSection(sectionName); + } + }; + var headSection = []; + var bodySection = []; + var footSection = []; + var columnGroupsSection = []; + each$2(grid, function (row) { + switch (row.section) { + case 'thead': + headSection.push(row); + break; + case 'tbody': + bodySection.push(row); + break; + case 'tfoot': + footSection.push(row); + break; + case 'colgroup': + columnGroupsSection.push(row); + break; + } + }); + renderOrRemoveSection(columnGroupsSection, 'colgroup'); + renderOrRemoveSection(headSection, 'thead'); + renderOrRemoveSection(bodySection, 'tbody'); + renderOrRemoveSection(footSection, 'tfoot'); + return { + newRows: newRows, + newCells: newCells + }; + }; + var copy = function (grid) { + return map$1(grid, function (row) { + var tr = shallow(row.element); + each$2(row.cells, function (cell) { + var clonedCell = deep(cell.element); + setIfNot(clonedCell, 'colspan', cell.colspan, 1); + setIfNot(clonedCell, 'rowspan', cell.rowspan, 1); + append$1(tr, clonedCell); + }); + return tr; + }); + }; + + var getColumn = function (grid, index) { + return map$1(grid, function (row) { + return getCell(row, index); + }); + }; + var getRow = function (grid, index) { + return grid[index]; + }; + var findDiff = function (xs, comp) { + if (xs.length === 0) { + return 0; + } + var first = xs[0]; + var index = findIndex(xs, function (x) { + return !comp(first.element, x.element); + }); + return index.getOr(xs.length); + }; + var subgrid = function (grid, row, column, comparator) { + var gridRow = getRow(grid, row); + var isColRow = gridRow.section === 'colgroup'; + var colspan = findDiff(gridRow.cells.slice(column), comparator); + var rowspan = isColRow ? 1 : findDiff(getColumn(grid.slice(row), column), comparator); + return { + colspan: colspan, + rowspan: rowspan + }; + }; + + var toDetails = function (grid, comparator) { + var seen = map$1(grid, function (row) { + return map$1(row.cells, never); + }); + var updateSeen = function (rowIndex, columnIndex, rowspan, colspan) { + for (var row = rowIndex; row < rowIndex + rowspan; row++) { + for (var column = columnIndex; column < columnIndex + colspan; column++) { + seen[row][column] = true; + } + } + }; + return map$1(grid, function (row, rowIndex) { + var details = bind$2(row.cells, function (cell, columnIndex) { + if (seen[rowIndex][columnIndex] === false) { + var result = subgrid(grid, rowIndex, columnIndex, comparator); + updateSeen(rowIndex, columnIndex, result.rowspan, result.colspan); + return [detailnew(cell.element, result.rowspan, result.colspan, cell.isNew)]; + } else { + return []; + } + }); + return rowdetailnew(row.element, details, row.section, row.isNew); + }); + }; + var toGrid = function (warehouse, generators, isNew) { + var grid = []; + each$2(warehouse.colgroups, function (colgroup) { + var colgroupCols = []; + for (var columnIndex = 0; columnIndex < warehouse.grid.columns; columnIndex++) { + var element = Warehouse.getColumnAt(warehouse, columnIndex).map(function (column) { + return elementnew(column.element, isNew, false); + }).getOrThunk(function () { + return elementnew(generators.colGap(), true, false); + }); + colgroupCols.push(element); + } + grid.push(rowcells(colgroup.element, colgroupCols, 'colgroup', isNew)); + }); + for (var rowIndex = 0; rowIndex < warehouse.grid.rows; rowIndex++) { + var rowCells = []; + for (var columnIndex = 0; columnIndex < warehouse.grid.columns; columnIndex++) { + var element = Warehouse.getAt(warehouse, rowIndex, columnIndex).map(function (item) { + return elementnew(item.element, isNew, item.isLocked); + }).getOrThunk(function () { + return elementnew(generators.gap(), true, false); + }); + rowCells.push(element); + } + var rowDetail = warehouse.all[rowIndex]; + var row = rowcells(rowDetail.element, rowCells, rowDetail.section, isNew); + grid.push(row); + } + return grid; + }; + + var fromWarehouse = function (warehouse, generators) { + return toGrid(warehouse, generators, false); + }; + var toDetailList = function (grid) { + return toDetails(grid, eq$1); + }; + var findInWarehouse = function (warehouse, element) { + return findMap(warehouse.all, function (r) { + return find$1(r.cells, function (e) { + return eq$1(element, e.element); + }); + }); + }; + var extractCells = function (warehouse, target, predicate) { + var details = map$1(target.selection, function (cell$1) { + return cell(cell$1).bind(function (lc) { + return findInWarehouse(warehouse, lc); + }).filter(predicate); + }); + var cells = cat(details); + return someIf(cells.length > 0, cells); + }; + var run = function (operation, extract, adjustment, postAction, genWrappers) { + return function (wire, table, target, generators, behaviours) { + var warehouse = Warehouse.fromTable(table); + var tableSection = Optional.from(behaviours === null || behaviours === void 0 ? void 0 : behaviours.section).getOrThunk(TableSection.fallback); + var output = extract(warehouse, target).map(function (info) { + var model = fromWarehouse(warehouse, generators); + var result = operation(model, info, eq$1, genWrappers(generators), tableSection); + var lockedColumns = getLockedColumnsFromGrid(result.grid); + var grid = toDetailList(result.grid); + return { + info: info, + grid: grid, + cursor: result.cursor, + lockedColumns: lockedColumns + }; + }); + return output.bind(function (out) { + var newElements = render$1(table, out.grid); + var tableSizing = Optional.from(behaviours === null || behaviours === void 0 ? void 0 : behaviours.sizing).getOrThunk(function () { + return TableSize.getTableSize(table); + }); + var resizing = Optional.from(behaviours === null || behaviours === void 0 ? void 0 : behaviours.resize).getOrThunk(preserveTable); + adjustment(table, out.grid, out.info, { + sizing: tableSizing, + resize: resizing, + section: tableSection + }); + postAction(table); + refresh(wire, table); + remove$7(table, LOCKED_COL_ATTR); + if (out.lockedColumns.length > 0) { + set$2(table, LOCKED_COL_ATTR, out.lockedColumns.join(',')); + } + return Optional.some({ + cursor: out.cursor, + newRows: newElements.newRows, + newCells: newElements.newCells + }); + }); + }; + }; + var onPaste = function (warehouse, target) { + return cell(target.element).bind(function (cell) { + return findInWarehouse(warehouse, cell).map(function (details) { + var value = __assign(__assign({}, details), { + generators: target.generators, + clipboard: target.clipboard + }); + return value; + }); + }); + }; + var onPasteByEditor = function (warehouse, target) { + return extractCells(warehouse, target, always).map(function (cells) { + return { + cells: cells, + generators: target.generators, + clipboard: target.clipboard + }; + }); + }; + var onMergable = function (_warehouse, target) { + return target.mergable; + }; + var onUnmergable = function (_warehouse, target) { + return target.unmergable; + }; + var onCells = function (warehouse, target) { + return extractCells(warehouse, target, always); + }; + var onUnlockedCells = function (warehouse, target) { + return extractCells(warehouse, target, function (detail) { + return !detail.isLocked; + }); + }; + var isUnlockedTableCell = function (warehouse, cell) { + return findInWarehouse(warehouse, cell).exists(function (detail) { + return !detail.isLocked; + }); + }; + var allUnlocked = function (warehouse, cells) { + return forall(cells, function (cell) { + return isUnlockedTableCell(warehouse, cell); + }); + }; + var onUnlockedMergable = function (warehouse, target) { + return onMergable(warehouse, target).filter(function (mergeable) { + return allUnlocked(warehouse, mergeable.cells); + }); + }; + var onUnlockedUnmergable = function (warehouse, target) { + return onUnmergable(warehouse, target).filter(function (cells) { + return allUnlocked(warehouse, cells); + }); + }; + + var merge$2 = function (grid, bounds, comparator, substitution) { + var rows = extractGridDetails(grid).rows; + if (rows.length === 0) { + return grid; + } + for (var i = bounds.startRow; i <= bounds.finishRow; i++) { + for (var j = bounds.startCol; j <= bounds.finishCol; j++) { + var row = rows[i]; + var isLocked = getCell(row, j).isLocked; + mutateCell(row, j, elementnew(substitution(), false, isLocked)); + } + } + return grid; + }; + var unmerge = function (grid, target, comparator, substitution) { + var rows = extractGridDetails(grid).rows; + var first = true; + for (var i = 0; i < rows.length; i++) { + for (var j = 0; j < cellLength(rows[0]); j++) { + var row = rows[i]; + var currentCell = getCell(row, j); + var currentCellElm = currentCell.element; + var isToReplace = comparator(currentCellElm, target); + if (isToReplace === true && first === false) { + mutateCell(row, j, elementnew(substitution(), true, currentCell.isLocked)); + } else if (isToReplace === true) { + first = false; + } + } + } + return grid; + }; + var uniqueCells = function (row, comparator) { + return foldl(row, function (rest, cell) { + return exists(rest, function (currentCell) { + return comparator(currentCell.element, cell.element); + }) ? rest : rest.concat([cell]); + }, []); + }; + var splitCols = function (grid, index, comparator, substitution) { + if (index > 0 && index < grid[0].cells.length) { + each$2(grid, function (row) { + var prevCell = row.cells[index - 1]; + var current = row.cells[index]; + var isToReplace = comparator(current.element, prevCell.element); + if (isToReplace) { + mutateCell(row, index, elementnew(substitution(), true, current.isLocked)); + } + }); + } + return grid; + }; + var splitRows = function (grid, index, comparator, substitution) { + var rows = extractGridDetails(grid).rows; + if (index > 0 && index < rows.length) { + var rowPrevCells = rows[index - 1].cells; + var cells = uniqueCells(rowPrevCells, comparator); + each$2(cells, function (cell) { + var replacement = Optional.none(); + for (var i = index; i < rows.length; i++) { + var _loop_1 = function (j) { + var row = rows[i]; + var current = getCell(row, j); + var isToReplace = comparator(current.element, cell.element); + if (isToReplace) { + if (replacement.isNone()) { + replacement = Optional.some(substitution()); + } + replacement.each(function (sub) { + mutateCell(row, j, elementnew(sub, true, current.isLocked)); + }); + } + }; + for (var j = 0; j < cellLength(rows[0]); j++) { + _loop_1(j); + } + } + }); + } + return grid; + }; + + var value$1 = function (o) { + var or = function (_opt) { + return value$1(o); + }; + var orThunk = function (_f) { + return value$1(o); + }; + var map = function (f) { + return value$1(f(o)); + }; + var mapError = function (_f) { + return value$1(o); + }; + var each = function (f) { + f(o); + }; + var bind = function (f) { + return f(o); + }; + var fold = function (_, onValue) { + return onValue(o); + }; + var exists = function (f) { + return f(o); + }; + var forall = function (f) { + return f(o); + }; + var toOptional = function () { + return Optional.some(o); + }; + return { + isValue: always, + isError: never, + getOr: constant(o), + getOrThunk: constant(o), + getOrDie: constant(o), + or: or, + orThunk: orThunk, + fold: fold, + map: map, + mapError: mapError, + each: each, + bind: bind, + exists: exists, + forall: forall, + toOptional: toOptional + }; + }; + var error = function (message) { + var getOrThunk = function (f) { + return f(); + }; + var getOrDie = function () { + return die(String(message))(); + }; + var or = identity; + var orThunk = function (f) { + return f(); + }; + var map = function (_f) { + return error(message); + }; + var mapError = function (f) { + return error(f(message)); + }; + var bind = function (_f) { + return error(message); + }; + var fold = function (onError, _) { + return onError(message); + }; + return { + isValue: never, + isError: always, + getOr: identity, + getOrThunk: getOrThunk, + getOrDie: getOrDie, + or: or, + orThunk: orThunk, + fold: fold, + map: map, + mapError: mapError, + each: noop, + bind: bind, + exists: never, + forall: always, + toOptional: Optional.none + }; + }; + var fromOption = function (opt, err) { + return opt.fold(function () { + return error(err); + }, value$1); + }; + var Result = { + value: value$1, + error: error, + fromOption: fromOption + }; + + var measure = function (startAddress, gridA, gridB) { + if (startAddress.row >= gridA.length || startAddress.column > cellLength(gridA[0])) { + return Result.error('invalid start address out of table bounds, row: ' + startAddress.row + ', column: ' + startAddress.column); + } + var rowRemainder = gridA.slice(startAddress.row); + var colRemainder = rowRemainder[0].cells.slice(startAddress.column); + var colRequired = cellLength(gridB[0]); + var rowRequired = gridB.length; + return Result.value({ + rowDelta: rowRemainder.length - rowRequired, + colDelta: colRemainder.length - colRequired + }); + }; + var measureWidth = function (gridA, gridB) { + var colLengthA = cellLength(gridA[0]); + var colLengthB = cellLength(gridB[0]); + return { + rowDelta: 0, + colDelta: colLengthA - colLengthB + }; + }; + var measureHeight = function (gridA, gridB) { + var rowLengthA = gridA.length; + var rowLengthB = gridB.length; + return { + rowDelta: rowLengthA - rowLengthB, + colDelta: 0 + }; + }; + var generateElements = function (amount, row, generators, isLocked) { + var generator = row.section === 'colgroup' ? generators.col : generators.cell; + return range$1(amount, function (idx) { + return elementnew(generator(), true, isLocked(idx)); + }); + }; + var rowFill = function (grid, amount, generators, lockedColumns) { + var exampleRow = grid[grid.length - 1]; + return grid.concat(range$1(amount, function () { + var generator = exampleRow.section === 'colgroup' ? generators.colgroup : generators.row; + var row = clone$1(exampleRow, generator, identity); + var elements = generateElements(row.cells.length, row, generators, function (idx) { + return has$1(lockedColumns, idx.toString()); + }); + return setCells(row, elements); + })); + }; + var colFill = function (grid, amount, generators, startIndex) { + return map$1(grid, function (row) { + var newChildren = generateElements(amount, row, generators, never); + return addCells(row, startIndex, newChildren); + }); + }; + var lockedColFill = function (grid, generators, lockedColumns) { + return map$1(grid, function (row) { + return foldl(lockedColumns, function (acc, colNum) { + var newChild = generateElements(1, row, generators, always)[0]; + return addCell(acc, colNum, newChild); + }, row); + }); + }; + var tailor = function (gridA, delta, generators) { + var fillCols = delta.colDelta < 0 ? colFill : identity; + var fillRows = delta.rowDelta < 0 ? rowFill : identity; + var lockedColumns = getLockedColumnsFromGrid(gridA); + var gridWidth = cellLength(gridA[0]); + var isLastColLocked = exists(lockedColumns, function (locked) { + return locked === gridWidth - 1; + }); + var modifiedCols = fillCols(gridA, Math.abs(delta.colDelta), generators, isLastColLocked ? gridWidth - 1 : gridWidth); + var newLockedColumns = getLockedColumnsFromGrid(modifiedCols); + return fillRows(modifiedCols, Math.abs(delta.rowDelta), generators, mapToObject(newLockedColumns, always)); + }; + + var isSpanning = function (grid, row, col, comparator) { + var candidate = getCell(grid[row], col); + var matching = curry(comparator, candidate.element); + var currentRow = grid[row]; + return grid.length > 1 && cellLength(currentRow) > 1 && (col > 0 && matching(getCellElement(currentRow, col - 1)) || col < currentRow.cells.length - 1 && matching(getCellElement(currentRow, col + 1)) || row > 0 && matching(getCellElement(grid[row - 1], col)) || row < grid.length - 1 && matching(getCellElement(grid[row + 1], col))); + }; + var mergeTables = function (startAddress, gridA, gridB, generator, comparator, lockedColumns) { + var startRow = startAddress.row; + var startCol = startAddress.column; + var mergeHeight = gridB.length; + var mergeWidth = cellLength(gridB[0]); + var endRow = startRow + mergeHeight; + var endCol = startCol + mergeWidth + lockedColumns.length; + var lockedColumnObj = mapToObject(lockedColumns, always); + for (var r = startRow; r < endRow; r++) { + var skippedCol = 0; + for (var c = startCol; c < endCol; c++) { + if (lockedColumnObj[c]) { + skippedCol++; + continue; + } + if (isSpanning(gridA, r, c, comparator)) { + unmerge(gridA, getCellElement(gridA[r], c), comparator, generator.cell); + } + var gridBColIndex = c - startCol - skippedCol; + var newCell = getCell(gridB[r - startRow], gridBColIndex); + var newCellElm = newCell.element; + var replacement = generator.replace(newCellElm); + mutateCell(gridA[r], c, elementnew(replacement, true, newCell.isLocked)); + } + } + return gridA; + }; + var getValidStartAddress = function (currentStartAddress, grid, lockedColumns) { + var gridColLength = cellLength(grid[0]); + var adjustedRowAddress = extractGridDetails(grid).cols.length + currentStartAddress.row; + var possibleColAddresses = range$1(gridColLength - currentStartAddress.column, function (num) { + return num + currentStartAddress.column; + }); + var validColAddress = find$1(possibleColAddresses, function (num) { + return forall(lockedColumns, function (col) { + return col !== num; + }); + }).getOr(gridColLength - 1); + return { + row: adjustedRowAddress, + column: validColAddress + }; + }; + var getLockedColumnsWithinBounds = function (startAddress, grid, lockedColumns) { + return filter$2(lockedColumns, function (colNum) { + return colNum >= startAddress.column && colNum <= cellLength(grid[0]) + startAddress.column; + }); + }; + var merge$1 = function (startAddress, gridA, gridB, generator, comparator) { + var lockedColumns = getLockedColumnsFromGrid(gridA); + var validStartAddress = getValidStartAddress(startAddress, gridA, lockedColumns); + var gridBRows = extractGridDetails(gridB).rows; + var lockedColumnsWithinBounds = getLockedColumnsWithinBounds(validStartAddress, gridBRows, lockedColumns); + var result = measure(validStartAddress, gridA, gridBRows); + return result.map(function (diff) { + var delta = __assign(__assign({}, diff), { colDelta: diff.colDelta - lockedColumnsWithinBounds.length }); + var fittedGrid = tailor(gridA, delta, generator); + var newLockedColumns = getLockedColumnsFromGrid(fittedGrid); + var newLockedColumnsWithinBounds = getLockedColumnsWithinBounds(validStartAddress, gridBRows, newLockedColumns); + return mergeTables(validStartAddress, fittedGrid, gridBRows, generator, comparator, newLockedColumnsWithinBounds); + }); + }; + var insertCols = function (index, gridA, gridB, generator, comparator) { + splitCols(gridA, index, comparator, generator.cell); + var delta = measureHeight(gridB, gridA); + var fittedNewGrid = tailor(gridB, delta, generator); + var secondDelta = measureHeight(gridA, fittedNewGrid); + var fittedOldGrid = tailor(gridA, secondDelta, generator); + return map$1(fittedOldGrid, function (gridRow, i) { + return addCells(gridRow, index, fittedNewGrid[i].cells); + }); + }; + var insertRows = function (index, gridA, gridB, generator, comparator) { + splitRows(gridA, index, comparator, generator.cell); + var locked = getLockedColumnsFromGrid(gridA); + var diff = measureWidth(gridA, gridB); + var delta = __assign(__assign({}, diff), { colDelta: diff.colDelta - locked.length }); + var fittedOldGrid = tailor(gridA, delta, generator); + var _a = extractGridDetails(fittedOldGrid), oldCols = _a.cols, oldRows = _a.rows; + var newLocked = getLockedColumnsFromGrid(fittedOldGrid); + var secondDiff = measureWidth(gridB, gridA); + var secondDelta = __assign(__assign({}, secondDiff), { colDelta: secondDiff.colDelta + newLocked.length }); + var fittedGridB = lockedColFill(gridB, generator, newLocked); + var fittedNewGrid = tailor(fittedGridB, secondDelta, generator); + return oldCols.concat(oldRows.slice(0, index)).concat(fittedNewGrid).concat(oldRows.slice(index, oldRows.length)); + }; + + var cloneRow = function (row, cloneCell, comparator, substitution) { + return clone$1(row, function (elem) { + return substitution(elem, comparator); + }, cloneCell); + }; + var insertRowAt = function (grid, index, example, comparator, substitution) { + var _a = extractGridDetails(grid), rows = _a.rows, cols = _a.cols; + var before = rows.slice(0, index); + var after = rows.slice(index); + var newRow = cloneRow(rows[example], function (ex, c) { + var withinSpan = index > 0 && index < rows.length && comparator(getCellElement(rows[index - 1], c), getCellElement(rows[index], c)); + var ret = withinSpan ? getCell(rows[index], c) : elementnew(substitution(ex.element, comparator), true, ex.isLocked); + return ret; + }, comparator, substitution); + return cols.concat(before).concat([newRow]).concat(after); + }; + var getElementFor = function (row, column, section, withinSpan, example, comparator, substitution) { + if (section === 'colgroup' || !withinSpan) { + var cell = getCell(row, example); + return elementnew(substitution(cell.element, comparator), true, false); + } else { + return getCell(row, column); + } + }; + var insertColumnAt = function (grid, index, example, comparator, substitution) { + return map$1(grid, function (row) { + var withinSpan = index > 0 && index < cellLength(row) && comparator(getCellElement(row, index - 1), getCellElement(row, index)); + var sub = getElementFor(row, index, row.section, withinSpan, example, comparator, substitution); + return addCell(row, index, sub); + }); + }; + var deleteColumnsAt = function (grid, columns) { + return bind$2(grid, function (row) { + var existingCells = row.cells; + var cells = foldr(columns, function (acc, column) { + return column >= 0 && column < acc.length ? acc.slice(0, column).concat(acc.slice(column + 1)) : acc; + }, existingCells); + return cells.length > 0 ? [rowcells(row.element, cells, row.section, row.isNew)] : []; + }); + }; + var deleteRowsAt = function (grid, start, finish) { + var _a = extractGridDetails(grid), rows = _a.rows, cols = _a.cols; + return cols.concat(rows.slice(0, start)).concat(rows.slice(finish + 1)); + }; + + var notInStartRow = function (grid, rowIndex, colIndex, comparator) { + return getCellElement(grid[rowIndex], colIndex) !== undefined && (rowIndex > 0 && comparator(getCellElement(grid[rowIndex - 1], colIndex), getCellElement(grid[rowIndex], colIndex))); + }; + var notInStartColumn = function (row, index, comparator) { + return index > 0 && comparator(getCellElement(row, index - 1), getCellElement(row, index)); + }; + var isDuplicatedCell = function (grid, rowIndex, colIndex, comparator) { + return notInStartRow(grid, rowIndex, colIndex, comparator) || notInStartColumn(grid[rowIndex], colIndex, comparator); + }; + var rowReplacerPredicate = function (targetRow, columnHeaders) { + var entireTableIsHeader = forall(columnHeaders, identity) && isHeaderCells(targetRow.cells); + return entireTableIsHeader ? always : function (cell, _rowIndex, colIndex) { + var type = name(cell.element); + return !(type === 'th' && columnHeaders[colIndex]); + }; + }; + var columnReplacePredicate = function (targetColumn, rowHeaders) { + var entireTableIsHeader = forall(rowHeaders, identity) && isHeaderCells(targetColumn); + return entireTableIsHeader ? always : function (cell, rowIndex, _colIndex) { + var type = name(cell.element); + return !(type === 'th' && rowHeaders[rowIndex]); + }; + }; + var determineScope = function (applyScope, element, newScope, isInHeader) { + var hasSpan = function (scope) { + return scope === 'row' ? hasRowspan(element) : hasColspan(element); + }; + var getScope = function (scope) { + return hasSpan(scope) ? scope + 'group' : scope; + }; + if (applyScope) { + return isHeaderCell(element) ? getScope(newScope) : null; + } else if (isInHeader && isHeaderCell(element)) { + var oppositeScope = newScope === 'row' ? 'col' : 'row'; + return getScope(oppositeScope); + } else { + return null; + } + }; + var rowScopeGenerator = function (applyScope, columnHeaders) { + return function (cell, rowIndex, columnIndex) { + return Optional.some(determineScope(applyScope, cell.element, 'col', columnHeaders[columnIndex])); + }; + }; + var columnScopeGenerator = function (applyScope, rowHeaders) { + return function (cell, rowIndex) { + return Optional.some(determineScope(applyScope, cell.element, 'row', rowHeaders[rowIndex])); + }; + }; + var replace = function (cell, comparator, substitute) { + return elementnew(substitute(cell.element, comparator), true, cell.isLocked); + }; + var replaceIn = function (grid, targets, comparator, substitute, replacer, genScope, shouldReplace) { + var isTarget = function (cell) { + return exists(targets, function (target) { + return comparator(cell.element, target.element); + }); + }; + return map$1(grid, function (row, rowIndex) { + return mapCells(row, function (cell, colIndex) { + if (isTarget(cell)) { + var newCell_1 = shouldReplace(cell, rowIndex, colIndex) ? replacer(cell, comparator, substitute) : cell; + genScope(newCell_1, rowIndex, colIndex).each(function (scope) { + setOptions(newCell_1.element, { scope: Optional.from(scope) }); + }); + return newCell_1; + } else { + return cell; + } + }); + }); + }; + var getColumnCells = function (rows, columnIndex, comparator) { + return bind$2(rows, function (row, i) { + return isDuplicatedCell(rows, i, columnIndex, comparator) ? [] : [getCell(row, columnIndex)]; + }); + }; + var getRowCells = function (rows, rowIndex, comparator) { + var targetRow = rows[rowIndex]; + return bind$2(targetRow.cells, function (item, i) { + return isDuplicatedCell(rows, rowIndex, i, comparator) ? [] : [item]; + }); + }; + var replaceColumns = function (grid, indexes, applyScope, comparator, substitution) { + var rows = extractGridDetails(grid).rows; + var targets = bind$2(indexes, function (index) { + return getColumnCells(rows, index, comparator); + }); + var rowHeaders = map$1(grid, function (row) { + return isHeaderCells(row.cells); + }); + var shouldReplaceCell = columnReplacePredicate(targets, rowHeaders); + var scopeGenerator = columnScopeGenerator(applyScope, rowHeaders); + return replaceIn(grid, targets, comparator, substitution, replace, scopeGenerator, shouldReplaceCell); + }; + var replaceRows = function (grid, indexes, section, applyScope, comparator, substitution, tableSection) { + var _a = extractGridDetails(grid), cols = _a.cols, rows = _a.rows; + var targetRow = rows[indexes[0]]; + var targets = bind$2(indexes, function (index) { + return getRowCells(rows, index, comparator); + }); + var columnHeaders = map$1(targetRow.cells, function (_cell, index) { + return isHeaderCells(getColumnCells(rows, index, comparator)); + }); + var newRows = __spreadArray([], rows, true); + each$2(indexes, function (index) { + newRows[index] = tableSection.transformRow(rows[index], section); + }); + var newGrid = cols.concat(newRows); + var shouldReplaceCell = rowReplacerPredicate(targetRow, columnHeaders); + var scopeGenerator = rowScopeGenerator(applyScope, columnHeaders); + return replaceIn(newGrid, targets, comparator, substitution, tableSection.transformCell, scopeGenerator, shouldReplaceCell); + }; + var replaceCells = function (grid, details, comparator, substitution) { + var rows = extractGridDetails(grid).rows; + var targetCells = map$1(details, function (detail) { + return getCell(rows[detail.row], detail.column); + }); + return replaceIn(grid, targetCells, comparator, substitution, replace, Optional.none, always); + }; + + var uniqueColumns = function (details) { + var uniqueCheck = function (rest, detail) { + var columnExists = exists(rest, function (currentDetail) { + return currentDetail.column === detail.column; + }); + return columnExists ? rest : rest.concat([detail]); + }; + return foldl(details, uniqueCheck, []).sort(function (detailA, detailB) { + return detailA.column - detailB.column; + }); + }; + + var isCol = isTag('col'); + var isColgroup = isTag('colgroup'); + var isRow$1 = function (element) { + return name(element) === 'tr' || isColgroup(element); + }; + var elementToData = function (element) { + var colspan = getAttrValue(element, 'colspan', 1); + var rowspan = getAttrValue(element, 'rowspan', 1); + return { + element: element, + colspan: colspan, + rowspan: rowspan + }; + }; + var modification = function (generators, toData) { + if (toData === void 0) { + toData = elementToData; + } + var nuCell = function (data) { + return isCol(data.element) ? generators.col(data) : generators.cell(data); + }; + var nuRow = function (data) { + return isColgroup(data.element) ? generators.colgroup(data) : generators.row(data); + }; + var add = function (element) { + if (isRow$1(element)) { + return nuRow({ element: element }); + } else { + var replacement = nuCell(toData(element)); + recent = Optional.some({ + item: element, + replacement: replacement + }); + return replacement; + } + }; + var recent = Optional.none(); + var getOrInit = function (element, comparator) { + return recent.fold(function () { + return add(element); + }, function (p) { + return comparator(element, p.item) ? p.replacement : add(element); + }); + }; + return { getOrInit: getOrInit }; + }; + var transform = function (tag) { + return function (generators) { + var list = []; + var find = function (element, comparator) { + return find$1(list, function (x) { + return comparator(x.item, element); + }); + }; + var makeNew = function (element) { + var attrs = tag === 'td' ? { scope: null } : {}; + var cell = generators.replace(element, tag, attrs); + list.push({ + item: element, + sub: cell + }); + return cell; + }; + var replaceOrInit = function (element, comparator) { + if (isRow$1(element) || isCol(element)) { + return element; + } else { + return find(element, comparator).fold(function () { + return makeNew(element); + }, function (p) { + return comparator(element, p.item) ? p.sub : makeNew(element); + }); + } + }; + return { replaceOrInit: replaceOrInit }; + }; + }; + var getScopeAttribute = function (cell) { + return getOpt(cell, 'scope').map(function (attribute) { + return attribute.substr(0, 3); + }); + }; + var merging = function (generators) { + var unmerge = function (cell) { + var scope = getScopeAttribute(cell); + scope.each(function (attribute) { + return set$2(cell, 'scope', attribute); + }); + return function () { + var raw = generators.cell({ + element: cell, + colspan: 1, + rowspan: 1 + }); + remove$6(raw, 'width'); + remove$6(cell, 'width'); + scope.each(function (attribute) { + return set$2(raw, 'scope', attribute); + }); + return raw; + }; + }; + var merge = function (cells) { + var getScopeProperty = function () { + var stringAttributes = cat(map$1(cells, getScopeAttribute)); + if (stringAttributes.length === 0) { + return Optional.none(); + } else { + var baseScope_1 = stringAttributes[0]; + var scopes_1 = [ + 'row', + 'col' + ]; + var isMixed = exists(stringAttributes, function (attribute) { + return attribute !== baseScope_1 && contains$2(scopes_1, attribute); + }); + return isMixed ? Optional.none() : Optional.from(baseScope_1); + } + }; + remove$6(cells[0], 'width'); + getScopeProperty().fold(function () { + return remove$7(cells[0], 'scope'); + }, function (attribute) { + return set$2(cells[0], 'scope', attribute + 'group'); + }); + return constant(cells[0]); + }; + return { + unmerge: unmerge, + merge: merge + }; + }; + var Generators = { + modification: modification, + transform: transform, + merging: merging + }; + + var blockList = [ + 'body', + 'p', + 'div', + 'article', + 'aside', + 'figcaption', + 'figure', + 'footer', + 'header', + 'nav', + 'section', + 'ol', + 'ul', + 'table', + 'thead', + 'tfoot', + 'tbody', + 'caption', + 'tr', + 'td', + 'th', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'blockquote', + 'pre', + 'address' + ]; + var isList$1 = function (universe, item) { + var tagName = universe.property().name(item); + return contains$2([ + 'ol', + 'ul' + ], tagName); + }; + var isBlock$1 = function (universe, item) { + var tagName = universe.property().name(item); + return contains$2(blockList, tagName); + }; + var isEmptyTag$1 = function (universe, item) { + return contains$2([ + 'br', + 'img', + 'hr', + 'input' + ], universe.property().name(item)); + }; + + var universe$1 = DomUniverse(); + var isBlock = function (element) { + return isBlock$1(universe$1, element); + }; + var isList = function (element) { + return isList$1(universe$1, element); + }; + var isEmptyTag = function (element) { + return isEmptyTag$1(universe$1, element); + }; + + var merge = function (cells) { + var isBr = function (el) { + return name(el) === 'br'; + }; + var advancedBr = function (children) { + return forall(children, function (c) { + return isBr(c) || isText(c) && get$9(c).trim().length === 0; + }); + }; + var isListItem = function (el) { + return name(el) === 'li' || ancestor$2(el, isList).isSome(); + }; + var siblingIsBlock = function (el) { + return nextSibling(el).map(function (rightSibling) { + if (isBlock(rightSibling)) { + return true; + } + if (isEmptyTag(rightSibling)) { + return name(rightSibling) === 'img' ? false : true; + } + return false; + }).getOr(false); + }; + var markCell = function (cell) { + return last$1(cell).bind(function (rightEdge) { + var rightSiblingIsBlock = siblingIsBlock(rightEdge); + return parent(rightEdge).map(function (parent) { + return rightSiblingIsBlock === true || isListItem(parent) || isBr(rightEdge) || isBlock(parent) && !eq$1(cell, parent) ? [] : [SugarElement.fromTag('br')]; + }); + }).getOr([]); + }; + var markContent = function () { + var content = bind$2(cells, function (cell) { + var children = children$3(cell); + return advancedBr(children) ? [] : children.concat(markCell(cell)); + }); + return content.length === 0 ? [SugarElement.fromTag('br')] : content; + }; + var contents = markContent(); + empty(cells[0]); + append(cells[0], contents); + }; + + var isEditable = function (elem) { + return isEditable$1(elem, true); + }; + var prune = function (table) { + var cells = cells$1(table); + if (cells.length === 0) { + remove$5(table); + } + }; + var outcome = function (grid, cursor) { + return { + grid: grid, + cursor: cursor + }; + }; + var findEditableCursorPosition = function (rows) { + return findMap(rows, function (row) { + return findMap(row.cells, function (cell) { + var elem = cell.element; + return someIf(isEditable(elem), elem); + }); + }); + }; + var elementFromGrid = function (grid, row, column) { + var _a, _b; + var rows = extractGridDetails(grid).rows; + return Optional.from((_b = (_a = rows[row]) === null || _a === void 0 ? void 0 : _a.cells[column]) === null || _b === void 0 ? void 0 : _b.element).filter(isEditable).orThunk(function () { + return findEditableCursorPosition(rows); + }); + }; + var bundle = function (grid, row, column) { + var cursorElement = elementFromGrid(grid, row, column); + return outcome(grid, cursorElement); + }; + var uniqueRows = function (details) { + var rowCompilation = function (rest, detail) { + var rowExists = exists(rest, function (currentDetail) { + return currentDetail.row === detail.row; + }); + return rowExists ? rest : rest.concat([detail]); + }; + return foldl(details, rowCompilation, []).sort(function (detailA, detailB) { + return detailA.row - detailB.row; + }); + }; + var opInsertRowsBefore = function (grid, details, comparator, genWrappers) { + var targetIndex = details[0].row; + var rows = uniqueRows(details); + var newGrid = foldr(rows, function (acc, row) { + var newG = insertRowAt(acc.grid, targetIndex, row.row + acc.delta, comparator, genWrappers.getOrInit); + return { + grid: newG, + delta: acc.delta + 1 + }; + }, { + grid: grid, + delta: 0 + }).grid; + return bundle(newGrid, targetIndex, details[0].column); + }; + var opInsertRowsAfter = function (grid, details, comparator, genWrappers) { + var rows = uniqueRows(details); + var target = rows[rows.length - 1]; + var targetIndex = target.row + target.rowspan; + var newGrid = foldr(rows, function (newG, row) { + return insertRowAt(newG, targetIndex, row.row, comparator, genWrappers.getOrInit); + }, grid); + return bundle(newGrid, targetIndex, details[0].column); + }; + var opInsertColumnsBefore = function (grid, extractDetail, comparator, genWrappers) { + var details = extractDetail.details; + var columns = uniqueColumns(details); + var targetIndex = columns[0].column; + var newGrid = foldr(columns, function (acc, col) { + var newG = insertColumnAt(acc.grid, targetIndex, col.column + acc.delta, comparator, genWrappers.getOrInit); + return { + grid: newG, + delta: acc.delta + 1 + }; + }, { + grid: grid, + delta: 0 + }).grid; + return bundle(newGrid, details[0].row, targetIndex); + }; + var opInsertColumnsAfter = function (grid, extractDetail, comparator, genWrappers) { + var details = extractDetail.details; + var target = details[details.length - 1]; + var targetIndex = target.column + target.colspan; + var columns = uniqueColumns(details); + var newGrid = foldr(columns, function (newG, col) { + return insertColumnAt(newG, targetIndex, col.column, comparator, genWrappers.getOrInit); + }, grid); + return bundle(newGrid, details[0].row, targetIndex); + }; + var opMakeColumnsHeader = function (initialGrid, details, comparator, genWrappers) { + var columns = uniqueColumns(details); + var columnIndexes = map$1(columns, function (detail) { + return detail.column; + }); + var newGrid = replaceColumns(initialGrid, columnIndexes, true, comparator, genWrappers.replaceOrInit); + return bundle(newGrid, details[0].row, details[0].column); + }; + var opMakeCellsHeader = function (initialGrid, details, comparator, genWrappers) { + var newGrid = replaceCells(initialGrid, details, comparator, genWrappers.replaceOrInit); + return bundle(newGrid, details[0].row, details[0].column); + }; + var opUnmakeColumnsHeader = function (initialGrid, details, comparator, genWrappers) { + var columns = uniqueColumns(details); + var columnIndexes = map$1(columns, function (detail) { + return detail.column; + }); + var newGrid = replaceColumns(initialGrid, columnIndexes, false, comparator, genWrappers.replaceOrInit); + return bundle(newGrid, details[0].row, details[0].column); + }; + var opUnmakeCellsHeader = function (initialGrid, details, comparator, genWrappers) { + var newGrid = replaceCells(initialGrid, details, comparator, genWrappers.replaceOrInit); + return bundle(newGrid, details[0].row, details[0].column); + }; + var makeRowsSection = function (section, applyScope) { + return function (initialGrid, details, comparator, genWrappers, tableSection) { + var rows = uniqueRows(details); + var rowIndexes = map$1(rows, function (detail) { + return detail.row; + }); + var newGrid = replaceRows(initialGrid, rowIndexes, section, applyScope, comparator, genWrappers.replaceOrInit, tableSection); + return bundle(newGrid, details[0].row, details[0].column); + }; + }; + var opMakeRowsHeader = makeRowsSection('thead', true); + var opMakeRowsBody = makeRowsSection('tbody', false); + var opMakeRowsFooter = makeRowsSection('tfoot', false); + var opEraseColumns = function (grid, extractDetail, _comparator, _genWrappers) { + var columns = uniqueColumns(extractDetail.details); + var newGrid = deleteColumnsAt(grid, map$1(columns, function (column) { + return column.column; + })); + var maxColIndex = newGrid.length > 0 ? newGrid[0].cells.length - 1 : 0; + return bundle(newGrid, columns[0].row, Math.min(columns[0].column, maxColIndex)); + }; + var opEraseRows = function (grid, details, _comparator, _genWrappers) { + var rows = uniqueRows(details); + var newGrid = deleteRowsAt(grid, rows[0].row, rows[rows.length - 1].row); + var maxRowIndex = newGrid.length > 0 ? newGrid.length - 1 : 0; + return bundle(newGrid, Math.min(details[0].row, maxRowIndex), details[0].column); + }; + var opMergeCells = function (grid, mergable, comparator, genWrappers) { + var cells = mergable.cells; + merge(cells); + var newGrid = merge$2(grid, mergable.bounds, comparator, genWrappers.merge(cells)); + return outcome(newGrid, Optional.from(cells[0])); + }; + var opUnmergeCells = function (grid, unmergable, comparator, genWrappers) { + var unmerge$1 = function (b, cell) { + return unmerge(b, cell, comparator, genWrappers.unmerge(cell)); + }; + var newGrid = foldr(unmergable, unmerge$1, grid); + return outcome(newGrid, Optional.from(unmergable[0])); + }; + var opPasteCells = function (grid, pasteDetails, comparator, _genWrappers) { + var gridify = function (table, generators) { + var wh = Warehouse.fromTable(table); + return toGrid(wh, generators, true); + }; + var gridB = gridify(pasteDetails.clipboard, pasteDetails.generators); + var startAddress = address(pasteDetails.row, pasteDetails.column); + var mergedGrid = merge$1(startAddress, grid, gridB, pasteDetails.generators, comparator); + return mergedGrid.fold(function () { + return outcome(grid, Optional.some(pasteDetails.element)); + }, function (newGrid) { + return bundle(newGrid, pasteDetails.row, pasteDetails.column); + }); + }; + var gridifyRows = function (rows, generators, context) { + var pasteDetails = fromPastedRows(rows, context.section); + var wh = Warehouse.generate(pasteDetails); + return toGrid(wh, generators, true); + }; + var opPasteColsBefore = function (grid, pasteDetails, comparator, _genWrappers) { + var rows = extractGridDetails(grid).rows; + var index = pasteDetails.cells[0].column; + var context = rows[pasteDetails.cells[0].row]; + var gridB = gridifyRows(pasteDetails.clipboard, pasteDetails.generators, context); + var mergedGrid = insertCols(index, grid, gridB, pasteDetails.generators, comparator); + return bundle(mergedGrid, pasteDetails.cells[0].row, pasteDetails.cells[0].column); + }; + var opPasteColsAfter = function (grid, pasteDetails, comparator, _genWrappers) { + var rows = extractGridDetails(grid).rows; + var index = pasteDetails.cells[pasteDetails.cells.length - 1].column + pasteDetails.cells[pasteDetails.cells.length - 1].colspan; + var context = rows[pasteDetails.cells[0].row]; + var gridB = gridifyRows(pasteDetails.clipboard, pasteDetails.generators, context); + var mergedGrid = insertCols(index, grid, gridB, pasteDetails.generators, comparator); + return bundle(mergedGrid, pasteDetails.cells[0].row, pasteDetails.cells[0].column); + }; + var opPasteRowsBefore = function (grid, pasteDetails, comparator, _genWrappers) { + var rows = extractGridDetails(grid).rows; + var index = pasteDetails.cells[0].row; + var context = rows[index]; + var gridB = gridifyRows(pasteDetails.clipboard, pasteDetails.generators, context); + var mergedGrid = insertRows(index, grid, gridB, pasteDetails.generators, comparator); + return bundle(mergedGrid, pasteDetails.cells[0].row, pasteDetails.cells[0].column); + }; + var opPasteRowsAfter = function (grid, pasteDetails, comparator, _genWrappers) { + var rows = extractGridDetails(grid).rows; + var index = pasteDetails.cells[pasteDetails.cells.length - 1].row + pasteDetails.cells[pasteDetails.cells.length - 1].rowspan; + var context = rows[pasteDetails.cells[0].row]; + var gridB = gridifyRows(pasteDetails.clipboard, pasteDetails.generators, context); + var mergedGrid = insertRows(index, grid, gridB, pasteDetails.generators, comparator); + return bundle(mergedGrid, pasteDetails.cells[0].row, pasteDetails.cells[0].column); + }; + var opGetColumnsType = function (table, target) { + var house = Warehouse.fromTable(table); + var details = onCells(house, target); + return details.bind(function (selectedCells) { + var lastSelectedCell = selectedCells[selectedCells.length - 1]; + var minColRange = selectedCells[0].column; + var maxColRange = lastSelectedCell.column + lastSelectedCell.colspan; + var selectedColumnCells = flatten$1(map$1(house.all, function (row) { + return filter$2(row.cells, function (cell) { + return cell.column >= minColRange && cell.column < maxColRange; + }); + })); + return findCommonCellType(selectedColumnCells); + }).getOr(''); + }; + var opGetCellsType = function (table, target) { + var house = Warehouse.fromTable(table); + var details = onCells(house, target); + return details.bind(findCommonCellType).getOr(''); + }; + var opGetRowsType = function (table, target) { + var house = Warehouse.fromTable(table); + var details = onCells(house, target); + return details.bind(function (selectedCells) { + var lastSelectedCell = selectedCells[selectedCells.length - 1]; + var minRowRange = selectedCells[0].row; + var maxRowRange = lastSelectedCell.row + lastSelectedCell.rowspan; + var selectedRows = house.all.slice(minRowRange, maxRowRange); + return findCommonRowType(selectedRows); + }).getOr(''); + }; + var resize = function (table, list, details, behaviours) { + return adjustWidthTo(table, list, details, behaviours.sizing); + }; + var adjustAndRedistributeWidths = function (table, list, details, behaviours) { + return adjustAndRedistributeWidths$1(table, list, details, behaviours.sizing, behaviours.resize); + }; + var firstColumnIsLocked = function (_warehouse, details) { + return exists(details, function (detail) { + return detail.column === 0 && detail.isLocked; + }); + }; + var lastColumnIsLocked = function (warehouse, details) { + return exists(details, function (detail) { + return detail.column + detail.colspan >= warehouse.grid.columns && detail.isLocked; + }); + }; + var getColumnsWidth = function (warehouse, details) { + var columns$1 = columns(warehouse); + var uniqueCols = uniqueColumns(details); + return foldl(uniqueCols, function (acc, detail) { + var column = columns$1[detail.column]; + var colWidth = column.map(getOuter$2).getOr(0); + return acc + colWidth; + }, 0); + }; + var insertColumnsExtractor = function (before) { + return function (warehouse, target) { + return onCells(warehouse, target).filter(function (details) { + var checkLocked = before ? firstColumnIsLocked : lastColumnIsLocked; + return !checkLocked(warehouse, details); + }).map(function (details) { + return { + details: details, + pixelDelta: getColumnsWidth(warehouse, details) + }; + }); + }; + }; + var eraseColumnsExtractor = function (warehouse, target) { + return onUnlockedCells(warehouse, target).map(function (details) { + return { + details: details, + pixelDelta: -getColumnsWidth(warehouse, details) + }; + }); + }; + var pasteColumnsExtractor = function (before) { + return function (warehouse, target) { + return onPasteByEditor(warehouse, target).filter(function (details) { + var checkLocked = before ? firstColumnIsLocked : lastColumnIsLocked; + return !checkLocked(warehouse, details.cells); + }); + }; + }; + var headerCellGenerator = Generators.transform('th'); + var bodyCellGenerator = Generators.transform('td'); + var insertRowsBefore = run(opInsertRowsBefore, onCells, noop, noop, Generators.modification); + var insertRowsAfter = run(opInsertRowsAfter, onCells, noop, noop, Generators.modification); + var insertColumnsBefore = run(opInsertColumnsBefore, insertColumnsExtractor(true), adjustAndRedistributeWidths, noop, Generators.modification); + var insertColumnsAfter = run(opInsertColumnsAfter, insertColumnsExtractor(false), adjustAndRedistributeWidths, noop, Generators.modification); + var eraseColumns = run(opEraseColumns, eraseColumnsExtractor, adjustAndRedistributeWidths, prune, Generators.modification); + var eraseRows = run(opEraseRows, onCells, noop, prune, Generators.modification); + var makeColumnsHeader = run(opMakeColumnsHeader, onUnlockedCells, noop, noop, headerCellGenerator); + var unmakeColumnsHeader = run(opUnmakeColumnsHeader, onUnlockedCells, noop, noop, bodyCellGenerator); + var makeRowsHeader = run(opMakeRowsHeader, onUnlockedCells, noop, noop, headerCellGenerator); + var makeRowsBody = run(opMakeRowsBody, onUnlockedCells, noop, noop, bodyCellGenerator); + var makeRowsFooter = run(opMakeRowsFooter, onUnlockedCells, noop, noop, bodyCellGenerator); + var makeCellsHeader = run(opMakeCellsHeader, onUnlockedCells, noop, noop, headerCellGenerator); + var unmakeCellsHeader = run(opUnmakeCellsHeader, onUnlockedCells, noop, noop, bodyCellGenerator); + var mergeCells = run(opMergeCells, onUnlockedMergable, resize, noop, Generators.merging); + var unmergeCells = run(opUnmergeCells, onUnlockedUnmergable, resize, noop, Generators.merging); + var pasteCells = run(opPasteCells, onPaste, resize, noop, Generators.modification); + var pasteColsBefore = run(opPasteColsBefore, pasteColumnsExtractor(true), noop, noop, Generators.modification); + var pasteColsAfter = run(opPasteColsAfter, pasteColumnsExtractor(false), noop, noop, Generators.modification); + var pasteRowsBefore = run(opPasteRowsBefore, onPasteByEditor, noop, noop, Generators.modification); + var pasteRowsAfter = run(opPasteRowsAfter, onPasteByEditor, noop, noop, Generators.modification); + var getColumnsType = opGetColumnsType; + var getCellsType = opGetCellsType; + var getRowsType = opGetRowsType; + + var TableActions = function (editor, cellSelection, lazyWire) { + var isTableBody = function (editor) { + return name(getBody(editor)) === 'table'; + }; + var lastRowGuard = function (table) { + return isTableBody(editor) === false || getGridSize(table).rows > 1; + }; + var lastColumnGuard = function (table) { + return isTableBody(editor) === false || getGridSize(table).columns > 1; + }; + var cloneFormats = getCloneElements(editor); + var colMutationOp = isResizeTableColumnResizing(editor) ? noop : halve; + var getTableSectionType = function (table) { + switch (getTableHeaderType(editor)) { + case 'section': + return TableSection.section(); + case 'sectionCells': + return TableSection.sectionCells(); + case 'cells': + return TableSection.cells(); + default: + return TableSection.getTableSectionType(table, 'section'); + } + }; + var setSelectionFromAction = function (table, result) { + return result.cursor.fold(function () { + var cells = cells$1(table); + return head(cells).filter(inBody).map(function (firstCell) { + cellSelection.clear(table); + var rng = editor.dom.createRng(); + rng.selectNode(firstCell.dom); + editor.selection.setRng(rng); + set$2(firstCell, 'data-mce-selected', '1'); + return rng; + }); + }, function (cell) { + var des = freefallRtl(cell); + var rng = editor.dom.createRng(); + rng.setStart(des.element.dom, des.offset); + rng.setEnd(des.element.dom, des.offset); + editor.selection.setRng(rng); + cellSelection.clear(table); + return Optional.some(rng); + }); + }; + var execute = function (operation, guard, mutate, lazyWire, effect) { + return function (table, target, noEvents) { + if (noEvents === void 0) { + noEvents = false; + } + removeDataStyle(table); + var wire = lazyWire(); + var doc = SugarElement.fromDom(editor.getDoc()); + var generators = cellOperations(mutate, doc, cloneFormats); + var behaviours = { + sizing: get$4(editor, table), + resize: isResizeTableColumnResizing(editor) ? resizeTable() : preserveTable(), + section: getTableSectionType(table) + }; + return guard(table) ? operation(wire, table, target, generators, behaviours).bind(function (result) { + each$2(result.newRows, function (row) { + fireNewRow(editor, row.dom); + }); + each$2(result.newCells, function (cell) { + fireNewCell(editor, cell.dom); + }); + var range = setSelectionFromAction(table, result); + if (inBody(table)) { + removeDataStyle(table); + if (!noEvents) { + fireTableModified(editor, table.dom, effect); + } + } + return range.map(function (rng) { + return { + rng: rng, + effect: effect + }; + }); + }) : Optional.none(); + }; + }; + var deleteRow = execute(eraseRows, lastRowGuard, noop, lazyWire, structureModified); + var deleteColumn = execute(eraseColumns, lastColumnGuard, noop, lazyWire, structureModified); + var insertRowsBefore$1 = execute(insertRowsBefore, always, noop, lazyWire, structureModified); + var insertRowsAfter$1 = execute(insertRowsAfter, always, noop, lazyWire, structureModified); + var insertColumnsBefore$1 = execute(insertColumnsBefore, always, colMutationOp, lazyWire, structureModified); + var insertColumnsAfter$1 = execute(insertColumnsAfter, always, colMutationOp, lazyWire, structureModified); + var mergeCells$1 = execute(mergeCells, always, noop, lazyWire, structureModified); + var unmergeCells$1 = execute(unmergeCells, always, noop, lazyWire, structureModified); + var pasteColsBefore$1 = execute(pasteColsBefore, always, noop, lazyWire, structureModified); + var pasteColsAfter$1 = execute(pasteColsAfter, always, noop, lazyWire, structureModified); + var pasteRowsBefore$1 = execute(pasteRowsBefore, always, noop, lazyWire, structureModified); + var pasteRowsAfter$1 = execute(pasteRowsAfter, always, noop, lazyWire, structureModified); + var pasteCells$1 = execute(pasteCells, always, noop, lazyWire, styleAndStructureModified); + var makeCellsHeader$1 = execute(makeCellsHeader, always, noop, lazyWire, structureModified); + var unmakeCellsHeader$1 = execute(unmakeCellsHeader, always, noop, lazyWire, structureModified); + var makeColumnsHeader$1 = execute(makeColumnsHeader, always, noop, lazyWire, structureModified); + var unmakeColumnsHeader$1 = execute(unmakeColumnsHeader, always, noop, lazyWire, structureModified); + var makeRowsHeader$1 = execute(makeRowsHeader, always, noop, lazyWire, structureModified); + var makeRowsBody$1 = execute(makeRowsBody, always, noop, lazyWire, structureModified); + var makeRowsFooter$1 = execute(makeRowsFooter, always, noop, lazyWire, structureModified); + var getTableCellType = getCellsType; + var getTableColType = getColumnsType; + var getTableRowType = getRowsType; + return { + deleteRow: deleteRow, + deleteColumn: deleteColumn, + insertRowsBefore: insertRowsBefore$1, + insertRowsAfter: insertRowsAfter$1, + insertColumnsBefore: insertColumnsBefore$1, + insertColumnsAfter: insertColumnsAfter$1, + mergeCells: mergeCells$1, + unmergeCells: unmergeCells$1, + pasteColsBefore: pasteColsBefore$1, + pasteColsAfter: pasteColsAfter$1, + pasteRowsBefore: pasteRowsBefore$1, + pasteRowsAfter: pasteRowsAfter$1, + pasteCells: pasteCells$1, + makeCellsHeader: makeCellsHeader$1, + unmakeCellsHeader: unmakeCellsHeader$1, + makeColumnsHeader: makeColumnsHeader$1, + unmakeColumnsHeader: unmakeColumnsHeader$1, + makeRowsHeader: makeRowsHeader$1, + makeRowsBody: makeRowsBody$1, + makeRowsFooter: makeRowsFooter$1, + getTableRowType: getTableRowType, + getTableCellType: getTableCellType, + getTableColType: getTableColType + }; + }; + + var DefaultRenderOptions = { + styles: { + 'border-collapse': 'collapse', + 'width': '100%' + }, + attributes: { border: '1' }, + colGroups: false + }; + var tableHeaderCell = function () { + return SugarElement.fromTag('th'); + }; + var tableCell = function () { + return SugarElement.fromTag('td'); + }; + var tableColumn = function () { + return SugarElement.fromTag('col'); + }; + var createRow = function (columns, rowHeaders, columnHeaders, rowIndex) { + var tr = SugarElement.fromTag('tr'); + for (var j = 0; j < columns; j++) { + var td = rowIndex < rowHeaders || j < columnHeaders ? tableHeaderCell() : tableCell(); + if (j < columnHeaders) { + set$2(td, 'scope', 'row'); + } + if (rowIndex < rowHeaders) { + set$2(td, 'scope', 'col'); + } + append$1(td, SugarElement.fromTag('br')); + append$1(tr, td); + } + return tr; + }; + var createGroupRow = function (columns) { + var columnGroup = SugarElement.fromTag('colgroup'); + range$1(columns, function () { + return append$1(columnGroup, tableColumn()); + }); + return columnGroup; + }; + var createRows = function (rows, columns, rowHeaders, columnHeaders) { + return range$1(rows, function (r) { + return createRow(columns, rowHeaders, columnHeaders, r); + }); + }; + var render = function (rows, columns, rowHeaders, columnHeaders, headerType, renderOpts) { + if (renderOpts === void 0) { + renderOpts = DefaultRenderOptions; + } + var table = SugarElement.fromTag('table'); + var rowHeadersGoInThead = headerType !== 'cells'; + setAll(table, renderOpts.styles); + setAll$1(table, renderOpts.attributes); + if (renderOpts.colGroups) { + append$1(table, createGroupRow(columns)); + } + var actualRowHeaders = Math.min(rows, rowHeaders); + if (rowHeadersGoInThead && rowHeaders > 0) { + var thead = SugarElement.fromTag('thead'); + append$1(table, thead); + var theadRowHeaders = headerType === 'sectionCells' ? actualRowHeaders : 0; + var theadRows = createRows(rowHeaders, columns, theadRowHeaders, columnHeaders); + append(thead, theadRows); + } + var tbody = SugarElement.fromTag('tbody'); + append$1(table, tbody); + var numRows = rowHeadersGoInThead ? rows - actualRowHeaders : rows; + var numRowHeaders = rowHeadersGoInThead ? 0 : rowHeaders; + var tbodyRows = createRows(numRows, columns, numRowHeaders, columnHeaders); + append(tbody, tbodyRows); + return table; + }; + + var get$2 = function (element) { + return element.dom.innerHTML; + }; + var getOuter = function (element) { + var container = SugarElement.fromTag('div'); + var clone = SugarElement.fromDom(element.dom.cloneNode(true)); + append$1(container, clone); + return get$2(container); + }; + + var placeCaretInCell = function (editor, cell) { + editor.selection.select(cell.dom, true); + editor.selection.collapse(true); + }; + var selectFirstCellInTable = function (editor, tableElm) { + descendant(tableElm, 'td,th').each(curry(placeCaretInCell, editor)); + }; + var fireEvents = function (editor, table) { + each$2(descendants(table, 'tr'), function (row) { + fireNewRow(editor, row.dom); + each$2(descendants(row, 'th,td'), function (cell) { + fireNewCell(editor, cell.dom); + }); + }); + }; + var isPercentage = function (width) { + return isString(width) && width.indexOf('%') !== -1; + }; + var insert = function (editor, columns, rows, colHeaders, rowHeaders) { + var defaultStyles = getDefaultStyles(editor); + var options = { + styles: defaultStyles, + attributes: getDefaultAttributes(editor), + colGroups: useColumnGroup(editor) + }; + editor.undoManager.ignore(function () { + var table = render(rows, columns, rowHeaders, colHeaders, getTableHeaderType(editor), options); + set$2(table, 'data-mce-id', '__mce'); + var html = getOuter(table); + editor.insertContent(html); + editor.addVisual(); + }); + return descendant(getBody(editor), 'table[data-mce-id="__mce"]').map(function (table) { + if (isPixelsForced(editor)) { + enforcePixels(table); + } else if (isResponsiveForced(editor)) { + enforceNone(table); + } else if (isPercentagesForced(editor) || isPercentage(defaultStyles.width)) { + enforcePercentage(table); + } + removeDataStyle(table); + remove$7(table, 'data-mce-id'); + fireEvents(editor, table); + selectFirstCellInTable(editor, table); + return table.dom; + }).getOr(null); + }; + var insertTableWithDataValidation = function (editor, rows, columns, options, errorMsg) { + if (options === void 0) { + options = {}; + } + var checkInput = function (val) { + return isNumber(val) && val > 0; + }; + if (checkInput(rows) && checkInput(columns)) { + var headerRows = options.headerRows || 0; + var headerColumns = options.headerColumns || 0; + return insert(editor, columns, rows, headerColumns, headerRows); + } else { + console.error(errorMsg); + return null; + } + }; + + var getClipboardElements = function (getClipboard) { + return function () { + return getClipboard().fold(function () { + return []; + }, function (elems) { + return map$1(elems, function (e) { + return e.dom; + }); + }); + }; + }; + var setClipboardElements = function (setClipboard) { + return function (elems) { + var elmsOpt = elems.length > 0 ? Optional.some(fromDom(elems)) : Optional.none(); + setClipboard(elmsOpt); + }; + }; + var insertTable = function (editor) { + return function (columns, rows, options) { + if (options === void 0) { + options = {}; + } + var table = insertTableWithDataValidation(editor, rows, columns, options, 'Invalid values for insertTable - rows and columns values are required to insert a table.'); + editor.undoManager.add(); + return table; + }; + }; + var getApi = function (editor, clipboard, resizeHandler, selectionTargets) { + return { + insertTable: insertTable(editor), + setClipboardRows: setClipboardElements(clipboard.setRows), + getClipboardRows: getClipboardElements(clipboard.getRows), + setClipboardCols: setClipboardElements(clipboard.setColumns), + getClipboardCols: getClipboardElements(clipboard.getColumns), + resizeHandler: resizeHandler, + selectionTargets: selectionTargets + }; + }; + + var constrainSpan = function (element, property, value) { + var currentColspan = getAttrValue(element, property, 1); + if (value === 1 || currentColspan <= 1) { + remove$7(element, property); + } else { + set$2(element, property, Math.min(value, currentColspan)); + } + }; + var generateColGroup = function (house, minColRange, maxColRange) { + if (Warehouse.hasColumns(house)) { + var colsToCopy = filter$2(Warehouse.justColumns(house), function (col) { + return col.column >= minColRange && col.column < maxColRange; + }); + var copiedCols = map$1(colsToCopy, function (c) { + var clonedCol = deep(c.element); + constrainSpan(clonedCol, 'span', maxColRange - minColRange); + return clonedCol; + }); + var fakeColgroup = SugarElement.fromTag('colgroup'); + append(fakeColgroup, copiedCols); + return [fakeColgroup]; + } else { + return []; + } + }; + var generateRows = function (house, minColRange, maxColRange) { + return map$1(house.all, function (row) { + var cellsToCopy = filter$2(row.cells, function (cell) { + return cell.column >= minColRange && cell.column < maxColRange; + }); + var copiedCells = map$1(cellsToCopy, function (cell) { + var clonedCell = deep(cell.element); + constrainSpan(clonedCell, 'colspan', maxColRange - minColRange); + return clonedCell; + }); + var fakeTR = SugarElement.fromTag('tr'); + append(fakeTR, copiedCells); + return fakeTR; + }); + }; + var copyCols = function (table, target) { + var house = Warehouse.fromTable(table); + var details = onUnlockedCells(house, target); + return details.map(function (selectedCells) { + var lastSelectedCell = selectedCells[selectedCells.length - 1]; + var minColRange = selectedCells[0].column; + var maxColRange = lastSelectedCell.column + lastSelectedCell.colspan; + var fakeColGroups = generateColGroup(house, minColRange, maxColRange); + var fakeRows = generateRows(house, minColRange, maxColRange); + return __spreadArray(__spreadArray([], fakeColGroups, true), fakeRows, true); + }); + }; + + var copyRows = function (table, target, generators) { + var warehouse = Warehouse.fromTable(table); + var details = onCells(warehouse, target); + return details.bind(function (selectedCells) { + var grid = toGrid(warehouse, generators, false); + var rows = extractGridDetails(grid).rows; + var slicedGrid = rows.slice(selectedCells[0].row, selectedCells[selectedCells.length - 1].row + selectedCells[selectedCells.length - 1].rowspan); + var filteredGrid = bind$2(slicedGrid, function (row) { + var newCells = filter$2(row.cells, function (cell) { + return !cell.isLocked; + }); + return newCells.length > 0 ? [__assign(__assign({}, row), { cells: newCells })] : []; + }); + var slicedDetails = toDetailList(filteredGrid); + return someIf(slicedDetails.length > 0, slicedDetails); + }).map(function (slicedDetails) { + return copy(slicedDetails); + }); + }; + + var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var getTDTHOverallStyle = function (dom, elm, name) { + var cells = dom.select('td,th', elm); + var firstChildStyle; + var checkChildren = function (firstChildStyle, elms) { + for (var i = 0; i < elms.length; i++) { + var currentStyle = dom.getStyle(elms[i], name); + if (typeof firstChildStyle === 'undefined') { + firstChildStyle = currentStyle; + } + if (firstChildStyle !== currentStyle) { + return ''; + } + } + return firstChildStyle; + }; + return checkChildren(firstChildStyle, cells); + }; + var applyAlign = function (editor, elm, name) { + if (name) { + editor.formatter.apply('align' + name, {}, elm); + } + }; + var applyVAlign = function (editor, elm, name) { + if (name) { + editor.formatter.apply('valign' + name, {}, elm); + } + }; + var unApplyAlign = function (editor, elm) { + global$2.each('left center right'.split(' '), function (name) { + editor.formatter.remove('align' + name, {}, elm); + }); + }; + var unApplyVAlign = function (editor, elm) { + global$2.each('top middle bottom'.split(' '), function (name) { + editor.formatter.remove('valign' + name, {}, elm); + }); + }; + + var verticalAlignValues = [ + { + text: 'None', + value: '' + }, + { + text: 'Top', + value: 'top' + }, + { + text: 'Middle', + value: 'middle' + }, + { + text: 'Bottom', + value: 'bottom' + } + ]; + + var hexColour = function (value) { + return { value: value }; + }; + var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; + var longformRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; + var isHexString = function (hex) { + return shorthandRegex.test(hex) || longformRegex.test(hex); + }; + var normalizeHex = function (hex) { + return removeLeading(hex, '#').toUpperCase(); + }; + var fromString$1 = function (hex) { + return isHexString(hex) ? Optional.some({ value: normalizeHex(hex) }) : Optional.none(); + }; + var toHex = function (component) { + var hex = component.toString(16); + return (hex.length === 1 ? '0' + hex : hex).toUpperCase(); + }; + var fromRgba = function (rgbaColour) { + var value = toHex(rgbaColour.red) + toHex(rgbaColour.green) + toHex(rgbaColour.blue); + return hexColour(value); + }; + + var rgbRegex = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)/; + var rgbaRegex = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/; + var rgbaColour = function (red, green, blue, alpha) { + return { + red: red, + green: green, + blue: blue, + alpha: alpha + }; + }; + var fromStringValues = function (red, green, blue, alpha) { + var r = parseInt(red, 10); + var g = parseInt(green, 10); + var b = parseInt(blue, 10); + var a = parseFloat(alpha); + return rgbaColour(r, g, b, a); + }; + var fromString = function (rgbaString) { + if (rgbaString === 'transparent') { + return Optional.some(rgbaColour(0, 0, 0, 0)); + } + var rgbMatch = rgbRegex.exec(rgbaString); + if (rgbMatch !== null) { + return Optional.some(fromStringValues(rgbMatch[1], rgbMatch[2], rgbMatch[3], '1')); + } + var rgbaMatch = rgbaRegex.exec(rgbaString); + if (rgbaMatch !== null) { + return Optional.some(fromStringValues(rgbaMatch[1], rgbaMatch[2], rgbaMatch[3], rgbaMatch[4])); + } + return Optional.none(); + }; + + var anyToHex = function (color) { + return fromString$1(color).orThunk(function () { + return fromString(color).map(fromRgba); + }).getOrThunk(function () { + var canvas = document.createElement('canvas'); + canvas.height = 1; + canvas.width = 1; + var canvasContext = canvas.getContext('2d'); + canvasContext.clearRect(0, 0, canvas.width, canvas.height); + canvasContext.fillStyle = '#FFFFFF'; + canvasContext.fillStyle = color; + canvasContext.fillRect(0, 0, 1, 1); + var rgba = canvasContext.getImageData(0, 0, 1, 1).data; + var r = rgba[0]; + var g = rgba[1]; + var b = rgba[2]; + var a = rgba[3]; + return fromRgba(rgbaColour(r, g, b, a)); + }); + }; + + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; + }; + var set = function (v) { + value = v; + }; + return { + get: get, + set: set + }; + }; + + var singleton = function (doRevoke) { + var subject = Cell(Optional.none()); + var revoke = function () { + return subject.get().each(doRevoke); + }; + var clear = function () { + revoke(); + subject.set(Optional.none()); + }; + var isSet = function () { + return subject.get().isSome(); + }; + var get = function () { + return subject.get(); + }; + var set = function (s) { + revoke(); + subject.set(Optional.some(s)); + }; + return { + clear: clear, + isSet: isSet, + get: get, + set: set + }; + }; + var unbindable = function () { + return singleton(function (s) { + return s.unbind(); + }); + }; + var value = function () { + var subject = singleton(noop); + var on = function (f) { + return subject.get().each(f); + }; + return __assign(__assign({}, subject), { on: on }); + }; + + var onSetupToggle = function (editor, selections, formatName, formatValue) { + return function (api) { + var boundCallback = unbindable(); + var isNone = isEmpty$1(formatValue); + var init = function () { + var selectedCells = getCellsFromSelection(selections); + var checkNode = function (cell) { + return editor.formatter.match(formatName, { value: formatValue }, cell.dom, isNone); + }; + if (isNone) { + api.setActive(!exists(selectedCells, checkNode)); + boundCallback.set(editor.formatter.formatChanged(formatName, function (match) { + return api.setActive(!match); + }, true)); + } else { + api.setActive(forall(selectedCells, checkNode)); + boundCallback.set(editor.formatter.formatChanged(formatName, api.setActive, false, { value: formatValue })); + } + }; + editor.initialized ? init() : editor.on('init', init); + return boundCallback.clear; + }; + }; + var isListGroup = function (item) { + return hasNonNullableKey(item, 'menu'); + }; + var buildListItems = function (items) { + return map$1(items, function (item) { + var text = item.text || item.title; + if (isListGroup(item)) { + return { + text: text, + items: buildListItems(item.menu) + }; + } else { + return { + text: text, + value: item.value + }; + } + }); + }; + var buildMenuItems = function (editor, selections, items, format, onAction) { + return map$1(items, function (item) { + var text = item.text || item.title; + if (isListGroup(item)) { + return { + type: 'nestedmenuitem', + text: text, + getSubmenuItems: function () { + return buildMenuItems(editor, selections, item.menu, format, onAction); + } + }; + } else { + return { + text: text, + type: 'togglemenuitem', + onAction: function () { + return onAction(item.value); + }, + onSetup: onSetupToggle(editor, selections, format, item.value) + }; + } + }); + }; + var applyTableCellStyle = function (editor, style) { + return function (value) { + var _a; + editor.execCommand('mceTableApplyCellStyle', false, (_a = {}, _a[style] = value, _a)); + }; + }; + var filterNoneItem = function (list) { + return bind$2(list, function (item) { + if (isListGroup(item)) { + return [__assign(__assign({}, item), { menu: filterNoneItem(item.menu) })]; + } else { + return isNotEmpty(item.value) ? [item] : []; + } + }); + }; + var generateMenuItemsCallback = function (editor, selections, items, format, onAction) { + return function (callback) { + return callback(buildMenuItems(editor, selections, items, format, onAction)); + }; + }; + var buildColorMenu = function (editor, colorList, style) { + var colorMap = map$1(colorList, function (entry) { + return { + text: entry.title, + value: '#' + anyToHex(entry.value).value, + type: 'choiceitem' + }; + }); + return [{ + type: 'fancymenuitem', + fancytype: 'colorswatch', + initData: { + colors: colorMap.length > 0 ? colorMap : undefined, + allowCustomColors: false + }, + onAction: function (data) { + var _a; + var value = data.value === 'remove' ? '' : data.value; + editor.execCommand('mceTableApplyCellStyle', false, (_a = {}, _a[style] = value, _a)); + } + }]; + }; + var changeRowHeader = function (editor) { + return function () { + var currentType = editor.queryCommandValue('mceTableRowType'); + var newType = currentType === 'header' ? 'body' : 'header'; + editor.execCommand('mceTableRowType', false, { type: newType }); + }; + }; + var changeColumnHeader = function (editor) { + return function () { + var currentType = editor.queryCommandValue('mceTableColType'); + var newType = currentType === 'th' ? 'td' : 'th'; + editor.execCommand('mceTableColType', false, { type: newType }); + }; + }; + + var getClassList$1 = function (editor) { + var classes = buildListItems(getCellClassList(editor)); + if (classes.length > 0) { + return Optional.some({ + name: 'class', + type: 'listbox', + label: 'Class', + items: classes + }); + } + return Optional.none(); + }; + var children = [ + { + name: 'width', + type: 'input', + label: 'Width' + }, + { + name: 'height', + type: 'input', + label: 'Height' + }, + { + name: 'celltype', + type: 'listbox', + label: 'Cell type', + items: [ + { + text: 'Cell', + value: 'td' + }, + { + text: 'Header cell', + value: 'th' + } + ] + }, + { + name: 'scope', + type: 'listbox', + label: 'Scope', + items: [ + { + text: 'None', + value: '' + }, + { + text: 'Row', + value: 'row' + }, + { + text: 'Column', + value: 'col' + }, + { + text: 'Row group', + value: 'rowgroup' + }, + { + text: 'Column group', + value: 'colgroup' + } + ] + }, + { + name: 'halign', + type: 'listbox', + label: 'Horizontal align', + items: [ + { + text: 'None', + value: '' + }, + { + text: 'Left', + value: 'left' + }, + { + text: 'Center', + value: 'center' + }, + { + text: 'Right', + value: 'right' + } + ] + }, + { + name: 'valign', + type: 'listbox', + label: 'Vertical align', + items: verticalAlignValues + } + ]; + var getItems$2 = function (editor) { + return children.concat(getClassList$1(editor).toArray()); + }; + + var getAdvancedTab = function (editor, dialogName) { + var emptyBorderStyle = [{ + text: 'Select...', + value: '' + }]; + var advTabItems = [ + { + name: 'borderstyle', + type: 'listbox', + label: 'Border style', + items: emptyBorderStyle.concat(buildListItems(getTableBorderStyles(editor))) + }, + { + name: 'bordercolor', + type: 'colorinput', + label: 'Border color' + }, + { + name: 'backgroundcolor', + type: 'colorinput', + label: 'Background color' + } + ]; + var borderWidth = { + name: 'borderwidth', + type: 'input', + label: 'Border width' + }; + var items = dialogName === 'cell' ? [borderWidth].concat(advTabItems) : advTabItems; + return { + title: 'Advanced', + name: 'advanced', + items: items + }; + }; + + var modifiers = function (testTruthy) { + return function (editor, node) { + var dom = editor.dom; + var setAttrib = function (attr, value) { + if (!testTruthy || value) { + dom.setAttrib(node, attr, value); + } + }; + var setStyle = function (prop, value) { + if (!testTruthy || value) { + dom.setStyle(node, prop, value); + } + }; + var setFormat = function (formatName, value) { + if (!testTruthy || value) { + if (value === '') { + editor.formatter.remove(formatName, { value: null }, node, true); + } else { + editor.formatter.apply(formatName, { value: value }, node); + } + } + }; + return { + setAttrib: setAttrib, + setStyle: setStyle, + setFormat: setFormat + }; + }; + }; + var DomModifier = { + normal: modifiers(false), + ifTruthy: modifiers(true) + }; + + var rgbToHex = function (dom) { + return function (value) { + return startsWith(value, 'rgb') ? dom.toHex(value) : value; + }; + }; + var extractAdvancedStyles = function (dom, elm) { + var element = SugarElement.fromDom(elm); + return { + borderwidth: getRaw$2(element, 'border-width').getOr(''), + borderstyle: getRaw$2(element, 'border-style').getOr(''), + bordercolor: getRaw$2(element, 'border-color').map(rgbToHex(dom)).getOr(''), + backgroundcolor: getRaw$2(element, 'background-color').map(rgbToHex(dom)).getOr('') + }; + }; + var getSharedValues = function (data) { + var baseData = data[0]; + var comparisonData = data.slice(1); + each$2(comparisonData, function (items) { + each$2(keys(baseData), function (key) { + each$1(items, function (itemValue, itemKey) { + var comparisonValue = baseData[key]; + if (comparisonValue !== '' && key === itemKey) { + if (comparisonValue !== itemValue) { + baseData[key] = ''; + } + } + }); + }); + }); + return baseData; + }; + var getAlignment = function (formats, formatName, editor, elm) { + return find$1(formats, function (name) { + return !isUndefined(editor.formatter.matchNode(elm, formatName + name)); + }).getOr(''); + }; + var getHAlignment = curry(getAlignment, [ + 'left', + 'center', + 'right' + ], 'align'); + var getVAlignment = curry(getAlignment, [ + 'top', + 'middle', + 'bottom' + ], 'valign'); + var extractDataFromSettings = function (editor, hasAdvTableTab) { + var style = getDefaultStyles(editor); + var attrs = getDefaultAttributes(editor); + var extractAdvancedStyleData = function (dom) { + return { + borderstyle: get$c(style, 'border-style').getOr(''), + bordercolor: rgbToHex(dom)(get$c(style, 'border-color').getOr('')), + backgroundcolor: rgbToHex(dom)(get$c(style, 'background-color').getOr('')) + }; + }; + var defaultData = { + height: '', + width: '100%', + cellspacing: '', + cellpadding: '', + caption: false, + class: '', + align: '', + border: '' + }; + var getBorder = function () { + var borderWidth = style['border-width']; + if (shouldStyleWithCss(editor) && borderWidth) { + return { border: borderWidth }; + } + return get$c(attrs, 'border').fold(function () { + return {}; + }, function (border) { + return { border: border }; + }); + }; + var advStyle = hasAdvTableTab ? extractAdvancedStyleData(editor.dom) : {}; + var getCellPaddingCellSpacing = function () { + var spacing = get$c(style, 'border-spacing').or(get$c(attrs, 'cellspacing')).fold(function () { + return {}; + }, function (cellspacing) { + return { cellspacing: cellspacing }; + }); + var padding = get$c(style, 'border-padding').or(get$c(attrs, 'cellpadding')).fold(function () { + return {}; + }, function (cellpadding) { + return { cellpadding: cellpadding }; + }); + return __assign(__assign({}, spacing), padding); + }; + var data = __assign(__assign(__assign(__assign(__assign(__assign({}, defaultData), style), attrs), advStyle), getBorder()), getCellPaddingCellSpacing()); + return data; + }; + var getRowType = function (elm) { + return table(SugarElement.fromDom(elm)).map(function (table) { + var target = { selection: fromDom(elm.cells) }; + return getRowsType(table, target); + }).getOr(''); + }; + var extractDataFromTableElement = function (editor, elm, hasAdvTableTab) { + var getBorder = function (dom, elm) { + var optBorderWidth = getRaw$2(SugarElement.fromDom(elm), 'border-width'); + if (shouldStyleWithCss(editor) && optBorderWidth.isSome()) { + return optBorderWidth.getOr(''); + } + return dom.getAttrib(elm, 'border') || getTDTHOverallStyle(editor.dom, elm, 'border-width') || getTDTHOverallStyle(editor.dom, elm, 'border'); + }; + var dom = editor.dom; + var cellspacing = shouldStyleWithCss(editor) ? dom.getStyle(elm, 'border-spacing') || dom.getAttrib(elm, 'cellspacing') : dom.getAttrib(elm, 'cellspacing') || dom.getStyle(elm, 'border-spacing'); + var cellpadding = shouldStyleWithCss(editor) ? getTDTHOverallStyle(dom, elm, 'padding') || dom.getAttrib(elm, 'cellpadding') : dom.getAttrib(elm, 'cellpadding') || getTDTHOverallStyle(dom, elm, 'padding'); + return __assign({ + width: dom.getStyle(elm, 'width') || dom.getAttrib(elm, 'width'), + height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'), + cellspacing: cellspacing, + cellpadding: cellpadding, + border: getBorder(dom, elm), + caption: !!dom.select('caption', elm)[0], + class: dom.getAttrib(elm, 'class', ''), + align: getHAlignment(editor, elm) + }, hasAdvTableTab ? extractAdvancedStyles(dom, elm) : {}); + }; + var extractDataFromRowElement = function (editor, elm, hasAdvancedRowTab) { + var dom = editor.dom; + return __assign({ + height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'), + class: dom.getAttrib(elm, 'class', ''), + type: getRowType(elm), + align: getHAlignment(editor, elm) + }, hasAdvancedRowTab ? extractAdvancedStyles(dom, elm) : {}); + }; + var extractDataFromCellElement = function (editor, cell, hasAdvancedCellTab, column) { + var dom = editor.dom; + var colElm = column.getOr(cell); + var getStyle = function (element, style) { + return dom.getStyle(element, style) || dom.getAttrib(element, style); + }; + return __assign({ + width: getStyle(colElm, 'width'), + height: getStyle(cell, 'height'), + scope: dom.getAttrib(cell, 'scope'), + celltype: getNodeName(cell), + class: dom.getAttrib(cell, 'class', ''), + halign: getHAlignment(editor, cell), + valign: getVAlignment(editor, cell) + }, hasAdvancedCellTab ? extractAdvancedStyles(dom, cell) : {}); + }; + + var getSelectedCells = function (table, cells) { + var warehouse = Warehouse.fromTable(table); + var allCells = Warehouse.justCells(warehouse); + var filtered = filter$2(allCells, function (cellA) { + return exists(cells, function (cellB) { + return eq$1(cellA.element, cellB); + }); + }); + return map$1(filtered, function (cell) { + return { + element: cell.element.dom, + column: Warehouse.getColumnAt(warehouse, cell.column).map(function (col) { + return col.element.dom; + }) + }; + }); + }; + var updateSimpleProps$1 = function (modifier, colModifier, data) { + modifier.setAttrib('scope', data.scope); + modifier.setAttrib('class', data.class); + modifier.setStyle('height', addPxSuffix(data.height)); + colModifier.setStyle('width', addPxSuffix(data.width)); + }; + var updateAdvancedProps$1 = function (modifier, data) { + modifier.setFormat('tablecellbackgroundcolor', data.backgroundcolor); + modifier.setFormat('tablecellbordercolor', data.bordercolor); + modifier.setFormat('tablecellborderstyle', data.borderstyle); + modifier.setFormat('tablecellborderwidth', addPxSuffix(data.borderwidth)); + }; + var applyStyleData$1 = function (editor, cells, data) { + var isSingleCell = cells.length === 1; + each$2(cells, function (item) { + var cellElm = item.element; + var modifier = isSingleCell ? DomModifier.normal(editor, cellElm) : DomModifier.ifTruthy(editor, cellElm); + var colModifier = item.column.map(function (col) { + return isSingleCell ? DomModifier.normal(editor, col) : DomModifier.ifTruthy(editor, col); + }).getOr(modifier); + updateSimpleProps$1(modifier, colModifier, data); + if (hasAdvancedCellTab(editor)) { + updateAdvancedProps$1(modifier, data); + } + if (isSingleCell) { + unApplyAlign(editor, cellElm); + unApplyVAlign(editor, cellElm); + } + if (data.halign) { + applyAlign(editor, cellElm, data.halign); + } + if (data.valign) { + applyVAlign(editor, cellElm, data.valign); + } + }); + }; + var applyStructureData$1 = function (editor, data) { + editor.execCommand('mceTableCellType', false, { + type: data.celltype, + no_events: true + }); + }; + var applyCellData = function (editor, cells, oldData, data) { + var modifiedData = filter$1(data, function (value, key) { + return oldData[key] !== value; + }); + if (size(modifiedData) > 0 && cells.length >= 1) { + table(cells[0]).each(function (table) { + var selectedCells = getSelectedCells(table, cells); + var styleModified = size(filter$1(modifiedData, function (_value, key) { + return key !== 'scope' && key !== 'celltype'; + })) > 0; + var structureModified = has$1(modifiedData, 'celltype'); + if (styleModified || has$1(modifiedData, 'scope')) { + applyStyleData$1(editor, selectedCells, data); + } + if (structureModified) { + applyStructureData$1(editor, data); + } + fireTableModified(editor, table.dom, { + structure: structureModified, + style: styleModified + }); + }); + } + }; + var onSubmitCellForm = function (editor, cells, oldData, api) { + var data = api.getData(); + api.close(); + editor.undoManager.transact(function () { + applyCellData(editor, cells, oldData, data); + editor.focus(); + }); + }; + var getData = function (editor, cells) { + var cellsData = table(cells[0]).map(function (table) { + return map$1(getSelectedCells(table, cells), function (item) { + return extractDataFromCellElement(editor, item.element, hasAdvancedCellTab(editor), item.column); + }); + }); + return getSharedValues(cellsData.getOrDie()); + }; + var open$2 = function (editor, selections) { + var cells = getCellsFromSelection(selections); + if (cells.length === 0) { + return; + } + var data = getData(editor, cells); + var dialogTabPanel = { + type: 'tabpanel', + tabs: [ + { + title: 'General', + name: 'general', + items: getItems$2(editor) + }, + getAdvancedTab(editor, 'cell') + ] + }; + var dialogPanel = { + type: 'panel', + items: [{ + type: 'grid', + columns: 2, + items: getItems$2(editor) + }] + }; + editor.windowManager.open({ + title: 'Cell Properties', + size: 'normal', + body: hasAdvancedCellTab(editor) ? dialogTabPanel : dialogPanel, + buttons: [ + { + type: 'cancel', + name: 'cancel', + text: 'Cancel' + }, + { + type: 'submit', + name: 'save', + text: 'Save', + primary: true + } + ], + initialData: data, + onSubmit: curry(onSubmitCellForm, editor, cells, data) + }); + }; + + var getClassList = function (editor) { + var classes = buildListItems(getRowClassList(editor)); + if (classes.length > 0) { + return Optional.some({ + name: 'class', + type: 'listbox', + label: 'Class', + items: classes + }); + } + return Optional.none(); + }; + var formChildren = [ + { + type: 'listbox', + name: 'type', + label: 'Row type', + items: [ + { + text: 'Header', + value: 'header' + }, + { + text: 'Body', + value: 'body' + }, + { + text: 'Footer', + value: 'footer' + } + ] + }, + { + type: 'listbox', + name: 'align', + label: 'Alignment', + items: [ + { + text: 'None', + value: '' + }, + { + text: 'Left', + value: 'left' + }, + { + text: 'Center', + value: 'center' + }, + { + text: 'Right', + value: 'right' + } + ] + }, + { + label: 'Height', + name: 'height', + type: 'input' + } + ]; + var getItems$1 = function (editor) { + return formChildren.concat(getClassList(editor).toArray()); + }; + + var updateSimpleProps = function (modifier, data) { + modifier.setAttrib('class', data.class); + modifier.setStyle('height', addPxSuffix(data.height)); + }; + var updateAdvancedProps = function (modifier, data) { + modifier.setStyle('background-color', data.backgroundcolor); + modifier.setStyle('border-color', data.bordercolor); + modifier.setStyle('border-style', data.borderstyle); + }; + var applyStyleData = function (editor, rows, data, oldData) { + var isSingleRow = rows.length === 1; + each$2(rows, function (rowElm) { + var modifier = isSingleRow ? DomModifier.normal(editor, rowElm) : DomModifier.ifTruthy(editor, rowElm); + updateSimpleProps(modifier, data); + if (hasAdvancedRowTab(editor)) { + updateAdvancedProps(modifier, data); + } + if (data.align !== oldData.align) { + unApplyAlign(editor, rowElm); + applyAlign(editor, rowElm, data.align); + } + }); + }; + var applyStructureData = function (editor, data) { + editor.execCommand('mceTableRowType', false, { + type: data.type, + no_events: true + }); + }; + var applyRowData = function (editor, rows, oldData, data) { + var modifiedData = filter$1(data, function (value, key) { + return oldData[key] !== value; + }); + if (size(modifiedData) > 0) { + var typeModified_1 = has$1(modifiedData, 'type'); + var styleModified_1 = typeModified_1 ? size(modifiedData) > 1 : true; + if (styleModified_1) { + applyStyleData(editor, rows, data, oldData); + } + if (typeModified_1) { + applyStructureData(editor, data); + } + table(SugarElement.fromDom(rows[0])).each(function (table) { + return fireTableModified(editor, table.dom, { + structure: typeModified_1, + style: styleModified_1 + }); + }); + } + }; + var onSubmitRowForm = function (editor, rows, oldData, api) { + var data = api.getData(); + api.close(); + editor.undoManager.transact(function () { + applyRowData(editor, rows, oldData, data); + editor.focus(); + }); + }; + var open$1 = function (editor) { + var rows = getRowsFromSelection(getSelectionStart(editor), ephemera.selected); + if (rows.length === 0) { + return; + } + var rowsData = map$1(rows, function (rowElm) { + return extractDataFromRowElement(editor, rowElm.dom, hasAdvancedRowTab(editor)); + }); + var data = getSharedValues(rowsData); + var dialogTabPanel = { + type: 'tabpanel', + tabs: [ + { + title: 'General', + name: 'general', + items: getItems$1(editor) + }, + getAdvancedTab(editor, 'row') + ] + }; + var dialogPanel = { + type: 'panel', + items: [{ + type: 'grid', + columns: 2, + items: getItems$1(editor) + }] + }; + editor.windowManager.open({ + title: 'Row Properties', + size: 'normal', + body: hasAdvancedRowTab(editor) ? dialogTabPanel : dialogPanel, + buttons: [ + { + type: 'cancel', + name: 'cancel', + text: 'Cancel' + }, + { + type: 'submit', + name: 'save', + text: 'Save', + primary: true + } + ], + initialData: data, + onSubmit: curry(onSubmitRowForm, editor, map$1(rows, function (r) { + return r.dom; + }), data) + }); + }; + + var getItems = function (editor, classes, insertNewTable) { + var rowColCountItems = !insertNewTable ? [] : [ + { + type: 'input', + name: 'cols', + label: 'Cols', + inputMode: 'numeric' + }, + { + type: 'input', + name: 'rows', + label: 'Rows', + inputMode: 'numeric' + } + ]; + var alwaysItems = [ + { + type: 'input', + name: 'width', + label: 'Width' + }, + { + type: 'input', + name: 'height', + label: 'Height' + } + ]; + var appearanceItems = hasAppearanceOptions(editor) ? [ + { + type: 'input', + name: 'cellspacing', + label: 'Cell spacing', + inputMode: 'numeric' + }, + { + type: 'input', + name: 'cellpadding', + label: 'Cell padding', + inputMode: 'numeric' + }, + { + type: 'input', + name: 'border', + label: 'Border width' + }, + { + type: 'label', + label: 'Caption', + items: [{ + type: 'checkbox', + name: 'caption', + label: 'Show caption' + }] + } + ] : []; + var alignmentItem = [{ + type: 'listbox', + name: 'align', + label: 'Alignment', + items: [ + { + text: 'None', + value: '' + }, + { + text: 'Left', + value: 'left' + }, + { + text: 'Center', + value: 'center' + }, + { + text: 'Right', + value: 'right' + } + ] + }]; + var classListItem = classes.length > 0 ? [{ + type: 'listbox', + name: 'class', + label: 'Class', + items: classes + }] : []; + return rowColCountItems.concat(alwaysItems).concat(appearanceItems).concat(alignmentItem).concat(classListItem); + }; + + var styleTDTH = function (dom, elm, name, value) { + if (elm.tagName === 'TD' || elm.tagName === 'TH') { + if (isString(name)) { + dom.setStyle(elm, name, value); + } else { + dom.setStyle(elm, name); + } + } else { + if (elm.children) { + for (var i = 0; i < elm.children.length; i++) { + styleTDTH(dom, elm.children[i], name, value); + } + } + } + }; + var applyDataToElement = function (editor, tableElm, data) { + var dom = editor.dom; + var attrs = {}; + var styles = {}; + attrs.class = data.class; + styles.height = addPxSuffix(data.height); + if (dom.getAttrib(tableElm, 'width') && !shouldStyleWithCss(editor)) { + attrs.width = removePxSuffix(data.width); + } else { + styles.width = addPxSuffix(data.width); + } + if (shouldStyleWithCss(editor)) { + styles['border-width'] = addPxSuffix(data.border); + styles['border-spacing'] = addPxSuffix(data.cellspacing); + } else { + attrs.border = data.border; + attrs.cellpadding = data.cellpadding; + attrs.cellspacing = data.cellspacing; + } + if (shouldStyleWithCss(editor) && tableElm.children) { + for (var i = 0; i < tableElm.children.length; i++) { + styleTDTH(dom, tableElm.children[i], { + 'border-width': addPxSuffix(data.border), + 'padding': addPxSuffix(data.cellpadding) + }); + if (hasAdvancedTableTab(editor)) { + styleTDTH(dom, tableElm.children[i], { 'border-color': data.bordercolor }); + } + } + } + if (hasAdvancedTableTab(editor)) { + styles['background-color'] = data.backgroundcolor; + styles['border-color'] = data.bordercolor; + styles['border-style'] = data.borderstyle; + } + attrs.style = dom.serializeStyle(__assign(__assign({}, getDefaultStyles(editor)), styles)); + dom.setAttribs(tableElm, __assign(__assign({}, getDefaultAttributes(editor)), attrs)); + }; + var onSubmitTableForm = function (editor, tableElm, oldData, api) { + var dom = editor.dom; + var data = api.getData(); + var modifiedData = filter$1(data, function (value, key) { + return oldData[key] !== value; + }); + api.close(); + if (data.class === '') { + delete data.class; + } + editor.undoManager.transact(function () { + if (!tableElm) { + var cols = parseInt(data.cols, 10) || 1; + var rows = parseInt(data.rows, 10) || 1; + tableElm = insert(editor, cols, rows, 0, 0); + } + if (size(modifiedData) > 0) { + applyDataToElement(editor, tableElm, data); + var captionElm = dom.select('caption', tableElm)[0]; + if (captionElm && !data.caption || !captionElm && data.caption) { + editor.execCommand('mceTableToggleCaption'); + } + if (data.align === '') { + unApplyAlign(editor, tableElm); + } else { + applyAlign(editor, tableElm, data.align); + } + } + editor.focus(); + editor.addVisual(); + if (size(modifiedData) > 0) { + var captionModified = has$1(modifiedData, 'caption'); + var styleModified = captionModified ? size(modifiedData) > 1 : true; + fireTableModified(editor, tableElm, { + structure: captionModified, + style: styleModified + }); + } + }); + }; + var open = function (editor, insertNewTable) { + var dom = editor.dom; + var tableElm; + var data = extractDataFromSettings(editor, hasAdvancedTableTab(editor)); + if (insertNewTable === false) { + tableElm = dom.getParent(editor.selection.getStart(), 'table', editor.getBody()); + if (tableElm) { + data = extractDataFromTableElement(editor, tableElm, hasAdvancedTableTab(editor)); + } else { + if (hasAdvancedTableTab(editor)) { + data.borderstyle = ''; + data.bordercolor = ''; + data.backgroundcolor = ''; + } + } + } else { + data.cols = '1'; + data.rows = '1'; + if (hasAdvancedTableTab(editor)) { + data.borderstyle = ''; + data.bordercolor = ''; + data.backgroundcolor = ''; + } + } + var classes = buildListItems(getTableClassList(editor)); + if (classes.length > 0) { + if (data.class) { + data.class = data.class.replace(/\s*mce\-item\-table\s*/g, ''); + } + } + var generalPanel = { + type: 'grid', + columns: 2, + items: getItems(editor, classes, insertNewTable) + }; + var nonAdvancedForm = function () { + return { + type: 'panel', + items: [generalPanel] + }; + }; + var advancedForm = function () { + return { + type: 'tabpanel', + tabs: [ + { + title: 'General', + name: 'general', + items: [generalPanel] + }, + getAdvancedTab(editor, 'table') + ] + }; + }; + var dialogBody = hasAdvancedTableTab(editor) ? advancedForm() : nonAdvancedForm(); + editor.windowManager.open({ + title: 'Table Properties', + size: 'normal', + body: dialogBody, + onSubmit: curry(onSubmitTableForm, editor, tableElm, data), + buttons: [ + { + type: 'cancel', + name: 'cancel', + text: 'Cancel' + }, + { + type: 'submit', + name: 'save', + text: 'Save', + primary: true + } + ], + initialData: data + }); + }; + + var getSelectionStartCellOrCaption = function (editor) { + return getSelectionCellOrCaption(getSelectionStart(editor), getIsRoot(editor)); + }; + var getSelectionStartCell = function (editor) { + return getSelectionCell(getSelectionStart(editor), getIsRoot(editor)); + }; + var registerCommands = function (editor, actions, cellSelection, selections, clipboard) { + var isRoot = getIsRoot(editor); + var eraseTable = function () { + return getSelectionStartCellOrCaption(editor).each(function (cellOrCaption) { + table(cellOrCaption, isRoot).filter(not(isRoot)).each(function (table) { + var cursor = SugarElement.fromText(''); + after$5(table, cursor); + remove$5(table); + if (editor.dom.isEmpty(editor.getBody())) { + editor.setContent(''); + editor.selection.setCursorLocation(); + } else { + var rng = editor.dom.createRng(); + rng.setStart(cursor.dom, 0); + rng.setEnd(cursor.dom, 0); + editor.selection.setRng(rng); + editor.nodeChanged(); + } + }); + }); + }; + var setSizingMode = function (sizing) { + return getSelectionStartCellOrCaption(editor).each(function (cellOrCaption) { + var isForcedSizing = isResponsiveForced(editor) || isPixelsForced(editor) || isPercentagesForced(editor); + if (!isForcedSizing) { + table(cellOrCaption, isRoot).each(function (table) { + if (sizing === 'relative' && !isPercentSizing(table)) { + enforcePercentage(table); + } else if (sizing === 'fixed' && !isPixelSizing(table)) { + enforcePixels(table); + } else if (sizing === 'responsive' && !isNoneSizing(table)) { + enforceNone(table); + } + removeDataStyle(table); + fireTableModified(editor, table.dom, structureModified); + }); + } + }); + }; + var getTableFromCell = function (cell) { + return table(cell, isRoot); + }; + var performActionOnSelection = function (action) { + return getSelectionStartCell(editor).bind(function (cell) { + return getTableFromCell(cell).map(function (table) { + return action(table, cell); + }); + }); + }; + var toggleTableClass = function (_ui, clazz) { + performActionOnSelection(function (table) { + editor.formatter.toggle('tableclass', { value: clazz }, table.dom); + fireTableModified(editor, table.dom, styleModified); + }); + }; + var toggleTableCellClass = function (_ui, clazz) { + performActionOnSelection(function (table) { + var selectedCells = getCellsFromSelection(selections); + var allHaveClass = forall(selectedCells, function (cell) { + return editor.formatter.match('tablecellclass', { value: clazz }, cell.dom); + }); + var formatterAction = allHaveClass ? editor.formatter.remove : editor.formatter.apply; + each$2(selectedCells, function (cell) { + return formatterAction('tablecellclass', { value: clazz }, cell.dom); + }); + fireTableModified(editor, table.dom, styleModified); + }); + }; + var toggleCaption = function () { + getSelectionStartCellOrCaption(editor).each(function (cellOrCaption) { + table(cellOrCaption, isRoot).each(function (table) { + child$1(table, 'caption').fold(function () { + var caption = SugarElement.fromTag('caption'); + append$1(caption, SugarElement.fromText('Caption')); + appendAt(table, caption, 0); + editor.selection.setCursorLocation(caption.dom, 0); + }, function (caption) { + if (isTag('caption')(cellOrCaption)) { + one('td', table).each(function (td) { + return editor.selection.setCursorLocation(td.dom, 0); + }); + } + remove$5(caption); + }); + fireTableModified(editor, table.dom, structureModified); + }); + }); + }; + var postExecute = function (_data) { + editor.focus(); + }; + var actOnSelection = function (execute, noEvents) { + if (noEvents === void 0) { + noEvents = false; + } + return performActionOnSelection(function (table, startCell) { + var targets = forMenu(selections, table, startCell); + execute(table, targets, noEvents).each(postExecute); + }); + }; + var copyRowSelection = function () { + return performActionOnSelection(function (table, startCell) { + var targets = forMenu(selections, table, startCell); + var generators = cellOperations(noop, SugarElement.fromDom(editor.getDoc()), Optional.none()); + return copyRows(table, targets, generators); + }); + }; + var copyColSelection = function () { + return performActionOnSelection(function (table, startCell) { + var targets = forMenu(selections, table, startCell); + return copyCols(table, targets); + }); + }; + var pasteOnSelection = function (execute, getRows) { + return getRows().each(function (rows) { + var clonedRows = map$1(rows, function (row) { + return deep(row); + }); + performActionOnSelection(function (table, startCell) { + var generators = paste$1(SugarElement.fromDom(editor.getDoc())); + var targets = pasteRows(selections, startCell, clonedRows, generators); + execute(table, targets).each(postExecute); + }); + }); + }; + var actOnType = function (getAction) { + return function (_ui, args) { + return get$c(args, 'type').each(function (type) { + actOnSelection(getAction(type), args.no_events); + }); + }; + }; + each$1({ + mceTableSplitCells: function () { + return actOnSelection(actions.unmergeCells); + }, + mceTableMergeCells: function () { + return actOnSelection(actions.mergeCells); + }, + mceTableInsertRowBefore: function () { + return actOnSelection(actions.insertRowsBefore); + }, + mceTableInsertRowAfter: function () { + return actOnSelection(actions.insertRowsAfter); + }, + mceTableInsertColBefore: function () { + return actOnSelection(actions.insertColumnsBefore); + }, + mceTableInsertColAfter: function () { + return actOnSelection(actions.insertColumnsAfter); + }, + mceTableDeleteCol: function () { + return actOnSelection(actions.deleteColumn); + }, + mceTableDeleteRow: function () { + return actOnSelection(actions.deleteRow); + }, + mceTableCutCol: function () { + return copyColSelection().each(function (selection) { + clipboard.setColumns(selection); + actOnSelection(actions.deleteColumn); + }); + }, + mceTableCutRow: function () { + return copyRowSelection().each(function (selection) { + clipboard.setRows(selection); + actOnSelection(actions.deleteRow); + }); + }, + mceTableCopyCol: function () { + return copyColSelection().each(function (selection) { + return clipboard.setColumns(selection); + }); + }, + mceTableCopyRow: function () { + return copyRowSelection().each(function (selection) { + return clipboard.setRows(selection); + }); + }, + mceTablePasteColBefore: function () { + return pasteOnSelection(actions.pasteColsBefore, clipboard.getColumns); + }, + mceTablePasteColAfter: function () { + return pasteOnSelection(actions.pasteColsAfter, clipboard.getColumns); + }, + mceTablePasteRowBefore: function () { + return pasteOnSelection(actions.pasteRowsBefore, clipboard.getRows); + }, + mceTablePasteRowAfter: function () { + return pasteOnSelection(actions.pasteRowsAfter, clipboard.getRows); + }, + mceTableDelete: eraseTable, + mceTableCellToggleClass: toggleTableCellClass, + mceTableToggleClass: toggleTableClass, + mceTableToggleCaption: toggleCaption, + mceTableSizingMode: function (_ui, sizing) { + return setSizingMode(sizing); + }, + mceTableCellType: actOnType(function (type) { + return type === 'th' ? actions.makeCellsHeader : actions.unmakeCellsHeader; + }), + mceTableColType: actOnType(function (type) { + return type === 'th' ? actions.makeColumnsHeader : actions.unmakeColumnsHeader; + }), + mceTableRowType: actOnType(function (type) { + switch (type) { + case 'header': + return actions.makeRowsHeader; + case 'footer': + return actions.makeRowsFooter; + default: + return actions.makeRowsBody; + } + }) + }, function (func, name) { + return editor.addCommand(name, func); + }); + each$1({ + mceTableProps: curry(open, editor, false), + mceTableRowProps: curry(open$1, editor), + mceTableCellProps: curry(open$2, editor, selections) + }, function (func, name) { + return editor.addCommand(name, function () { + return func(); + }); + }); + editor.addCommand('mceInsertTable', function (_ui, args) { + if (isObject(args) && keys(args).length > 0) { + insertTableWithDataValidation(editor, args.rows, args.columns, args.options, 'Invalid values for mceInsertTable - rows and columns values are required to insert a table.'); + } else { + open(editor, true); + } + }); + editor.addCommand('mceTableApplyCellStyle', function (_ui, args) { + var getFormatName = function (style) { + return 'tablecell' + style.toLowerCase().replace('-', ''); + }; + if (!isObject(args)) { + return; + } + var cells = getCellsFromSelection(selections); + if (cells.length === 0) { + return; + } + var validArgs = filter$1(args, function (value, style) { + return editor.formatter.has(getFormatName(style)) && isString(value); + }); + if (isEmpty(validArgs)) { + return; + } + each$1(validArgs, function (value, style) { + each$2(cells, function (cell) { + DomModifier.normal(editor, cell.dom).setFormat(getFormatName(style), value); + }); + }); + getTableFromCell(cells[0]).each(function (table) { + return fireTableModified(editor, table.dom, styleModified); + }); + }); + }; + + var registerQueryCommands = function (editor, actions, selections) { + var isRoot = getIsRoot(editor); + var lookupOnSelection = function (action) { + return getSelectionCell(getSelectionStart(editor)).bind(function (cell) { + return table(cell, isRoot).map(function (table) { + var targets = forMenu(selections, table, cell); + return action(table, targets); + }); + }).getOr(''); + }; + each$1({ + mceTableRowType: function () { + return lookupOnSelection(actions.getTableRowType); + }, + mceTableCellType: function () { + return lookupOnSelection(actions.getTableCellType); + }, + mceTableColType: function () { + return lookupOnSelection(actions.getTableColType); + } + }, function (func, name) { + return editor.addQueryValueHandler(name, func); + }); + }; + + var Clipboard = function () { + var rows = value(); + var cols = value(); + return { + getRows: rows.get, + setRows: function (r) { + r.fold(rows.clear, rows.set); + cols.clear(); + }, + clearRows: rows.clear, + getColumns: cols.get, + setColumns: function (c) { + c.fold(cols.clear, cols.set); + rows.clear(); + }, + clearColumns: cols.clear + }; + }; + + var genericBase = { + remove_similar: true, + inherit: false + }; + var cellBase = __assign({ selector: 'td,th' }, genericBase); + var cellFormats = { + tablecellbackgroundcolor: __assign({ styles: { backgroundColor: '%value' } }, cellBase), + tablecellverticalalign: __assign({ styles: { 'vertical-align': '%value' } }, cellBase), + tablecellbordercolor: __assign({ styles: { borderColor: '%value' } }, cellBase), + tablecellclass: __assign({ classes: ['%value'] }, cellBase), + tableclass: __assign({ + selector: 'table', + classes: ['%value'] + }, genericBase), + tablecellborderstyle: __assign({ styles: { borderStyle: '%value' } }, cellBase), + tablecellborderwidth: __assign({ styles: { borderWidth: '%value' } }, cellBase) + }; + var registerFormats = function (editor) { + editor.formatter.register(cellFormats); + }; + + var adt$5 = Adt.generate([ + { none: ['current'] }, + { first: ['current'] }, + { + middle: [ + 'current', + 'target' + ] + }, + { last: ['current'] } + ]); + var none = function (current) { + if (current === void 0) { + current = undefined; + } + return adt$5.none(current); + }; + var CellLocation = __assign(__assign({}, adt$5), { none: none }); + + var walk = function (all, current, index, direction, isEligible) { + if (isEligible === void 0) { + isEligible = always; + } + var forwards = direction === 1; + if (!forwards && index <= 0) { + return CellLocation.first(all[0]); + } else if (forwards && index >= all.length - 1) { + return CellLocation.last(all[all.length - 1]); + } else { + var newIndex = index + direction; + var elem = all[newIndex]; + return isEligible(elem) ? CellLocation.middle(current, elem) : walk(all, current, newIndex, direction, isEligible); + } + }; + var detect$1 = function (current, isRoot) { + return table(current, isRoot).bind(function (table) { + var all = cells$1(table); + var index = findIndex(all, function (x) { + return eq$1(current, x); + }); + return index.map(function (index) { + return { + index: index, + all: all + }; + }); + }); + }; + var next = function (current, isEligible, isRoot) { + var detection = detect$1(current, isRoot); + return detection.fold(function () { + return CellLocation.none(current); + }, function (info) { + return walk(info.all, current, info.index, 1, isEligible); + }); + }; + var prev = function (current, isEligible, isRoot) { + var detection = detect$1(current, isRoot); + return detection.fold(function () { + return CellLocation.none(); + }, function (info) { + return walk(info.all, current, info.index, -1, isEligible); + }); + }; + + var create$2 = function (start, soffset, finish, foffset) { + return { + start: start, + soffset: soffset, + finish: finish, + foffset: foffset + }; + }; + var SimRange = { create: create$2 }; + + var adt$4 = Adt.generate([ + { before: ['element'] }, + { + on: [ + 'element', + 'offset' + ] + }, + { after: ['element'] } + ]); + var cata$1 = function (subject, onBefore, onOn, onAfter) { + return subject.fold(onBefore, onOn, onAfter); + }; + var getStart$1 = function (situ) { + return situ.fold(identity, identity, identity); + }; + var before$2 = adt$4.before; + var on = adt$4.on; + var after$3 = adt$4.after; + var Situ = { + before: before$2, + on: on, + after: after$3, + cata: cata$1, + getStart: getStart$1 + }; + + var adt$3 = Adt.generate([ + { domRange: ['rng'] }, + { + relative: [ + 'startSitu', + 'finishSitu' + ] + }, + { + exact: [ + 'start', + 'soffset', + 'finish', + 'foffset' + ] + } + ]); + var exactFromRange = function (simRange) { + return adt$3.exact(simRange.start, simRange.soffset, simRange.finish, simRange.foffset); + }; + var getStart = function (selection) { + return selection.match({ + domRange: function (rng) { + return SugarElement.fromDom(rng.startContainer); + }, + relative: function (startSitu, _finishSitu) { + return Situ.getStart(startSitu); + }, + exact: function (start, _soffset, _finish, _foffset) { + return start; + } + }); + }; + var domRange = adt$3.domRange; + var relative = adt$3.relative; + var exact = adt$3.exact; + var getWin = function (selection) { + var start = getStart(selection); + return defaultView(start); + }; + var range = SimRange.create; + var SimSelection = { + domRange: domRange, + relative: relative, + exact: exact, + exactFromRange: exactFromRange, + getWin: getWin, + range: range + }; + + var selectNode = function (win, element) { + var rng = win.document.createRange(); + rng.selectNode(element.dom); + return rng; + }; + var selectNodeContents = function (win, element) { + var rng = win.document.createRange(); + selectNodeContentsUsing(rng, element); + return rng; + }; + var selectNodeContentsUsing = function (rng, element) { + return rng.selectNodeContents(element.dom); + }; + var setStart = function (rng, situ) { + situ.fold(function (e) { + rng.setStartBefore(e.dom); + }, function (e, o) { + rng.setStart(e.dom, o); + }, function (e) { + rng.setStartAfter(e.dom); + }); + }; + var setFinish = function (rng, situ) { + situ.fold(function (e) { + rng.setEndBefore(e.dom); + }, function (e, o) { + rng.setEnd(e.dom, o); + }, function (e) { + rng.setEndAfter(e.dom); + }); + }; + var relativeToNative = function (win, startSitu, finishSitu) { + var range = win.document.createRange(); + setStart(range, startSitu); + setFinish(range, finishSitu); + return range; + }; + var exactToNative = function (win, start, soffset, finish, foffset) { + var rng = win.document.createRange(); + rng.setStart(start.dom, soffset); + rng.setEnd(finish.dom, foffset); + return rng; + }; + var toRect = function (rect) { + return { + left: rect.left, + top: rect.top, + right: rect.right, + bottom: rect.bottom, + width: rect.width, + height: rect.height + }; + }; + var getFirstRect$1 = function (rng) { + var rects = rng.getClientRects(); + var rect = rects.length > 0 ? rects[0] : rng.getBoundingClientRect(); + return rect.width > 0 || rect.height > 0 ? Optional.some(rect).map(toRect) : Optional.none(); + }; + + var adt$2 = Adt.generate([ + { + ltr: [ + 'start', + 'soffset', + 'finish', + 'foffset' + ] + }, + { + rtl: [ + 'start', + 'soffset', + 'finish', + 'foffset' + ] + } + ]); + var fromRange = function (win, type, range) { + return type(SugarElement.fromDom(range.startContainer), range.startOffset, SugarElement.fromDom(range.endContainer), range.endOffset); + }; + var getRanges = function (win, selection) { + return selection.match({ + domRange: function (rng) { + return { + ltr: constant(rng), + rtl: Optional.none + }; + }, + relative: function (startSitu, finishSitu) { + return { + ltr: cached(function () { + return relativeToNative(win, startSitu, finishSitu); + }), + rtl: cached(function () { + return Optional.some(relativeToNative(win, finishSitu, startSitu)); + }) + }; + }, + exact: function (start, soffset, finish, foffset) { + return { + ltr: cached(function () { + return exactToNative(win, start, soffset, finish, foffset); + }), + rtl: cached(function () { + return Optional.some(exactToNative(win, finish, foffset, start, soffset)); + }) + }; + } + }); + }; + var doDiagnose = function (win, ranges) { + var rng = ranges.ltr(); + if (rng.collapsed) { + var reversed = ranges.rtl().filter(function (rev) { + return rev.collapsed === false; + }); + return reversed.map(function (rev) { + return adt$2.rtl(SugarElement.fromDom(rev.endContainer), rev.endOffset, SugarElement.fromDom(rev.startContainer), rev.startOffset); + }).getOrThunk(function () { + return fromRange(win, adt$2.ltr, rng); + }); + } else { + return fromRange(win, adt$2.ltr, rng); + } + }; + var diagnose = function (win, selection) { + var ranges = getRanges(win, selection); + return doDiagnose(win, ranges); + }; + var asLtrRange = function (win, selection) { + var diagnosis = diagnose(win, selection); + return diagnosis.match({ + ltr: function (start, soffset, finish, foffset) { + var rng = win.document.createRange(); + rng.setStart(start.dom, soffset); + rng.setEnd(finish.dom, foffset); + return rng; + }, + rtl: function (start, soffset, finish, foffset) { + var rng = win.document.createRange(); + rng.setStart(finish.dom, foffset); + rng.setEnd(start.dom, soffset); + return rng; + } + }); + }; + adt$2.ltr; + adt$2.rtl; + + var searchForPoint = function (rectForOffset, x, y, maxX, length) { + if (length === 0) { + return 0; + } else if (x === maxX) { + return length - 1; + } + var xDelta = maxX; + for (var i = 1; i < length; i++) { + var rect = rectForOffset(i); + var curDeltaX = Math.abs(x - rect.left); + if (y <= rect.bottom) { + if (y < rect.top || curDeltaX > xDelta) { + return i - 1; + } else { + xDelta = curDeltaX; + } + } + } + return 0; + }; + var inRect = function (rect, x, y) { + return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom; + }; + + var locateOffset = function (doc, textnode, x, y, rect) { + var rangeForOffset = function (o) { + var r = doc.dom.createRange(); + r.setStart(textnode.dom, o); + r.collapse(true); + return r; + }; + var rectForOffset = function (o) { + var r = rangeForOffset(o); + return r.getBoundingClientRect(); + }; + var length = get$9(textnode).length; + var offset = searchForPoint(rectForOffset, x, y, rect.right, length); + return rangeForOffset(offset); + }; + var locate$1 = function (doc, node, x, y) { + var r = doc.dom.createRange(); + r.selectNode(node.dom); + var rects = r.getClientRects(); + var foundRect = findMap(rects, function (rect) { + return inRect(rect, x, y) ? Optional.some(rect) : Optional.none(); + }); + return foundRect.map(function (rect) { + return locateOffset(doc, node, x, y, rect); + }); + }; + + var searchInChildren = function (doc, node, x, y) { + var r = doc.dom.createRange(); + var nodes = children$3(node); + return findMap(nodes, function (n) { + r.selectNode(n.dom); + return inRect(r.getBoundingClientRect(), x, y) ? locateNode(doc, n, x, y) : Optional.none(); + }); + }; + var locateNode = function (doc, node, x, y) { + return isText(node) ? locate$1(doc, node, x, y) : searchInChildren(doc, node, x, y); + }; + var locate = function (doc, node, x, y) { + var r = doc.dom.createRange(); + r.selectNode(node.dom); + var rect = r.getBoundingClientRect(); + var boundedX = Math.max(rect.left, Math.min(rect.right, x)); + var boundedY = Math.max(rect.top, Math.min(rect.bottom, y)); + return locateNode(doc, node, boundedX, boundedY); + }; + + var COLLAPSE_TO_LEFT = true; + var COLLAPSE_TO_RIGHT = false; + var getCollapseDirection = function (rect, x) { + return x - rect.left < rect.right - x ? COLLAPSE_TO_LEFT : COLLAPSE_TO_RIGHT; + }; + var createCollapsedNode = function (doc, target, collapseDirection) { + var r = doc.dom.createRange(); + r.selectNode(target.dom); + r.collapse(collapseDirection); + return r; + }; + var locateInElement = function (doc, node, x) { + var cursorRange = doc.dom.createRange(); + cursorRange.selectNode(node.dom); + var rect = cursorRange.getBoundingClientRect(); + var collapseDirection = getCollapseDirection(rect, x); + var f = collapseDirection === COLLAPSE_TO_LEFT ? first : last$1; + return f(node).map(function (target) { + return createCollapsedNode(doc, target, collapseDirection); + }); + }; + var locateInEmpty = function (doc, node, x) { + var rect = node.dom.getBoundingClientRect(); + var collapseDirection = getCollapseDirection(rect, x); + return Optional.some(createCollapsedNode(doc, node, collapseDirection)); + }; + var search = function (doc, node, x) { + var f = children$3(node).length === 0 ? locateInEmpty : locateInElement; + return f(doc, node, x); + }; + + var caretPositionFromPoint = function (doc, x, y) { + var _a, _b; + return Optional.from((_b = (_a = doc.dom).caretPositionFromPoint) === null || _b === void 0 ? void 0 : _b.call(_a, x, y)).bind(function (pos) { + if (pos.offsetNode === null) { + return Optional.none(); + } + var r = doc.dom.createRange(); + r.setStart(pos.offsetNode, pos.offset); + r.collapse(); + return Optional.some(r); + }); + }; + var caretRangeFromPoint = function (doc, x, y) { + var _a, _b; + return Optional.from((_b = (_a = doc.dom).caretRangeFromPoint) === null || _b === void 0 ? void 0 : _b.call(_a, x, y)); + }; + var searchTextNodes = function (doc, node, x, y) { + var r = doc.dom.createRange(); + r.selectNode(node.dom); + var rect = r.getBoundingClientRect(); + var boundedX = Math.max(rect.left, Math.min(rect.right, x)); + var boundedY = Math.max(rect.top, Math.min(rect.bottom, y)); + return locate(doc, node, boundedX, boundedY); + }; + var searchFromPoint = function (doc, x, y) { + return SugarElement.fromPoint(doc, x, y).bind(function (elem) { + var fallback = function () { + return search(doc, elem, x); + }; + return children$3(elem).length === 0 ? fallback() : searchTextNodes(doc, elem, x, y).orThunk(fallback); + }); + }; + var availableSearch = function () { + if (document.caretPositionFromPoint) { + return caretPositionFromPoint; + } else if (document.caretRangeFromPoint) { + return caretRangeFromPoint; + } else { + return searchFromPoint; + } + }(); + var fromPoint = function (win, x, y) { + var doc = SugarElement.fromDom(win.document); + return availableSearch(doc, x, y).map(function (rng) { + return SimRange.create(SugarElement.fromDom(rng.startContainer), rng.startOffset, SugarElement.fromDom(rng.endContainer), rng.endOffset); + }); + }; + + var beforeSpecial = function (element, offset) { + var name$1 = name(element); + if ('input' === name$1) { + return Situ.after(element); + } else if (!contains$2([ + 'br', + 'img' + ], name$1)) { + return Situ.on(element, offset); + } else { + return offset === 0 ? Situ.before(element) : Situ.after(element); + } + }; + var preprocessRelative = function (startSitu, finishSitu) { + var start = startSitu.fold(Situ.before, beforeSpecial, Situ.after); + var finish = finishSitu.fold(Situ.before, beforeSpecial, Situ.after); + return SimSelection.relative(start, finish); + }; + var preprocessExact = function (start, soffset, finish, foffset) { + var startSitu = beforeSpecial(start, soffset); + var finishSitu = beforeSpecial(finish, foffset); + return SimSelection.relative(startSitu, finishSitu); + }; + var preprocess = function (selection) { + return selection.match({ + domRange: function (rng) { + var start = SugarElement.fromDom(rng.startContainer); + var finish = SugarElement.fromDom(rng.endContainer); + return preprocessExact(start, rng.startOffset, finish, rng.endOffset); + }, + relative: preprocessRelative, + exact: preprocessExact + }); + }; + + var makeRange = function (start, soffset, finish, foffset) { + var doc = owner(start); + var rng = doc.dom.createRange(); + rng.setStart(start.dom, soffset); + rng.setEnd(finish.dom, foffset); + return rng; + }; + var after$2 = function (start, soffset, finish, foffset) { + var r = makeRange(start, soffset, finish, foffset); + var same = eq$1(start, finish) && soffset === foffset; + return r.collapsed && !same; + }; + + var getNativeSelection = function (win) { + return Optional.from(win.getSelection()); + }; + var doSetNativeRange = function (win, rng) { + getNativeSelection(win).each(function (selection) { + selection.removeAllRanges(); + selection.addRange(rng); + }); + }; + var doSetRange = function (win, start, soffset, finish, foffset) { + var rng = exactToNative(win, start, soffset, finish, foffset); + doSetNativeRange(win, rng); + }; + var setLegacyRtlRange = function (win, selection, start, soffset, finish, foffset) { + selection.collapse(start.dom, soffset); + selection.extend(finish.dom, foffset); + }; + var setRangeFromRelative = function (win, relative) { + return diagnose(win, relative).match({ + ltr: function (start, soffset, finish, foffset) { + doSetRange(win, start, soffset, finish, foffset); + }, + rtl: function (start, soffset, finish, foffset) { + getNativeSelection(win).each(function (selection) { + if (selection.setBaseAndExtent) { + selection.setBaseAndExtent(start.dom, soffset, finish.dom, foffset); + } else if (selection.extend) { + try { + setLegacyRtlRange(win, selection, start, soffset, finish, foffset); + } catch (e) { + doSetRange(win, finish, foffset, start, soffset); + } + } else { + doSetRange(win, finish, foffset, start, soffset); + } + }); + } + }); + }; + var setExact = function (win, start, soffset, finish, foffset) { + var relative = preprocessExact(start, soffset, finish, foffset); + setRangeFromRelative(win, relative); + }; + var setRelative = function (win, startSitu, finishSitu) { + var relative = preprocessRelative(startSitu, finishSitu); + setRangeFromRelative(win, relative); + }; + var toNative = function (selection) { + var win = SimSelection.getWin(selection).dom; + var getDomRange = function (start, soffset, finish, foffset) { + return exactToNative(win, start, soffset, finish, foffset); + }; + var filtered = preprocess(selection); + return diagnose(win, filtered).match({ + ltr: getDomRange, + rtl: getDomRange + }); + }; + var readRange = function (selection) { + if (selection.rangeCount > 0) { + var firstRng = selection.getRangeAt(0); + var lastRng = selection.getRangeAt(selection.rangeCount - 1); + return Optional.some(SimRange.create(SugarElement.fromDom(firstRng.startContainer), firstRng.startOffset, SugarElement.fromDom(lastRng.endContainer), lastRng.endOffset)); + } else { + return Optional.none(); + } + }; + var doGetExact = function (selection) { + if (selection.anchorNode === null || selection.focusNode === null) { + return readRange(selection); + } else { + var anchor = SugarElement.fromDom(selection.anchorNode); + var focus_1 = SugarElement.fromDom(selection.focusNode); + return after$2(anchor, selection.anchorOffset, focus_1, selection.focusOffset) ? Optional.some(SimRange.create(anchor, selection.anchorOffset, focus_1, selection.focusOffset)) : readRange(selection); + } + }; + var setToElement = function (win, element, selectNodeContents$1) { + if (selectNodeContents$1 === void 0) { + selectNodeContents$1 = true; + } + var rngGetter = selectNodeContents$1 ? selectNodeContents : selectNode; + var rng = rngGetter(win, element); + doSetNativeRange(win, rng); + }; + var getExact = function (win) { + return getNativeSelection(win).filter(function (sel) { + return sel.rangeCount > 0; + }).bind(doGetExact); + }; + var get$1 = function (win) { + return getExact(win).map(function (range) { + return SimSelection.exact(range.start, range.soffset, range.finish, range.foffset); + }); + }; + var getFirstRect = function (win, selection) { + var rng = asLtrRange(win, selection); + return getFirstRect$1(rng); + }; + var getAtPoint = function (win, x, y) { + return fromPoint(win, x, y); + }; + var clear = function (win) { + getNativeSelection(win).each(function (selection) { + return selection.removeAllRanges(); + }); + }; + + var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK'); + + var forward = function (editor, isRoot, cell) { + return go$1(editor, isRoot, next(cell, isEditable$1)); + }; + var backward = function (editor, isRoot, cell) { + return go$1(editor, isRoot, prev(cell, isEditable$1)); + }; + var getCellFirstCursorPosition = function (editor, cell) { + var selection = SimSelection.exact(cell, 0, cell, 0); + return toNative(selection); + }; + var go$1 = function (editor, isRoot, cell) { + return cell.fold(Optional.none, Optional.none, function (current, next) { + return first(next).map(function (cell) { + return getCellFirstCursorPosition(editor, cell); + }); + }, function (current) { + editor.execCommand('mceTableInsertRowAfter'); + return forward(editor, isRoot, current); + }); + }; + var rootElements = [ + 'table', + 'li', + 'dl' + ]; + var handle$1 = function (event, editor, cellSelection) { + if (event.keyCode === global$1.TAB) { + var body_1 = getBody(editor); + var isRoot_1 = function (element) { + var name$1 = name(element); + return eq$1(element, body_1) || contains$2(rootElements, name$1); + }; + var rng = editor.selection.getRng(); + var container = SugarElement.fromDom(event.shiftKey ? rng.startContainer : rng.endContainer); + cell(container, isRoot_1).each(function (cell) { + event.preventDefault(); + table(cell, isRoot_1).each(cellSelection.clear); + editor.selection.collapse(event.shiftKey); + var navigation = event.shiftKey ? backward : forward; + var rng = navigation(editor, isRoot_1, cell); + rng.each(function (range) { + editor.selection.setRng(range); + }); + }); + } + }; + + var create$1 = function (selection, kill) { + return { + selection: selection, + kill: kill + }; + }; + var Response = { create: create$1 }; + + var create = function (start, soffset, finish, foffset) { + return { + start: Situ.on(start, soffset), + finish: Situ.on(finish, foffset) + }; + }; + var Situs = { create: create }; + + var convertToRange = function (win, selection) { + var rng = asLtrRange(win, selection); + return SimRange.create(SugarElement.fromDom(rng.startContainer), rng.startOffset, SugarElement.fromDom(rng.endContainer), rng.endOffset); + }; + var makeSitus = Situs.create; + + var sync = function (container, isRoot, start, soffset, finish, foffset, selectRange) { + if (!(eq$1(start, finish) && soffset === foffset)) { + return closest$1(start, 'td,th', isRoot).bind(function (s) { + return closest$1(finish, 'td,th', isRoot).bind(function (f) { + return detect(container, isRoot, s, f, selectRange); + }); + }); + } else { + return Optional.none(); + } + }; + var detect = function (container, isRoot, start, finish, selectRange) { + if (!eq$1(start, finish)) { + return identify(start, finish, isRoot).bind(function (cellSel) { + var boxes = cellSel.boxes.getOr([]); + if (boxes.length > 1) { + selectRange(container, boxes, cellSel.start, cellSel.finish); + return Optional.some(Response.create(Optional.some(makeSitus(start, 0, start, getEnd(start))), true)); + } else { + return Optional.none(); + } + }); + } else { + return Optional.none(); + } + }; + var update = function (rows, columns, container, selected, annotations) { + var updateSelection = function (newSels) { + annotations.clearBeforeUpdate(container); + annotations.selectRange(container, newSels.boxes, newSels.start, newSels.finish); + return newSels.boxes; + }; + return shiftSelection(selected, rows, columns, annotations.firstSelectedSelector, annotations.lastSelectedSelector).map(updateSelection); + }; + + var traverse = function (item, mode) { + return { + item: item, + mode: mode + }; + }; + var backtrack = function (universe, item, _direction, transition) { + if (transition === void 0) { + transition = sidestep; + } + return universe.property().parent(item).map(function (p) { + return traverse(p, transition); + }); + }; + var sidestep = function (universe, item, direction, transition) { + if (transition === void 0) { + transition = advance; + } + return direction.sibling(universe, item).map(function (p) { + return traverse(p, transition); + }); + }; + var advance = function (universe, item, direction, transition) { + if (transition === void 0) { + transition = advance; + } + var children = universe.property().children(item); + var result = direction.first(children); + return result.map(function (r) { + return traverse(r, transition); + }); + }; + var successors = [ + { + current: backtrack, + next: sidestep, + fallback: Optional.none() + }, + { + current: sidestep, + next: advance, + fallback: Optional.some(backtrack) + }, + { + current: advance, + next: advance, + fallback: Optional.some(sidestep) + } + ]; + var go = function (universe, item, mode, direction, rules) { + if (rules === void 0) { + rules = successors; + } + var ruleOpt = find$1(rules, function (succ) { + return succ.current === mode; + }); + return ruleOpt.bind(function (rule) { + return rule.current(universe, item, direction, rule.next).orThunk(function () { + return rule.fallback.bind(function (fb) { + return go(universe, item, fb, direction); + }); + }); + }); + }; + + var left$1 = function () { + var sibling = function (universe, item) { + return universe.query().prevSibling(item); + }; + var first = function (children) { + return children.length > 0 ? Optional.some(children[children.length - 1]) : Optional.none(); + }; + return { + sibling: sibling, + first: first + }; + }; + var right$1 = function () { + var sibling = function (universe, item) { + return universe.query().nextSibling(item); + }; + var first = function (children) { + return children.length > 0 ? Optional.some(children[0]) : Optional.none(); + }; + return { + sibling: sibling, + first: first + }; + }; + var Walkers = { + left: left$1, + right: right$1 + }; + + var hone = function (universe, item, predicate, mode, direction, isRoot) { + var next = go(universe, item, mode, direction); + return next.bind(function (n) { + if (isRoot(n.item)) { + return Optional.none(); + } else { + return predicate(n.item) ? Optional.some(n.item) : hone(universe, n.item, predicate, n.mode, direction, isRoot); + } + }); + }; + var left = function (universe, item, predicate, isRoot) { + return hone(universe, item, predicate, sidestep, Walkers.left(), isRoot); + }; + var right = function (universe, item, predicate, isRoot) { + return hone(universe, item, predicate, sidestep, Walkers.right(), isRoot); + }; + + var isLeaf = function (universe) { + return function (element) { + return universe.property().children(element).length === 0; + }; + }; + var before$1 = function (universe, item, isRoot) { + return seekLeft$1(universe, item, isLeaf(universe), isRoot); + }; + var after$1 = function (universe, item, isRoot) { + return seekRight$1(universe, item, isLeaf(universe), isRoot); + }; + var seekLeft$1 = left; + var seekRight$1 = right; + + var universe = DomUniverse(); + var before = function (element, isRoot) { + return before$1(universe, element, isRoot); + }; + var after = function (element, isRoot) { + return after$1(universe, element, isRoot); + }; + var seekLeft = function (element, predicate, isRoot) { + return seekLeft$1(universe, element, predicate, isRoot); + }; + var seekRight = function (element, predicate, isRoot) { + return seekRight$1(universe, element, predicate, isRoot); + }; + + var ancestor = function (scope, predicate, isRoot) { + return ancestor$2(scope, predicate, isRoot).isSome(); + }; + + var adt$1 = Adt.generate([ + { none: ['message'] }, + { success: [] }, + { failedUp: ['cell'] }, + { failedDown: ['cell'] } + ]); + var isOverlapping = function (bridge, before, after) { + var beforeBounds = bridge.getRect(before); + var afterBounds = bridge.getRect(after); + return afterBounds.right > beforeBounds.left && afterBounds.left < beforeBounds.right; + }; + var isRow = function (elem) { + return closest$1(elem, 'tr'); + }; + var verify = function (bridge, before, beforeOffset, after, afterOffset, failure, isRoot) { + return closest$1(after, 'td,th', isRoot).bind(function (afterCell) { + return closest$1(before, 'td,th', isRoot).map(function (beforeCell) { + if (!eq$1(afterCell, beforeCell)) { + return sharedOne(isRow, [ + afterCell, + beforeCell + ]).fold(function () { + return isOverlapping(bridge, beforeCell, afterCell) ? adt$1.success() : failure(beforeCell); + }, function (_sharedRow) { + return failure(beforeCell); + }); + } else { + return eq$1(after, afterCell) && getEnd(afterCell) === afterOffset ? failure(beforeCell) : adt$1.none('in same cell'); + } + }); + }).getOr(adt$1.none('default')); + }; + var cata = function (subject, onNone, onSuccess, onFailedUp, onFailedDown) { + return subject.fold(onNone, onSuccess, onFailedUp, onFailedDown); + }; + var BeforeAfter = __assign(__assign({}, adt$1), { + verify: verify, + cata: cata + }); + + var inParent = function (parent, children, element, index) { + return { + parent: parent, + children: children, + element: element, + index: index + }; + }; + var indexInParent = function (element) { + return parent(element).bind(function (parent) { + var children = children$3(parent); + return indexOf(children, element).map(function (index) { + return inParent(parent, children, element, index); + }); + }); + }; + var indexOf = function (elements, element) { + return findIndex(elements, curry(eq$1, element)); + }; + + var isBr = function (elem) { + return name(elem) === 'br'; + }; + var gatherer = function (cand, gather, isRoot) { + return gather(cand, isRoot).bind(function (target) { + return isText(target) && get$9(target).trim().length === 0 ? gatherer(target, gather, isRoot) : Optional.some(target); + }); + }; + var handleBr = function (isRoot, element, direction) { + return direction.traverse(element).orThunk(function () { + return gatherer(element, direction.gather, isRoot); + }).map(direction.relative); + }; + var findBr = function (element, offset) { + return child$3(element, offset).filter(isBr).orThunk(function () { + return child$3(element, offset - 1).filter(isBr); + }); + }; + var handleParent = function (isRoot, element, offset, direction) { + return findBr(element, offset).bind(function (br) { + return direction.traverse(br).fold(function () { + return gatherer(br, direction.gather, isRoot).map(direction.relative); + }, function (adjacent) { + return indexInParent(adjacent).map(function (info) { + return Situ.on(info.parent, info.index); + }); + }); + }); + }; + var tryBr = function (isRoot, element, offset, direction) { + var target = isBr(element) ? handleBr(isRoot, element, direction) : handleParent(isRoot, element, offset, direction); + return target.map(function (tgt) { + return { + start: tgt, + finish: tgt + }; + }); + }; + var process = function (analysis) { + return BeforeAfter.cata(analysis, function (_message) { + return Optional.none(); + }, function () { + return Optional.none(); + }, function (cell) { + return Optional.some(point(cell, 0)); + }, function (cell) { + return Optional.some(point(cell, getEnd(cell))); + }); + }; + + var moveDown = function (caret, amount) { + return { + left: caret.left, + top: caret.top + amount, + right: caret.right, + bottom: caret.bottom + amount + }; + }; + var moveUp = function (caret, amount) { + return { + left: caret.left, + top: caret.top - amount, + right: caret.right, + bottom: caret.bottom - amount + }; + }; + var translate = function (caret, xDelta, yDelta) { + return { + left: caret.left + xDelta, + top: caret.top + yDelta, + right: caret.right + xDelta, + bottom: caret.bottom + yDelta + }; + }; + var getTop = function (caret) { + return caret.top; + }; + var getBottom = function (caret) { + return caret.bottom; + }; + + var getPartialBox = function (bridge, element, offset) { + if (offset >= 0 && offset < getEnd(element)) { + return bridge.getRangedRect(element, offset, element, offset + 1); + } else if (offset > 0) { + return bridge.getRangedRect(element, offset - 1, element, offset); + } + return Optional.none(); + }; + var toCaret = function (rect) { + return { + left: rect.left, + top: rect.top, + right: rect.right, + bottom: rect.bottom + }; + }; + var getElemBox = function (bridge, element) { + return Optional.some(bridge.getRect(element)); + }; + var getBoxAt = function (bridge, element, offset) { + if (isElement(element)) { + return getElemBox(bridge, element).map(toCaret); + } else if (isText(element)) { + return getPartialBox(bridge, element, offset).map(toCaret); + } else { + return Optional.none(); + } + }; + var getEntireBox = function (bridge, element) { + if (isElement(element)) { + return getElemBox(bridge, element).map(toCaret); + } else if (isText(element)) { + return bridge.getRangedRect(element, 0, element, getEnd(element)).map(toCaret); + } else { + return Optional.none(); + } + }; + + var JUMP_SIZE = 5; + var NUM_RETRIES = 100; + var adt = Adt.generate([ + { none: [] }, + { retry: ['caret'] } + ]); + var isOutside = function (caret, box) { + return caret.left < box.left || Math.abs(box.right - caret.left) < 1 || caret.left > box.right; + }; + var inOutsideBlock = function (bridge, element, caret) { + return closest$2(element, isBlock).fold(never, function (cell) { + return getEntireBox(bridge, cell).exists(function (box) { + return isOutside(caret, box); + }); + }); + }; + var adjustDown = function (bridge, element, guessBox, original, caret) { + var lowerCaret = moveDown(caret, JUMP_SIZE); + if (Math.abs(guessBox.bottom - original.bottom) < 1) { + return adt.retry(lowerCaret); + } else if (guessBox.top > caret.bottom) { + return adt.retry(lowerCaret); + } else if (guessBox.top === caret.bottom) { + return adt.retry(moveDown(caret, 1)); + } else { + return inOutsideBlock(bridge, element, caret) ? adt.retry(translate(lowerCaret, JUMP_SIZE, 0)) : adt.none(); + } + }; + var adjustUp = function (bridge, element, guessBox, original, caret) { + var higherCaret = moveUp(caret, JUMP_SIZE); + if (Math.abs(guessBox.top - original.top) < 1) { + return adt.retry(higherCaret); + } else if (guessBox.bottom < caret.top) { + return adt.retry(higherCaret); + } else if (guessBox.bottom === caret.top) { + return adt.retry(moveUp(caret, 1)); + } else { + return inOutsideBlock(bridge, element, caret) ? adt.retry(translate(higherCaret, JUMP_SIZE, 0)) : adt.none(); + } + }; + var upMovement = { + point: getTop, + adjuster: adjustUp, + move: moveUp, + gather: before + }; + var downMovement = { + point: getBottom, + adjuster: adjustDown, + move: moveDown, + gather: after + }; + var isAtTable = function (bridge, x, y) { + return bridge.elementFromPoint(x, y).filter(function (elm) { + return name(elm) === 'table'; + }).isSome(); + }; + var adjustForTable = function (bridge, movement, original, caret, numRetries) { + return adjustTil(bridge, movement, original, movement.move(caret, JUMP_SIZE), numRetries); + }; + var adjustTil = function (bridge, movement, original, caret, numRetries) { + if (numRetries === 0) { + return Optional.some(caret); + } + if (isAtTable(bridge, caret.left, movement.point(caret))) { + return adjustForTable(bridge, movement, original, caret, numRetries - 1); + } + return bridge.situsFromPoint(caret.left, movement.point(caret)).bind(function (guess) { + return guess.start.fold(Optional.none, function (element) { + return getEntireBox(bridge, element).bind(function (guessBox) { + return movement.adjuster(bridge, element, guessBox, original, caret).fold(Optional.none, function (newCaret) { + return adjustTil(bridge, movement, original, newCaret, numRetries - 1); + }); + }).orThunk(function () { + return Optional.some(caret); + }); + }, Optional.none); + }); + }; + var ieTryDown = function (bridge, caret) { + return bridge.situsFromPoint(caret.left, caret.bottom + JUMP_SIZE); + }; + var ieTryUp = function (bridge, caret) { + return bridge.situsFromPoint(caret.left, caret.top - JUMP_SIZE); + }; + var checkScroll = function (movement, adjusted, bridge) { + if (movement.point(adjusted) > bridge.getInnerHeight()) { + return Optional.some(movement.point(adjusted) - bridge.getInnerHeight()); + } else if (movement.point(adjusted) < 0) { + return Optional.some(-movement.point(adjusted)); + } else { + return Optional.none(); + } + }; + var retry = function (movement, bridge, caret) { + var moved = movement.move(caret, JUMP_SIZE); + var adjusted = adjustTil(bridge, movement, caret, moved, NUM_RETRIES).getOr(moved); + return checkScroll(movement, adjusted, bridge).fold(function () { + return bridge.situsFromPoint(adjusted.left, movement.point(adjusted)); + }, function (delta) { + bridge.scrollBy(0, delta); + return bridge.situsFromPoint(adjusted.left, movement.point(adjusted) - delta); + }); + }; + var Retries = { + tryUp: curry(retry, upMovement), + tryDown: curry(retry, downMovement), + ieTryUp: ieTryUp, + ieTryDown: ieTryDown, + getJumpSize: constant(JUMP_SIZE) + }; + + var MAX_RETRIES = 20; + var findSpot = function (bridge, isRoot, direction) { + return bridge.getSelection().bind(function (sel) { + return tryBr(isRoot, sel.finish, sel.foffset, direction).fold(function () { + return Optional.some(point(sel.finish, sel.foffset)); + }, function (brNeighbour) { + var range = bridge.fromSitus(brNeighbour); + var analysis = BeforeAfter.verify(bridge, sel.finish, sel.foffset, range.finish, range.foffset, direction.failure, isRoot); + return process(analysis); + }); + }); + }; + var scan = function (bridge, isRoot, element, offset, direction, numRetries) { + if (numRetries === 0) { + return Optional.none(); + } + return tryCursor(bridge, isRoot, element, offset, direction).bind(function (situs) { + var range = bridge.fromSitus(situs); + var analysis = BeforeAfter.verify(bridge, element, offset, range.finish, range.foffset, direction.failure, isRoot); + return BeforeAfter.cata(analysis, function () { + return Optional.none(); + }, function () { + return Optional.some(situs); + }, function (cell) { + if (eq$1(element, cell) && offset === 0) { + return tryAgain(bridge, element, offset, moveUp, direction); + } else { + return scan(bridge, isRoot, cell, 0, direction, numRetries - 1); + } + }, function (cell) { + if (eq$1(element, cell) && offset === getEnd(cell)) { + return tryAgain(bridge, element, offset, moveDown, direction); + } else { + return scan(bridge, isRoot, cell, getEnd(cell), direction, numRetries - 1); + } + }); + }); + }; + var tryAgain = function (bridge, element, offset, move, direction) { + return getBoxAt(bridge, element, offset).bind(function (box) { + return tryAt(bridge, direction, move(box, Retries.getJumpSize())); + }); + }; + var tryAt = function (bridge, direction, box) { + var browser = detect$3().browser; + if (browser.isChrome() || browser.isSafari() || browser.isFirefox() || browser.isEdge()) { + return direction.otherRetry(bridge, box); + } else if (browser.isIE()) { + return direction.ieRetry(bridge, box); + } else { + return Optional.none(); + } + }; + var tryCursor = function (bridge, isRoot, element, offset, direction) { + return getBoxAt(bridge, element, offset).bind(function (box) { + return tryAt(bridge, direction, box); + }); + }; + var handle = function (bridge, isRoot, direction) { + return findSpot(bridge, isRoot, direction).bind(function (spot) { + return scan(bridge, isRoot, spot.element, spot.offset, direction, MAX_RETRIES).map(bridge.fromSitus); + }); + }; + + var inSameTable = function (elem, table) { + return ancestor(elem, function (e) { + return parent(e).exists(function (p) { + return eq$1(p, table); + }); + }); + }; + var simulate = function (bridge, isRoot, direction, initial, anchor) { + return closest$1(initial, 'td,th', isRoot).bind(function (start) { + return closest$1(start, 'table', isRoot).bind(function (table) { + if (!inSameTable(anchor, table)) { + return Optional.none(); + } + return handle(bridge, isRoot, direction).bind(function (range) { + return closest$1(range.finish, 'td,th', isRoot).map(function (finish) { + return { + start: start, + finish: finish, + range: range + }; + }); + }); + }); + }); + }; + var navigate = function (bridge, isRoot, direction, initial, anchor, precheck) { + if (detect$3().browser.isIE()) { + return Optional.none(); + } else { + return precheck(initial, isRoot).orThunk(function () { + return simulate(bridge, isRoot, direction, initial, anchor).map(function (info) { + var range = info.range; + return Response.create(Optional.some(makeSitus(range.start, range.soffset, range.finish, range.foffset)), true); + }); + }); + } + }; + var firstUpCheck = function (initial, isRoot) { + return closest$1(initial, 'tr', isRoot).bind(function (startRow) { + return closest$1(startRow, 'table', isRoot).bind(function (table) { + var rows = descendants(table, 'tr'); + if (eq$1(startRow, rows[0])) { + return seekLeft(table, function (element) { + return last$1(element).isSome(); + }, isRoot).map(function (last) { + var lastOffset = getEnd(last); + return Response.create(Optional.some(makeSitus(last, lastOffset, last, lastOffset)), true); + }); + } else { + return Optional.none(); + } + }); + }); + }; + var lastDownCheck = function (initial, isRoot) { + return closest$1(initial, 'tr', isRoot).bind(function (startRow) { + return closest$1(startRow, 'table', isRoot).bind(function (table) { + var rows = descendants(table, 'tr'); + if (eq$1(startRow, rows[rows.length - 1])) { + return seekRight(table, function (element) { + return first(element).isSome(); + }, isRoot).map(function (first) { + return Response.create(Optional.some(makeSitus(first, 0, first, 0)), true); + }); + } else { + return Optional.none(); + } + }); + }); + }; + var select = function (bridge, container, isRoot, direction, initial, anchor, selectRange) { + return simulate(bridge, isRoot, direction, initial, anchor).bind(function (info) { + return detect(container, isRoot, info.start, info.finish, selectRange); + }); + }; + + var findCell = function (target, isRoot) { + return closest$1(target, 'td,th', isRoot); + }; + var MouseSelection = function (bridge, container, isRoot, annotations) { + var cursor = value(); + var clearstate = cursor.clear; + var applySelection = function (event) { + cursor.on(function (start) { + annotations.clearBeforeUpdate(container); + findCell(event.target, isRoot).each(function (finish) { + identify(start, finish, isRoot).each(function (cellSel) { + var boxes = cellSel.boxes.getOr([]); + if (boxes.length === 1) { + var singleCell = boxes[0]; + var isNonEditableCell = getRaw(singleCell) === 'false'; + var isCellClosestContentEditable = is(closest(event.target), singleCell, eq$1); + if (isNonEditableCell && isCellClosestContentEditable) { + annotations.selectRange(container, boxes, singleCell, singleCell); + bridge.selectContents(singleCell); + } + } else if (boxes.length > 1) { + annotations.selectRange(container, boxes, cellSel.start, cellSel.finish); + bridge.selectContents(finish); + } + }); + }); + }); + }; + var mousedown = function (event) { + annotations.clear(container); + findCell(event.target, isRoot).each(cursor.set); + }; + var mouseover = function (event) { + applySelection(event); + }; + var mouseup = function (event) { + applySelection(event); + clearstate(); + }; + return { + clearstate: clearstate, + mousedown: mousedown, + mouseover: mouseover, + mouseup: mouseup + }; + }; + + var down = { + traverse: nextSibling, + gather: after, + relative: Situ.before, + otherRetry: Retries.tryDown, + ieRetry: Retries.ieTryDown, + failure: BeforeAfter.failedDown + }; + var up = { + traverse: prevSibling, + gather: before, + relative: Situ.before, + otherRetry: Retries.tryUp, + ieRetry: Retries.ieTryUp, + failure: BeforeAfter.failedUp + }; + + var isKey = function (key) { + return function (keycode) { + return keycode === key; + }; + }; + var isUp = isKey(38); + var isDown = isKey(40); + var isNavigation = function (keycode) { + return keycode >= 37 && keycode <= 40; + }; + var ltr = { + isBackward: isKey(37), + isForward: isKey(39) + }; + var rtl = { + isBackward: isKey(39), + isForward: isKey(37) + }; + + var get = function (_DOC) { + var doc = _DOC !== undefined ? _DOC.dom : document; + var x = doc.body.scrollLeft || doc.documentElement.scrollLeft; + var y = doc.body.scrollTop || doc.documentElement.scrollTop; + return SugarPosition(x, y); + }; + var by = function (x, y, _DOC) { + var doc = _DOC !== undefined ? _DOC.dom : document; + var win = doc.defaultView; + if (win) { + win.scrollBy(x, y); + } + }; + + var WindowBridge = function (win) { + var elementFromPoint = function (x, y) { + return SugarElement.fromPoint(SugarElement.fromDom(win.document), x, y); + }; + var getRect = function (element) { + return element.dom.getBoundingClientRect(); + }; + var getRangedRect = function (start, soffset, finish, foffset) { + var sel = SimSelection.exact(start, soffset, finish, foffset); + return getFirstRect(win, sel); + }; + var getSelection = function () { + return get$1(win).map(function (exactAdt) { + return convertToRange(win, exactAdt); + }); + }; + var fromSitus = function (situs) { + var relative = SimSelection.relative(situs.start, situs.finish); + return convertToRange(win, relative); + }; + var situsFromPoint = function (x, y) { + return getAtPoint(win, x, y).map(function (exact) { + return Situs.create(exact.start, exact.soffset, exact.finish, exact.foffset); + }); + }; + var clearSelection = function () { + clear(win); + }; + var collapseSelection = function (toStart) { + if (toStart === void 0) { + toStart = false; + } + get$1(win).each(function (sel) { + return sel.fold(function (rng) { + return rng.collapse(toStart); + }, function (startSitu, finishSitu) { + var situ = toStart ? startSitu : finishSitu; + setRelative(win, situ, situ); + }, function (start, soffset, finish, foffset) { + var node = toStart ? start : finish; + var offset = toStart ? soffset : foffset; + setExact(win, node, offset, node, offset); + }); + }); + }; + var selectNode = function (element) { + setToElement(win, element, false); + }; + var selectContents = function (element) { + setToElement(win, element); + }; + var setSelection = function (sel) { + setExact(win, sel.start, sel.soffset, sel.finish, sel.foffset); + }; + var setRelativeSelection = function (start, finish) { + setRelative(win, start, finish); + }; + var getInnerHeight = function () { + return win.innerHeight; + }; + var getScrollY = function () { + var pos = get(SugarElement.fromDom(win.document)); + return pos.top; + }; + var scrollBy = function (x, y) { + by(x, y, SugarElement.fromDom(win.document)); + }; + return { + elementFromPoint: elementFromPoint, + getRect: getRect, + getRangedRect: getRangedRect, + getSelection: getSelection, + fromSitus: fromSitus, + situsFromPoint: situsFromPoint, + clearSelection: clearSelection, + collapseSelection: collapseSelection, + setSelection: setSelection, + setRelativeSelection: setRelativeSelection, + selectNode: selectNode, + selectContents: selectContents, + getInnerHeight: getInnerHeight, + getScrollY: getScrollY, + scrollBy: scrollBy + }; + }; + + var rc = function (rows, cols) { + return { + rows: rows, + cols: cols + }; + }; + var mouse = function (win, container, isRoot, annotations) { + var bridge = WindowBridge(win); + var handlers = MouseSelection(bridge, container, isRoot, annotations); + return { + clearstate: handlers.clearstate, + mousedown: handlers.mousedown, + mouseover: handlers.mouseover, + mouseup: handlers.mouseup + }; + }; + var keyboard = function (win, container, isRoot, annotations) { + var bridge = WindowBridge(win); + var clearToNavigate = function () { + annotations.clear(container); + return Optional.none(); + }; + var keydown = function (event, start, soffset, finish, foffset, direction) { + var realEvent = event.raw; + var keycode = realEvent.which; + var shiftKey = realEvent.shiftKey === true; + var handler = retrieve$1(container, annotations.selectedSelector).fold(function () { + if (isNavigation(keycode) && !shiftKey) { + annotations.clearBeforeUpdate(container); + } + if (isDown(keycode) && shiftKey) { + return curry(select, bridge, container, isRoot, down, finish, start, annotations.selectRange); + } else if (isUp(keycode) && shiftKey) { + return curry(select, bridge, container, isRoot, up, finish, start, annotations.selectRange); + } else if (isDown(keycode)) { + return curry(navigate, bridge, isRoot, down, finish, start, lastDownCheck); + } else if (isUp(keycode)) { + return curry(navigate, bridge, isRoot, up, finish, start, firstUpCheck); + } else { + return Optional.none; + } + }, function (selected) { + var update$1 = function (attempts) { + return function () { + var navigation = findMap(attempts, function (delta) { + return update(delta.rows, delta.cols, container, selected, annotations); + }); + return navigation.fold(function () { + return getEdges(container, annotations.firstSelectedSelector, annotations.lastSelectedSelector).map(function (edges) { + var relative = isDown(keycode) || direction.isForward(keycode) ? Situ.after : Situ.before; + bridge.setRelativeSelection(Situ.on(edges.first, 0), relative(edges.table)); + annotations.clear(container); + return Response.create(Optional.none(), true); + }); + }, function (_) { + return Optional.some(Response.create(Optional.none(), true)); + }); + }; + }; + if (isDown(keycode) && shiftKey) { + return update$1([rc(+1, 0)]); + } else if (isUp(keycode) && shiftKey) { + return update$1([rc(-1, 0)]); + } else if (direction.isBackward(keycode) && shiftKey) { + return update$1([ + rc(0, -1), + rc(-1, 0) + ]); + } else if (direction.isForward(keycode) && shiftKey) { + return update$1([ + rc(0, +1), + rc(+1, 0) + ]); + } else if (isNavigation(keycode) && !shiftKey) { + return clearToNavigate; + } else { + return Optional.none; + } + }); + return handler(); + }; + var keyup = function (event, start, soffset, finish, foffset) { + return retrieve$1(container, annotations.selectedSelector).fold(function () { + var realEvent = event.raw; + var keycode = realEvent.which; + var shiftKey = realEvent.shiftKey === true; + if (!shiftKey) { + return Optional.none(); + } + if (isNavigation(keycode)) { + return sync(container, isRoot, start, soffset, finish, foffset, annotations.selectRange); + } else { + return Optional.none(); + } + }, Optional.none); + }; + return { + keydown: keydown, + keyup: keyup + }; + }; + var external = function (win, container, isRoot, annotations) { + var bridge = WindowBridge(win); + return function (start, finish) { + annotations.clearBeforeUpdate(container); + identify(start, finish, isRoot).each(function (cellSel) { + var boxes = cellSel.boxes.getOr([]); + annotations.selectRange(container, boxes, cellSel.start, cellSel.finish); + bridge.selectContents(finish); + bridge.collapseSelection(); + }); + }; + }; + + var remove = function (element, classes) { + each$2(classes, function (x) { + remove$2(element, x); + }); + }; + + var addClass = function (clazz) { + return function (element) { + add(element, clazz); + }; + }; + var removeClasses = function (classes) { + return function (element) { + remove(element, classes); + }; + }; + + var byClass = function (ephemera) { + var addSelectionClass = addClass(ephemera.selected); + var removeSelectionClasses = removeClasses([ + ephemera.selected, + ephemera.lastSelected, + ephemera.firstSelected + ]); + var clear = function (container) { + var sels = descendants(container, ephemera.selectedSelector); + each$2(sels, removeSelectionClasses); + }; + var selectRange = function (container, cells, start, finish) { + clear(container); + each$2(cells, addSelectionClass); + add(start, ephemera.firstSelected); + add(finish, ephemera.lastSelected); + }; + return { + clearBeforeUpdate: clear, + clear: clear, + selectRange: selectRange, + selectedSelector: ephemera.selectedSelector, + firstSelectedSelector: ephemera.firstSelectedSelector, + lastSelectedSelector: ephemera.lastSelectedSelector + }; + }; + var byAttr = function (ephemera, onSelection, onClear) { + var removeSelectionAttributes = function (element) { + remove$7(element, ephemera.selected); + remove$7(element, ephemera.firstSelected); + remove$7(element, ephemera.lastSelected); + }; + var addSelectionAttribute = function (element) { + set$2(element, ephemera.selected, '1'); + }; + var clear = function (container) { + clearBeforeUpdate(container); + onClear(); + }; + var clearBeforeUpdate = function (container) { + var sels = descendants(container, ephemera.selectedSelector + ',' + ephemera.firstSelectedSelector + ',' + ephemera.lastSelectedSelector); + each$2(sels, removeSelectionAttributes); + }; + var selectRange = function (container, cells, start, finish) { + clear(container); + each$2(cells, addSelectionAttribute); + set$2(start, ephemera.firstSelected, '1'); + set$2(finish, ephemera.lastSelected, '1'); + onSelection(cells, start, finish); + }; + return { + clearBeforeUpdate: clearBeforeUpdate, + clear: clear, + selectRange: selectRange, + selectedSelector: ephemera.selectedSelector, + firstSelectedSelector: ephemera.firstSelectedSelector, + lastSelectedSelector: ephemera.lastSelectedSelector + }; + }; + var SelectionAnnotation = { + byClass: byClass, + byAttr: byAttr + }; + + var getUpOrLeftCells = function (grid, selectedCells) { + var upGrid = grid.slice(0, selectedCells[selectedCells.length - 1].row + 1); + var upDetails = toDetailList(upGrid); + return bind$2(upDetails, function (detail) { + var slicedCells = detail.cells.slice(0, selectedCells[selectedCells.length - 1].column + 1); + return map$1(slicedCells, function (cell) { + return cell.element; + }); + }); + }; + var getDownOrRightCells = function (grid, selectedCells) { + var downGrid = grid.slice(selectedCells[0].row + selectedCells[0].rowspan - 1, grid.length); + var downDetails = toDetailList(downGrid); + return bind$2(downDetails, function (detail) { + var slicedCells = detail.cells.slice(selectedCells[0].column + selectedCells[0].colspan - 1, detail.cells.length); + return map$1(slicedCells, function (cell) { + return cell.element; + }); + }); + }; + var getOtherCells = function (table, target, generators) { + var warehouse = Warehouse.fromTable(table); + var details = onCells(warehouse, target); + return details.map(function (selectedCells) { + var grid = toGrid(warehouse, generators, false); + var upOrLeftCells = getUpOrLeftCells(grid, selectedCells); + var downOrRightCells = getDownOrRightCells(grid, selectedCells); + return { + upOrLeftCells: upOrLeftCells, + downOrRightCells: downOrRightCells + }; + }); + }; + + var global = tinymce.util.Tools.resolve('tinymce.Env'); + + var hasInternalTarget = function (e) { + return has(SugarElement.fromDom(e.target), 'ephox-snooker-resizer-bar') === false; + }; + function CellSelection (editor, lazyResize, selectionTargets) { + var onSelection = function (cells, start, finish) { + selectionTargets.targets().each(function (targets) { + var tableOpt = table(start); + tableOpt.each(function (table) { + var cloneFormats = getCloneElements(editor); + var generators = cellOperations(noop, SugarElement.fromDom(editor.getDoc()), cloneFormats); + var otherCells = getOtherCells(table, targets, generators); + fireTableSelectionChange(editor, cells, start, finish, otherCells); + }); + }); + }; + var onClear = function () { + return fireTableSelectionClear(editor); + }; + var annotations = SelectionAnnotation.byAttr(ephemera, onSelection, onClear); + editor.on('init', function (_e) { + var win = editor.getWin(); + var body = getBody(editor); + var isRoot = getIsRoot(editor); + var syncSelection = function () { + var sel = editor.selection; + var start = SugarElement.fromDom(sel.getStart()); + var end = SugarElement.fromDom(sel.getEnd()); + var shared = sharedOne(table, [ + start, + end + ]); + shared.fold(function () { + return annotations.clear(body); + }, noop); + }; + var mouseHandlers = mouse(win, body, isRoot, annotations); + var keyHandlers = keyboard(win, body, isRoot, annotations); + var external$1 = external(win, body, isRoot, annotations); + var hasShiftKey = function (event) { + return event.raw.shiftKey === true; + }; + editor.on('TableSelectorChange', function (e) { + return external$1(e.start, e.finish); + }); + var handleResponse = function (event, response) { + if (!hasShiftKey(event)) { + return; + } + if (response.kill) { + event.kill(); + } + response.selection.each(function (ns) { + var relative = SimSelection.relative(ns.start, ns.finish); + var rng = asLtrRange(win, relative); + editor.selection.setRng(rng); + }); + }; + var keyup = function (event) { + var wrappedEvent = fromRawEvent(event); + if (wrappedEvent.raw.shiftKey && isNavigation(wrappedEvent.raw.which)) { + var rng = editor.selection.getRng(); + var start = SugarElement.fromDom(rng.startContainer); + var end = SugarElement.fromDom(rng.endContainer); + keyHandlers.keyup(wrappedEvent, start, rng.startOffset, end, rng.endOffset).each(function (response) { + handleResponse(wrappedEvent, response); + }); + } + }; + var keydown = function (event) { + var wrappedEvent = fromRawEvent(event); + lazyResize().each(function (resize) { + return resize.hideBars(); + }); + var rng = editor.selection.getRng(); + var start = SugarElement.fromDom(rng.startContainer); + var end = SugarElement.fromDom(rng.endContainer); + var direction = onDirection(ltr, rtl)(SugarElement.fromDom(editor.selection.getStart())); + keyHandlers.keydown(wrappedEvent, start, rng.startOffset, end, rng.endOffset, direction).each(function (response) { + handleResponse(wrappedEvent, response); + }); + lazyResize().each(function (resize) { + return resize.showBars(); + }); + }; + var isLeftMouse = function (raw) { + return raw.button === 0; + }; + var isLeftButtonPressed = function (raw) { + if (raw.buttons === undefined) { + return true; + } + if (global.browser.isEdge() && raw.buttons === 0) { + return true; + } + return (raw.buttons & 1) !== 0; + }; + var dragStart = function (_e) { + mouseHandlers.clearstate(); + }; + var mouseDown = function (e) { + if (isLeftMouse(e) && hasInternalTarget(e)) { + mouseHandlers.mousedown(fromRawEvent(e)); + } + }; + var mouseOver = function (e) { + if (isLeftButtonPressed(e) && hasInternalTarget(e)) { + mouseHandlers.mouseover(fromRawEvent(e)); + } + }; + var mouseUp = function (e) { + if (isLeftMouse(e) && hasInternalTarget(e)) { + mouseHandlers.mouseup(fromRawEvent(e)); + } + }; + var getDoubleTap = function () { + var lastTarget = Cell(SugarElement.fromDom(body)); + var lastTimeStamp = Cell(0); + var touchEnd = function (t) { + var target = SugarElement.fromDom(t.target); + if (name(target) === 'td' || name(target) === 'th') { + var lT = lastTarget.get(); + var lTS = lastTimeStamp.get(); + if (eq$1(lT, target) && t.timeStamp - lTS < 300) { + t.preventDefault(); + external$1(target, target); + } + } + lastTarget.set(target); + lastTimeStamp.set(t.timeStamp); + }; + return { touchEnd: touchEnd }; + }; + var doubleTap = getDoubleTap(); + editor.on('dragstart', dragStart); + editor.on('mousedown', mouseDown); + editor.on('mouseover', mouseOver); + editor.on('mouseup', mouseUp); + editor.on('touchend', doubleTap.touchEnd); + editor.on('keyup', keyup); + editor.on('keydown', keydown); + editor.on('NodeChange', syncSelection); + }); + return { clear: annotations.clear }; + } + + var child = function (scope, selector) { + return child$1(scope, selector).isSome(); + }; + + var getSelectionTargets = function (editor, selections) { + var targets = Cell(Optional.none()); + var changeHandlers = Cell([]); + var selectionDetails = Optional.none(); + var isCaption = isTag('caption'); + var isDisabledForSelection = function (key) { + return selectionDetails.forall(function (details) { + return !details[key]; + }); + }; + var getStart = function () { + return getSelectionCellOrCaption(getSelectionStart(editor), getIsRoot(editor)); + }; + var getEnd = function () { + return getSelectionCellOrCaption(getSelectionEnd(editor), getIsRoot(editor)); + }; + var findTargets = function () { + return getStart().bind(function (startCellOrCaption) { + return flatten(lift2(table(startCellOrCaption), getEnd().bind(table), function (startTable, endTable) { + if (eq$1(startTable, endTable)) { + if (isCaption(startCellOrCaption)) { + return Optional.some(noMenu(startCellOrCaption)); + } else { + return Optional.some(forMenu(selections, startTable, startCellOrCaption)); + } + } + return Optional.none(); + })); + }); + }; + var getExtractedDetails = function (targets) { + var tableOpt = table(targets.element); + return tableOpt.map(function (table) { + var warehouse = Warehouse.fromTable(table); + var selectedCells = onCells(warehouse, targets).getOr([]); + var locked = foldl(selectedCells, function (acc, cell) { + if (cell.isLocked) { + acc.onAny = true; + if (cell.column === 0) { + acc.onFirst = true; + } else if (cell.column + cell.colspan >= warehouse.grid.columns) { + acc.onLast = true; + } + } + return acc; + }, { + onAny: false, + onFirst: false, + onLast: false + }); + return { + mergeable: onUnlockedMergable(warehouse, targets).isSome(), + unmergeable: onUnlockedUnmergable(warehouse, targets).isSome(), + locked: locked + }; + }); + }; + var resetTargets = function () { + targets.set(cached(findTargets)()); + selectionDetails = targets.get().bind(getExtractedDetails); + each$2(changeHandlers.get(), function (handler) { + return handler(); + }); + }; + var setupHandler = function (handler) { + handler(); + changeHandlers.set(changeHandlers.get().concat([handler])); + return function () { + changeHandlers.set(filter$2(changeHandlers.get(), function (h) { + return h !== handler; + })); + }; + }; + var onSetup = function (api, isDisabled) { + return setupHandler(function () { + return targets.get().fold(function () { + api.setDisabled(true); + }, function (targets) { + api.setDisabled(isDisabled(targets)); + }); + }); + }; + var onSetupWithToggle = function (api, isDisabled, isActive) { + return setupHandler(function () { + return targets.get().fold(function () { + api.setDisabled(true); + api.setActive(false); + }, function (targets) { + api.setDisabled(isDisabled(targets)); + api.setActive(isActive(targets)); + }); + }); + }; + var isDisabledFromLocked = function (lockedDisable) { + return selectionDetails.exists(function (details) { + return details.locked[lockedDisable]; + }); + }; + var onSetupTable = function (api) { + return onSetup(api, function (_) { + return false; + }); + }; + var onSetupCellOrRow = function (api) { + return onSetup(api, function (targets) { + return isCaption(targets.element); + }); + }; + var onSetupColumn = function (lockedDisable) { + return function (api) { + return onSetup(api, function (targets) { + return isCaption(targets.element) || isDisabledFromLocked(lockedDisable); + }); + }; + }; + var onSetupPasteable = function (getClipboardData) { + return function (api) { + return onSetup(api, function (targets) { + return isCaption(targets.element) || getClipboardData().isNone(); + }); + }; + }; + var onSetupPasteableColumn = function (getClipboardData, lockedDisable) { + return function (api) { + return onSetup(api, function (targets) { + return isCaption(targets.element) || getClipboardData().isNone() || isDisabledFromLocked(lockedDisable); + }); + }; + }; + var onSetupMergeable = function (api) { + return onSetup(api, function (_targets) { + return isDisabledForSelection('mergeable'); + }); + }; + var onSetupUnmergeable = function (api) { + return onSetup(api, function (_targets) { + return isDisabledForSelection('unmergeable'); + }); + }; + var onSetupTableWithCaption = function (api) { + return onSetupWithToggle(api, never, function (targets) { + var tableOpt = table(targets.element, getIsRoot(editor)); + return tableOpt.exists(function (table) { + return child(table, 'caption'); + }); + }); + }; + var onSetupTableHeaders = function (command, headerType) { + return function (api) { + return onSetupWithToggle(api, function (targets) { + return isCaption(targets.element); + }, function () { + return editor.queryCommandValue(command) === headerType; + }); + }; + }; + var onSetupTableRowHeaders = onSetupTableHeaders('mceTableRowType', 'header'); + var onSetupTableColumnHeaders = onSetupTableHeaders('mceTableColType', 'th'); + editor.on('NodeChange ExecCommand TableSelectorChange', resetTargets); + return { + onSetupTable: onSetupTable, + onSetupCellOrRow: onSetupCellOrRow, + onSetupColumn: onSetupColumn, + onSetupPasteable: onSetupPasteable, + onSetupPasteableColumn: onSetupPasteableColumn, + onSetupMergeable: onSetupMergeable, + onSetupUnmergeable: onSetupUnmergeable, + resetTargets: resetTargets, + onSetupTableWithCaption: onSetupTableWithCaption, + onSetupTableRowHeaders: onSetupTableRowHeaders, + onSetupTableColumnHeaders: onSetupTableColumnHeaders, + targets: targets.get + }; + }; + + var addButtons = function (editor, selections, selectionTargets, clipboard) { + editor.ui.registry.addMenuButton('table', { + tooltip: 'Table', + icon: 'table', + fetch: function (callback) { + return callback('inserttable | cell row column | advtablesort | tableprops deletetable'); + } + }); + var cmd = function (command) { + return function () { + return editor.execCommand(command); + }; + }; + editor.ui.registry.addButton('tableprops', { + tooltip: 'Table properties', + onAction: cmd('mceTableProps'), + icon: 'table', + onSetup: selectionTargets.onSetupTable + }); + editor.ui.registry.addButton('tabledelete', { + tooltip: 'Delete table', + onAction: cmd('mceTableDelete'), + icon: 'table-delete-table', + onSetup: selectionTargets.onSetupTable + }); + editor.ui.registry.addButton('tablecellprops', { + tooltip: 'Cell properties', + onAction: cmd('mceTableCellProps'), + icon: 'table-cell-properties', + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addButton('tablemergecells', { + tooltip: 'Merge cells', + onAction: cmd('mceTableMergeCells'), + icon: 'table-merge-cells', + onSetup: selectionTargets.onSetupMergeable + }); + editor.ui.registry.addButton('tablesplitcells', { + tooltip: 'Split cell', + onAction: cmd('mceTableSplitCells'), + icon: 'table-split-cells', + onSetup: selectionTargets.onSetupUnmergeable + }); + editor.ui.registry.addButton('tableinsertrowbefore', { + tooltip: 'Insert row before', + onAction: cmd('mceTableInsertRowBefore'), + icon: 'table-insert-row-above', + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addButton('tableinsertrowafter', { + tooltip: 'Insert row after', + onAction: cmd('mceTableInsertRowAfter'), + icon: 'table-insert-row-after', + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addButton('tabledeleterow', { + tooltip: 'Delete row', + onAction: cmd('mceTableDeleteRow'), + icon: 'table-delete-row', + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addButton('tablerowprops', { + tooltip: 'Row properties', + onAction: cmd('mceTableRowProps'), + icon: 'table-row-properties', + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addButton('tableinsertcolbefore', { + tooltip: 'Insert column before', + onAction: cmd('mceTableInsertColBefore'), + icon: 'table-insert-column-before', + onSetup: selectionTargets.onSetupColumn('onFirst') + }); + editor.ui.registry.addButton('tableinsertcolafter', { + tooltip: 'Insert column after', + onAction: cmd('mceTableInsertColAfter'), + icon: 'table-insert-column-after', + onSetup: selectionTargets.onSetupColumn('onLast') + }); + editor.ui.registry.addButton('tabledeletecol', { + tooltip: 'Delete column', + onAction: cmd('mceTableDeleteCol'), + icon: 'table-delete-column', + onSetup: selectionTargets.onSetupColumn('onAny') + }); + editor.ui.registry.addButton('tablecutrow', { + tooltip: 'Cut row', + icon: 'cut-row', + onAction: cmd('mceTableCutRow'), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addButton('tablecopyrow', { + tooltip: 'Copy row', + icon: 'duplicate-row', + onAction: cmd('mceTableCopyRow'), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addButton('tablepasterowbefore', { + tooltip: 'Paste row before', + icon: 'paste-row-before', + onAction: cmd('mceTablePasteRowBefore'), + onSetup: selectionTargets.onSetupPasteable(clipboard.getRows) + }); + editor.ui.registry.addButton('tablepasterowafter', { + tooltip: 'Paste row after', + icon: 'paste-row-after', + onAction: cmd('mceTablePasteRowAfter'), + onSetup: selectionTargets.onSetupPasteable(clipboard.getRows) + }); + editor.ui.registry.addButton('tablecutcol', { + tooltip: 'Cut column', + icon: 'cut-column', + onAction: cmd('mceTableCutCol'), + onSetup: selectionTargets.onSetupColumn('onAny') + }); + editor.ui.registry.addButton('tablecopycol', { + tooltip: 'Copy column', + icon: 'duplicate-column', + onAction: cmd('mceTableCopyCol'), + onSetup: selectionTargets.onSetupColumn('onAny') + }); + editor.ui.registry.addButton('tablepastecolbefore', { + tooltip: 'Paste column before', + icon: 'paste-column-before', + onAction: cmd('mceTablePasteColBefore'), + onSetup: selectionTargets.onSetupPasteableColumn(clipboard.getColumns, 'onFirst') + }); + editor.ui.registry.addButton('tablepastecolafter', { + tooltip: 'Paste column after', + icon: 'paste-column-after', + onAction: cmd('mceTablePasteColAfter'), + onSetup: selectionTargets.onSetupPasteableColumn(clipboard.getColumns, 'onLast') + }); + editor.ui.registry.addButton('tableinsertdialog', { + tooltip: 'Insert table', + onAction: cmd('mceInsertTable'), + icon: 'table' + }); + var tableClassList = filterNoneItem(getTableClassList(editor)); + if (tableClassList.length !== 0) { + editor.ui.registry.addMenuButton('tableclass', { + icon: 'table-classes', + tooltip: 'Table styles', + fetch: generateMenuItemsCallback(editor, selections, tableClassList, 'tableclass', function (value) { + return editor.execCommand('mceTableToggleClass', false, value); + }), + onSetup: selectionTargets.onSetupTable + }); + } + var tableCellClassList = filterNoneItem(getCellClassList(editor)); + if (tableCellClassList.length !== 0) { + editor.ui.registry.addMenuButton('tablecellclass', { + icon: 'table-cell-classes', + tooltip: 'Cell styles', + fetch: generateMenuItemsCallback(editor, selections, tableCellClassList, 'tablecellclass', function (value) { + return editor.execCommand('mceTableCellToggleClass', false, value); + }), + onSetup: selectionTargets.onSetupCellOrRow + }); + } + editor.ui.registry.addMenuButton('tablecellvalign', { + icon: 'vertical-align', + tooltip: 'Vertical align', + fetch: generateMenuItemsCallback(editor, selections, verticalAlignValues, 'tablecellverticalalign', applyTableCellStyle(editor, 'vertical-align')), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuButton('tablecellborderwidth', { + icon: 'border-width', + tooltip: 'Border width', + fetch: generateMenuItemsCallback(editor, selections, getTableBorderWidths(editor), 'tablecellborderwidth', applyTableCellStyle(editor, 'border-width')), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuButton('tablecellborderstyle', { + icon: 'border-style', + tooltip: 'Border style', + fetch: generateMenuItemsCallback(editor, selections, getTableBorderStyles(editor), 'tablecellborderstyle', applyTableCellStyle(editor, 'border-style')), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addToggleButton('tablecaption', { + tooltip: 'Table caption', + onAction: cmd('mceTableToggleCaption'), + icon: 'table-caption', + onSetup: selectionTargets.onSetupTableWithCaption + }); + editor.ui.registry.addMenuButton('tablecellbackgroundcolor', { + icon: 'cell-background-color', + tooltip: 'Background color', + fetch: function (callback) { + return callback(buildColorMenu(editor, getTableBackgroundColorMap(editor), 'background-color')); + }, + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuButton('tablecellbordercolor', { + icon: 'cell-border-color', + tooltip: 'Border color', + fetch: function (callback) { + return callback(buildColorMenu(editor, getTableBorderColorMap(editor), 'border-color')); + }, + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addToggleButton('tablerowheader', { + tooltip: 'Row header', + icon: 'table-top-header', + onAction: changeRowHeader(editor), + onSetup: selectionTargets.onSetupTableRowHeaders + }); + editor.ui.registry.addToggleButton('tablecolheader', { + tooltip: 'Column header', + icon: 'table-left-header', + onAction: changeColumnHeader(editor), + onSetup: selectionTargets.onSetupTableColumnHeaders + }); + }; + var addToolbars = function (editor) { + var isTable = function (table) { + return editor.dom.is(table, 'table') && editor.getBody().contains(table); + }; + var toolbar = getToolbar(editor); + if (toolbar.length > 0) { + editor.ui.registry.addContextToolbar('table', { + predicate: isTable, + items: toolbar, + scope: 'node', + position: 'node' + }); + } + }; + + var addMenuItems = function (editor, selections, selectionTargets, clipboard) { + var cmd = function (command) { + return function () { + return editor.execCommand(command); + }; + }; + var insertTableAction = function (data) { + editor.execCommand('mceInsertTable', false, { + rows: data.numRows, + columns: data.numColumns + }); + }; + var tableProperties = { + text: 'Table properties', + onSetup: selectionTargets.onSetupTable, + onAction: cmd('mceTableProps') + }; + var deleteTable = { + text: 'Delete table', + icon: 'table-delete-table', + onSetup: selectionTargets.onSetupTable, + onAction: cmd('mceTableDelete') + }; + editor.ui.registry.addMenuItem('tableinsertrowbefore', { + text: 'Insert row before', + icon: 'table-insert-row-above', + onAction: cmd('mceTableInsertRowBefore'), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuItem('tableinsertrowafter', { + text: 'Insert row after', + icon: 'table-insert-row-after', + onAction: cmd('mceTableInsertRowAfter'), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuItem('tabledeleterow', { + text: 'Delete row', + icon: 'table-delete-row', + onAction: cmd('mceTableDeleteRow'), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuItem('tablerowprops', { + text: 'Row properties', + icon: 'table-row-properties', + onAction: cmd('mceTableRowProps'), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuItem('tablecutrow', { + text: 'Cut row', + icon: 'cut-row', + onAction: cmd('mceTableCutRow'), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuItem('tablecopyrow', { + text: 'Copy row', + icon: 'duplicate-row', + onAction: cmd('mceTableCopyRow'), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuItem('tablepasterowbefore', { + text: 'Paste row before', + icon: 'paste-row-before', + onAction: cmd('mceTablePasteRowBefore'), + onSetup: selectionTargets.onSetupPasteable(clipboard.getRows) + }); + editor.ui.registry.addMenuItem('tablepasterowafter', { + text: 'Paste row after', + icon: 'paste-row-after', + onAction: cmd('mceTablePasteRowAfter'), + onSetup: selectionTargets.onSetupPasteable(clipboard.getRows) + }); + var row = { + type: 'nestedmenuitem', + text: 'Row', + getSubmenuItems: constant('tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter') + }; + editor.ui.registry.addMenuItem('tableinsertcolumnbefore', { + text: 'Insert column before', + icon: 'table-insert-column-before', + onAction: cmd('mceTableInsertColBefore'), + onSetup: selectionTargets.onSetupColumn('onFirst') + }); + editor.ui.registry.addMenuItem('tableinsertcolumnafter', { + text: 'Insert column after', + icon: 'table-insert-column-after', + onAction: cmd('mceTableInsertColAfter'), + onSetup: selectionTargets.onSetupColumn('onLast') + }); + editor.ui.registry.addMenuItem('tabledeletecolumn', { + text: 'Delete column', + icon: 'table-delete-column', + onAction: cmd('mceTableDeleteCol'), + onSetup: selectionTargets.onSetupColumn('onAny') + }); + editor.ui.registry.addMenuItem('tablecutcolumn', { + text: 'Cut column', + icon: 'cut-column', + onAction: cmd('mceTableCutCol'), + onSetup: selectionTargets.onSetupColumn('onAny') + }); + editor.ui.registry.addMenuItem('tablecopycolumn', { + text: 'Copy column', + icon: 'duplicate-column', + onAction: cmd('mceTableCopyCol'), + onSetup: selectionTargets.onSetupColumn('onAny') + }); + editor.ui.registry.addMenuItem('tablepastecolumnbefore', { + text: 'Paste column before', + icon: 'paste-column-before', + onAction: cmd('mceTablePasteColBefore'), + onSetup: selectionTargets.onSetupPasteableColumn(clipboard.getColumns, 'onFirst') + }); + editor.ui.registry.addMenuItem('tablepastecolumnafter', { + text: 'Paste column after', + icon: 'paste-column-after', + onAction: cmd('mceTablePasteColAfter'), + onSetup: selectionTargets.onSetupPasteableColumn(clipboard.getColumns, 'onLast') + }); + var column = { + type: 'nestedmenuitem', + text: 'Column', + getSubmenuItems: constant('tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter') + }; + editor.ui.registry.addMenuItem('tablecellprops', { + text: 'Cell properties', + icon: 'table-cell-properties', + onAction: cmd('mceTableCellProps'), + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addMenuItem('tablemergecells', { + text: 'Merge cells', + icon: 'table-merge-cells', + onAction: cmd('mceTableMergeCells'), + onSetup: selectionTargets.onSetupMergeable + }); + editor.ui.registry.addMenuItem('tablesplitcells', { + text: 'Split cell', + icon: 'table-split-cells', + onAction: cmd('mceTableSplitCells'), + onSetup: selectionTargets.onSetupUnmergeable + }); + var cell = { + type: 'nestedmenuitem', + text: 'Cell', + getSubmenuItems: constant('tablecellprops tablemergecells tablesplitcells') + }; + if (hasTableGrid(editor) === false) { + editor.ui.registry.addMenuItem('inserttable', { + text: 'Table', + icon: 'table', + onAction: cmd('mceInsertTable') + }); + } else { + editor.ui.registry.addNestedMenuItem('inserttable', { + text: 'Table', + icon: 'table', + getSubmenuItems: function () { + return [{ + type: 'fancymenuitem', + fancytype: 'inserttable', + onAction: insertTableAction + }]; + } + }); + } + editor.ui.registry.addMenuItem('inserttabledialog', { + text: 'Insert table', + icon: 'table', + onAction: cmd('mceInsertTable') + }); + editor.ui.registry.addMenuItem('tableprops', tableProperties); + editor.ui.registry.addMenuItem('deletetable', deleteTable); + editor.ui.registry.addNestedMenuItem('row', row); + editor.ui.registry.addNestedMenuItem('column', column); + editor.ui.registry.addNestedMenuItem('cell', cell); + editor.ui.registry.addContextMenu('table', { + update: function () { + selectionTargets.resetTargets(); + return selectionTargets.targets().fold(constant(''), function (targets) { + if (name(targets.element) === 'caption') { + return 'tableprops deletetable'; + } else { + return 'cell row column | advtablesort | tableprops deletetable'; + } + }); + } + }); + var tableClassList = filterNoneItem(getTableClassList(editor)); + if (tableClassList.length !== 0) { + editor.ui.registry.addNestedMenuItem('tableclass', { + icon: 'table-classes', + text: 'Table styles', + getSubmenuItems: function () { + return buildMenuItems(editor, selections, tableClassList, 'tableclass', function (value) { + return editor.execCommand('mceTableToggleClass', false, value); + }); + }, + onSetup: selectionTargets.onSetupTable + }); + } + var tableCellClassList = filterNoneItem(getCellClassList(editor)); + if (tableCellClassList.length !== 0) { + editor.ui.registry.addNestedMenuItem('tablecellclass', { + icon: 'table-cell-classes', + text: 'Cell styles', + getSubmenuItems: function () { + return buildMenuItems(editor, selections, tableCellClassList, 'tablecellclass', function (value) { + return editor.execCommand('mceTableCellToggleClass', false, value); + }); + }, + onSetup: selectionTargets.onSetupCellOrRow + }); + } + editor.ui.registry.addNestedMenuItem('tablecellvalign', { + icon: 'vertical-align', + text: 'Vertical align', + getSubmenuItems: function () { + return buildMenuItems(editor, selections, verticalAlignValues, 'tablecellverticalalign', applyTableCellStyle(editor, 'vertical-align')); + }, + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addNestedMenuItem('tablecellborderwidth', { + icon: 'border-width', + text: 'Border width', + getSubmenuItems: function () { + return buildMenuItems(editor, selections, getTableBorderWidths(editor), 'tablecellborderwidth', applyTableCellStyle(editor, 'border-width')); + }, + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addNestedMenuItem('tablecellborderstyle', { + icon: 'border-style', + text: 'Border style', + getSubmenuItems: function () { + return buildMenuItems(editor, selections, getTableBorderStyles(editor), 'tablecellborderstyle', applyTableCellStyle(editor, 'border-style')); + }, + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addToggleMenuItem('tablecaption', { + icon: 'table-caption', + text: 'Table caption', + onAction: cmd('mceTableToggleCaption'), + onSetup: selectionTargets.onSetupTableWithCaption + }); + editor.ui.registry.addNestedMenuItem('tablecellbackgroundcolor', { + icon: 'cell-background-color', + text: 'Background color', + getSubmenuItems: function () { + return buildColorMenu(editor, getTableBackgroundColorMap(editor), 'background-color'); + }, + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addNestedMenuItem('tablecellbordercolor', { + icon: 'cell-border-color', + text: 'Border color', + getSubmenuItems: function () { + return buildColorMenu(editor, getTableBorderColorMap(editor), 'border-color'); + }, + onSetup: selectionTargets.onSetupCellOrRow + }); + editor.ui.registry.addToggleMenuItem('tablerowheader', { + text: 'Row header', + icon: 'table-top-header', + onAction: changeRowHeader(editor), + onSetup: selectionTargets.onSetupTableRowHeaders + }); + editor.ui.registry.addToggleMenuItem('tablecolheader', { + text: 'Column header', + icon: 'table-left-header', + onAction: changeColumnHeader(editor), + onSetup: selectionTargets.onSetupTableColumnHeaders + }); + }; + + var Plugin = function (editor) { + var selections = Selections(function () { + return getBody(editor); + }, function () { + return getSelectionCell(getSelectionStart(editor), getIsRoot(editor)); + }, ephemera.selectedSelector); + var selectionTargets = getSelectionTargets(editor, selections); + var resizeHandler = getResizeHandler(editor); + var cellSelection = CellSelection(editor, resizeHandler.lazyResize, selectionTargets); + var actions = TableActions(editor, cellSelection, resizeHandler.lazyWire); + var clipboard = Clipboard(); + registerCommands(editor, actions, cellSelection, selections, clipboard); + registerQueryCommands(editor, actions, selections); + registerEvents(editor, selections, actions); + addMenuItems(editor, selections, selectionTargets, clipboard); + addButtons(editor, selections, selectionTargets, clipboard); + addToolbars(editor); + editor.on('PreInit', function () { + editor.serializer.addTempAttr(ephemera.firstSelected); + editor.serializer.addTempAttr(ephemera.lastSelected); + registerFormats(editor); + }); + if (hasTabNavigation(editor)) { + editor.on('keydown', function (e) { + handle$1(e, editor, cellSelection); + }); + } + editor.on('remove', function () { + resizeHandler.destroy(); + }); + return getApi(editor, clipboard, resizeHandler, selectionTargets); + }; + function Plugin$1 () { + global$3.add('table', Plugin); + } + + Plugin$1(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$4 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var typeOf = function (x) { + var t = typeof x; + if (x === null) { + return 'null'; + } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { + return 'array'; + } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { + return 'string'; + } else { + return t; + } + }; + var isType = function (type) { + return function (value) { + return typeOf(value) === type; + }; + }; + var isSimpleType = function (type) { + return function (value) { + return typeof value === type; + }; + }; + var isString = isType('string'); + var isFunction = isSimpleType('function'); + + var noop = function () { + }; + var constant = function (value) { + return function () { + return value; + }; + }; + var identity = function (x) { + return x; + }; + function curry(fn) { + var initialArgs = []; + for (var _i = 1; _i < arguments.length; _i++) { + initialArgs[_i - 1] = arguments[_i]; + } + return function () { + var restArgs = []; + for (var _i = 0; _i < arguments.length; _i++) { + restArgs[_i] = arguments[_i]; + } + var all = initialArgs.concat(restArgs); + return fn.apply(null, all); + }; + } + var never = constant(false); + var always = constant(true); + + var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var global$2 = tinymce.util.Tools.resolve('tinymce.util.XHR'); + + var getCreationDateClasses = function (editor) { + return editor.getParam('template_cdate_classes', 'cdate'); + }; + var getModificationDateClasses = function (editor) { + return editor.getParam('template_mdate_classes', 'mdate'); + }; + var getSelectedContentClasses = function (editor) { + return editor.getParam('template_selected_content_classes', 'selcontent'); + }; + var getPreviewReplaceValues = function (editor) { + return editor.getParam('template_preview_replace_values'); + }; + var getContentStyle = function (editor) { + return editor.getParam('content_style', '', 'string'); + }; + var shouldUseContentCssCors = function (editor) { + return editor.getParam('content_css_cors', false, 'boolean'); + }; + var getTemplateReplaceValues = function (editor) { + return editor.getParam('template_replace_values'); + }; + var getTemplates = function (editor) { + return editor.getParam('templates'); + }; + var getCdateFormat = function (editor) { + return editor.getParam('template_cdate_format', editor.translate('%Y-%m-%d')); + }; + var getMdateFormat = function (editor) { + return editor.getParam('template_mdate_format', editor.translate('%Y-%m-%d')); + }; + var getBodyClassFromHash = function (editor) { + var bodyClass = editor.getParam('body_class', '', 'hash'); + return bodyClass[editor.id] || ''; + }; + var getBodyClass = function (editor) { + var bodyClass = editor.getParam('body_class', '', 'string'); + if (bodyClass.indexOf('=') === -1) { + return bodyClass; + } else { + return getBodyClassFromHash(editor); + } + }; + + var addZeros = function (value, len) { + value = '' + value; + if (value.length < len) { + for (var i = 0; i < len - value.length; i++) { + value = '0' + value; + } + } + return value; + }; + var getDateTime = function (editor, fmt, date) { + if (date === void 0) { + date = new Date(); + } + var daysShort = 'Sun Mon Tue Wed Thu Fri Sat Sun'.split(' '); + var daysLong = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split(' '); + var monthsShort = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' '); + var monthsLong = 'January February March April May June July August September October November December'.split(' '); + fmt = fmt.replace('%D', '%m/%d/%Y'); + fmt = fmt.replace('%r', '%I:%M:%S %p'); + fmt = fmt.replace('%Y', '' + date.getFullYear()); + fmt = fmt.replace('%y', '' + date.getYear()); + fmt = fmt.replace('%m', addZeros(date.getMonth() + 1, 2)); + fmt = fmt.replace('%d', addZeros(date.getDate(), 2)); + fmt = fmt.replace('%H', '' + addZeros(date.getHours(), 2)); + fmt = fmt.replace('%M', '' + addZeros(date.getMinutes(), 2)); + fmt = fmt.replace('%S', '' + addZeros(date.getSeconds(), 2)); + fmt = fmt.replace('%I', '' + ((date.getHours() + 11) % 12 + 1)); + fmt = fmt.replace('%p', '' + (date.getHours() < 12 ? 'AM' : 'PM')); + fmt = fmt.replace('%B', '' + editor.translate(monthsLong[date.getMonth()])); + fmt = fmt.replace('%b', '' + editor.translate(monthsShort[date.getMonth()])); + fmt = fmt.replace('%A', '' + editor.translate(daysLong[date.getDay()])); + fmt = fmt.replace('%a', '' + editor.translate(daysShort[date.getDay()])); + fmt = fmt.replace('%%', '%'); + return fmt; + }; + + var createTemplateList = function (editor, callback) { + return function () { + var templateList = getTemplates(editor); + if (isFunction(templateList)) { + templateList(callback); + } else if (isString(templateList)) { + global$2.send({ + url: templateList, + success: function (text) { + callback(JSON.parse(text)); + } + }); + } else { + callback(templateList); + } + }; + }; + var replaceTemplateValues = function (html, templateValues) { + global$3.each(templateValues, function (v, k) { + if (isFunction(v)) { + v = v(k); + } + html = html.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v); + }); + return html; + }; + var replaceVals = function (editor, scope) { + var dom = editor.dom, vl = getTemplateReplaceValues(editor); + global$3.each(dom.select('*', scope), function (e) { + global$3.each(vl, function (v, k) { + if (dom.hasClass(e, k)) { + if (isFunction(v)) { + v(e); + } + } + }); + }); + }; + var hasClass = function (n, c) { + return new RegExp('\\b' + c + '\\b', 'g').test(n.className); + }; + var insertTemplate = function (editor, _ui, html) { + var dom = editor.dom; + var sel = editor.selection.getContent(); + html = replaceTemplateValues(html, getTemplateReplaceValues(editor)); + var el = dom.create('div', null, html); + var n = dom.select('.mceTmpl', el); + if (n && n.length > 0) { + el = dom.create('div', null); + el.appendChild(n[0].cloneNode(true)); + } + global$3.each(dom.select('*', el), function (n) { + if (hasClass(n, getCreationDateClasses(editor).replace(/\s+/g, '|'))) { + n.innerHTML = getDateTime(editor, getCdateFormat(editor)); + } + if (hasClass(n, getModificationDateClasses(editor).replace(/\s+/g, '|'))) { + n.innerHTML = getDateTime(editor, getMdateFormat(editor)); + } + if (hasClass(n, getSelectedContentClasses(editor).replace(/\s+/g, '|'))) { + n.innerHTML = sel; + } + }); + replaceVals(editor, el); + editor.execCommand('mceInsertContent', false, el.innerHTML); + editor.addVisual(); + }; + + var none = function () { + return NONE; + }; + var NONE = function () { + var call = function (thunk) { + return thunk(); + }; + var id = identity; + var me = { + fold: function (n, _s) { + return n(); + }, + isSome: never, + isNone: always, + getOr: id, + getOrThunk: call, + getOrDie: function (msg) { + throw new Error(msg || 'error: getOrDie called on none.'); + }, + getOrNull: constant(null), + getOrUndefined: constant(undefined), + or: id, + orThunk: call, + map: none, + each: noop, + bind: none, + exists: never, + forall: always, + filter: function () { + return none(); + }, + toArray: function () { + return []; + }, + toString: constant('none()') + }; + return me; + }(); + var some = function (a) { + var constant_a = constant(a); + var self = function () { + return me; + }; + var bind = function (f) { + return f(a); + }; + var me = { + fold: function (n, s) { + return s(a); + }, + isSome: always, + isNone: never, + getOr: constant_a, + getOrThunk: constant_a, + getOrDie: constant_a, + getOrNull: constant_a, + getOrUndefined: constant_a, + or: self, + orThunk: self, + map: function (f) { + return some(f(a)); + }, + each: function (f) { + f(a); + }, + bind: bind, + exists: bind, + forall: bind, + filter: function (f) { + return f(a) ? me : NONE; + }, + toArray: function () { + return [a]; + }, + toString: function () { + return 'some(' + a + ')'; + } + }; + return me; + }; + var from = function (value) { + return value === null || value === undefined ? NONE : some(value); + }; + var Optional = { + some: some, + none: none, + from: from + }; + + var map = function (xs, f) { + var len = xs.length; + var r = new Array(len); + for (var i = 0; i < len; i++) { + var x = xs[i]; + r[i] = f(x, i); + } + return r; + }; + var findUntil = function (xs, pred, until) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + return Optional.some(x); + } else if (until(x, i)) { + break; + } + } + return Optional.none(); + }; + var find = function (xs, pred) { + return findUntil(xs, pred, never); + }; + + var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); + + var global = tinymce.util.Tools.resolve('tinymce.util.Promise'); + + var hasOwnProperty = Object.hasOwnProperty; + var get = function (obj, key) { + return has(obj, key) ? Optional.from(obj[key]) : Optional.none(); + }; + var has = function (obj, key) { + return hasOwnProperty.call(obj, key); + }; + + var entitiesAttr = { + '"': '"', + '<': '<', + '>': '>', + '&': '&', + '\'': ''' + }; + var htmlEscape = function (html) { + return html.replace(/["'<>&]/g, function (match) { + return get(entitiesAttr, match).getOr(match); + }); + }; + + var getPreviewContent = function (editor, html) { + if (html.indexOf('') === -1) { + var contentCssEntries_1 = ''; + var contentStyle = getContentStyle(editor); + var cors_1 = shouldUseContentCssCors(editor) ? ' crossorigin="anonymous"' : ''; + global$3.each(editor.contentCSS, function (url) { + contentCssEntries_1 += ''; + }); + if (contentStyle) { + contentCssEntries_1 += ''; + } + var bodyClass = getBodyClass(editor); + var encode = editor.dom.encode; + var isMetaKeyPressed = global$1.mac ? 'e.metaKey' : 'e.ctrlKey && !e.altKey'; + var preventClicksOnLinksScript = ' '; + var directionality = editor.getBody().dir; + var dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : ''; + html = '' + '' + '' + '' + contentCssEntries_1 + preventClicksOnLinksScript + '' + '' + html + '' + ''; + } + return replaceTemplateValues(html, getPreviewReplaceValues(editor)); + }; + var open = function (editor, templateList) { + var createTemplates = function () { + if (!templateList || templateList.length === 0) { + var message = editor.translate('No templates defined.'); + editor.notificationManager.open({ + text: message, + type: 'info' + }); + return Optional.none(); + } + return Optional.from(global$3.map(templateList, function (template, index) { + var isUrlTemplate = function (t) { + return t.url !== undefined; + }; + return { + selected: index === 0, + text: template.title, + value: { + url: isUrlTemplate(template) ? Optional.from(template.url) : Optional.none(), + content: !isUrlTemplate(template) ? Optional.from(template.content) : Optional.none(), + description: template.description + } + }; + })); + }; + var createSelectBoxItems = function (templates) { + return map(templates, function (t) { + return { + text: t.text, + value: t.text + }; + }); + }; + var findTemplate = function (templates, templateTitle) { + return find(templates, function (t) { + return t.text === templateTitle; + }); + }; + var loadFailedAlert = function (api) { + editor.windowManager.alert('Could not load the specified template.', function () { + return api.focus('template'); + }); + }; + var getTemplateContent = function (t) { + return new global(function (resolve, reject) { + t.value.url.fold(function () { + return resolve(t.value.content.getOr('')); + }, function (url) { + return global$2.send({ + url: url, + success: function (html) { + resolve(html); + }, + error: function (e) { + reject(e); + } + }); + }); + }); + }; + var onChange = function (templates, updateDialog) { + return function (api, change) { + if (change.name === 'template') { + var newTemplateTitle = api.getData().template; + findTemplate(templates, newTemplateTitle).each(function (t) { + api.block('Loading...'); + getTemplateContent(t).then(function (previewHtml) { + updateDialog(api, t, previewHtml); + }).catch(function () { + updateDialog(api, t, ''); + api.disable('save'); + loadFailedAlert(api); + }); + }); + } + }; + }; + var onSubmit = function (templates) { + return function (api) { + var data = api.getData(); + findTemplate(templates, data.template).each(function (t) { + getTemplateContent(t).then(function (previewHtml) { + editor.execCommand('mceInsertTemplate', false, previewHtml); + api.close(); + }).catch(function () { + api.disable('save'); + loadFailedAlert(api); + }); + }); + }; + }; + var openDialog = function (templates) { + var selectBoxItems = createSelectBoxItems(templates); + var buildDialogSpec = function (bodyItems, initialData) { + return { + title: 'Insert Template', + size: 'large', + body: { + type: 'panel', + items: bodyItems + }, + initialData: initialData, + buttons: [ + { + type: 'cancel', + name: 'cancel', + text: 'Cancel' + }, + { + type: 'submit', + name: 'save', + text: 'Save', + primary: true + } + ], + onSubmit: onSubmit(templates), + onChange: onChange(templates, updateDialog) + }; + }; + var updateDialog = function (dialogApi, template, previewHtml) { + var content = getPreviewContent(editor, previewHtml); + var bodyItems = [ + { + type: 'selectbox', + name: 'template', + label: 'Templates', + items: selectBoxItems + }, + { + type: 'htmlpanel', + html: '

' + htmlEscape(template.value.description) + '

' + }, + { + label: 'Preview', + type: 'iframe', + name: 'preview', + sandboxed: false + } + ]; + var initialData = { + template: template.text, + preview: content + }; + dialogApi.unblock(); + dialogApi.redial(buildDialogSpec(bodyItems, initialData)); + dialogApi.focus('template'); + }; + var dialogApi = editor.windowManager.open(buildDialogSpec([], { + template: '', + preview: '' + })); + dialogApi.block('Loading...'); + getTemplateContent(templates[0]).then(function (previewHtml) { + updateDialog(dialogApi, templates[0], previewHtml); + }).catch(function () { + updateDialog(dialogApi, templates[0], ''); + dialogApi.disable('save'); + loadFailedAlert(dialogApi); + }); + }; + var optTemplates = createTemplates(); + optTemplates.each(openDialog); + }; + + var showDialog = function (editor) { + return function (templates) { + open(editor, templates); + }; + }; + var register$1 = function (editor) { + editor.addCommand('mceInsertTemplate', curry(insertTemplate, editor)); + editor.addCommand('mceTemplate', createTemplateList(editor, showDialog(editor))); + }; + + var setup = function (editor) { + editor.on('PreProcess', function (o) { + var dom = editor.dom, dateFormat = getMdateFormat(editor); + global$3.each(dom.select('div', o.node), function (e) { + if (dom.hasClass(e, 'mceTmpl')) { + global$3.each(dom.select('*', e), function (e) { + if (dom.hasClass(e, getModificationDateClasses(editor).replace(/\s+/g, '|'))) { + e.innerHTML = getDateTime(editor, dateFormat); + } + }); + replaceVals(editor, e); + } + }); + }); + }; + + var register = function (editor) { + var onAction = function () { + return editor.execCommand('mceTemplate'); + }; + editor.ui.registry.addButton('template', { + icon: 'template', + tooltip: 'Insert template', + onAction: onAction + }); + editor.ui.registry.addMenuItem('template', { + icon: 'template', + text: 'Insert template...', + onAction: onAction + }); + }; + + function Plugin () { + global$4.add('template', function (editor) { + register(editor); + register$1(editor); + setup(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + function Plugin () { + global.add('textcolor', function () { + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; + }; + var set = function (v) { + value = v; + }; + return { + get: get, + set: set + }; + }; + + var global$5 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + } + + var typeOf = function (x) { + var t = typeof x; + if (x === null) { + return 'null'; + } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { + return 'array'; + } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { + return 'string'; + } else { + return t; + } + }; + var isType = function (type) { + return function (value) { + return typeOf(value) === type; + }; + }; + var isString = isType('string'); + var isObject = isType('object'); + var isArray = isType('array'); + + var noop = function () { + }; + var constant = function (value) { + return function () { + return value; + }; + }; + var identity = function (x) { + return x; + }; + var die = function (msg) { + return function () { + throw new Error(msg); + }; + }; + var never = constant(false); + var always = constant(true); + + var none = function () { + return NONE; + }; + var NONE = function () { + var call = function (thunk) { + return thunk(); + }; + var id = identity; + var me = { + fold: function (n, _s) { + return n(); + }, + isSome: never, + isNone: always, + getOr: id, + getOrThunk: call, + getOrDie: function (msg) { + throw new Error(msg || 'error: getOrDie called on none.'); + }, + getOrNull: constant(null), + getOrUndefined: constant(undefined), + or: id, + orThunk: call, + map: none, + each: noop, + bind: none, + exists: never, + forall: always, + filter: function () { + return none(); + }, + toArray: function () { + return []; + }, + toString: constant('none()') + }; + return me; + }(); + var some = function (a) { + var constant_a = constant(a); + var self = function () { + return me; + }; + var bind = function (f) { + return f(a); + }; + var me = { + fold: function (n, s) { + return s(a); + }, + isSome: always, + isNone: never, + getOr: constant_a, + getOrThunk: constant_a, + getOrDie: constant_a, + getOrNull: constant_a, + getOrUndefined: constant_a, + or: self, + orThunk: self, + map: function (f) { + return some(f(a)); + }, + each: function (f) { + f(a); + }, + bind: bind, + exists: bind, + forall: bind, + filter: function (f) { + return f(a) ? me : NONE; + }, + toArray: function () { + return [a]; + }, + toString: function () { + return 'some(' + a + ')'; + } + }; + return me; + }; + var from = function (value) { + return value === null || value === undefined ? NONE : some(value); + }; + var Optional = { + some: some, + none: none, + from: from + }; + + var nativeSlice = Array.prototype.slice; + var nativeIndexOf = Array.prototype.indexOf; + var rawIndexOf = function (ts, t) { + return nativeIndexOf.call(ts, t); + }; + var contains = function (xs, x) { + return rawIndexOf(xs, x) > -1; + }; + var map = function (xs, f) { + var len = xs.length; + var r = new Array(len); + for (var i = 0; i < len; i++) { + var x = xs[i]; + r[i] = f(x, i); + } + return r; + }; + var each = function (xs, f) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + f(x, i); + } + }; + var eachr = function (xs, f) { + for (var i = xs.length - 1; i >= 0; i--) { + var x = xs[i]; + f(x, i); + } + }; + var filter = function (xs, pred) { + var r = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + r.push(x); + } + } + return r; + }; + var foldr = function (xs, f, acc) { + eachr(xs, function (x, i) { + acc = f(acc, x, i); + }); + return acc; + }; + var foldl = function (xs, f, acc) { + each(xs, function (x, i) { + acc = f(acc, x, i); + }); + return acc; + }; + var findUntil = function (xs, pred, until) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + return Optional.some(x); + } else if (until(x, i)) { + break; + } + } + return Optional.none(); + }; + var find = function (xs, pred) { + return findUntil(xs, pred, never); + }; + var forall = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; ++i) { + var x = xs[i]; + if (pred(x, i) !== true) { + return false; + } + } + return true; + }; + var sort = function (xs, comparator) { + var copy = nativeSlice.call(xs, 0); + copy.sort(comparator); + return copy; + }; + var get$1 = function (xs, i) { + return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none(); + }; + var head = function (xs) { + return get$1(xs, 0); + }; + + var keys = Object.keys; + var hasOwnProperty = Object.hasOwnProperty; + var has = function (obj, key) { + return hasOwnProperty.call(obj, key); + }; + + var generate$1 = function (cases) { + if (!isArray(cases)) { + throw new Error('cases must be an array'); + } + if (cases.length === 0) { + throw new Error('there must be at least one case'); + } + var constructors = []; + var adt = {}; + each(cases, function (acase, count) { + var keys$1 = keys(acase); + if (keys$1.length !== 1) { + throw new Error('one and only one name per case'); + } + var key = keys$1[0]; + var value = acase[key]; + if (adt[key] !== undefined) { + throw new Error('duplicate key detected:' + key); + } else if (key === 'cata') { + throw new Error('cannot have a case named cata (sorry)'); + } else if (!isArray(value)) { + throw new Error('case arguments must be an array'); + } + constructors.push(key); + adt[key] = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var argLength = args.length; + if (argLength !== value.length) { + throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength); + } + var match = function (branches) { + var branchKeys = keys(branches); + if (constructors.length !== branchKeys.length) { + throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\nActual: ' + branchKeys.join(',')); + } + var allReqd = forall(constructors, function (reqKey) { + return contains(branchKeys, reqKey); + }); + if (!allReqd) { + throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\nRequired: ' + constructors.join(', ')); + } + return branches[key].apply(null, args); + }; + return { + fold: function () { + var foldArgs = []; + for (var _i = 0; _i < arguments.length; _i++) { + foldArgs[_i] = arguments[_i]; + } + if (foldArgs.length !== cases.length) { + throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + foldArgs.length); + } + var target = foldArgs[count]; + return target.apply(null, args); + }, + match: match, + log: function (label) { + console.log(label, { + constructors: constructors, + constructor: key, + params: args + }); + } + }; + }; + }); + return adt; + }; + var Adt = { generate: generate$1 }; + + Adt.generate([ + { + bothErrors: [ + 'error1', + 'error2' + ] + }, + { + firstError: [ + 'error1', + 'value2' + ] + }, + { + secondError: [ + 'value1', + 'error2' + ] + }, + { + bothValues: [ + 'value1', + 'value2' + ] + } + ]); + var partition = function (results) { + var errors = []; + var values = []; + each(results, function (result) { + result.fold(function (err) { + errors.push(err); + }, function (value) { + values.push(value); + }); + }); + return { + errors: errors, + values: values + }; + }; + + var value = function (o) { + var or = function (_opt) { + return value(o); + }; + var orThunk = function (_f) { + return value(o); + }; + var map = function (f) { + return value(f(o)); + }; + var mapError = function (_f) { + return value(o); + }; + var each = function (f) { + f(o); + }; + var bind = function (f) { + return f(o); + }; + var fold = function (_, onValue) { + return onValue(o); + }; + var exists = function (f) { + return f(o); + }; + var forall = function (f) { + return f(o); + }; + var toOptional = function () { + return Optional.some(o); + }; + return { + isValue: always, + isError: never, + getOr: constant(o), + getOrThunk: constant(o), + getOrDie: constant(o), + or: or, + orThunk: orThunk, + fold: fold, + map: map, + mapError: mapError, + each: each, + bind: bind, + exists: exists, + forall: forall, + toOptional: toOptional + }; + }; + var error$1 = function (message) { + var getOrThunk = function (f) { + return f(); + }; + var getOrDie = function () { + return die(String(message))(); + }; + var or = identity; + var orThunk = function (f) { + return f(); + }; + var map = function (_f) { + return error$1(message); + }; + var mapError = function (f) { + return error$1(f(message)); + }; + var bind = function (_f) { + return error$1(message); + }; + var fold = function (onError, _) { + return onError(message); + }; + return { + isValue: never, + isError: always, + getOr: identity, + getOrThunk: getOrThunk, + getOrDie: getOrDie, + or: or, + orThunk: orThunk, + fold: fold, + map: map, + mapError: mapError, + each: noop, + bind: bind, + exists: never, + forall: always, + toOptional: Optional.none + }; + }; + var fromOption = function (opt, err) { + return opt.fold(function () { + return error$1(err); + }, value); + }; + var Result = { + value: value, + error: error$1, + fromOption: fromOption + }; + + var isInlinePattern = function (pattern) { + return pattern.type === 'inline-command' || pattern.type === 'inline-format'; + }; + var isBlockPattern = function (pattern) { + return pattern.type === 'block-command' || pattern.type === 'block-format'; + }; + var sortPatterns = function (patterns) { + return sort(patterns, function (a, b) { + if (a.start.length === b.start.length) { + return 0; + } + return a.start.length > b.start.length ? -1 : 1; + }); + }; + var normalizePattern = function (pattern) { + var err = function (message) { + return Result.error({ + message: message, + pattern: pattern + }); + }; + var formatOrCmd = function (name, onFormat, onCommand) { + if (pattern.format !== undefined) { + var formats = void 0; + if (isArray(pattern.format)) { + if (!forall(pattern.format, isString)) { + return err(name + ' pattern has non-string items in the `format` array'); + } + formats = pattern.format; + } else if (isString(pattern.format)) { + formats = [pattern.format]; + } else { + return err(name + ' pattern has non-string `format` parameter'); + } + return Result.value(onFormat(formats)); + } else if (pattern.cmd !== undefined) { + if (!isString(pattern.cmd)) { + return err(name + ' pattern has non-string `cmd` parameter'); + } + return Result.value(onCommand(pattern.cmd, pattern.value)); + } else { + return err(name + ' pattern is missing both `format` and `cmd` parameters'); + } + }; + if (!isObject(pattern)) { + return err('Raw pattern is not an object'); + } + if (!isString(pattern.start)) { + return err('Raw pattern is missing `start` parameter'); + } + if (pattern.end !== undefined) { + if (!isString(pattern.end)) { + return err('Inline pattern has non-string `end` parameter'); + } + if (pattern.start.length === 0 && pattern.end.length === 0) { + return err('Inline pattern has empty `start` and `end` parameters'); + } + var start_1 = pattern.start; + var end_1 = pattern.end; + if (end_1.length === 0) { + end_1 = start_1; + start_1 = ''; + } + return formatOrCmd('Inline', function (format) { + return { + type: 'inline-format', + start: start_1, + end: end_1, + format: format + }; + }, function (cmd, value) { + return { + type: 'inline-command', + start: start_1, + end: end_1, + cmd: cmd, + value: value + }; + }); + } else if (pattern.replacement !== undefined) { + if (!isString(pattern.replacement)) { + return err('Replacement pattern has non-string `replacement` parameter'); + } + if (pattern.start.length === 0) { + return err('Replacement pattern has empty `start` parameter'); + } + return Result.value({ + type: 'inline-command', + start: '', + end: pattern.start, + cmd: 'mceInsertContent', + value: pattern.replacement + }); + } else { + if (pattern.start.length === 0) { + return err('Block pattern has empty `start` parameter'); + } + return formatOrCmd('Block', function (formats) { + return { + type: 'block-format', + start: pattern.start, + format: formats[0] + }; + }, function (command, commandValue) { + return { + type: 'block-command', + start: pattern.start, + cmd: command, + value: commandValue + }; + }); + } + }; + var denormalizePattern = function (pattern) { + if (pattern.type === 'block-command') { + return { + start: pattern.start, + cmd: pattern.cmd, + value: pattern.value + }; + } else if (pattern.type === 'block-format') { + return { + start: pattern.start, + format: pattern.format + }; + } else if (pattern.type === 'inline-command') { + if (pattern.cmd === 'mceInsertContent' && pattern.start === '') { + return { + start: pattern.end, + replacement: pattern.value + }; + } else { + return { + start: pattern.start, + end: pattern.end, + cmd: pattern.cmd, + value: pattern.value + }; + } + } else if (pattern.type === 'inline-format') { + return { + start: pattern.start, + end: pattern.end, + format: pattern.format.length === 1 ? pattern.format[0] : pattern.format + }; + } + }; + var createPatternSet = function (patterns) { + return { + inlinePatterns: filter(patterns, isInlinePattern), + blockPatterns: sortPatterns(filter(patterns, isBlockPattern)) + }; + }; + + var get = function (patternsState) { + var setPatterns = function (newPatterns) { + var normalized = partition(map(newPatterns, normalizePattern)); + if (normalized.errors.length > 0) { + var firstError = normalized.errors[0]; + throw new Error(firstError.message + ':\n' + JSON.stringify(firstError.pattern, null, 2)); + } + patternsState.set(createPatternSet(normalized.values)); + }; + var getPatterns = function () { + return __spreadArray(__spreadArray([], map(patternsState.get().inlinePatterns, denormalizePattern), true), map(patternsState.get().blockPatterns, denormalizePattern), true); + }; + return { + setPatterns: setPatterns, + getPatterns: getPatterns + }; + }; + + var Global = typeof window !== 'undefined' ? window : Function('return this;')(); + + var error = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var console = Global.console; + if (console) { + if (console.error) { + console.error.apply(console, args); + } else { + console.log.apply(console, args); + } + } + }; + var defaultPatterns = [ + { + start: '*', + end: '*', + format: 'italic' + }, + { + start: '**', + end: '**', + format: 'bold' + }, + { + start: '#', + format: 'h1' + }, + { + start: '##', + format: 'h2' + }, + { + start: '###', + format: 'h3' + }, + { + start: '####', + format: 'h4' + }, + { + start: '#####', + format: 'h5' + }, + { + start: '######', + format: 'h6' + }, + { + start: '1. ', + cmd: 'InsertOrderedList' + }, + { + start: '* ', + cmd: 'InsertUnorderedList' + }, + { + start: '- ', + cmd: 'InsertUnorderedList' + } + ]; + var getPatternSet = function (editor) { + var patterns = editor.getParam('textpattern_patterns', defaultPatterns, 'array'); + if (!isArray(patterns)) { + error('The setting textpattern_patterns should be an array'); + return { + inlinePatterns: [], + blockPatterns: [] + }; + } + var normalized = partition(map(patterns, normalizePattern)); + each(normalized.errors, function (err) { + return error(err.message, err.pattern); + }); + return createPatternSet(normalized.values); + }; + var getForcedRootBlock = function (editor) { + var block = editor.getParam('forced_root_block', 'p'); + if (block === false) { + return ''; + } else if (block === true) { + return 'p'; + } else { + return block; + } + }; + + var global$4 = tinymce.util.Tools.resolve('tinymce.util.Delay'); + + var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK'); + + var zeroWidth = '\uFEFF'; + var nbsp = '\xA0'; + + var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); + + var global = tinymce.util.Tools.resolve('tinymce.dom.TextSeeker'); + + var point = function (container, offset) { + return { + container: container, + offset: offset + }; + }; + + var isText = function (node) { + return node.nodeType === Node.TEXT_NODE; + }; + var cleanEmptyNodes = function (dom, node, isRoot) { + if (node && dom.isEmpty(node) && !isRoot(node)) { + var parent_1 = node.parentNode; + dom.remove(node); + cleanEmptyNodes(dom, parent_1, isRoot); + } + }; + var deleteRng = function (dom, rng, isRoot, clean) { + if (clean === void 0) { + clean = true; + } + var startParent = rng.startContainer.parentNode; + var endParent = rng.endContainer.parentNode; + rng.deleteContents(); + if (clean && !isRoot(rng.startContainer)) { + if (isText(rng.startContainer) && rng.startContainer.data.length === 0) { + dom.remove(rng.startContainer); + } + if (isText(rng.endContainer) && rng.endContainer.data.length === 0) { + dom.remove(rng.endContainer); + } + cleanEmptyNodes(dom, startParent, isRoot); + if (startParent !== endParent) { + cleanEmptyNodes(dom, endParent, isRoot); + } + } + }; + var isBlockFormatName = function (name, formatter) { + var formatSet = formatter.get(name); + return isArray(formatSet) && head(formatSet).exists(function (format) { + return has(format, 'block'); + }); + }; + var isReplacementPattern = function (pattern) { + return pattern.start.length === 0; + }; + var getParentBlock = function (editor, rng) { + var parentBlockOpt = Optional.from(editor.dom.getParent(rng.startContainer, editor.dom.isBlock)); + if (getForcedRootBlock(editor) === '') { + return parentBlockOpt.orThunk(function () { + return Optional.some(editor.getBody()); + }); + } else { + return parentBlockOpt; + } + }; + + var DOM = global$1.DOM; + var alwaysNext = function (startNode) { + return function (node) { + return startNode === node ? -1 : 0; + }; + }; + var isBoundary = function (dom) { + return function (node) { + return dom.isBlock(node) || contains([ + 'BR', + 'IMG', + 'HR', + 'INPUT' + ], node.nodeName) || dom.getContentEditable(node) === 'false'; + }; + }; + var textBefore = function (node, offset, rootNode) { + if (isText(node) && offset >= 0) { + return Optional.some(point(node, offset)); + } else { + var textSeeker = global(DOM); + return Optional.from(textSeeker.backwards(node, offset, alwaysNext(node), rootNode)).map(function (prev) { + return point(prev.container, prev.container.data.length); + }); + } + }; + var textAfter = function (node, offset, rootNode) { + if (isText(node) && offset >= node.length) { + return Optional.some(point(node, offset)); + } else { + var textSeeker = global(DOM); + return Optional.from(textSeeker.forwards(node, offset, alwaysNext(node), rootNode)).map(function (prev) { + return point(prev.container, 0); + }); + } + }; + var scanLeft = function (node, offset, rootNode) { + if (!isText(node)) { + return Optional.none(); + } + var text = node.textContent; + if (offset >= 0 && offset <= text.length) { + return Optional.some(point(node, offset)); + } else { + var textSeeker = global(DOM); + return Optional.from(textSeeker.backwards(node, offset, alwaysNext(node), rootNode)).bind(function (prev) { + var prevText = prev.container.data; + return scanLeft(prev.container, offset + prevText.length, rootNode); + }); + } + }; + var scanRight = function (node, offset, rootNode) { + if (!isText(node)) { + return Optional.none(); + } + var text = node.textContent; + if (offset <= text.length) { + return Optional.some(point(node, offset)); + } else { + var textSeeker = global(DOM); + return Optional.from(textSeeker.forwards(node, offset, alwaysNext(node), rootNode)).bind(function (next) { + return scanRight(next.container, offset - text.length, rootNode); + }); + } + }; + var repeatLeft = function (dom, node, offset, process, rootNode) { + var search = global(dom, isBoundary(dom)); + return Optional.from(search.backwards(node, offset, process, rootNode)); + }; + + var generatePath = function (root, node, offset) { + if (isText(node) && (offset < 0 || offset > node.data.length)) { + return []; + } + var p = [offset]; + var current = node; + while (current !== root && current.parentNode) { + var parent_1 = current.parentNode; + for (var i = 0; i < parent_1.childNodes.length; i++) { + if (parent_1.childNodes[i] === current) { + p.push(i); + break; + } + } + current = parent_1; + } + return current === root ? p.reverse() : []; + }; + var generatePathRange = function (root, startNode, startOffset, endNode, endOffset) { + var start = generatePath(root, startNode, startOffset); + var end = generatePath(root, endNode, endOffset); + return { + start: start, + end: end + }; + }; + var resolvePath = function (root, path) { + var nodePath = path.slice(); + var offset = nodePath.pop(); + var resolvedNode = foldl(nodePath, function (optNode, index) { + return optNode.bind(function (node) { + return Optional.from(node.childNodes[index]); + }); + }, Optional.some(root)); + return resolvedNode.bind(function (node) { + if (isText(node) && (offset < 0 || offset > node.data.length)) { + return Optional.none(); + } else { + return Optional.some({ + node: node, + offset: offset + }); + } + }); + }; + var resolvePathRange = function (root, range) { + return resolvePath(root, range.start).bind(function (_a) { + var startNode = _a.node, startOffset = _a.offset; + return resolvePath(root, range.end).map(function (_a) { + var endNode = _a.node, endOffset = _a.offset; + var rng = document.createRange(); + rng.setStart(startNode, startOffset); + rng.setEnd(endNode, endOffset); + return rng; + }); + }); + }; + var generatePathRangeFromRange = function (root, range) { + return generatePathRange(root, range.startContainer, range.startOffset, range.endContainer, range.endOffset); + }; + + var stripPattern = function (dom, block, pattern) { + var firstTextNode = textAfter(block, 0, block); + firstTextNode.each(function (spot) { + var node = spot.container; + scanRight(node, pattern.start.length, block).each(function (end) { + var rng = dom.createRng(); + rng.setStart(node, 0); + rng.setEnd(end.container, end.offset); + deleteRng(dom, rng, function (e) { + return e === block; + }); + }); + }); + }; + var applyPattern$1 = function (editor, match) { + var dom = editor.dom; + var pattern = match.pattern; + var rng = resolvePathRange(dom.getRoot(), match.range).getOrDie('Unable to resolve path range'); + getParentBlock(editor, rng).each(function (block) { + if (pattern.type === 'block-format') { + if (isBlockFormatName(pattern.format, editor.formatter)) { + editor.undoManager.transact(function () { + stripPattern(editor.dom, block, pattern); + editor.formatter.apply(pattern.format); + }); + } + } else if (pattern.type === 'block-command') { + editor.undoManager.transact(function () { + stripPattern(editor.dom, block, pattern); + editor.execCommand(pattern.cmd, false, pattern.value); + }); + } + }); + return true; + }; + var findPattern$1 = function (patterns, text) { + var nuText = text.replace(nbsp, ' '); + return find(patterns, function (pattern) { + return text.indexOf(pattern.start) === 0 || nuText.indexOf(pattern.start) === 0; + }); + }; + var findPatterns$1 = function (editor, patterns) { + var dom = editor.dom; + var rng = editor.selection.getRng(); + return getParentBlock(editor, rng).filter(function (block) { + var forcedRootBlock = getForcedRootBlock(editor); + var matchesForcedRootBlock = forcedRootBlock === '' && dom.is(block, 'body') || dom.is(block, forcedRootBlock); + return block !== null && matchesForcedRootBlock; + }).bind(function (block) { + var blockText = block.textContent; + var matchedPattern = findPattern$1(patterns, blockText); + return matchedPattern.map(function (pattern) { + if (global$2.trim(blockText).length === pattern.start.length) { + return []; + } + return [{ + pattern: pattern, + range: generatePathRange(dom.getRoot(), block, 0, block, 0) + }]; + }); + }).getOr([]); + }; + var applyMatches$1 = function (editor, matches) { + if (matches.length === 0) { + return; + } + var bookmark = editor.selection.getBookmark(); + each(matches, function (match) { + return applyPattern$1(editor, match); + }); + editor.selection.moveToBookmark(bookmark); + }; + + var unique = 0; + var generate = function (prefix) { + var date = new Date(); + var time = date.getTime(); + var random = Math.floor(Math.random() * 1000000000); + unique++; + return prefix + '_' + random + unique + String(time); + }; + + var checkRange = function (str, substr, start) { + return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr; + }; + var endsWith = function (str, suffix) { + return checkRange(str, suffix, str.length - suffix.length); + }; + + var newMarker = function (dom, id) { + return dom.create('span', { + 'data-mce-type': 'bookmark', + id: id + }); + }; + var rangeFromMarker = function (dom, marker) { + var rng = dom.createRng(); + rng.setStartAfter(marker.start); + rng.setEndBefore(marker.end); + return rng; + }; + var createMarker = function (dom, markerPrefix, pathRange) { + var rng = resolvePathRange(dom.getRoot(), pathRange).getOrDie('Unable to resolve path range'); + var startNode = rng.startContainer; + var endNode = rng.endContainer; + var textEnd = rng.endOffset === 0 ? endNode : endNode.splitText(rng.endOffset); + var textStart = rng.startOffset === 0 ? startNode : startNode.splitText(rng.startOffset); + return { + prefix: markerPrefix, + end: textEnd.parentNode.insertBefore(newMarker(dom, markerPrefix + '-end'), textEnd), + start: textStart.parentNode.insertBefore(newMarker(dom, markerPrefix + '-start'), textStart) + }; + }; + var removeMarker = function (dom, marker, isRoot) { + cleanEmptyNodes(dom, dom.get(marker.prefix + '-end'), isRoot); + cleanEmptyNodes(dom, dom.get(marker.prefix + '-start'), isRoot); + }; + + var matchesPattern = function (dom, block, patternContent) { + return function (element, offset) { + var text = element.data; + var searchText = text.substring(0, offset); + var startEndIndex = searchText.lastIndexOf(patternContent.charAt(patternContent.length - 1)); + var startIndex = searchText.lastIndexOf(patternContent); + if (startIndex !== -1) { + return startIndex + patternContent.length; + } else if (startEndIndex !== -1) { + return startEndIndex + 1; + } else { + return -1; + } + }; + }; + var findPatternStartFromSpot = function (dom, pattern, block, spot) { + var startPattern = pattern.start; + var startSpot = repeatLeft(dom, spot.container, spot.offset, matchesPattern(dom, block, startPattern), block); + return startSpot.bind(function (spot) { + if (spot.offset >= startPattern.length) { + var rng = dom.createRng(); + rng.setStart(spot.container, spot.offset - startPattern.length); + rng.setEnd(spot.container, spot.offset); + return Optional.some(rng); + } else { + var offset = spot.offset - startPattern.length; + return scanLeft(spot.container, offset, block).map(function (nextSpot) { + var rng = dom.createRng(); + rng.setStart(nextSpot.container, nextSpot.offset); + rng.setEnd(spot.container, spot.offset); + return rng; + }).filter(function (rng) { + return rng.toString() === startPattern; + }).orThunk(function () { + return findPatternStartFromSpot(dom, pattern, block, point(spot.container, 0)); + }); + } + }); + }; + var findPatternStart = function (dom, pattern, node, offset, block, requireGap) { + if (requireGap === void 0) { + requireGap = false; + } + if (pattern.start.length === 0 && !requireGap) { + var rng = dom.createRng(); + rng.setStart(node, offset); + rng.setEnd(node, offset); + return Optional.some(rng); + } + return textBefore(node, offset, block).bind(function (spot) { + var start = findPatternStartFromSpot(dom, pattern, block, spot); + return start.bind(function (startRange) { + if (requireGap) { + if (startRange.endContainer === spot.container && startRange.endOffset === spot.offset) { + return Optional.none(); + } else if (spot.offset === 0 && startRange.endContainer.textContent.length === startRange.endOffset) { + return Optional.none(); + } + } + return Optional.some(startRange); + }); + }); + }; + var findPattern = function (editor, block, details) { + var dom = editor.dom; + var root = dom.getRoot(); + var pattern = details.pattern; + var endNode = details.position.container; + var endOffset = details.position.offset; + return scanLeft(endNode, endOffset - details.pattern.end.length, block).bind(function (spot) { + var endPathRng = generatePathRange(root, spot.container, spot.offset, endNode, endOffset); + if (isReplacementPattern(pattern)) { + return Optional.some({ + matches: [{ + pattern: pattern, + startRng: endPathRng, + endRng: endPathRng + }], + position: spot + }); + } else { + var resultsOpt = findPatternsRec(editor, details.remainingPatterns, spot.container, spot.offset, block); + var results_1 = resultsOpt.getOr({ + matches: [], + position: spot + }); + var pos = results_1.position; + var start = findPatternStart(dom, pattern, pos.container, pos.offset, block, resultsOpt.isNone()); + return start.map(function (startRng) { + var startPathRng = generatePathRangeFromRange(root, startRng); + return { + matches: results_1.matches.concat([{ + pattern: pattern, + startRng: startPathRng, + endRng: endPathRng + }]), + position: point(startRng.startContainer, startRng.startOffset) + }; + }); + } + }); + }; + var findPatternsRec = function (editor, patterns, node, offset, block) { + var dom = editor.dom; + return textBefore(node, offset, dom.getRoot()).bind(function (endSpot) { + var rng = dom.createRng(); + rng.setStart(block, 0); + rng.setEnd(node, offset); + var text = rng.toString(); + for (var i = 0; i < patterns.length; i++) { + var pattern = patterns[i]; + if (!endsWith(text, pattern.end)) { + continue; + } + var patternsWithoutCurrent = patterns.slice(); + patternsWithoutCurrent.splice(i, 1); + var result = findPattern(editor, block, { + pattern: pattern, + remainingPatterns: patternsWithoutCurrent, + position: endSpot + }); + if (result.isSome()) { + return result; + } + } + return Optional.none(); + }); + }; + var applyPattern = function (editor, pattern, patternRange) { + editor.selection.setRng(patternRange); + if (pattern.type === 'inline-format') { + each(pattern.format, function (format) { + editor.formatter.apply(format); + }); + } else { + editor.execCommand(pattern.cmd, false, pattern.value); + } + }; + var applyReplacementPattern = function (editor, pattern, marker, isRoot) { + var markerRange = rangeFromMarker(editor.dom, marker); + deleteRng(editor.dom, markerRange, isRoot); + applyPattern(editor, pattern, markerRange); + }; + var applyPatternWithContent = function (editor, pattern, startMarker, endMarker, isRoot) { + var dom = editor.dom; + var markerEndRange = rangeFromMarker(dom, endMarker); + var markerStartRange = rangeFromMarker(dom, startMarker); + deleteRng(dom, markerStartRange, isRoot); + deleteRng(dom, markerEndRange, isRoot); + var patternMarker = { + prefix: startMarker.prefix, + start: startMarker.end, + end: endMarker.start + }; + var patternRange = rangeFromMarker(dom, patternMarker); + applyPattern(editor, pattern, patternRange); + }; + var addMarkers = function (dom, matches) { + var markerPrefix = generate('mce_textpattern'); + var matchesWithEnds = foldr(matches, function (acc, match) { + var endMarker = createMarker(dom, markerPrefix + ('_end' + acc.length), match.endRng); + return acc.concat([__assign(__assign({}, match), { endMarker: endMarker })]); + }, []); + return foldr(matchesWithEnds, function (acc, match) { + var idx = matchesWithEnds.length - acc.length - 1; + var startMarker = isReplacementPattern(match.pattern) ? match.endMarker : createMarker(dom, markerPrefix + ('_start' + idx), match.startRng); + return acc.concat([__assign(__assign({}, match), { startMarker: startMarker })]); + }, []); + }; + var findPatterns = function (editor, patterns, space) { + var rng = editor.selection.getRng(); + if (rng.collapsed === false) { + return []; + } + return getParentBlock(editor, rng).bind(function (block) { + var offset = rng.startOffset - (space ? 1 : 0); + return findPatternsRec(editor, patterns, rng.startContainer, offset, block); + }).fold(function () { + return []; + }, function (result) { + return result.matches; + }); + }; + var applyMatches = function (editor, matches) { + if (matches.length === 0) { + return; + } + var dom = editor.dom; + var bookmark = editor.selection.getBookmark(); + var matchesWithMarkers = addMarkers(dom, matches); + each(matchesWithMarkers, function (match) { + var block = dom.getParent(match.startMarker.start, dom.isBlock); + var isRoot = function (node) { + return node === block; + }; + if (isReplacementPattern(match.pattern)) { + applyReplacementPattern(editor, match.pattern, match.endMarker, isRoot); + } else { + applyPatternWithContent(editor, match.pattern, match.startMarker, match.endMarker, isRoot); + } + removeMarker(dom, match.endMarker, isRoot); + removeMarker(dom, match.startMarker, isRoot); + }); + editor.selection.moveToBookmark(bookmark); + }; + + var handleEnter = function (editor, patternSet) { + if (!editor.selection.isCollapsed()) { + return false; + } + var inlineMatches = findPatterns(editor, patternSet.inlinePatterns, false); + var blockMatches = findPatterns$1(editor, patternSet.blockPatterns); + if (blockMatches.length > 0 || inlineMatches.length > 0) { + editor.undoManager.add(); + editor.undoManager.extra(function () { + editor.execCommand('mceInsertNewLine'); + }, function () { + editor.insertContent(zeroWidth); + applyMatches(editor, inlineMatches); + applyMatches$1(editor, blockMatches); + var range = editor.selection.getRng(); + var spot = textBefore(range.startContainer, range.startOffset, editor.dom.getRoot()); + editor.execCommand('mceInsertNewLine'); + spot.each(function (s) { + var node = s.container; + if (node.data.charAt(s.offset - 1) === zeroWidth) { + node.deleteData(s.offset - 1, 1); + cleanEmptyNodes(editor.dom, node.parentNode, function (e) { + return e === editor.dom.getRoot(); + }); + } + }); + }); + return true; + } + return false; + }; + var handleInlineKey = function (editor, patternSet) { + var inlineMatches = findPatterns(editor, patternSet.inlinePatterns, true); + if (inlineMatches.length > 0) { + editor.undoManager.transact(function () { + applyMatches(editor, inlineMatches); + }); + } + }; + var checkKeyEvent = function (codes, event, predicate) { + for (var i = 0; i < codes.length; i++) { + if (predicate(codes[i], event)) { + return true; + } + } + return false; + }; + var checkKeyCode = function (codes, event) { + return checkKeyEvent(codes, event, function (code, event) { + return code === event.keyCode && global$3.modifierPressed(event) === false; + }); + }; + var checkCharCode = function (chars, event) { + return checkKeyEvent(chars, event, function (chr, event) { + return chr.charCodeAt(0) === event.charCode; + }); + }; + + var setup = function (editor, patternsState) { + var charCodes = [ + ',', + '.', + ';', + ':', + '!', + '?' + ]; + var keyCodes = [32]; + editor.on('keydown', function (e) { + if (e.keyCode === 13 && !global$3.modifierPressed(e)) { + if (handleEnter(editor, patternsState.get())) { + e.preventDefault(); + } + } + }, true); + editor.on('keyup', function (e) { + if (checkKeyCode(keyCodes, e)) { + handleInlineKey(editor, patternsState.get()); + } + }); + editor.on('keypress', function (e) { + if (checkCharCode(charCodes, e)) { + global$4.setEditorTimeout(editor, function () { + handleInlineKey(editor, patternsState.get()); + }); + } + }); + }; + + function Plugin () { + global$5.add('textpattern', function (editor) { + var patternsState = Cell(getPatternSet(editor)); + setup(editor, patternsState); + return get(patternsState); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.util.I18n'); + + var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var getTocClass = function (editor) { + return editor.getParam('toc_class', 'mce-toc'); + }; + var getTocHeader = function (editor) { + var tagName = editor.getParam('toc_header', 'h2'); + return /^h[1-6]$/.test(tagName) ? tagName : 'h2'; + }; + var getTocDepth = function (editor) { + var depth = parseInt(editor.getParam('toc_depth', '3'), 10); + return depth >= 1 && depth <= 9 ? depth : 3; + }; + + var create = function (prefix) { + var counter = 0; + return function () { + var guid = new Date().getTime().toString(32); + return prefix + guid + (counter++).toString(32); + }; + }; + + var tocId = create('mcetoc_'); + var generateSelector = function (depth) { + var i; + var selector = []; + for (i = 1; i <= depth; i++) { + selector.push('h' + i); + } + return selector.join(','); + }; + var hasHeaders = function (editor) { + return readHeaders(editor).length > 0; + }; + var readHeaders = function (editor) { + var tocClass = getTocClass(editor); + var headerTag = getTocHeader(editor); + var selector = generateSelector(getTocDepth(editor)); + var headers = editor.$(selector); + if (headers.length && /^h[1-9]$/i.test(headerTag)) { + headers = headers.filter(function (i, el) { + return !editor.dom.hasClass(el.parentNode, tocClass); + }); + } + return global.map(headers, function (h) { + var id = h.id; + return { + id: id ? id : tocId(), + level: parseInt(h.nodeName.replace(/^H/i, ''), 10), + title: editor.$.text(h), + element: h + }; + }); + }; + var getMinLevel = function (headers) { + var minLevel = 9; + for (var i = 0; i < headers.length; i++) { + if (headers[i].level < minLevel) { + minLevel = headers[i].level; + } + if (minLevel === 1) { + return minLevel; + } + } + return minLevel; + }; + var generateTitle = function (tag, title) { + var openTag = '<' + tag + ' contenteditable="true">'; + var closeTag = ''; + return openTag + global$2.DOM.encode(title) + closeTag; + }; + var generateTocHtml = function (editor) { + var html = generateTocContentHtml(editor); + return '
' + html + '
'; + }; + var generateTocContentHtml = function (editor) { + var html = ''; + var headers = readHeaders(editor); + var prevLevel = getMinLevel(headers) - 1; + if (!headers.length) { + return ''; + } + html += generateTitle(getTocHeader(editor), global$1.translate('Table of Contents')); + for (var i = 0; i < headers.length; i++) { + var h = headers[i]; + h.element.id = h.id; + var nextLevel = headers[i + 1] && headers[i + 1].level; + if (prevLevel === h.level) { + html += '
  • '; + } else { + for (var ii = prevLevel; ii < h.level; ii++) { + html += '
    • '; + } + } + html += '' + h.title + ''; + if (nextLevel === h.level || !nextLevel) { + html += '
    • '; + if (!nextLevel) { + html += '
    '; + } + } else { + for (var ii = h.level; ii > nextLevel; ii--) { + if (ii === nextLevel + 1) { + html += '
  • '; + } else { + html += '
  • '; + } + } + } + prevLevel = h.level; + } + return html; + }; + var isEmptyOrOffscreen = function (editor, nodes) { + return !nodes.length || editor.dom.getParents(nodes[0], '.mce-offscreen-selection').length > 0; + }; + var insertToc = function (editor) { + var tocClass = getTocClass(editor); + var $tocElm = editor.$('.' + tocClass); + if (isEmptyOrOffscreen(editor, $tocElm)) { + editor.insertContent(generateTocHtml(editor)); + } else { + updateToc(editor); + } + }; + var updateToc = function (editor) { + var tocClass = getTocClass(editor); + var $tocElm = editor.$('.' + tocClass); + if ($tocElm.length) { + editor.undoManager.transact(function () { + $tocElm.html(generateTocContentHtml(editor)); + }); + } + }; + + var register$1 = function (editor) { + editor.addCommand('mceInsertToc', function () { + insertToc(editor); + }); + editor.addCommand('mceUpdateToc', function () { + updateToc(editor); + }); + }; + + var setup = function (editor) { + var $ = editor.$, tocClass = getTocClass(editor); + editor.on('PreProcess', function (e) { + var $tocElm = $('.' + tocClass, e.node); + if ($tocElm.length) { + $tocElm.removeAttr('contentEditable'); + $tocElm.find('[contenteditable]').removeAttr('contentEditable'); + } + }); + editor.on('SetContent', function () { + var $tocElm = $('.' + tocClass); + if ($tocElm.length) { + $tocElm.attr('contentEditable', false); + $tocElm.children(':first-child').attr('contentEditable', true); + } + }); + }; + + var toggleState = function (editor) { + return function (api) { + var toggleDisabledState = function () { + return api.setDisabled(editor.mode.isReadOnly() || !hasHeaders(editor)); + }; + toggleDisabledState(); + editor.on('LoadContent SetContent change', toggleDisabledState); + return function () { + return editor.on('LoadContent SetContent change', toggleDisabledState); + }; + }; + }; + var isToc = function (editor) { + return function (elm) { + return elm && editor.dom.is(elm, '.' + getTocClass(editor)) && editor.getBody().contains(elm); + }; + }; + var register = function (editor) { + var insertTocAction = function () { + return editor.execCommand('mceInsertToc'); + }; + editor.ui.registry.addButton('toc', { + icon: 'toc', + tooltip: 'Table of contents', + onAction: insertTocAction, + onSetup: toggleState(editor) + }); + editor.ui.registry.addButton('tocupdate', { + icon: 'reload', + tooltip: 'Update', + onAction: function () { + return editor.execCommand('mceUpdateToc'); + } + }); + editor.ui.registry.addMenuItem('toc', { + icon: 'toc', + text: 'Table of contents', + onAction: insertTocAction, + onSetup: toggleState(editor) + }); + editor.ui.registry.addContextToolbar('toc', { + items: 'tocupdate', + predicate: isToc(editor), + scope: 'node', + position: 'node' + }); + }; + + function Plugin () { + global$3.add('toc', function (editor) { + register$1(editor); + register(editor); + setup(editor); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; + }; + var set = function (v) { + value = v; + }; + return { + get: get, + set: set + }; + }; + + var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var get$2 = function (toggleState) { + var isEnabled = function () { + return toggleState.get(); + }; + return { isEnabled: isEnabled }; + }; + + var fireVisualChars = function (editor, state) { + return editor.fire('VisualChars', { state: state }); + }; + + var typeOf = function (x) { + var t = typeof x; + if (x === null) { + return 'null'; + } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { + return 'array'; + } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { + return 'string'; + } else { + return t; + } + }; + var isType$1 = function (type) { + return function (value) { + return typeOf(value) === type; + }; + }; + var isSimpleType = function (type) { + return function (value) { + return typeof value === type; + }; + }; + var isString = isType$1('string'); + var isBoolean = isSimpleType('boolean'); + var isNumber = isSimpleType('number'); + + var noop = function () { + }; + var constant = function (value) { + return function () { + return value; + }; + }; + var identity = function (x) { + return x; + }; + var never = constant(false); + var always = constant(true); + + var none = function () { + return NONE; + }; + var NONE = function () { + var call = function (thunk) { + return thunk(); + }; + var id = identity; + var me = { + fold: function (n, _s) { + return n(); + }, + isSome: never, + isNone: always, + getOr: id, + getOrThunk: call, + getOrDie: function (msg) { + throw new Error(msg || 'error: getOrDie called on none.'); + }, + getOrNull: constant(null), + getOrUndefined: constant(undefined), + or: id, + orThunk: call, + map: none, + each: noop, + bind: none, + exists: never, + forall: always, + filter: function () { + return none(); + }, + toArray: function () { + return []; + }, + toString: constant('none()') + }; + return me; + }(); + var some = function (a) { + var constant_a = constant(a); + var self = function () { + return me; + }; + var bind = function (f) { + return f(a); + }; + var me = { + fold: function (n, s) { + return s(a); + }, + isSome: always, + isNone: never, + getOr: constant_a, + getOrThunk: constant_a, + getOrDie: constant_a, + getOrNull: constant_a, + getOrUndefined: constant_a, + or: self, + orThunk: self, + map: function (f) { + return some(f(a)); + }, + each: function (f) { + f(a); + }, + bind: bind, + exists: bind, + forall: bind, + filter: function (f) { + return f(a) ? me : NONE; + }, + toArray: function () { + return [a]; + }, + toString: function () { + return 'some(' + a + ')'; + } + }; + return me; + }; + var from = function (value) { + return value === null || value === undefined ? NONE : some(value); + }; + var Optional = { + some: some, + none: none, + from: from + }; + + var map = function (xs, f) { + var len = xs.length; + var r = new Array(len); + for (var i = 0; i < len; i++) { + var x = xs[i]; + r[i] = f(x, i); + } + return r; + }; + var each$1 = function (xs, f) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + f(x, i); + } + }; + var filter = function (xs, pred) { + var r = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + r.push(x); + } + } + return r; + }; + + var keys = Object.keys; + var each = function (obj, f) { + var props = keys(obj); + for (var k = 0, len = props.length; k < len; k++) { + var i = props[k]; + var x = obj[i]; + f(x, i); + } + }; + + typeof window !== 'undefined' ? window : Function('return this;')(); + + var TEXT = 3; + + var type = function (element) { + return element.dom.nodeType; + }; + var value = function (element) { + return element.dom.nodeValue; + }; + var isType = function (t) { + return function (element) { + return type(element) === t; + }; + }; + var isText = isType(TEXT); + + var rawSet = function (dom, key, value) { + if (isString(value) || isBoolean(value) || isNumber(value)) { + dom.setAttribute(key, value + ''); + } else { + console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom); + throw new Error('Attribute value was not simple'); + } + }; + var set = function (element, key, value) { + rawSet(element.dom, key, value); + }; + var get$1 = function (element, key) { + var v = element.dom.getAttribute(key); + return v === null ? undefined : v; + }; + var remove$3 = function (element, key) { + element.dom.removeAttribute(key); + }; + + var read = function (element, attr) { + var value = get$1(element, attr); + return value === undefined || value === '' ? [] : value.split(' '); + }; + var add$2 = function (element, attr, id) { + var old = read(element, attr); + var nu = old.concat([id]); + set(element, attr, nu.join(' ')); + return true; + }; + var remove$2 = function (element, attr, id) { + var nu = filter(read(element, attr), function (v) { + return v !== id; + }); + if (nu.length > 0) { + set(element, attr, nu.join(' ')); + } else { + remove$3(element, attr); + } + return false; + }; + + var supports = function (element) { + return element.dom.classList !== undefined; + }; + var get = function (element) { + return read(element, 'class'); + }; + var add$1 = function (element, clazz) { + return add$2(element, 'class', clazz); + }; + var remove$1 = function (element, clazz) { + return remove$2(element, 'class', clazz); + }; + + var add = function (element, clazz) { + if (supports(element)) { + element.dom.classList.add(clazz); + } else { + add$1(element, clazz); + } + }; + var cleanClass = function (element) { + var classList = supports(element) ? element.dom.classList : get(element); + if (classList.length === 0) { + remove$3(element, 'class'); + } + }; + var remove = function (element, clazz) { + if (supports(element)) { + var classList = element.dom.classList; + classList.remove(clazz); + } else { + remove$1(element, clazz); + } + cleanClass(element); + }; + + var fromHtml = function (html, scope) { + var doc = scope || document; + var div = doc.createElement('div'); + div.innerHTML = html; + if (!div.hasChildNodes() || div.childNodes.length > 1) { + console.error('HTML does not have a single root node', html); + throw new Error('HTML must have a single root node'); + } + return fromDom(div.childNodes[0]); + }; + var fromTag = function (tag, scope) { + var doc = scope || document; + var node = doc.createElement(tag); + return fromDom(node); + }; + var fromText = function (text, scope) { + var doc = scope || document; + var node = doc.createTextNode(text); + return fromDom(node); + }; + var fromDom = function (node) { + if (node === null || node === undefined) { + throw new Error('Node cannot be null or undefined'); + } + return { dom: node }; + }; + var fromPoint = function (docElm, x, y) { + return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom); + }; + var SugarElement = { + fromHtml: fromHtml, + fromTag: fromTag, + fromText: fromText, + fromDom: fromDom, + fromPoint: fromPoint + }; + + var charMap = { + '\xA0': 'nbsp', + '\xAD': 'shy' + }; + var charMapToRegExp = function (charMap, global) { + var regExp = ''; + each(charMap, function (_value, key) { + regExp += key; + }); + return new RegExp('[' + regExp + ']', global ? 'g' : ''); + }; + var charMapToSelector = function (charMap) { + var selector = ''; + each(charMap, function (value) { + if (selector) { + selector += ','; + } + selector += 'span.mce-' + value; + }); + return selector; + }; + var regExp = charMapToRegExp(charMap); + var regExpGlobal = charMapToRegExp(charMap, true); + var selector = charMapToSelector(charMap); + var nbspClass = 'mce-nbsp'; + + var wrapCharWithSpan = function (value) { + return '' + value + ''; + }; + + var isMatch = function (n) { + var value$1 = value(n); + return isText(n) && value$1 !== undefined && regExp.test(value$1); + }; + var filterDescendants = function (scope, predicate) { + var result = []; + var dom = scope.dom; + var children = map(dom.childNodes, SugarElement.fromDom); + each$1(children, function (x) { + if (predicate(x)) { + result = result.concat([x]); + } + result = result.concat(filterDescendants(x, predicate)); + }); + return result; + }; + var findParentElm = function (elm, rootElm) { + while (elm.parentNode) { + if (elm.parentNode === rootElm) { + return elm; + } + elm = elm.parentNode; + } + }; + var replaceWithSpans = function (text) { + return text.replace(regExpGlobal, wrapCharWithSpan); + }; + + var isWrappedNbsp = function (node) { + return node.nodeName.toLowerCase() === 'span' && node.classList.contains('mce-nbsp-wrap'); + }; + var show = function (editor, rootElm) { + var nodeList = filterDescendants(SugarElement.fromDom(rootElm), isMatch); + each$1(nodeList, function (n) { + var parent = n.dom.parentNode; + if (isWrappedNbsp(parent)) { + add(SugarElement.fromDom(parent), nbspClass); + } else { + var withSpans = replaceWithSpans(editor.dom.encode(value(n))); + var div = editor.dom.create('div', null, withSpans); + var node = void 0; + while (node = div.lastChild) { + editor.dom.insertAfter(node, n.dom); + } + editor.dom.remove(n.dom); + } + }); + }; + var hide = function (editor, rootElm) { + var nodeList = editor.dom.select(selector, rootElm); + each$1(nodeList, function (node) { + if (isWrappedNbsp(node)) { + remove(SugarElement.fromDom(node), nbspClass); + } else { + editor.dom.remove(node, true); + } + }); + }; + var toggle = function (editor) { + var body = editor.getBody(); + var bookmark = editor.selection.getBookmark(); + var parentNode = findParentElm(editor.selection.getNode(), body); + parentNode = parentNode !== undefined ? parentNode : body; + hide(editor, parentNode); + show(editor, parentNode); + editor.selection.moveToBookmark(bookmark); + }; + + var applyVisualChars = function (editor, toggleState) { + fireVisualChars(editor, toggleState.get()); + var body = editor.getBody(); + if (toggleState.get() === true) { + show(editor, body); + } else { + hide(editor, body); + } + }; + var toggleVisualChars = function (editor, toggleState) { + toggleState.set(!toggleState.get()); + var bookmark = editor.selection.getBookmark(); + applyVisualChars(editor, toggleState); + editor.selection.moveToBookmark(bookmark); + }; + + var register$1 = function (editor, toggleState) { + editor.addCommand('mceVisualChars', function () { + toggleVisualChars(editor, toggleState); + }); + }; + + var isEnabledByDefault = function (editor) { + return editor.getParam('visualchars_default_state', false); + }; + var hasForcedRootBlock = function (editor) { + return editor.getParam('forced_root_block') !== false; + }; + + var setup$1 = function (editor, toggleState) { + editor.on('init', function () { + applyVisualChars(editor, toggleState); + }); + }; + + var global = tinymce.util.Tools.resolve('tinymce.util.Delay'); + + var setup = function (editor, toggleState) { + var debouncedToggle = global.debounce(function () { + toggle(editor); + }, 300); + if (hasForcedRootBlock(editor)) { + editor.on('keydown', function (e) { + if (toggleState.get() === true) { + e.keyCode === 13 ? toggle(editor) : debouncedToggle(); + } + }); + } + editor.on('remove', debouncedToggle.stop); + }; + + var toggleActiveState = function (editor, enabledStated) { + return function (api) { + api.setActive(enabledStated.get()); + var editorEventCallback = function (e) { + return api.setActive(e.state); + }; + editor.on('VisualChars', editorEventCallback); + return function () { + return editor.off('VisualChars', editorEventCallback); + }; + }; + }; + var register = function (editor, toggleState) { + var onAction = function () { + return editor.execCommand('mceVisualChars'); + }; + editor.ui.registry.addToggleButton('visualchars', { + tooltip: 'Show invisible characters', + icon: 'visualchars', + onAction: onAction, + onSetup: toggleActiveState(editor, toggleState) + }); + editor.ui.registry.addToggleMenuItem('visualchars', { + text: 'Show invisible characters', + icon: 'visualchars', + onAction: onAction, + onSetup: toggleActiveState(editor, toggleState) + }); + }; + + function Plugin () { + global$1.add('visualchars', function (editor) { + var toggleState = Cell(isEnabledByDefault(editor)); + register$1(editor, toggleState); + register(editor, toggleState); + setup(editor, toggleState); + setup$1(editor, toggleState); + return get$2(toggleState); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; + }; + var set = function (v) { + value = v; + }; + return { + get: get, + set: set + }; + }; + + var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var fireVisualBlocks = function (editor, state) { + editor.fire('VisualBlocks', { state: state }); + }; + + var toggleVisualBlocks = function (editor, pluginUrl, enabledState) { + var dom = editor.dom; + dom.toggleClass(editor.getBody(), 'mce-visualblocks'); + enabledState.set(!enabledState.get()); + fireVisualBlocks(editor, enabledState.get()); + }; + + var register$1 = function (editor, pluginUrl, enabledState) { + editor.addCommand('mceVisualBlocks', function () { + toggleVisualBlocks(editor, pluginUrl, enabledState); + }); + }; + + var isEnabledByDefault = function (editor) { + return editor.getParam('visualblocks_default_state', false, 'boolean'); + }; + + var setup = function (editor, pluginUrl, enabledState) { + editor.on('PreviewFormats AfterPreviewFormats', function (e) { + if (enabledState.get()) { + editor.dom.toggleClass(editor.getBody(), 'mce-visualblocks', e.type === 'afterpreviewformats'); + } + }); + editor.on('init', function () { + if (isEnabledByDefault(editor)) { + toggleVisualBlocks(editor, pluginUrl, enabledState); + } + }); + }; + + var toggleActiveState = function (editor, enabledState) { + return function (api) { + api.setActive(enabledState.get()); + var editorEventCallback = function (e) { + return api.setActive(e.state); + }; + editor.on('VisualBlocks', editorEventCallback); + return function () { + return editor.off('VisualBlocks', editorEventCallback); + }; + }; + }; + var register = function (editor, enabledState) { + var onAction = function () { + return editor.execCommand('mceVisualBlocks'); + }; + editor.ui.registry.addToggleButton('visualblocks', { + icon: 'visualblocks', + tooltip: 'Show blocks', + onAction: onAction, + onSetup: toggleActiveState(editor, enabledState) + }); + editor.ui.registry.addToggleMenuItem('visualblocks', { + text: 'Show blocks', + icon: 'visualblocks', + onAction: onAction, + onSetup: toggleActiveState(editor, enabledState) + }); + }; + + function Plugin () { + global.add('visualblocks', function (editor, pluginUrl) { + var enabledState = Cell(false); + register$1(editor, pluginUrl, enabledState); + register(editor, enabledState); + setup(editor, pluginUrl, enabledState); + }); + } + + Plugin(); + +}()); + +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.10.5 (2022-05-25) + */ +(function () { + 'use strict'; + + var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var identity = function (x) { + return x; + }; + + var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + var zeroWidth = '\uFEFF'; + var removeZwsp$1 = function (s) { + return s.replace(/\uFEFF/g, ''); + }; + + var map = function (xs, f) { + var len = xs.length; + var r = new Array(len); + for (var i = 0; i < len; i++) { + var x = xs[i]; + r[i] = f(x, i); + } + return r; + }; + + var punctuationStr = '[!-#%-*,-\\/:;?@\\[-\\]_{}\xA1\xAB\xB7\xBB\xBF;\xB7\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1361-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u3008\u3009\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30\u2E31\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uff3f\uFF5B\uFF5D\uFF5F-\uFF65]'; + var regExps = { + aletter: '[A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05F3\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u10a0-\u10c5\u10d0-\u10fa\u10fc\u1100-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bc0-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u24B6-\u24E9\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2d00-\u2d25\u2d30-\u2d65\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005\u303b\u303c\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790\ua791\ua7a0-\ua7a9\ua7fa-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uffa0-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]', + midnumlet: '[-\'\\.\u2018\u2019\u2024\uFE52\uFF07\uFF0E]', + midletter: '[:\xB7\xB7\u05F4\u2027\uFE13\uFE55\uFF1A]', + midnum: '[\xB1+*/,;;\u0589\u060C\u060D\u066C\u07F8\u2044\uFE10\uFE14\uFE50\uFE54\uFF0C\uFF1B]', + numeric: '[0-9\u0660-\u0669\u066B\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\uaa50-\uaa59\uabf0-\uabf9]', + cr: '\\r', + lf: '\\n', + newline: '[\x0B\f\x85\u2028\u2029]', + extend: '[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d02\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f\u109a-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b6-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u192b\u1930-\u193b\u19b0-\u19c0\u19c8\u19c9\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f\u1b00-\u1b04\u1b34-\u1b44\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1baa\u1be6-\u1bf3\u1c24-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2\u1dc0-\u1de6\u1dfc-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\uA672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa7b\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe3-\uabea\uabec\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]', + format: '[\xAD\u0600-\u0603\u06DD\u070F\u17b4\u17b5\u200E\u200F\u202A-\u202E\u2060-\u2064\u206A-\u206F\uFEFF\uFFF9-\uFFFB]', + katakana: '[\u3031-\u3035\u309B\u309C\u30A0-\u30fa\u30fc-\u30ff\u31f0-\u31ff\u32D0-\u32FE\u3300-\u3357\uff66-\uff9d]', + extendnumlet: '[=_\u203f\u2040\u2054\ufe33\ufe34\ufe4d-\ufe4f\uff3f\u2200-\u22FF<>]', + punctuation: punctuationStr + }; + var characterIndices = { + ALETTER: 0, + MIDNUMLET: 1, + MIDLETTER: 2, + MIDNUM: 3, + NUMERIC: 4, + CR: 5, + LF: 6, + NEWLINE: 7, + EXTEND: 8, + FORMAT: 9, + KATAKANA: 10, + EXTENDNUMLET: 11, + AT: 12, + OTHER: 13 + }; + var SETS$1 = [ + new RegExp(regExps.aletter), + new RegExp(regExps.midnumlet), + new RegExp(regExps.midletter), + new RegExp(regExps.midnum), + new RegExp(regExps.numeric), + new RegExp(regExps.cr), + new RegExp(regExps.lf), + new RegExp(regExps.newline), + new RegExp(regExps.extend), + new RegExp(regExps.format), + new RegExp(regExps.katakana), + new RegExp(regExps.extendnumlet), + new RegExp('@') + ]; + var EMPTY_STRING$1 = ''; + var PUNCTUATION$1 = new RegExp('^' + regExps.punctuation + '$'); + var WHITESPACE$1 = /^\s+$/; + + var SETS = SETS$1; + var OTHER = characterIndices.OTHER; + var getType = function (char) { + var type = OTHER; + var setsLength = SETS.length; + for (var j = 0; j < setsLength; ++j) { + var set = SETS[j]; + if (set && set.test(char)) { + type = j; + break; + } + } + return type; + }; + var memoize = function (func) { + var cache = {}; + return function (char) { + if (cache[char]) { + return cache[char]; + } else { + var result = func(char); + cache[char] = result; + return result; + } + }; + }; + var classify = function (characters) { + var memoized = memoize(getType); + return map(characters, memoized); + }; + + var isWordBoundary = function (map, index) { + var type = map[index]; + var nextType = map[index + 1]; + if (index < 0 || index > map.length - 1 && index !== 0) { + return false; + } + if (type === characterIndices.ALETTER && nextType === characterIndices.ALETTER) { + return false; + } + var nextNextType = map[index + 2]; + if (type === characterIndices.ALETTER && (nextType === characterIndices.MIDLETTER || nextType === characterIndices.MIDNUMLET || nextType === characterIndices.AT) && nextNextType === characterIndices.ALETTER) { + return false; + } + var prevType = map[index - 1]; + if ((type === characterIndices.MIDLETTER || type === characterIndices.MIDNUMLET || nextType === characterIndices.AT) && nextType === characterIndices.ALETTER && prevType === characterIndices.ALETTER) { + return false; + } + if ((type === characterIndices.NUMERIC || type === characterIndices.ALETTER) && (nextType === characterIndices.NUMERIC || nextType === characterIndices.ALETTER)) { + return false; + } + if ((type === characterIndices.MIDNUM || type === characterIndices.MIDNUMLET) && nextType === characterIndices.NUMERIC && prevType === characterIndices.NUMERIC) { + return false; + } + if (type === characterIndices.NUMERIC && (nextType === characterIndices.MIDNUM || nextType === characterIndices.MIDNUMLET) && nextNextType === characterIndices.NUMERIC) { + return false; + } + if (type === characterIndices.EXTEND || type === characterIndices.FORMAT || prevType === characterIndices.EXTEND || prevType === characterIndices.FORMAT || nextType === characterIndices.EXTEND || nextType === characterIndices.FORMAT) { + return false; + } + if (type === characterIndices.CR && nextType === characterIndices.LF) { + return false; + } + if (type === characterIndices.NEWLINE || type === characterIndices.CR || type === characterIndices.LF) { + return true; + } + if (nextType === characterIndices.NEWLINE || nextType === characterIndices.CR || nextType === characterIndices.LF) { + return true; + } + if (type === characterIndices.KATAKANA && nextType === characterIndices.KATAKANA) { + return false; + } + if (nextType === characterIndices.EXTENDNUMLET && (type === characterIndices.ALETTER || type === characterIndices.NUMERIC || type === characterIndices.KATAKANA || type === characterIndices.EXTENDNUMLET)) { + return false; + } + if (type === characterIndices.EXTENDNUMLET && (nextType === characterIndices.ALETTER || nextType === characterIndices.NUMERIC || nextType === characterIndices.KATAKANA)) { + return false; + } + if (type === characterIndices.AT) { + return false; + } + return true; + }; + + var EMPTY_STRING = EMPTY_STRING$1; + var WHITESPACE = WHITESPACE$1; + var PUNCTUATION = PUNCTUATION$1; + var isProtocol = function (str) { + return str === 'http' || str === 'https'; + }; + var findWordEnd = function (characters, startIndex) { + var i; + for (i = startIndex; i < characters.length; i++) { + if (WHITESPACE.test(characters[i])) { + break; + } + } + return i; + }; + var findUrlEnd = function (characters, startIndex) { + var endIndex = findWordEnd(characters, startIndex + 1); + var peakedWord = characters.slice(startIndex + 1, endIndex).join(EMPTY_STRING); + return peakedWord.substr(0, 3) === '://' ? endIndex : startIndex; + }; + var findWords = function (chars, sChars, characterMap, options) { + var words = []; + var word = []; + for (var i = 0; i < characterMap.length; ++i) { + word.push(chars[i]); + if (isWordBoundary(characterMap, i)) { + var ch = sChars[i]; + if ((options.includeWhitespace || !WHITESPACE.test(ch)) && (options.includePunctuation || !PUNCTUATION.test(ch))) { + var startOfWord = i - word.length + 1; + var endOfWord = i + 1; + var str = sChars.slice(startOfWord, endOfWord).join(EMPTY_STRING); + if (isProtocol(str)) { + var endOfUrl = findUrlEnd(sChars, i); + var url = chars.slice(endOfWord, endOfUrl); + Array.prototype.push.apply(word, url); + i = endOfUrl; + } + words.push(word); + } + word = []; + } + } + return words; + }; + var getDefaultOptions = function () { + return { + includeWhitespace: false, + includePunctuation: false + }; + }; + var getWords$1 = function (chars, extract, options) { + options = __assign(__assign({}, getDefaultOptions()), options); + var filteredChars = []; + var extractedChars = []; + for (var i = 0; i < chars.length; i++) { + var ch = extract(chars[i]); + if (ch !== zeroWidth) { + filteredChars.push(chars[i]); + extractedChars.push(ch); + } + } + var characterMap = classify(extractedChars); + return findWords(filteredChars, extractedChars, characterMap, options); + }; + + var getWords = getWords$1; + + var global$1 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker'); + + var getText = function (node, schema) { + var blockElements = schema.getBlockElements(); + var shortEndedElements = schema.getShortEndedElements(); + var isNewline = function (node) { + return blockElements[node.nodeName] || shortEndedElements[node.nodeName]; + }; + var textBlocks = []; + var txt = ''; + var treeWalker = new global$1(node, node); + while (node = treeWalker.next()) { + if (node.nodeType === 3) { + txt += removeZwsp$1(node.data); + } else if (isNewline(node) && txt.length) { + textBlocks.push(txt); + txt = ''; + } + } + if (txt.length) { + textBlocks.push(txt); + } + return textBlocks; + }; + + var removeZwsp = function (text) { + return text.replace(/\u200B/g, ''); + }; + var strLen = function (str) { + return str.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length; + }; + var countWords = function (node, schema) { + var text = removeZwsp(getText(node, schema).join('\n')); + return getWords(text.split(''), identity).length; + }; + var countCharacters = function (node, schema) { + var text = getText(node, schema).join(''); + return strLen(text); + }; + var countCharactersWithoutSpaces = function (node, schema) { + var text = getText(node, schema).join('').replace(/\s/g, ''); + return strLen(text); + }; + + var createBodyCounter = function (editor, count) { + return function () { + return count(editor.getBody(), editor.schema); + }; + }; + var createSelectionCounter = function (editor, count) { + return function () { + return count(editor.selection.getRng().cloneContents(), editor.schema); + }; + }; + var createBodyWordCounter = function (editor) { + return createBodyCounter(editor, countWords); + }; + var get = function (editor) { + return { + body: { + getWordCount: createBodyWordCounter(editor), + getCharacterCount: createBodyCounter(editor, countCharacters), + getCharacterCountWithoutSpaces: createBodyCounter(editor, countCharactersWithoutSpaces) + }, + selection: { + getWordCount: createSelectionCounter(editor, countWords), + getCharacterCount: createSelectionCounter(editor, countCharacters), + getCharacterCountWithoutSpaces: createSelectionCounter(editor, countCharactersWithoutSpaces) + }, + getCount: createBodyWordCounter(editor) + }; + }; + + var open = function (editor, api) { + editor.windowManager.open({ + title: 'Word Count', + body: { + type: 'panel', + items: [{ + type: 'table', + header: [ + 'Count', + 'Document', + 'Selection' + ], + cells: [ + [ + 'Words', + String(api.body.getWordCount()), + String(api.selection.getWordCount()) + ], + [ + 'Characters (no spaces)', + String(api.body.getCharacterCountWithoutSpaces()), + String(api.selection.getCharacterCountWithoutSpaces()) + ], + [ + 'Characters', + String(api.body.getCharacterCount()), + String(api.selection.getCharacterCount()) + ] + ] + }] + }, + buttons: [{ + type: 'cancel', + name: 'close', + text: 'Close', + primary: true + }] + }); + }; + + var register$1 = function (editor, api) { + editor.addCommand('mceWordCount', function () { + return open(editor, api); + }); + }; + + var global = tinymce.util.Tools.resolve('tinymce.util.Delay'); + + var fireWordCountUpdate = function (editor, api) { + editor.fire('wordCountUpdate', { + wordCount: { + words: api.body.getWordCount(), + characters: api.body.getCharacterCount(), + charactersWithoutSpaces: api.body.getCharacterCountWithoutSpaces() + } + }); + }; + + var updateCount = function (editor, api) { + fireWordCountUpdate(editor, api); + }; + var setup = function (editor, api, delay) { + var debouncedUpdate = global.debounce(function () { + return updateCount(editor, api); + }, delay); + editor.on('init', function () { + updateCount(editor, api); + global.setEditorTimeout(editor, function () { + editor.on('SetContent BeforeAddUndo Undo Redo ViewUpdate keyup', debouncedUpdate); + }, 0); + }); + }; + + var register = function (editor) { + var onAction = function () { + return editor.execCommand('mceWordCount'); + }; + editor.ui.registry.addButton('wordcount', { + tooltip: 'Word count', + icon: 'character-count', + onAction: onAction + }); + editor.ui.registry.addMenuItem('wordcount', { + text: 'Word count', + icon: 'character-count', + onAction: onAction + }); + }; + + function Plugin (delay) { + if (delay === void 0) { + delay = 300; + } + global$2.add('wordcount', function (editor) { + var api = get(editor); + register$1(editor, api); + register(editor); + setup(editor, api, delay); + return api; + }); + } + + Plugin(); + +}()); diff --git a/Moonlight/wwwroot/assets/plugins/custom/typedjs/typedjs.bundle.js b/Moonlight/wwwroot/assets/plugins/custom/typedjs/typedjs.bundle.js new file mode 100644 index 0000000..0992dc5 --- /dev/null +++ b/Moonlight/wwwroot/assets/plugins/custom/typedjs/typedjs.bundle.js @@ -0,0 +1,1052 @@ +/*! + * + * typed.js - A JavaScript Typing Animation Library + * Author: Matt Boldt + * Version: v2.0.12 + * Url: https://github.com/mattboldt/typed.js + * License(s): MIT + * + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["Typed"] = factory(); + else + root["Typed"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + var _initializerJs = __webpack_require__(1); + + var _htmlParserJs = __webpack_require__(3); + + /** + * Welcome to Typed.js! + * @param {string} elementId HTML element ID _OR_ HTML element + * @param {object} options options object + * @returns {object} a new Typed object + */ + + var Typed = (function () { + function Typed(elementId, options) { + _classCallCheck(this, Typed); + + // Initialize it up + _initializerJs.initializer.load(this, options, elementId); + // All systems go! + this.begin(); + } + + /** + * Toggle start() and stop() of the Typed instance + * @public + */ + + _createClass(Typed, [{ + key: 'toggle', + value: function toggle() { + this.pause.status ? this.start() : this.stop(); + } + + /** + * Stop typing / backspacing and enable cursor blinking + * @public + */ + }, { + key: 'stop', + value: function stop() { + if (this.typingComplete) return; + if (this.pause.status) return; + this.toggleBlinking(true); + this.pause.status = true; + this.options.onStop(this.arrayPos, this); + } + + /** + * Start typing / backspacing after being stopped + * @public + */ + }, { + key: 'start', + value: function start() { + if (this.typingComplete) return; + if (!this.pause.status) return; + this.pause.status = false; + if (this.pause.typewrite) { + this.typewrite(this.pause.curString, this.pause.curStrPos); + } else { + this.backspace(this.pause.curString, this.pause.curStrPos); + } + this.options.onStart(this.arrayPos, this); + } + + /** + * Destroy this instance of Typed + * @public + */ + }, { + key: 'destroy', + value: function destroy() { + this.reset(false); + this.options.onDestroy(this); + } + + /** + * Reset Typed and optionally restarts + * @param {boolean} restart + * @public + */ + }, { + key: 'reset', + value: function reset() { + var restart = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; + + clearInterval(this.timeout); + this.replaceText(''); + if (this.cursor && this.cursor.parentNode) { + this.cursor.parentNode.removeChild(this.cursor); + this.cursor = null; + } + this.strPos = 0; + this.arrayPos = 0; + this.curLoop = 0; + if (restart) { + this.insertCursor(); + this.options.onReset(this); + this.begin(); + } + } + + /** + * Begins the typing animation + * @private + */ + }, { + key: 'begin', + value: function begin() { + var _this = this; + + this.options.onBegin(this); + this.typingComplete = false; + this.shuffleStringsIfNeeded(this); + this.insertCursor(); + if (this.bindInputFocusEvents) this.bindFocusEvents(); + this.timeout = setTimeout(function () { + // Check if there is some text in the element, if yes start by backspacing the default message + if (!_this.currentElContent || _this.currentElContent.length === 0) { + _this.typewrite(_this.strings[_this.sequence[_this.arrayPos]], _this.strPos); + } else { + // Start typing + _this.backspace(_this.currentElContent, _this.currentElContent.length); + } + }, this.startDelay); + } + + /** + * Called for each character typed + * @param {string} curString the current string in the strings array + * @param {number} curStrPos the current position in the curString + * @private + */ + }, { + key: 'typewrite', + value: function typewrite(curString, curStrPos) { + var _this2 = this; + + if (this.fadeOut && this.el.classList.contains(this.fadeOutClass)) { + this.el.classList.remove(this.fadeOutClass); + if (this.cursor) this.cursor.classList.remove(this.fadeOutClass); + } + + var humanize = this.humanizer(this.typeSpeed); + var numChars = 1; + + if (this.pause.status === true) { + this.setPauseStatus(curString, curStrPos, true); + return; + } + + // contain typing function in a timeout humanize'd delay + this.timeout = setTimeout(function () { + // skip over any HTML chars + curStrPos = _htmlParserJs.htmlParser.typeHtmlChars(curString, curStrPos, _this2); + + var pauseTime = 0; + var substr = curString.substr(curStrPos); + // check for an escape character before a pause value + // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^ + // single ^ are removed from string + if (substr.charAt(0) === '^') { + if (/^\^\d+/.test(substr)) { + var skip = 1; // skip at least 1 + substr = /\d+/.exec(substr)[0]; + skip += substr.length; + pauseTime = parseInt(substr); + _this2.temporaryPause = true; + _this2.options.onTypingPaused(_this2.arrayPos, _this2); + // strip out the escape character and pause value so they're not printed + curString = curString.substring(0, curStrPos) + curString.substring(curStrPos + skip); + _this2.toggleBlinking(true); + } + } + + // check for skip characters formatted as + // "this is a `string to print NOW` ..." + if (substr.charAt(0) === '`') { + while (curString.substr(curStrPos + numChars).charAt(0) !== '`') { + numChars++; + if (curStrPos + numChars > curString.length) break; + } + // strip out the escape characters and append all the string in between + var stringBeforeSkip = curString.substring(0, curStrPos); + var stringSkipped = curString.substring(stringBeforeSkip.length + 1, curStrPos + numChars); + var stringAfterSkip = curString.substring(curStrPos + numChars + 1); + curString = stringBeforeSkip + stringSkipped + stringAfterSkip; + numChars--; + } + + // timeout for any pause after a character + _this2.timeout = setTimeout(function () { + // Accounts for blinking while paused + _this2.toggleBlinking(false); + + // We're done with this sentence! + if (curStrPos >= curString.length) { + _this2.doneTyping(curString, curStrPos); + } else { + _this2.keepTyping(curString, curStrPos, numChars); + } + // end of character pause + if (_this2.temporaryPause) { + _this2.temporaryPause = false; + _this2.options.onTypingResumed(_this2.arrayPos, _this2); + } + }, pauseTime); + + // humanized value for typing + }, humanize); + } + + /** + * Continue to the next string & begin typing + * @param {string} curString the current string in the strings array + * @param {number} curStrPos the current position in the curString + * @private + */ + }, { + key: 'keepTyping', + value: function keepTyping(curString, curStrPos, numChars) { + // call before functions if applicable + if (curStrPos === 0) { + this.toggleBlinking(false); + this.options.preStringTyped(this.arrayPos, this); + } + // start typing each new char into existing string + // curString: arg, this.el.html: original text inside element + curStrPos += numChars; + var nextString = curString.substr(0, curStrPos); + this.replaceText(nextString); + // loop the function + this.typewrite(curString, curStrPos); + } + + /** + * We're done typing the current string + * @param {string} curString the current string in the strings array + * @param {number} curStrPos the current position in the curString + * @private + */ + }, { + key: 'doneTyping', + value: function doneTyping(curString, curStrPos) { + var _this3 = this; + + // fires callback function + this.options.onStringTyped(this.arrayPos, this); + this.toggleBlinking(true); + // is this the final string + if (this.arrayPos === this.strings.length - 1) { + // callback that occurs on the last typed string + this.complete(); + // quit if we wont loop back + if (this.loop === false || this.curLoop === this.loopCount) { + return; + } + } + this.timeout = setTimeout(function () { + _this3.backspace(curString, curStrPos); + }, this.backDelay); + } + + /** + * Backspaces 1 character at a time + * @param {string} curString the current string in the strings array + * @param {number} curStrPos the current position in the curString + * @private + */ + }, { + key: 'backspace', + value: function backspace(curString, curStrPos) { + var _this4 = this; + + if (this.pause.status === true) { + this.setPauseStatus(curString, curStrPos, false); + return; + } + if (this.fadeOut) return this.initFadeOut(); + + this.toggleBlinking(false); + var humanize = this.humanizer(this.backSpeed); + + this.timeout = setTimeout(function () { + curStrPos = _htmlParserJs.htmlParser.backSpaceHtmlChars(curString, curStrPos, _this4); + // replace text with base text + typed characters + var curStringAtPosition = curString.substr(0, curStrPos); + _this4.replaceText(curStringAtPosition); + + // if smartBack is enabled + if (_this4.smartBackspace) { + // the remaining part of the current string is equal of the same part of the new string + var nextString = _this4.strings[_this4.arrayPos + 1]; + if (nextString && curStringAtPosition === nextString.substr(0, curStrPos)) { + _this4.stopNum = curStrPos; + } else { + _this4.stopNum = 0; + } + } + + // if the number (id of character in current string) is + // less than the stop number, keep going + if (curStrPos > _this4.stopNum) { + // subtract characters one by one + curStrPos--; + // loop the function + _this4.backspace(curString, curStrPos); + } else if (curStrPos <= _this4.stopNum) { + // if the stop number has been reached, increase + // array position to next string + _this4.arrayPos++; + // When looping, begin at the beginning after backspace complete + if (_this4.arrayPos === _this4.strings.length) { + _this4.arrayPos = 0; + _this4.options.onLastStringBackspaced(); + _this4.shuffleStringsIfNeeded(); + _this4.begin(); + } else { + _this4.typewrite(_this4.strings[_this4.sequence[_this4.arrayPos]], curStrPos); + } + } + // humanized value for typing + }, humanize); + } + + /** + * Full animation is complete + * @private + */ + }, { + key: 'complete', + value: function complete() { + this.options.onComplete(this); + if (this.loop) { + this.curLoop++; + } else { + this.typingComplete = true; + } + } + + /** + * Has the typing been stopped + * @param {string} curString the current string in the strings array + * @param {number} curStrPos the current position in the curString + * @param {boolean} isTyping + * @private + */ + }, { + key: 'setPauseStatus', + value: function setPauseStatus(curString, curStrPos, isTyping) { + this.pause.typewrite = isTyping; + this.pause.curString = curString; + this.pause.curStrPos = curStrPos; + } + + /** + * Toggle the blinking cursor + * @param {boolean} isBlinking + * @private + */ + }, { + key: 'toggleBlinking', + value: function toggleBlinking(isBlinking) { + if (!this.cursor) return; + // if in paused state, don't toggle blinking a 2nd time + if (this.pause.status) return; + if (this.cursorBlinking === isBlinking) return; + this.cursorBlinking = isBlinking; + if (isBlinking) { + this.cursor.classList.add('typed-cursor--blink'); + } else { + this.cursor.classList.remove('typed-cursor--blink'); + } + } + + /** + * Speed in MS to type + * @param {number} speed + * @private + */ + }, { + key: 'humanizer', + value: function humanizer(speed) { + return Math.round(Math.random() * speed / 2) + speed; + } + + /** + * Shuffle the sequence of the strings array + * @private + */ + }, { + key: 'shuffleStringsIfNeeded', + value: function shuffleStringsIfNeeded() { + if (!this.shuffle) return; + this.sequence = this.sequence.sort(function () { + return Math.random() - 0.5; + }); + } + + /** + * Adds a CSS class to fade out current string + * @private + */ + }, { + key: 'initFadeOut', + value: function initFadeOut() { + var _this5 = this; + + this.el.className += ' ' + this.fadeOutClass; + if (this.cursor) this.cursor.className += ' ' + this.fadeOutClass; + return setTimeout(function () { + _this5.arrayPos++; + _this5.replaceText(''); + + // Resets current string if end of loop reached + if (_this5.strings.length > _this5.arrayPos) { + _this5.typewrite(_this5.strings[_this5.sequence[_this5.arrayPos]], 0); + } else { + _this5.typewrite(_this5.strings[0], 0); + _this5.arrayPos = 0; + } + }, this.fadeOutDelay); + } + + /** + * Replaces current text in the HTML element + * depending on element type + * @param {string} str + * @private + */ + }, { + key: 'replaceText', + value: function replaceText(str) { + if (this.attr) { + this.el.setAttribute(this.attr, str); + } else { + if (this.isInput) { + this.el.value = str; + } else if (this.contentType === 'html') { + this.el.innerHTML = str; + } else { + this.el.textContent = str; + } + } + } + + /** + * If using input elements, bind focus in order to + * start and stop the animation + * @private + */ + }, { + key: 'bindFocusEvents', + value: function bindFocusEvents() { + var _this6 = this; + + if (!this.isInput) return; + this.el.addEventListener('focus', function (e) { + _this6.stop(); + }); + this.el.addEventListener('blur', function (e) { + if (_this6.el.value && _this6.el.value.length !== 0) { + return; + } + _this6.start(); + }); + } + + /** + * On init, insert the cursor element + * @private + */ + }, { + key: 'insertCursor', + value: function insertCursor() { + if (!this.showCursor) return; + if (this.cursor) return; + this.cursor = document.createElement('span'); + this.cursor.className = 'typed-cursor'; + this.cursor.setAttribute('aria-hidden', true); + this.cursor.innerHTML = this.cursorChar; + this.el.parentNode && this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling); + } + }]); + + return Typed; + })(); + + exports['default'] = Typed; + module.exports = exports['default']; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + var _defaultsJs = __webpack_require__(2); + + var _defaultsJs2 = _interopRequireDefault(_defaultsJs); + + /** + * Initialize the Typed object + */ + + var Initializer = (function () { + function Initializer() { + _classCallCheck(this, Initializer); + } + + _createClass(Initializer, [{ + key: 'load', + + /** + * Load up defaults & options on the Typed instance + * @param {Typed} self instance of Typed + * @param {object} options options object + * @param {string} elementId HTML element ID _OR_ instance of HTML element + * @private + */ + + value: function load(self, options, elementId) { + // chosen element to manipulate text + if (typeof elementId === 'string') { + self.el = document.querySelector(elementId); + } else { + self.el = elementId; + } + + self.options = _extends({}, _defaultsJs2['default'], options); + + // attribute to type into + self.isInput = self.el.tagName.toLowerCase() === 'input'; + self.attr = self.options.attr; + self.bindInputFocusEvents = self.options.bindInputFocusEvents; + + // show cursor + self.showCursor = self.isInput ? false : self.options.showCursor; + + // custom cursor + self.cursorChar = self.options.cursorChar; + + // Is the cursor blinking + self.cursorBlinking = true; + + // text content of element + self.elContent = self.attr ? self.el.getAttribute(self.attr) : self.el.textContent; + + // html or plain text + self.contentType = self.options.contentType; + + // typing speed + self.typeSpeed = self.options.typeSpeed; + + // add a delay before typing starts + self.startDelay = self.options.startDelay; + + // backspacing speed + self.backSpeed = self.options.backSpeed; + + // only backspace what doesn't match the previous string + self.smartBackspace = self.options.smartBackspace; + + // amount of time to wait before backspacing + self.backDelay = self.options.backDelay; + + // Fade out instead of backspace + self.fadeOut = self.options.fadeOut; + self.fadeOutClass = self.options.fadeOutClass; + self.fadeOutDelay = self.options.fadeOutDelay; + + // variable to check whether typing is currently paused + self.isPaused = false; + + // input strings of text + self.strings = self.options.strings.map(function (s) { + return s.trim(); + }); + + // div containing strings + if (typeof self.options.stringsElement === 'string') { + self.stringsElement = document.querySelector(self.options.stringsElement); + } else { + self.stringsElement = self.options.stringsElement; + } + + if (self.stringsElement) { + self.strings = []; + self.stringsElement.style.display = 'none'; + var strings = Array.prototype.slice.apply(self.stringsElement.children); + var stringsLength = strings.length; + + if (stringsLength) { + for (var i = 0; i < stringsLength; i += 1) { + var stringEl = strings[i]; + self.strings.push(stringEl.innerHTML.trim()); + } + } + } + + // character number position of current string + self.strPos = 0; + + // current array position + self.arrayPos = 0; + + // index of string to stop backspacing on + self.stopNum = 0; + + // Looping logic + self.loop = self.options.loop; + self.loopCount = self.options.loopCount; + self.curLoop = 0; + + // shuffle the strings + self.shuffle = self.options.shuffle; + // the order of strings + self.sequence = []; + + self.pause = { + status: false, + typewrite: true, + curString: '', + curStrPos: 0 + }; + + // When the typing is complete (when not looped) + self.typingComplete = false; + + // Set the order in which the strings are typed + for (var i in self.strings) { + self.sequence[i] = i; + } + + // If there is some text in the element + self.currentElContent = this.getCurrentElContent(self); + + self.autoInsertCss = self.options.autoInsertCss; + + this.appendAnimationCss(self); + } + }, { + key: 'getCurrentElContent', + value: function getCurrentElContent(self) { + var elContent = ''; + if (self.attr) { + elContent = self.el.getAttribute(self.attr); + } else if (self.isInput) { + elContent = self.el.value; + } else if (self.contentType === 'html') { + elContent = self.el.innerHTML; + } else { + elContent = self.el.textContent; + } + return elContent; + } + }, { + key: 'appendAnimationCss', + value: function appendAnimationCss(self) { + var cssDataName = 'data-typed-js-css'; + if (!self.autoInsertCss) { + return; + } + if (!self.showCursor && !self.fadeOut) { + return; + } + if (document.querySelector('[' + cssDataName + ']')) { + return; + } + + var css = document.createElement('style'); + css.type = 'text/css'; + css.setAttribute(cssDataName, true); + + var innerCss = ''; + if (self.showCursor) { + innerCss += '\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n '; + } + if (self.fadeOut) { + innerCss += '\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n '; + } + if (css.length === 0) { + return; + } + css.innerHTML = innerCss; + document.body.appendChild(css); + } + }]); + + return Initializer; + })(); + + exports['default'] = Initializer; + var initializer = new Initializer(); + exports.initializer = initializer; + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + + /** + * Defaults & options + * @returns {object} Typed defaults & options + * @public + */ + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + var defaults = { + /** + * @property {array} strings strings to be typed + * @property {string} stringsElement ID of element containing string children + */ + strings: ['These are the default values...', 'You know what you should do?', 'Use your own!', 'Have a great day!'], + stringsElement: null, + + /** + * @property {number} typeSpeed type speed in milliseconds + */ + typeSpeed: 0, + + /** + * @property {number} startDelay time before typing starts in milliseconds + */ + startDelay: 0, + + /** + * @property {number} backSpeed backspacing speed in milliseconds + */ + backSpeed: 0, + + /** + * @property {boolean} smartBackspace only backspace what doesn't match the previous string + */ + smartBackspace: true, + + /** + * @property {boolean} shuffle shuffle the strings + */ + shuffle: false, + + /** + * @property {number} backDelay time before backspacing in milliseconds + */ + backDelay: 700, + + /** + * @property {boolean} fadeOut Fade out instead of backspace + * @property {string} fadeOutClass css class for fade animation + * @property {boolean} fadeOutDelay Fade out delay in milliseconds + */ + fadeOut: false, + fadeOutClass: 'typed-fade-out', + fadeOutDelay: 500, + + /** + * @property {boolean} loop loop strings + * @property {number} loopCount amount of loops + */ + loop: false, + loopCount: Infinity, + + /** + * @property {boolean} showCursor show cursor + * @property {string} cursorChar character for cursor + * @property {boolean} autoInsertCss insert CSS for cursor and fadeOut into HTML + */ + showCursor: true, + cursorChar: '|', + autoInsertCss: true, + + /** + * @property {string} attr attribute for typing + * Ex: input placeholder, value, or just HTML text + */ + attr: null, + + /** + * @property {boolean} bindInputFocusEvents bind to focus and blur if el is text input + */ + bindInputFocusEvents: false, + + /** + * @property {string} contentType 'html' or 'null' for plaintext + */ + contentType: 'html', + + /** + * Before it begins typing + * @param {Typed} self + */ + onBegin: function onBegin(self) {}, + + /** + * All typing is complete + * @param {Typed} self + */ + onComplete: function onComplete(self) {}, + + /** + * Before each string is typed + * @param {number} arrayPos + * @param {Typed} self + */ + preStringTyped: function preStringTyped(arrayPos, self) {}, + + /** + * After each string is typed + * @param {number} arrayPos + * @param {Typed} self + */ + onStringTyped: function onStringTyped(arrayPos, self) {}, + + /** + * During looping, after last string is typed + * @param {Typed} self + */ + onLastStringBackspaced: function onLastStringBackspaced(self) {}, + + /** + * Typing has been stopped + * @param {number} arrayPos + * @param {Typed} self + */ + onTypingPaused: function onTypingPaused(arrayPos, self) {}, + + /** + * Typing has been started after being stopped + * @param {number} arrayPos + * @param {Typed} self + */ + onTypingResumed: function onTypingResumed(arrayPos, self) {}, + + /** + * After reset + * @param {Typed} self + */ + onReset: function onReset(self) {}, + + /** + * After stop + * @param {number} arrayPos + * @param {Typed} self + */ + onStop: function onStop(arrayPos, self) {}, + + /** + * After start + * @param {number} arrayPos + * @param {Typed} self + */ + onStart: function onStart(arrayPos, self) {}, + + /** + * After destroy + * @param {Typed} self + */ + onDestroy: function onDestroy(self) {} + }; + + exports['default'] = defaults; + module.exports = exports['default']; + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + /** + * TODO: These methods can probably be combined somehow + * Parse HTML tags & HTML Characters + */ + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + var HTMLParser = (function () { + function HTMLParser() { + _classCallCheck(this, HTMLParser); + } + + _createClass(HTMLParser, [{ + key: 'typeHtmlChars', + + /** + * Type HTML tags & HTML Characters + * @param {string} curString Current string + * @param {number} curStrPos Position in current string + * @param {Typed} self instance of Typed + * @returns {number} a new string position + * @private + */ + + value: function typeHtmlChars(curString, curStrPos, self) { + if (self.contentType !== 'html') return curStrPos; + var curChar = curString.substr(curStrPos).charAt(0); + if (curChar === '<' || curChar === '&') { + var endTag = ''; + if (curChar === '<') { + endTag = '>'; + } else { + endTag = ';'; + } + while (curString.substr(curStrPos + 1).charAt(0) !== endTag) { + curStrPos++; + if (curStrPos + 1 > curString.length) { + break; + } + } + curStrPos++; + } + return curStrPos; + } + + /** + * Backspace HTML tags and HTML Characters + * @param {string} curString Current string + * @param {number} curStrPos Position in current string + * @param {Typed} self instance of Typed + * @returns {number} a new string position + * @private + */ + }, { + key: 'backSpaceHtmlChars', + value: function backSpaceHtmlChars(curString, curStrPos, self) { + if (self.contentType !== 'html') return curStrPos; + var curChar = curString.substr(curStrPos).charAt(0); + if (curChar === '>' || curChar === ';') { + var endTag = ''; + if (curChar === '>') { + endTag = '<'; + } else { + endTag = '&'; + } + while (curString.substr(curStrPos - 1).charAt(0) !== endTag) { + curStrPos--; + if (curStrPos < 0) { + break; + } + } + curStrPos--; + } + return curStrPos; + } + }]); + + return HTMLParser; + })(); + + exports['default'] = HTMLParser; + var htmlParser = new HTMLParser(); + exports.htmlParser = htmlParser; + +/***/ }) +/******/ ]) +}); +; \ No newline at end of file diff --git a/Moonlight/wwwroot/assets/plugins/custom/vis-timeline/vis-timeline.bundle.css b/Moonlight/wwwroot/assets/plugins/custom/vis-timeline/vis-timeline.bundle.css new file mode 100644 index 0000000..fab63d2 --- /dev/null +++ b/Moonlight/wwwroot/assets/plugins/custom/vis-timeline/vis-timeline.bundle.css @@ -0,0 +1,1240 @@ +@charset "UTF-8"; +/* override some bootstrap styles screwing up the timelines css */ +.vis [class*=span] { + min-height: 0; + width: auto; +} + +.vis-timeline { + /* + -webkit-transition: height .4s ease-in-out; + transition: height .4s ease-in-out; + */ +} + +.vis-panel { + /* + -webkit-transition: height .4s ease-in-out, top .4s ease-in-out; + transition: height .4s ease-in-out, top .4s ease-in-out; + */ +} + +.vis-axis { + /* + -webkit-transition: top .4s ease-in-out; + transition: top .4s ease-in-out; + */ +} + +/* TODO: get animation working nicely + +.vis-item { + -webkit-transition: top .4s ease-in-out; + transition: top .4s ease-in-out; +} + +.vis-item.line { + -webkit-transition: height .4s ease-in-out, top .4s ease-in-out; + transition: height .4s ease-in-out, top .4s ease-in-out; +} +/**/ +.vis-panel { + position: absolute; + padding: 0; + margin: 0; + box-sizing: border-box; +} + +.vis-panel.vis-center, +.vis-panel.vis-left, +.vis-panel.vis-right, +.vis-panel.vis-top, +.vis-panel.vis-bottom { + border: 1px #bfbfbf; +} + +.vis-panel.vis-center, +.vis-panel.vis-left, +.vis-panel.vis-right { + border-top-style: solid; + border-bottom-style: solid; + overflow: hidden; +} + +.vis-left.vis-panel.vis-vertical-scroll, .vis-right.vis-panel.vis-vertical-scroll { + height: 100%; + overflow-x: hidden; + overflow-y: scroll; +} + +.vis-left.vis-panel.vis-vertical-scroll { + direction: rtl; +} + +.vis-left.vis-panel.vis-vertical-scroll .vis-content { + direction: ltr; +} + +.vis-right.vis-panel.vis-vertical-scroll { + direction: ltr; +} + +.vis-right.vis-panel.vis-vertical-scroll .vis-content { + direction: rtl; +} + +.vis-panel.vis-center, +.vis-panel.vis-top, +.vis-panel.vis-bottom { + border-left-style: solid; + border-right-style: solid; +} + +.vis-background { + overflow: hidden; +} + +.vis-panel > .vis-content { + position: relative; +} + +.vis-panel .vis-shadow { + position: absolute; + width: 100%; + height: 1px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.8); + /* TODO: find a nice way to ensure vis-shadows are drawn on top of items + z-index: 1; + */ +} + +.vis-panel .vis-shadow.vis-top { + top: -1px; + left: 0; +} + +.vis-panel .vis-shadow.vis-bottom { + bottom: -1px; + left: 0; +} + +.vis-graph-group0 { + fill: #4f81bd; + fill-opacity: 0; + stroke-width: 2px; + stroke: #4f81bd; +} + +.vis-graph-group1 { + fill: #f79646; + fill-opacity: 0; + stroke-width: 2px; + stroke: #f79646; +} + +.vis-graph-group2 { + fill: #8c51cf; + fill-opacity: 0; + stroke-width: 2px; + stroke: #8c51cf; +} + +.vis-graph-group3 { + fill: #75c841; + fill-opacity: 0; + stroke-width: 2px; + stroke: #75c841; +} + +.vis-graph-group4 { + fill: #ff0100; + fill-opacity: 0; + stroke-width: 2px; + stroke: #ff0100; +} + +.vis-graph-group5 { + fill: #37d8e6; + fill-opacity: 0; + stroke-width: 2px; + stroke: #37d8e6; +} + +.vis-graph-group6 { + fill: #042662; + fill-opacity: 0; + stroke-width: 2px; + stroke: #042662; +} + +.vis-graph-group7 { + fill: #00ff26; + fill-opacity: 0; + stroke-width: 2px; + stroke: #00ff26; +} + +.vis-graph-group8 { + fill: #ff00ff; + fill-opacity: 0; + stroke-width: 2px; + stroke: #ff00ff; +} + +.vis-graph-group9 { + fill: #8f3938; + fill-opacity: 0; + stroke-width: 2px; + stroke: #8f3938; +} + +.vis-timeline .vis-fill { + fill-opacity: 0.1; + stroke: none; +} + +.vis-timeline .vis-bar { + fill-opacity: 0.5; + stroke-width: 1px; +} + +.vis-timeline .vis-point { + stroke-width: 2px; + fill-opacity: 1; +} + +.vis-timeline .vis-legend-background { + stroke-width: 1px; + fill-opacity: 0.9; + fill: #ffffff; + stroke: #c2c2c2; +} + +.vis-timeline .vis-outline { + stroke-width: 1px; + fill-opacity: 1; + fill: #ffffff; + stroke: #e5e5e5; +} + +.vis-timeline .vis-icon-fill { + fill-opacity: 0.3; + stroke: none; +} + +.vis-current-time { + background-color: #FF7F6E; + width: 2px; + z-index: 1; + pointer-events: none; +} + +.vis-rolling-mode-btn { + height: 40px; + width: 40px; + position: absolute; + top: 7px; + right: 20px; + border-radius: 50%; + font-size: 28px; + cursor: pointer; + opacity: 0.8; + color: white; + font-weight: bold; + text-align: center; + background: #3876c2; +} + +.vis-rolling-mode-btn:before { + content: "⛶"; +} + +.vis-rolling-mode-btn:hover { + opacity: 1; +} + +.vis-timeline { + position: relative; + border: 1px solid #bfbfbf; + overflow: hidden; + padding: 0; + margin: 0; + box-sizing: border-box; +} + +.vis-loading-screen { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; +} + +.vis-custom-time { + background-color: #6E94FF; + width: 2px; + cursor: move; + z-index: 1; +} + +.vis-custom-time > .vis-custom-time-marker { + background-color: inherit; + color: white; + font-size: 12px; + white-space: nowrap; + padding: 3px 5px; + top: 0px; + cursor: initial; + z-index: inherit; +} + +.vis-panel.vis-background.vis-horizontal .vis-grid.vis-horizontal { + position: absolute; + width: 100%; + height: 0; + border-bottom: 1px solid; +} + +.vis-panel.vis-background.vis-horizontal .vis-grid.vis-minor { + border-color: #e5e5e5; +} + +.vis-panel.vis-background.vis-horizontal .vis-grid.vis-major { + border-color: #bfbfbf; +} + +.vis-data-axis .vis-y-axis.vis-major { + width: 100%; + position: absolute; + color: #4d4d4d; + white-space: nowrap; +} + +.vis-data-axis .vis-y-axis.vis-major.vis-measure { + padding: 0; + margin: 0; + border: 0; + visibility: hidden; + width: auto; +} + +.vis-data-axis .vis-y-axis.vis-minor { + position: absolute; + width: 100%; + color: #bebebe; + white-space: nowrap; +} + +.vis-data-axis .vis-y-axis.vis-minor.vis-measure { + padding: 0; + margin: 0; + border: 0; + visibility: hidden; + width: auto; +} + +.vis-data-axis .vis-y-axis.vis-title { + position: absolute; + color: #4d4d4d; + white-space: nowrap; + bottom: 20px; + text-align: center; +} + +.vis-data-axis .vis-y-axis.vis-title.vis-measure { + padding: 0; + margin: 0; + visibility: hidden; + width: auto; +} + +.vis-data-axis .vis-y-axis.vis-title.vis-left { + bottom: 0; + -webkit-transform-origin: left top; + -moz-transform-origin: left top; + -ms-transform-origin: left top; + -o-transform-origin: left top; + transform-origin: left bottom; + -webkit-transform: rotate(-90deg); + -moz-transform: rotate(-90deg); + -ms-transform: rotate(-90deg); + -o-transform: rotate(-90deg); + transform: rotate(-90deg); +} + +.vis-data-axis .vis-y-axis.vis-title.vis-right { + bottom: 0; + -webkit-transform-origin: right bottom; + -moz-transform-origin: right bottom; + -ms-transform-origin: right bottom; + -o-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate(90deg); + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -o-transform: rotate(90deg); + transform: rotate(90deg); +} + +.vis-legend { + background-color: rgba(247, 252, 255, 0.65); + padding: 5px; + border: 1px solid #b3b3b3; + box-shadow: 2px 2px 10px rgba(154, 154, 154, 0.55); +} + +.vis-legend-text { + /*font-size: 10px;*/ + white-space: nowrap; + display: inline-block; +} + +.vis-itemset { + position: relative; + padding: 0; + margin: 0; + box-sizing: border-box; +} + +.vis-itemset .vis-background, +.vis-itemset .vis-foreground { + position: absolute; + width: 100%; + height: 100%; + overflow: visible; +} + +.vis-axis { + position: absolute; + width: 100%; + height: 0; + left: 0; + z-index: 1; +} + +.vis-foreground .vis-group { + position: relative; + box-sizing: border-box; + border-bottom: 1px solid #bfbfbf; +} + +.vis-foreground .vis-group:last-child { + border-bottom: none; +} + +.vis-nesting-group { + cursor: pointer; +} + +.vis-label.vis-nested-group.vis-group-level-unknown-but-gte1 { + background: #f5f5f5; +} + +.vis-label.vis-nested-group.vis-group-level-0 { + background-color: #ffffff; +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-0 .vis-inner { + padding-left: 0; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-0 .vis-inner { + padding-right: 0; +} + +.vis-label.vis-nested-group.vis-group-level-1 { + background-color: rgba(0, 0, 0, 0.05); +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-1 .vis-inner { + padding-left: 15px; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-1 .vis-inner { + padding-right: 15px; +} + +.vis-label.vis-nested-group.vis-group-level-2 { + background-color: rgba(0, 0, 0, 0.1); +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-2 .vis-inner { + padding-left: 30px; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-2 .vis-inner { + padding-right: 30px; +} + +.vis-label.vis-nested-group.vis-group-level-3 { + background-color: rgba(0, 0, 0, 0.15); +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-3 .vis-inner { + padding-left: 45px; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-3 .vis-inner { + padding-right: 45px; +} + +.vis-label.vis-nested-group.vis-group-level-4 { + background-color: rgba(0, 0, 0, 0.2); +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-4 .vis-inner { + padding-left: 60px; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-4 .vis-inner { + padding-right: 60px; +} + +.vis-label.vis-nested-group.vis-group-level-5 { + background-color: rgba(0, 0, 0, 0.25); +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-5 .vis-inner { + padding-left: 75px; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-5 .vis-inner { + padding-right: 75px; +} + +.vis-label.vis-nested-group.vis-group-level-6 { + background-color: rgba(0, 0, 0, 0.3); +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-6 .vis-inner { + padding-left: 90px; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-6 .vis-inner { + padding-right: 90px; +} + +.vis-label.vis-nested-group.vis-group-level-7 { + background-color: rgba(0, 0, 0, 0.35); +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-7 .vis-inner { + padding-left: 105px; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-7 .vis-inner { + padding-right: 105px; +} + +.vis-label.vis-nested-group.vis-group-level-8 { + background-color: rgba(0, 0, 0, 0.4); +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-8 .vis-inner { + padding-left: 120px; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-8 .vis-inner { + padding-right: 120px; +} + +.vis-label.vis-nested-group.vis-group-level-9 { + background-color: rgba(0, 0, 0, 0.45); +} + +.vis-ltr .vis-label.vis-nested-group.vis-group-level-9 .vis-inner { + padding-left: 135px; +} + +.vis-rtl .vis-label.vis-nested-group.vis-group-level-9 .vis-inner { + padding-right: 135px; +} + +/* default takes over beginning with level-10 (thats why we add .vis-nested-group + to the selectors above, to have higher specifity than these rules for the defaults) */ +.vis-label.vis-nested-group { + background-color: rgba(0, 0, 0, 0.5); +} + +.vis-ltr .vis-label.vis-nested-group .vis-inner { + padding-left: 150px; +} + +.vis-rtl .vis-label.vis-nested-group .vis-inner { + padding-right: 150px; +} + +.vis-group-level-unknown-but-gte1 { + border: 1px solid red; +} + +/* expanded/collapsed indicators */ +.vis-label.vis-nesting-group:before, +.vis-label.vis-nesting-group:before { + display: inline-block; + width: 15px; +} + +.vis-label.vis-nesting-group.expanded:before { + content: "▼"; +} + +.vis-label.vis-nesting-group.collapsed:before { + content: "▶"; +} + +.vis-rtl .vis-label.vis-nesting-group.collapsed:before { + content: "◀"; +} + +/* compensate missing expanded/collapsed indicator, but only at levels > 0 */ +.vis-ltr .vis-label:not(.vis-nesting-group):not(.vis-group-level-0) { + padding-left: 15px; +} + +.vis-rtl .vis-label:not(.vis-nesting-group):not(.vis-group-level-0) { + padding-right: 15px; +} + +.vis-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 10; +} + +.vis-labelset { + position: relative; + overflow: hidden; + box-sizing: border-box; +} + +.vis-labelset .vis-label { + position: relative; + left: 0; + top: 0; + width: 100%; + color: #4d4d4d; + box-sizing: border-box; +} + +.vis-labelset .vis-label { + border-bottom: 1px solid #bfbfbf; +} + +.vis-labelset .vis-label.draggable { + cursor: pointer; +} + +.vis-group-is-dragging { + background: rgba(0, 0, 0, 0.1); +} + +.vis-labelset .vis-label:last-child { + border-bottom: none; +} + +.vis-labelset .vis-label .vis-inner { + display: inline-block; + padding: 5px; +} + +.vis-labelset .vis-label .vis-inner.vis-hidden { + padding: 0; +} + +.vis-time-axis { + position: relative; + overflow: hidden; +} + +.vis-time-axis.vis-foreground { + top: 0; + left: 0; + width: 100%; +} + +.vis-time-axis.vis-background { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.vis-time-axis .vis-text { + position: absolute; + color: #4d4d4d; + padding: 3px; + overflow: hidden; + box-sizing: border-box; + white-space: nowrap; +} + +.vis-time-axis .vis-text.vis-measure { + position: absolute; + padding-left: 0; + padding-right: 0; + margin-left: 0; + margin-right: 0; + visibility: hidden; +} + +.vis-time-axis .vis-grid.vis-vertical { + position: absolute; + border-left: 1px solid; +} + +.vis-time-axis .vis-grid.vis-vertical-rtl { + position: absolute; + border-right: 1px solid; +} + +.vis-time-axis .vis-grid.vis-minor { + border-color: #e5e5e5; +} + +.vis-time-axis .vis-grid.vis-major { + border-color: #bfbfbf; +} + +.vis-item { + position: absolute; + color: #1A1A1A; + border-color: #97B0F8; + border-width: 1px; + background-color: #D5DDF6; + display: inline-block; + z-index: 1; + /*overflow: hidden;*/ +} + +.vis-item.vis-selected { + border-color: #FFC200; + background-color: #FFF785; + /* z-index must be higher than the z-index of custom time bar and current time bar */ + z-index: 2; +} + +.vis-editable.vis-selected { + cursor: move; +} + +.vis-item.vis-point.vis-selected { + background-color: #FFF785; +} + +.vis-item.vis-box { + text-align: center; + border-style: solid; + border-radius: 2px; +} + +.vis-item.vis-point { + background: none; +} + +.vis-item.vis-dot { + position: absolute; + padding: 0; + border-width: 4px; + border-style: solid; + border-radius: 4px; +} + +.vis-item.vis-range { + border-style: solid; + border-radius: 2px; + box-sizing: border-box; +} + +.vis-item.vis-background { + border: none; + background-color: rgba(213, 221, 246, 0.4); + box-sizing: border-box; + padding: 0; + margin: 0; +} + +.vis-item .vis-item-overflow { + position: relative; + width: 100%; + height: 100%; + padding: 0; + margin: 0; + overflow: hidden; +} + +.vis-item-visible-frame { + white-space: nowrap; +} + +.vis-item.vis-range .vis-item-content { + position: relative; + display: inline-block; +} + +.vis-item.vis-background .vis-item-content { + position: absolute; + display: inline-block; +} + +.vis-item.vis-line { + padding: 0; + position: absolute; + width: 0; + border-left-width: 1px; + border-left-style: solid; +} + +.vis-item .vis-item-content { + white-space: nowrap; + box-sizing: border-box; + padding: 5px; +} + +.vis-item .vis-onUpdateTime-tooltip { + position: absolute; + background: #4f81bd; + color: white; + width: 200px; + text-align: center; + white-space: nowrap; + padding: 5px; + border-radius: 1px; + transition: 0.4s; + -o-transition: 0.4s; + -moz-transition: 0.4s; + -webkit-transition: 0.4s; +} + +.vis-item .vis-delete, .vis-item .vis-delete-rtl { + position: absolute; + top: 0px; + width: 24px; + height: 24px; + box-sizing: border-box; + padding: 0px 5px; + cursor: pointer; + -webkit-transition: background 0.2s linear; + -moz-transition: background 0.2s linear; + -ms-transition: background 0.2s linear; + -o-transition: background 0.2s linear; + transition: background 0.2s linear; +} + +.vis-item .vis-delete { + right: -24px; +} + +.vis-item .vis-delete-rtl { + left: -24px; +} + +.vis-item .vis-delete:after, .vis-item .vis-delete-rtl:after { + content: "×"; /* MULTIPLICATION SIGN */ + color: red; + font-family: arial, sans-serif; + font-size: 22px; + font-weight: bold; + -webkit-transition: color 0.2s linear; + -moz-transition: color 0.2s linear; + -ms-transition: color 0.2s linear; + -o-transition: color 0.2s linear; + transition: color 0.2s linear; +} + +.vis-item .vis-delete:hover, .vis-item .vis-delete-rtl:hover { + background: red; +} + +.vis-item .vis-delete:hover:after, .vis-item .vis-delete-rtl:hover:after { + color: white; +} + +.vis-item .vis-drag-center { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0px; + cursor: move; +} + +.vis-item.vis-range .vis-drag-left { + position: absolute; + width: 24px; + max-width: 20%; + min-width: 2px; + height: 100%; + top: 0; + left: -4px; + cursor: w-resize; +} + +.vis-item.vis-range .vis-drag-right { + position: absolute; + width: 24px; + max-width: 20%; + min-width: 2px; + height: 100%; + top: 0; + right: -4px; + cursor: e-resize; +} + +.vis-range.vis-item.vis-readonly .vis-drag-left, +.vis-range.vis-item.vis-readonly .vis-drag-right { + cursor: auto; +} + +.vis-item.vis-cluster { + vertical-align: center; + text-align: center; + border-style: solid; + border-radius: 2px; +} + +.vis-item.vis-cluster-line { + padding: 0; + position: absolute; + width: 0; + border-left-width: 1px; + border-left-style: solid; +} + +.vis-item.vis-cluster-dot { + position: absolute; + padding: 0; + border-width: 4px; + border-style: solid; + border-radius: 4px; +} + +div.vis-configuration { + position: relative; + display: block; + float: left; + font-size: 12px; +} + +div.vis-configuration-wrapper { + display: block; + width: 700px; +} + +div.vis-configuration-wrapper::after { + clear: both; + content: ""; + display: block; +} + +div.vis-configuration.vis-config-option-container { + display: block; + width: 495px; + background-color: #ffffff; + border: 2px solid #f7f8fa; + border-radius: 4px; + margin-top: 20px; + left: 10px; + padding-left: 5px; +} + +div.vis-configuration.vis-config-button { + display: block; + width: 495px; + height: 25px; + vertical-align: middle; + line-height: 25px; + background-color: #f7f8fa; + border: 2px solid #ceced0; + border-radius: 4px; + margin-top: 20px; + left: 10px; + padding-left: 5px; + cursor: pointer; + margin-bottom: 30px; +} + +div.vis-configuration.vis-config-button.hover { + background-color: #4588e6; + border: 2px solid #214373; + color: #ffffff; +} + +div.vis-configuration.vis-config-item { + display: block; + float: left; + width: 495px; + height: 25px; + vertical-align: middle; + line-height: 25px; +} + +div.vis-configuration.vis-config-item.vis-config-s2 { + left: 10px; + background-color: #f7f8fa; + padding-left: 5px; + border-radius: 3px; +} + +div.vis-configuration.vis-config-item.vis-config-s3 { + left: 20px; + background-color: #e4e9f0; + padding-left: 5px; + border-radius: 3px; +} + +div.vis-configuration.vis-config-item.vis-config-s4 { + left: 30px; + background-color: #cfd8e6; + padding-left: 5px; + border-radius: 3px; +} + +div.vis-configuration.vis-config-header { + font-size: 18px; + font-weight: bold; +} + +div.vis-configuration.vis-config-label { + width: 120px; + height: 25px; + line-height: 25px; +} + +div.vis-configuration.vis-config-label.vis-config-s3 { + width: 110px; +} + +div.vis-configuration.vis-config-label.vis-config-s4 { + width: 100px; +} + +div.vis-configuration.vis-config-colorBlock { + top: 1px; + width: 30px; + height: 19px; + border: 1px solid #444444; + border-radius: 2px; + padding: 0px; + margin: 0px; + cursor: pointer; +} + +input.vis-configuration.vis-config-checkbox { + left: -5px; +} + +input.vis-configuration.vis-config-rangeinput { + position: relative; + top: -5px; + width: 60px; + /*height:13px;*/ + padding: 1px; + margin: 0; + pointer-events: none; +} + +input.vis-configuration.vis-config-range { + /*removes default webkit styles*/ + -webkit-appearance: none; + /*fix for FF unable to apply focus style bug */ + border: 0px solid white; + background-color: rgba(0, 0, 0, 0); + /*required for proper track sizing in FF*/ + width: 300px; + height: 20px; +} + +input.vis-configuration.vis-config-range::-webkit-slider-runnable-track { + width: 300px; + height: 5px; + background: #dedede; /* Old browsers */ + background: -moz-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #dedede), color-stop(99%, #c8c8c8)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* IE10+ */ + background: linear-gradient(to bottom, #dedede 0%, #c8c8c8 99%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="#dedede", endColorstr="#c8c8c8",GradientType=0 ); /* IE6-9 */ + border: 1px solid #999999; + box-shadow: #aaaaaa 0px 0px 3px 0px; + border-radius: 3px; +} + +input.vis-configuration.vis-config-range::-webkit-slider-thumb { + -webkit-appearance: none; + border: 1px solid #14334b; + height: 17px; + width: 17px; + border-radius: 50%; + background: #3876c2; /* Old browsers */ + background: -moz-linear-gradient(top, #3876c2 0%, #385380 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #3876c2), color-stop(100%, #385380)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #3876c2 0%, #385380 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #3876c2 0%, #385380 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #3876c2 0%, #385380 100%); /* IE10+ */ + background: linear-gradient(to bottom, #3876c2 0%, #385380 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="#3876c2", endColorstr="#385380",GradientType=0 ); /* IE6-9 */ + box-shadow: #111927 0px 0px 1px 0px; + margin-top: -7px; +} + +input.vis-configuration.vis-config-range:focus { + outline: none; +} + +input.vis-configuration.vis-config-range:focus::-webkit-slider-runnable-track { + background: #9d9d9d; /* Old browsers */ + background: -moz-linear-gradient(top, #9d9d9d 0%, #c8c8c8 99%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #9d9d9d), color-stop(99%, #c8c8c8)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #9d9d9d 0%, #c8c8c8 99%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #9d9d9d 0%, #c8c8c8 99%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #9d9d9d 0%, #c8c8c8 99%); /* IE10+ */ + background: linear-gradient(to bottom, #9d9d9d 0%, #c8c8c8 99%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="#9d9d9d", endColorstr="#c8c8c8",GradientType=0 ); /* IE6-9 */ +} + +input.vis-configuration.vis-config-range::-moz-range-track { + width: 300px; + height: 10px; + background: #dedede; /* Old browsers */ + background: -moz-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #dedede), color-stop(99%, #c8c8c8)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* IE10+ */ + background: linear-gradient(to bottom, #dedede 0%, #c8c8c8 99%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="#dedede", endColorstr="#c8c8c8",GradientType=0 ); /* IE6-9 */ + border: 1px solid #999999; + box-shadow: #aaaaaa 0px 0px 3px 0px; + border-radius: 3px; +} + +input.vis-configuration.vis-config-range::-moz-range-thumb { + border: none; + height: 16px; + width: 16px; + border-radius: 50%; + background: #385380; +} + +/*hide the outline behind the border*/ +input.vis-configuration.vis-config-range:-moz-focusring { + outline: 1px solid white; + outline-offset: -1px; +} + +input.vis-configuration.vis-config-range::-ms-track { + width: 300px; + height: 5px; + /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */ + background: transparent; + /*leave room for the larger thumb to overflow with a transparent border */ + border-color: transparent; + border-width: 6px 0; + /*remove default tick marks*/ + color: transparent; +} + +input.vis-configuration.vis-config-range::-ms-fill-lower { + background: #777; + border-radius: 10px; +} + +input.vis-configuration.vis-config-range::-ms-fill-upper { + background: #ddd; + border-radius: 10px; +} + +input.vis-configuration.vis-config-range::-ms-thumb { + border: none; + height: 16px; + width: 16px; + border-radius: 50%; + background: #385380; +} + +input.vis-configuration.vis-config-range:focus::-ms-fill-lower { + background: #888; +} + +input.vis-configuration.vis-config-range:focus::-ms-fill-upper { + background: #ccc; +} + +.vis-configuration-popup { + position: absolute; + background: rgba(57, 76, 89, 0.85); + border: 2px solid #f2faff; + line-height: 30px; + height: 30px; + width: 150px; + text-align: center; + color: #ffffff; + font-size: 14px; + border-radius: 4px; + -webkit-transition: opacity 0.3s ease-in-out; + -moz-transition: opacity 0.3s ease-in-out; + transition: opacity 0.3s ease-in-out; +} + +.vis-configuration-popup:after, .vis-configuration-popup:before { + left: 100%; + top: 50%; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none; +} + +.vis-configuration-popup:after { + border-color: rgba(136, 183, 213, 0); + border-left-color: rgba(57, 76, 89, 0.85); + border-width: 8px; + margin-top: -8px; +} + +.vis-configuration-popup:before { + border-color: rgba(194, 225, 245, 0); + border-left-color: #f2faff; + border-width: 12px; + margin-top: -12px; +} + +.vis .overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + /* Must be displayed above for example selected Timeline items */ + z-index: 10; +} + +.vis-active { + box-shadow: 0 0 10px #86d5f8; +} + +div.vis-tooltip { + position: absolute; + visibility: hidden; + padding: 5px; + white-space: nowrap; + font-family: verdana; + font-size: 14px; + color: #000000; + background-color: #f5f4ed; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + border: 1px solid #808074; + box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2); + pointer-events: none; + z-index: 5; +} \ No newline at end of file diff --git a/Moonlight/wwwroot/assets/plugins/custom/vis-timeline/vis-timeline.bundle.js b/Moonlight/wwwroot/assets/plugins/custom/vis-timeline/vis-timeline.bundle.js new file mode 100644 index 0000000..2c6b7fe --- /dev/null +++ b/Moonlight/wwwroot/assets/plugins/custom/vis-timeline/vis-timeline.bundle.js @@ -0,0 +1,64 @@ +/** + * vis-timeline and vis-graph2d + * https://visjs.github.io/vis-timeline/ + * + * Create a fully customizable, interactive timeline with items and ranges. + * + * @version 7.5.1 + * @date 2022-03-01T18:26:09.239Z + * + * @copyright (c) 2011-2017 Almende B.V, http://almende.com + * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs + * + * @license + * vis.js is dual licensed under both + * + * 1. The Apache 2.0 License + * http://www.apache.org/licenses/LICENSE-2.0 + * + * and + * + * 2. The MIT License + * http://opensource.org/licenses/MIT + * + * vis.js may be distributed under either license. + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vis=t.vis||{})}(this,(function(t){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var o={exports:{}};!function(t,e){t.exports=function(){var e,i;function o(){return e.apply(null,arguments)}function r(t){e=t}function s(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function a(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function l(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function h(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(l(t,e))return!1;return!0}function u(t){return void 0===t}function d(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function c(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function p(t,e){var i,n=[];for(i=0;i>>0;for(e=0;e0)for(i=0;i<_.length;i++)u(o=e[n=_[i]])||(t[n]=o);return t}function x(t){k(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===w&&(w=!0,o.updateOffset(this),w=!1)}function D(t){return t instanceof x||null!=t&&null!=t._isAMomentObject}function S(t){!1===o.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function C(t,e){var i=!0;return f((function(){if(null!=o.deprecationHandler&&o.deprecationHandler(null,t),i){var n,r,s,a=[];for(r=0;r=0?i?"+":"":"-")+Math.pow(10,Math.max(0,o)).toString().substr(1)+n}var R=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Y=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,j={},H={};function z(t,e,i,n){var o=n;"string"==typeof n&&(o=function(){return this[n]()}),t&&(H[t]=o),e&&(H[e[0]]=function(){return F(o.apply(this,arguments),e[1],e[2])}),i&&(H[i]=function(){return this.localeData().ordinal(o.apply(this,arguments),t)})}function G(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function B(t){var e,i,n=t.match(R);for(e=0,i=n.length;e=0&&Y.test(t);)t=t.replace(Y,n),Y.lastIndex=0,i-=1;return t}var U={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function X(t){var e=this._longDateFormat[t],i=this._longDateFormat[t.toUpperCase()];return e||!i?e:(this._longDateFormat[t]=i.match(R).map((function(t){return"MMMM"===t||"MM"===t||"DD"===t||"dddd"===t?t.slice(1):t})).join(""),this._longDateFormat[t])}var q="Invalid date";function Z(){return this._invalidDate}var $="%d",K=/\d{1,2}/;function J(t){return this._ordinal.replace("%d",t)}var Q={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function tt(t,e,i,n){var o=this._relativeTime[i];return E(o)?o(t,e,i,n):o.replace(/%d/i,t)}function et(t,e){var i=this._relativeTime[t>0?"future":"past"];return E(i)?i(e):i.replace(/%s/i,e)}var it={};function nt(t,e){var i=t.toLowerCase();it[i]=it[i+"s"]=it[e]=t}function ot(t){return"string"==typeof t?it[t]||it[t.toLowerCase()]:void 0}function rt(t){var e,i,n={};for(i in t)l(t,i)&&(e=ot(i))&&(n[e]=t[i]);return n}var st={};function at(t,e){st[t]=e}function lt(t){var e,i=[];for(e in t)l(t,e)&&i.push({unit:e,priority:st[e]});return i.sort((function(t,e){return t.priority-e.priority})),i}function ht(t){return t%4==0&&t%100!=0||t%400==0}function ut(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function dt(t){var e=+t,i=0;return 0!==e&&isFinite(e)&&(i=ut(e)),i}function ct(t,e){return function(i){return null!=i?(ft(this,t,i),o.updateOffset(this,e),this):pt(this,t)}}function pt(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function ft(t,e,i){t.isValid()&&!isNaN(i)&&("FullYear"===e&&ht(t.year())&&1===t.month()&&29===t.date()?(i=dt(i),t._d["set"+(t._isUTC?"UTC":"")+e](i,t.month(),te(i,t.month()))):t._d["set"+(t._isUTC?"UTC":"")+e](i))}function mt(t){return E(this[t=ot(t)])?this[t]():this}function vt(t,e){if("object"==typeof t){var i,n=lt(t=rt(t));for(i=0;i68?1900:2e3)};var ge=ct("FullYear",!0);function ye(){return ht(this.year())}function be(t,e,i,n,o,r,s){var a;return t<100&&t>=0?(a=new Date(t+400,e,i,n,o,r,s),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,i,n,o,r,s),a}function _e(t){var e,i;return t<100&&t>=0?((i=Array.prototype.slice.call(arguments))[0]=t+400,e=new Date(Date.UTC.apply(null,i)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function we(t,e,i){var n=7+e-i;return-(7+_e(t,0,n).getUTCDay()-e)%7+n-1}function ke(t,e,i,n,o){var r,s,a=1+7*(e-1)+(7+i-n)%7+we(t,n,o);return a<=0?s=ve(r=t-1)+a:a>ve(t)?(r=t+1,s=a-ve(t)):(r=t,s=a),{year:r,dayOfYear:s}}function xe(t,e,i){var n,o,r=we(t.year(),e,i),s=Math.floor((t.dayOfYear()-r-1)/7)+1;return s<1?n=s+De(o=t.year()-1,e,i):s>De(t.year(),e,i)?(n=s-De(t.year(),e,i),o=t.year()+1):(o=t.year(),n=s),{week:n,year:o}}function De(t,e,i){var n=we(t,e,i),o=we(t+1,e,i);return(ve(t)-n+o)/7}function Se(t){return xe(t,this._week.dow,this._week.doy).week}z("w",["ww",2],"wo","week"),z("W",["WW",2],"Wo","isoWeek"),nt("week","w"),nt("isoWeek","W"),at("week",5),at("isoWeek",5),Nt("w",xt),Nt("ww",xt,bt),Nt("W",xt),Nt("WW",xt,bt),zt(["w","ww","W","WW"],(function(t,e,i,n){e[n.substr(0,1)]=dt(t)}));var Ce={dow:0,doy:6};function Te(){return this._week.dow}function Me(){return this._week.doy}function Oe(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Ee(t){var e=xe(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Pe(t,e){return"string"!=typeof t?t:isNaN(t)?"number"==typeof(t=e.weekdaysParse(t))?t:null:parseInt(t,10)}function Ae(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Ie(t,e){return t.slice(e,7).concat(t.slice(0,e))}z("d",0,"do","day"),z("dd",0,0,(function(t){return this.localeData().weekdaysMin(this,t)})),z("ddd",0,0,(function(t){return this.localeData().weekdaysShort(this,t)})),z("dddd",0,0,(function(t){return this.localeData().weekdays(this,t)})),z("e",0,0,"weekday"),z("E",0,0,"isoWeekday"),nt("day","d"),nt("weekday","e"),nt("isoWeekday","E"),at("day",11),at("weekday",11),at("isoWeekday",11),Nt("d",xt),Nt("e",xt),Nt("E",xt),Nt("dd",(function(t,e){return e.weekdaysMinRegex(t)})),Nt("ddd",(function(t,e){return e.weekdaysShortRegex(t)})),Nt("dddd",(function(t,e){return e.weekdaysRegex(t)})),zt(["dd","ddd","dddd"],(function(t,e,i,n){var o=i._locale.weekdaysParse(t,n,i._strict);null!=o?e.d=o:g(i).invalidWeekday=t})),zt(["d","e","E"],(function(t,e,i,n){e[n]=dt(t)}));var Le="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ne="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Fe="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Re=Lt,Ye=Lt,je=Lt;function He(t,e){var i=s(this._weekdays)?this._weekdays:this._weekdays[t&&!0!==t&&this._weekdays.isFormat.test(e)?"format":"standalone"];return!0===t?Ie(i,this._week.dow):t?i[t.day()]:i}function ze(t){return!0===t?Ie(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function Ge(t){return!0===t?Ie(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function Be(t,e,i){var n,o,r,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)r=m([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(r,"").toLocaleLowerCase();return i?"dddd"===e?-1!==(o=Bt.call(this._weekdaysParse,s))?o:null:"ddd"===e?-1!==(o=Bt.call(this._shortWeekdaysParse,s))?o:null:-1!==(o=Bt.call(this._minWeekdaysParse,s))?o:null:"dddd"===e?-1!==(o=Bt.call(this._weekdaysParse,s))||-1!==(o=Bt.call(this._shortWeekdaysParse,s))||-1!==(o=Bt.call(this._minWeekdaysParse,s))?o:null:"ddd"===e?-1!==(o=Bt.call(this._shortWeekdaysParse,s))||-1!==(o=Bt.call(this._weekdaysParse,s))||-1!==(o=Bt.call(this._minWeekdaysParse,s))?o:null:-1!==(o=Bt.call(this._minWeekdaysParse,s))||-1!==(o=Bt.call(this._weekdaysParse,s))||-1!==(o=Bt.call(this._shortWeekdaysParse,s))?o:null}function We(t,e,i){var n,o,r;if(this._weekdaysParseExact)return Be.call(this,t,e,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(o=m([2e3,1]).day(n),i&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(o,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(o,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(o,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(r="^"+this.weekdays(o,"")+"|^"+this.weekdaysShort(o,"")+"|^"+this.weekdaysMin(o,""),this._weekdaysParse[n]=new RegExp(r.replace(".",""),"i")),i&&"dddd"===e&&this._fullWeekdaysParse[n].test(t))return n;if(i&&"ddd"===e&&this._shortWeekdaysParse[n].test(t))return n;if(i&&"dd"===e&&this._minWeekdaysParse[n].test(t))return n;if(!i&&this._weekdaysParse[n].test(t))return n}}function Ve(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Pe(t,this.localeData()),this.add(t-e,"d")):e}function Ue(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function Xe(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Ae(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function qe(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ke.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(l(this,"_weekdaysRegex")||(this._weekdaysRegex=Re),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function Ze(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ke.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(l(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Ye),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function $e(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ke.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(l(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=je),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ke(){function t(t,e){return e.length-t.length}var e,i,n,o,r,s=[],a=[],l=[],h=[];for(e=0;e<7;e++)i=m([2e3,1]).day(e),n=Yt(this.weekdaysMin(i,"")),o=Yt(this.weekdaysShort(i,"")),r=Yt(this.weekdays(i,"")),s.push(n),a.push(o),l.push(r),h.push(n),h.push(o),h.push(r);s.sort(t),a.sort(t),l.sort(t),h.sort(t),this._weekdaysRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Je(){return this.hours()%12||12}function Qe(){return this.hours()||24}function ti(t,e){z(t,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)}))}function ei(t,e){return e._meridiemParse}function ii(t){return"p"===(t+"").toLowerCase().charAt(0)}z("H",["HH",2],0,"hour"),z("h",["hh",2],0,Je),z("k",["kk",2],0,Qe),z("hmm",0,0,(function(){return""+Je.apply(this)+F(this.minutes(),2)})),z("hmmss",0,0,(function(){return""+Je.apply(this)+F(this.minutes(),2)+F(this.seconds(),2)})),z("Hmm",0,0,(function(){return""+this.hours()+F(this.minutes(),2)})),z("Hmmss",0,0,(function(){return""+this.hours()+F(this.minutes(),2)+F(this.seconds(),2)})),ti("a",!0),ti("A",!1),nt("hour","h"),at("hour",13),Nt("a",ei),Nt("A",ei),Nt("H",xt),Nt("h",xt),Nt("k",xt),Nt("HH",xt,bt),Nt("hh",xt,bt),Nt("kk",xt,bt),Nt("hmm",Dt),Nt("hmmss",St),Nt("Hmm",Dt),Nt("Hmmss",St),Ht(["H","HH"],Xt),Ht(["k","kk"],(function(t,e,i){var n=dt(t);e[Xt]=24===n?0:n})),Ht(["a","A"],(function(t,e,i){i._isPm=i._locale.isPM(t),i._meridiem=t})),Ht(["h","hh"],(function(t,e,i){e[Xt]=dt(t),g(i).bigHour=!0})),Ht("hmm",(function(t,e,i){var n=t.length-2;e[Xt]=dt(t.substr(0,n)),e[qt]=dt(t.substr(n)),g(i).bigHour=!0})),Ht("hmmss",(function(t,e,i){var n=t.length-4,o=t.length-2;e[Xt]=dt(t.substr(0,n)),e[qt]=dt(t.substr(n,2)),e[Zt]=dt(t.substr(o)),g(i).bigHour=!0})),Ht("Hmm",(function(t,e,i){var n=t.length-2;e[Xt]=dt(t.substr(0,n)),e[qt]=dt(t.substr(n))})),Ht("Hmmss",(function(t,e,i){var n=t.length-4,o=t.length-2;e[Xt]=dt(t.substr(0,n)),e[qt]=dt(t.substr(n,2)),e[Zt]=dt(t.substr(o))}));var ni=/[ap]\.?m?\.?/i,oi=ct("Hours",!0);function ri(t,e,i){return t>11?i?"pm":"PM":i?"am":"AM"}var si,ai={calendar:L,longDateFormat:U,invalidDate:q,ordinal:$,dayOfMonthOrdinalParse:K,relativeTime:Q,months:ee,monthsShort:ie,week:Ce,weekdays:Le,weekdaysMin:Fe,weekdaysShort:Ne,meridiemParse:ni},li={},hi={};function ui(t,e){var i,n=Math.min(t.length,e.length);for(i=0;i0;){if(n=pi(o.slice(0,e).join("-")))return n;if(i&&i.length>=e&&ui(o,i)>=e-1)break;e--}r++}return si}function pi(e){var i=null;if(void 0===li[e]&&t&&t.exports)try{i=si._abbr,n("./locale/"+e),fi(i)}catch(t){li[e]=null}return li[e]}function fi(t,e){var i;return t&&((i=u(e)?gi(t):mi(t,e))?si=i:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),si._abbr}function mi(t,e){if(null!==e){var i,n=ai;if(e.abbr=t,null!=li[t])O("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=li[t]._config;else if(null!=e.parentLocale)if(null!=li[e.parentLocale])n=li[e.parentLocale]._config;else{if(null==(i=pi(e.parentLocale)))return hi[e.parentLocale]||(hi[e.parentLocale]=[]),hi[e.parentLocale].push({name:t,config:e}),null;n=i._config}return li[t]=new I(A(n,e)),hi[t]&&hi[t].forEach((function(t){mi(t.name,t.config)})),fi(t),li[t]}return delete li[t],null}function vi(t,e){if(null!=e){var i,n,o=ai;null!=li[t]&&null!=li[t].parentLocale?li[t].set(A(li[t]._config,e)):(null!=(n=pi(t))&&(o=n._config),e=A(o,e),null==n&&(e.abbr=t),(i=new I(e)).parentLocale=li[t],li[t]=i),fi(t)}else null!=li[t]&&(null!=li[t].parentLocale?(li[t]=li[t].parentLocale,t===fi()&&fi(t)):null!=li[t]&&delete li[t]);return li[t]}function gi(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return si;if(!s(t)){if(e=pi(t))return e;t=[t]}return ci(t)}function yi(){return T(li)}function bi(t){var e,i=t._a;return i&&-2===g(t).overflow&&(e=i[Vt]<0||i[Vt]>11?Vt:i[Ut]<1||i[Ut]>te(i[Wt],i[Vt])?Ut:i[Xt]<0||i[Xt]>24||24===i[Xt]&&(0!==i[qt]||0!==i[Zt]||0!==i[$t])?Xt:i[qt]<0||i[qt]>59?qt:i[Zt]<0||i[Zt]>59?Zt:i[$t]<0||i[$t]>999?$t:-1,g(t)._overflowDayOfYear&&(eUt)&&(e=Ut),g(t)._overflowWeeks&&-1===e&&(e=Kt),g(t)._overflowWeekday&&-1===e&&(e=Jt),g(t).overflow=e),t}var _i=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,wi=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ki=/Z|[+-]\d\d(?::?\d\d)?/,xi=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Di=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Si=/^\/?Date\((-?\d+)/i,Ci=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Ti={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Mi(t){var e,i,n,o,r,s,a=t._i,l=_i.exec(a)||wi.exec(a);if(l){for(g(t).iso=!0,e=0,i=xi.length;eve(r)||0===t._dayOfYear)&&(g(t)._overflowDayOfYear=!0),i=_e(r,0,t._dayOfYear),t._a[Vt]=i.getUTCMonth(),t._a[Ut]=i.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=s[e]=n[e];for(;e<7;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[Xt]&&0===t._a[qt]&&0===t._a[Zt]&&0===t._a[$t]&&(t._nextDay=!0,t._a[Xt]=0),t._d=(t._useUTC?_e:be).apply(null,s),o=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[Xt]=24),t._w&&void 0!==t._w.d&&t._w.d!==o&&(g(t).weekdayMismatch=!0)}}function ji(t){var e,i,n,o,r,s,a,l,h;null!=(e=t._w).GG||null!=e.W||null!=e.E?(r=1,s=4,i=Fi(e.GG,t._a[Wt],xe(qi(),1,4).year),n=Fi(e.W,1),((o=Fi(e.E,1))<1||o>7)&&(l=!0)):(r=t._locale._week.dow,s=t._locale._week.doy,h=xe(qi(),r,s),i=Fi(e.gg,t._a[Wt],h.year),n=Fi(e.w,h.week),null!=e.d?((o=e.d)<0||o>6)&&(l=!0):null!=e.e?(o=e.e+r,(e.e<0||e.e>6)&&(l=!0)):o=r),n<1||n>De(i,r,s)?g(t)._overflowWeeks=!0:null!=l?g(t)._overflowWeekday=!0:(a=ke(i,n,o,r,s),t._a[Wt]=a.year,t._dayOfYear=a.dayOfYear)}function Hi(t){if(t._f!==o.ISO_8601)if(t._f!==o.RFC_2822){t._a=[],g(t).empty=!0;var e,i,n,r,s,a,l=""+t._i,h=l.length,u=0;for(n=V(t._f,t._locale).match(R)||[],e=0;e0&&g(t).unusedInput.push(s),l=l.slice(l.indexOf(i)+i.length),u+=i.length),H[r]?(i?g(t).empty=!1:g(t).unusedTokens.push(r),Gt(r,i,t)):t._strict&&!i&&g(t).unusedTokens.push(r);g(t).charsLeftOver=h-u,l.length>0&&g(t).unusedInput.push(l),t._a[Xt]<=12&&!0===g(t).bigHour&&t._a[Xt]>0&&(g(t).bigHour=void 0),g(t).parsedDateParts=t._a.slice(0),g(t).meridiem=t._meridiem,t._a[Xt]=zi(t._locale,t._a[Xt],t._meridiem),null!==(a=g(t).era)&&(t._a[Wt]=t._locale.erasConvertYear(a,t._a[Wt])),Yi(t),bi(t)}else Li(t);else Mi(t)}function zi(t,e,i){var n;return null==i?e:null!=t.meridiemHour?t.meridiemHour(e,i):null!=t.isPM?((n=t.isPM(i))&&e<12&&(e+=12),n||12!==e||(e=0),e):e}function Gi(t){var e,i,n,o,r,s,a=!1;if(0===t._f.length)return g(t).invalidFormat=!0,void(t._d=new Date(NaN));for(o=0;othis?this:t:b()}));function Ki(t,e){var i,n;if(1===e.length&&s(e[0])&&(e=e[0]),!e.length)return qi();for(i=e[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function kn(){if(!u(this._isDSTShifted))return this._isDSTShifted;var t,e={};return k(e,this),(e=Vi(e))._a?(t=e._isUTC?m(e._a):qi(e._a),this._isDSTShifted=this.isValid()&&hn(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function xn(){return!!this.isValid()&&!this._isUTC}function Dn(){return!!this.isValid()&&this._isUTC}function Sn(){return!!this.isValid()&&this._isUTC&&0===this._offset}o.updateOffset=function(){};var Cn=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Tn=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Mn(t,e){var i,n,o,r=t,s=null;return an(t)?r={ms:t._milliseconds,d:t._days,M:t._months}:d(t)||!isNaN(+t)?(r={},e?r[e]=+t:r.milliseconds=+t):(s=Cn.exec(t))?(i="-"===s[1]?-1:1,r={y:0,d:dt(s[Ut])*i,h:dt(s[Xt])*i,m:dt(s[qt])*i,s:dt(s[Zt])*i,ms:dt(ln(1e3*s[$t]))*i}):(s=Tn.exec(t))?(i="-"===s[1]?-1:1,r={y:On(s[2],i),M:On(s[3],i),w:On(s[4],i),d:On(s[5],i),h:On(s[6],i),m:On(s[7],i),s:On(s[8],i)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(o=Pn(qi(r.from),qi(r.to)),(r={}).ms=o.milliseconds,r.M=o.months),n=new sn(r),an(t)&&l(t,"_locale")&&(n._locale=t._locale),an(t)&&l(t,"_isValid")&&(n._isValid=t._isValid),n}function On(t,e){var i=t&&parseFloat(t.replace(",","."));return(isNaN(i)?0:i)*e}function En(t,e){var i={};return i.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(i.months,"M").isAfter(e)&&--i.months,i.milliseconds=+e-+t.clone().add(i.months,"M"),i}function Pn(t,e){var i;return t.isValid()&&e.isValid()?(e=pn(e,t),t.isBefore(e)?i=En(t,e):((i=En(e,t)).milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function An(t,e){return function(i,n){var o;return null===n||isNaN(+n)||(O(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=i,i=n,n=o),In(this,Mn(i,n),t),this}}function In(t,e,i,n){var r=e._milliseconds,s=ln(e._days),a=ln(e._months);t.isValid()&&(n=null==n||n,a&&ue(t,pt(t,"Month")+a*i),s&&ft(t,"Date",pt(t,"Date")+s*i),r&&t._d.setTime(t._d.valueOf()+r*i),n&&o.updateOffset(t,s||a))}Mn.fn=sn.prototype,Mn.invalid=rn;var Ln=An(1,"add"),Nn=An(-1,"subtract");function Fn(t){return"string"==typeof t||t instanceof String}function Rn(t){return D(t)||c(t)||Fn(t)||d(t)||jn(t)||Yn(t)||null==t}function Yn(t){var e,i,n=a(t)&&!h(t),o=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"];for(e=0;ei.valueOf():i.valueOf()9999?W(i,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):E(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",W(i,"Z")):W(i,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function to(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t,e,i,n,o="moment",r="";return this.isLocal()||(o=0===this.utcOffset()?"moment.utc":"moment.parseZone",r="Z"),t="["+o+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",n=r+'[")]',this.format(t+e+i+n)}function eo(t){t||(t=this.isUtc()?o.defaultFormatUtc:o.defaultFormat);var e=W(this,t);return this.localeData().postformat(e)}function io(t,e){return this.isValid()&&(D(t)&&t.isValid()||qi(t).isValid())?Mn({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function no(t){return this.from(qi(),t)}function oo(t,e){return this.isValid()&&(D(t)&&t.isValid()||qi(t).isValid())?Mn({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function ro(t){return this.to(qi(),t)}function so(t){var e;return void 0===t?this._locale._abbr:(null!=(e=gi(t))&&(this._locale=e),this)}o.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",o.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ao=C("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(t){return void 0===t?this.localeData():this.locale(t)}));function lo(){return this._locale}var ho=1e3,uo=60*ho,co=60*uo,po=3506328*co;function fo(t,e){return(t%e+e)%e}function mo(t,e,i){return t<100&&t>=0?new Date(t+400,e,i)-po:new Date(t,e,i).valueOf()}function vo(t,e,i){return t<100&&t>=0?Date.UTC(t+400,e,i)-po:Date.UTC(t,e,i)}function go(t){var e,i;if(void 0===(t=ot(t))||"millisecond"===t||!this.isValid())return this;switch(i=this._isUTC?vo:mo,t){case"year":e=i(this.year(),0,1);break;case"quarter":e=i(this.year(),this.month()-this.month()%3,1);break;case"month":e=i(this.year(),this.month(),1);break;case"week":e=i(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=i(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=i(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=fo(e+(this._isUTC?0:this.utcOffset()*uo),co);break;case"minute":e=this._d.valueOf(),e-=fo(e,uo);break;case"second":e=this._d.valueOf(),e-=fo(e,ho)}return this._d.setTime(e),o.updateOffset(this,!0),this}function yo(t){var e,i;if(void 0===(t=ot(t))||"millisecond"===t||!this.isValid())return this;switch(i=this._isUTC?vo:mo,t){case"year":e=i(this.year()+1,0,1)-1;break;case"quarter":e=i(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=i(this.year(),this.month()+1,1)-1;break;case"week":e=i(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=i(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=i(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=co-fo(e+(this._isUTC?0:this.utcOffset()*uo),co)-1;break;case"minute":e=this._d.valueOf(),e+=uo-fo(e,uo)-1;break;case"second":e=this._d.valueOf(),e+=ho-fo(e,ho)-1}return this._d.setTime(e),o.updateOffset(this,!0),this}function bo(){return this._d.valueOf()-6e4*(this._offset||0)}function _o(){return Math.floor(this.valueOf()/1e3)}function wo(){return new Date(this.valueOf())}function ko(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function xo(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function Do(){return this.isValid()?this.toISOString():null}function So(){return y(this)}function Co(){return f({},g(this))}function To(){return g(this).overflow}function Mo(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Oo(t,e){var i,n,r,s=this._eras||gi("en")._eras;for(i=0,n=s.length;i=0)return l[n]}function Po(t,e){var i=t.since<=t.until?1:-1;return void 0===e?o(t.since).year():o(t.since).year()+(e-t.offset)*i}function Ao(){var t,e,i,n=this.localeData().eras();for(t=0,e=n.length;t(r=De(t,n,o))&&(e=r),Jo.call(this,t,e,i,n,o))}function Jo(t,e,i,n,o){var r=ke(t,e,i,n,o),s=_e(r.year,0,r.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}function Qo(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}z("N",0,0,"eraAbbr"),z("NN",0,0,"eraAbbr"),z("NNN",0,0,"eraAbbr"),z("NNNN",0,0,"eraName"),z("NNNNN",0,0,"eraNarrow"),z("y",["y",1],"yo","eraYear"),z("y",["yy",2],0,"eraYear"),z("y",["yyy",3],0,"eraYear"),z("y",["yyyy",4],0,"eraYear"),Nt("N",jo),Nt("NN",jo),Nt("NNN",jo),Nt("NNNN",Ho),Nt("NNNNN",zo),Ht(["N","NN","NNN","NNNN","NNNNN"],(function(t,e,i,n){var o=i._locale.erasParse(t,n,i._strict);o?g(i).era=o:g(i).invalidEra=t})),Nt("y",Ot),Nt("yy",Ot),Nt("yyy",Ot),Nt("yyyy",Ot),Nt("yo",Go),Ht(["y","yy","yyy","yyyy"],Wt),Ht(["yo"],(function(t,e,i,n){var o;i._locale._eraYearOrdinalRegex&&(o=t.match(i._locale._eraYearOrdinalRegex)),i._locale.eraYearOrdinalParse?e[Wt]=i._locale.eraYearOrdinalParse(t,o):e[Wt]=parseInt(t,10)})),z(0,["gg",2],0,(function(){return this.weekYear()%100})),z(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Wo("gggg","weekYear"),Wo("ggggg","weekYear"),Wo("GGGG","isoWeekYear"),Wo("GGGGG","isoWeekYear"),nt("weekYear","gg"),nt("isoWeekYear","GG"),at("weekYear",1),at("isoWeekYear",1),Nt("G",Et),Nt("g",Et),Nt("GG",xt,bt),Nt("gg",xt,bt),Nt("GGGG",Tt,wt),Nt("gggg",Tt,wt),Nt("GGGGG",Mt,kt),Nt("ggggg",Mt,kt),zt(["gggg","ggggg","GGGG","GGGGG"],(function(t,e,i,n){e[n.substr(0,2)]=dt(t)})),zt(["gg","GG"],(function(t,e,i,n){e[n]=o.parseTwoDigitYear(t)})),z("Q",0,"Qo","quarter"),nt("quarter","Q"),at("quarter",7),Nt("Q",yt),Ht("Q",(function(t,e){e[Vt]=3*(dt(t)-1)})),z("D",["DD",2],"Do","date"),nt("date","D"),at("date",9),Nt("D",xt),Nt("DD",xt,bt),Nt("Do",(function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient})),Ht(["D","DD"],Ut),Ht("Do",(function(t,e){e[Ut]=dt(t.match(xt)[0])}));var tr=ct("Date",!0);function er(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}z("DDD",["DDDD",3],"DDDo","dayOfYear"),nt("dayOfYear","DDD"),at("dayOfYear",4),Nt("DDD",Ct),Nt("DDDD",_t),Ht(["DDD","DDDD"],(function(t,e,i){i._dayOfYear=dt(t)})),z("m",["mm",2],0,"minute"),nt("minute","m"),at("minute",14),Nt("m",xt),Nt("mm",xt,bt),Ht(["m","mm"],qt);var ir=ct("Minutes",!1);z("s",["ss",2],0,"second"),nt("second","s"),at("second",15),Nt("s",xt),Nt("ss",xt,bt),Ht(["s","ss"],Zt);var nr,or,rr=ct("Seconds",!1);for(z("S",0,0,(function(){return~~(this.millisecond()/100)})),z(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),z(0,["SSS",3],0,"millisecond"),z(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),z(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),z(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),z(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),z(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),z(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),nt("millisecond","ms"),at("millisecond",16),Nt("S",Ct,yt),Nt("SS",Ct,bt),Nt("SSS",Ct,_t),nr="SSSS";nr.length<=9;nr+="S")Nt(nr,Ot);function sr(t,e){e[$t]=dt(1e3*("0."+t))}for(nr="S";nr.length<=9;nr+="S")Ht(nr,sr);function ar(){return this._isUTC?"UTC":""}function lr(){return this._isUTC?"Coordinated Universal Time":""}or=ct("Milliseconds",!1),z("z",0,0,"zoneAbbr"),z("zz",0,0,"zoneName");var hr=x.prototype;function ur(t){return qi(1e3*t)}function dr(){return qi.apply(null,arguments).parseZone()}function cr(t){return t}hr.add=Ln,hr.calendar=Gn,hr.clone=Bn,hr.diff=$n,hr.endOf=yo,hr.format=eo,hr.from=io,hr.fromNow=no,hr.to=oo,hr.toNow=ro,hr.get=mt,hr.invalidAt=To,hr.isAfter=Wn,hr.isBefore=Vn,hr.isBetween=Un,hr.isSame=Xn,hr.isSameOrAfter=qn,hr.isSameOrBefore=Zn,hr.isValid=So,hr.lang=ao,hr.locale=so,hr.localeData=lo,hr.max=$i,hr.min=Zi,hr.parsingFlags=Co,hr.set=vt,hr.startOf=go,hr.subtract=Nn,hr.toArray=ko,hr.toObject=xo,hr.toDate=wo,hr.toISOString=Qn,hr.inspect=to,"undefined"!=typeof Symbol&&null!=Symbol.for&&(hr[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),hr.toJSON=Do,hr.toString=Jn,hr.unix=_o,hr.valueOf=bo,hr.creationData=Mo,hr.eraName=Ao,hr.eraNarrow=Io,hr.eraAbbr=Lo,hr.eraYear=No,hr.year=ge,hr.isLeapYear=ye,hr.weekYear=Vo,hr.isoWeekYear=Uo,hr.quarter=hr.quarters=Qo,hr.month=de,hr.daysInMonth=ce,hr.week=hr.weeks=Oe,hr.isoWeek=hr.isoWeeks=Ee,hr.weeksInYear=Zo,hr.weeksInWeekYear=$o,hr.isoWeeksInYear=Xo,hr.isoWeeksInISOWeekYear=qo,hr.date=tr,hr.day=hr.days=Ve,hr.weekday=Ue,hr.isoWeekday=Xe,hr.dayOfYear=er,hr.hour=hr.hours=oi,hr.minute=hr.minutes=ir,hr.second=hr.seconds=rr,hr.millisecond=hr.milliseconds=or,hr.utcOffset=mn,hr.utc=gn,hr.local=yn,hr.parseZone=bn,hr.hasAlignedHourOffset=_n,hr.isDST=wn,hr.isLocal=xn,hr.isUtcOffset=Dn,hr.isUtc=Sn,hr.isUTC=Sn,hr.zoneAbbr=ar,hr.zoneName=lr,hr.dates=C("dates accessor is deprecated. Use date instead.",tr),hr.months=C("months accessor is deprecated. Use month instead",de),hr.years=C("years accessor is deprecated. Use year instead",ge),hr.zone=C("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",vn),hr.isDSTShifted=C("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",kn);var pr=I.prototype;function fr(t,e,i,n){var o=gi(),r=m().set(n,e);return o[i](r,t)}function mr(t,e,i){if(d(t)&&(e=t,t=void 0),t=t||"",null!=e)return fr(t,e,i,"month");var n,o=[];for(n=0;n<12;n++)o[n]=fr(t,n,i,"month");return o}function vr(t,e,i,n){"boolean"==typeof t?(d(e)&&(i=e,e=void 0),e=e||""):(i=e=t,t=!1,d(e)&&(i=e,e=void 0),e=e||"");var o,r=gi(),s=t?r._week.dow:0,a=[];if(null!=i)return fr(e,(i+s)%7,n,"day");for(o=0;o<7;o++)a[o]=fr(e,(o+s)%7,n,"day");return a}function gr(t,e){return mr(t,e,"months")}function yr(t,e){return mr(t,e,"monthsShort")}function br(t,e,i){return vr(t,e,i,"weekdays")}function _r(t,e,i){return vr(t,e,i,"weekdaysShort")}function wr(t,e,i){return vr(t,e,i,"weekdaysMin")}pr.calendar=N,pr.longDateFormat=X,pr.invalidDate=Z,pr.ordinal=J,pr.preparse=cr,pr.postformat=cr,pr.relativeTime=tt,pr.pastFuture=et,pr.set=P,pr.eras=Oo,pr.erasParse=Eo,pr.erasConvertYear=Po,pr.erasAbbrRegex=Ro,pr.erasNameRegex=Fo,pr.erasNarrowRegex=Yo,pr.months=se,pr.monthsShort=ae,pr.monthsParse=he,pr.monthsRegex=fe,pr.monthsShortRegex=pe,pr.week=Se,pr.firstDayOfYear=Me,pr.firstDayOfWeek=Te,pr.weekdays=He,pr.weekdaysMin=Ge,pr.weekdaysShort=ze,pr.weekdaysParse=We,pr.weekdaysRegex=qe,pr.weekdaysShortRegex=Ze,pr.weekdaysMinRegex=$e,pr.isPM=ii,pr.meridiem=ri,fi("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===dt(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),o.lang=C("moment.lang is deprecated. Use moment.locale instead.",fi),o.langData=C("moment.langData is deprecated. Use moment.localeData instead.",gi);var kr=Math.abs;function xr(){var t=this._data;return this._milliseconds=kr(this._milliseconds),this._days=kr(this._days),this._months=kr(this._months),t.milliseconds=kr(t.milliseconds),t.seconds=kr(t.seconds),t.minutes=kr(t.minutes),t.hours=kr(t.hours),t.months=kr(t.months),t.years=kr(t.years),this}function Dr(t,e,i,n){var o=Mn(e,i);return t._milliseconds+=n*o._milliseconds,t._days+=n*o._days,t._months+=n*o._months,t._bubble()}function Sr(t,e){return Dr(this,t,e,1)}function Cr(t,e){return Dr(this,t,e,-1)}function Tr(t){return t<0?Math.floor(t):Math.ceil(t)}function Mr(){var t,e,i,n,o,r=this._milliseconds,s=this._days,a=this._months,l=this._data;return r>=0&&s>=0&&a>=0||r<=0&&s<=0&&a<=0||(r+=864e5*Tr(Er(a)+s),s=0,a=0),l.milliseconds=r%1e3,t=ut(r/1e3),l.seconds=t%60,e=ut(t/60),l.minutes=e%60,i=ut(e/60),l.hours=i%24,s+=ut(i/24),a+=o=ut(Or(s)),s-=Tr(Er(o)),n=ut(a/12),a%=12,l.days=s,l.months=a,l.years=n,this}function Or(t){return 4800*t/146097}function Er(t){return 146097*t/4800}function Pr(t){if(!this.isValid())return NaN;var e,i,n=this._milliseconds;if("month"===(t=ot(t))||"quarter"===t||"year"===t)switch(e=this._days+n/864e5,i=this._months+Or(e),t){case"month":return i;case"quarter":return i/3;case"year":return i/12}else switch(e=this._days+Math.round(Er(this._months)),t){case"week":return e/7+n/6048e5;case"day":return e+n/864e5;case"hour":return 24*e+n/36e5;case"minute":return 1440*e+n/6e4;case"second":return 86400*e+n/1e3;case"millisecond":return Math.floor(864e5*e)+n;default:throw new Error("Unknown unit "+t)}}function Ar(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*dt(this._months/12):NaN}function Ir(t){return function(){return this.as(t)}}var Lr=Ir("ms"),Nr=Ir("s"),Fr=Ir("m"),Rr=Ir("h"),Yr=Ir("d"),jr=Ir("w"),Hr=Ir("M"),zr=Ir("Q"),Gr=Ir("y");function Br(){return Mn(this)}function Wr(t){return t=ot(t),this.isValid()?this[t+"s"]():NaN}function Vr(t){return function(){return this.isValid()?this._data[t]:NaN}}var Ur=Vr("milliseconds"),Xr=Vr("seconds"),qr=Vr("minutes"),Zr=Vr("hours"),$r=Vr("days"),Kr=Vr("months"),Jr=Vr("years");function Qr(){return ut(this.days()/7)}var ts=Math.round,es={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function is(t,e,i,n,o){return o.relativeTime(e||1,!!i,t,n)}function ns(t,e,i,n){var o=Mn(t).abs(),r=ts(o.as("s")),s=ts(o.as("m")),a=ts(o.as("h")),l=ts(o.as("d")),h=ts(o.as("M")),u=ts(o.as("w")),d=ts(o.as("y")),c=r<=i.ss&&["s",r]||r0,c[4]=n,is.apply(null,c)}function os(t){return void 0===t?ts:"function"==typeof t&&(ts=t,!0)}function rs(t,e){return void 0!==es[t]&&(void 0===e?es[t]:(es[t]=e,"s"===t&&(es.ss=e-1),!0))}function ss(t,e){if(!this.isValid())return this.localeData().invalidDate();var i,n,o=!1,r=es;return"object"==typeof t&&(e=t,t=!1),"boolean"==typeof t&&(o=t),"object"==typeof e&&(r=Object.assign({},es,e),null!=e.s&&null==e.ss&&(r.ss=e.s-1)),n=ns(this,!o,r,i=this.localeData()),o&&(n=i.pastFuture(+this,n)),i.postformat(n)}var as=Math.abs;function ls(t){return(t>0)-(t<0)||+t}function hs(){if(!this.isValid())return this.localeData().invalidDate();var t,e,i,n,o,r,s,a,l=as(this._milliseconds)/1e3,h=as(this._days),u=as(this._months),d=this.asSeconds();return d?(t=ut(l/60),e=ut(t/60),l%=60,t%=60,i=ut(u/12),u%=12,n=l?l.toFixed(3).replace(/\.?0+$/,""):"",o=d<0?"-":"",r=ls(this._months)!==ls(d)?"-":"",s=ls(this._days)!==ls(d)?"-":"",a=ls(this._milliseconds)!==ls(d)?"-":"",o+"P"+(i?r+i+"Y":"")+(u?r+u+"M":"")+(h?s+h+"D":"")+(e||t||l?"T":"")+(e?a+e+"H":"")+(t?a+t+"M":"")+(l?a+n+"S":"")):"P0D"}var us=sn.prototype;return us.isValid=on,us.abs=xr,us.add=Sr,us.subtract=Cr,us.as=Pr,us.asMilliseconds=Lr,us.asSeconds=Nr,us.asMinutes=Fr,us.asHours=Rr,us.asDays=Yr,us.asWeeks=jr,us.asMonths=Hr,us.asQuarters=zr,us.asYears=Gr,us.valueOf=Ar,us._bubble=Mr,us.clone=Br,us.get=Wr,us.milliseconds=Ur,us.seconds=Xr,us.minutes=qr,us.hours=Zr,us.days=$r,us.weeks=Qr,us.months=Kr,us.years=Jr,us.humanize=ss,us.toISOString=hs,us.toString=hs,us.toJSON=hs,us.locale=so,us.localeData=lo,us.toIsoString=C("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",hs),us.lang=ao,z("X",0,0,"unix"),z("x",0,0,"valueOf"),Nt("x",Et),Nt("X",It),Ht("X",(function(t,e,i){i._d=new Date(1e3*parseFloat(t))})),Ht("x",(function(t,e,i){i._d=new Date(dt(t))})),//! moment.js +o.version="2.29.1",r(qi),o.fn=hr,o.min=Ji,o.max=Qi,o.now=tn,o.utc=m,o.unix=ur,o.months=gr,o.isDate=c,o.locale=fi,o.invalid=b,o.duration=Mn,o.isMoment=D,o.weekdays=br,o.parseZone=dr,o.localeData=gi,o.isDuration=an,o.monthsShort=yr,o.weekdaysMin=wr,o.defineLocale=mi,o.updateLocale=vi,o.locales=yi,o.weekdaysShort=_r,o.normalizeUnits=ot,o.relativeTimeRounding=os,o.relativeTimeThreshold=rs,o.calendarFormat=zn,o.prototype=hr,o.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},o}()}(o);var r=o.exports;!function(t){function e(t,e,i,n){var o={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?o[i][0]:o[i][1]}t.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(o.exports),function(t){var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),i="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),n=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],o=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,n){return t?/-MMM-/.test(n)?i[t.month()]:e[t.month()]:e},monthsRegex:o,monthsShortRegex:o,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4},invalidDate:"Fecha inválida"})}(o.exports),function(t){var e=/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,i=[/^janv/i,/^févr/i,/^mars/i,/^avr/i,/^mai/i,/^juin/i,/^juil/i,/^août/i,/^sept/i,/^oct/i,/^nov/i,/^déc/i];t.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsRegex:e,monthsShortRegex:e,monthsStrictRegex:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,monthsShortStrictRegex:/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,monthsParse:i,longMonthsParse:i,shortMonthsParse:i,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",w:"une semaine",ww:"%d semaines",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|)/,ordinal:function(t,e){switch(e){case"D":return t+(1===t?"er":"");default:case"M":case"Q":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}},week:{dow:1,doy:4}})}(o.exports),function(t){t.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:function(){return"[Oggi a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextDay:function(){return"[Domani a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextWeek:function(){return"dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastDay:function(){return"[Ieri a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastWeek:function(){switch(this.day()){case 0:return"[La scorsa] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT";default:return"[Lo scorso] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"}},sameElse:"L"},relativeTime:{future:"tra %s",past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",w:"una settimana",ww:"%d settimane",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(o.exports),function(t){t.defineLocale("ja",{eras:[{since:"2019-05-01",offset:1,name:"令和",narrow:"㋿",abbr:"R"},{since:"1989-01-08",until:"2019-04-30",offset:1,name:"平成",narrow:"㍻",abbr:"H"},{since:"1926-12-25",until:"1989-01-07",offset:1,name:"昭和",narrow:"㍼",abbr:"S"},{since:"1912-07-30",until:"1926-12-24",offset:1,name:"大正",narrow:"㍽",abbr:"T"},{since:"1873-01-01",until:"1912-07-29",offset:6,name:"明治",narrow:"㍾",abbr:"M"},{since:"0001-01-01",until:"1873-12-31",offset:1,name:"西暦",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"紀元前",narrow:"BC",abbr:"BC"}],eraYearOrdinalRegex:/(元|\d+)年/,eraYearOrdinalParse:function(t,e){return"元"===e[1]?1:parseInt(e[1]||t,10)},months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日 dddd HH:mm",l:"YYYY/MM/DD",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日(ddd) HH:mm"},meridiemParse:/午前|午後/i,isPM:function(t){return"午後"===t},meridiem:function(t,e,i){return t<12?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:function(t){return t.week()!==this.week()?"[来週]dddd LT":"dddd LT"},lastDay:"[昨日] LT",lastWeek:function(t){return this.week()!==t.week()?"[先週]dddd LT":"dddd LT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}日/,ordinal:function(t,e){switch(e){case"y":return 1===t?"元年":t+"年";case"d":case"D":case"DDD":return t+"日";default:return t}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",ss:"%d秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}(o.exports),function(t){var e="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),i="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),n=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],o=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;t.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(t,n){return t?/-MMM-/.test(n)?i[t.month()]:e[t.month()]:e},monthsRegex:o,monthsShortRegex:o,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",w:"één week",ww:"%d weken",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(o.exports),function(t){var e="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),i="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),n=[/^sty/i,/^lut/i,/^mar/i,/^kwi/i,/^maj/i,/^cze/i,/^lip/i,/^sie/i,/^wrz/i,/^paź/i,/^lis/i,/^gru/i];function o(t){return t%10<5&&t%10>1&&~~(t/10)%10!=1}function r(t,e,i){var n=t+" ";switch(i){case"ss":return n+(o(t)?"sekundy":"sekund");case"m":return e?"minuta":"minutę";case"mm":return n+(o(t)?"minuty":"minut");case"h":return e?"godzina":"godzinę";case"hh":return n+(o(t)?"godziny":"godzin");case"ww":return n+(o(t)?"tygodnie":"tygodni");case"MM":return n+(o(t)?"miesiące":"miesięcy");case"yy":return n+(o(t)?"lata":"lat")}}t.defineLocale("pl",{months:function(t,n){return t?/D MMMM/.test(n)?i[t.month()]:e[t.month()]:e},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"ndz_pon_wt_śr_czw_pt_sob".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:function(){switch(this.day()){case 0:return"[W niedzielę o] LT";case 2:return"[We wtorek o] LT";case 3:return"[W środę o] LT";case 6:return"[W sobotę o] LT";default:return"[W] dddd [o] LT"}},lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",ss:r,m:r,mm:r,h:r,hh:r,d:"1 dzień",dd:"%d dni",w:"tydzień",ww:r,M:"miesiąc",MM:r,y:"rok",yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(o.exports),function(t){function e(t,e,i){var n,o;return"m"===i?e?"минута":"минуту":t+" "+(n=+t,o={ss:e?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:e?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",ww:"неделя_недели_недель",MM:"месяц_месяца_месяцев",yy:"год_года_лет"}[i].split("_"),n%10==1&&n%100!=11?o[0]:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?o[1]:o[2])}var i=[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i];t.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:i,longMonthsParse:i,shortMonthsParse:i,monthsRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsShortRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsStrictRegex:/^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,monthsShortStrictRegex:/^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., H:mm",LLLL:"dddd, D MMMM YYYY г., H:mm"},calendar:{sameDay:"[Сегодня, в] LT",nextDay:"[Завтра, в] LT",lastDay:"[Вчера, в] LT",nextWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В следующее] dddd, [в] LT";case 1:case 2:case 4:return"[В следующий] dddd, [в] LT";case 3:case 5:case 6:return"[В следующую] dddd, [в] LT"}},lastWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd, [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd, [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd, [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",ss:e,m:e,mm:e,h:"час",hh:e,d:"день",dd:e,w:"неделя",ww:e,M:"месяц",MM:e,y:"год",yy:e},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(t){return/^(дня|вечера)$/.test(t)},meridiem:function(t,e,i){return t<4?"ночи":t<12?"утра":t<17?"дня":"вечера"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":return t+"-й";case"D":return t+"-го";case"w":case"W":return t+"-я";default:return t}},week:{dow:1,doy:4}})}(o.exports),function(t){function e(t,e,i){var n,o;return"m"===i?e?"хвилина":"хвилину":"h"===i?e?"година":"годину":t+" "+(n=+t,o={ss:e?"секунда_секунди_секунд":"секунду_секунди_секунд",mm:e?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:e?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"}[i].split("_"),n%10==1&&n%100!=11?o[0]:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?o[1]:o[2])}function i(t){return function(){return t+"о"+(11===this.hours()?"б":"")+"] LT"}}t.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:function(t,e){var i={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")};return!0===t?i.nominative.slice(1,7).concat(i.nominative.slice(0,1)):t?i[/(\[[ВвУу]\]) ?dddd/.test(e)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(e)?"genitive":"nominative"][t.day()]:i.nominative},weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:i("[Сьогодні "),nextDay:i("[Завтра "),lastDay:i("[Вчора "),nextWeek:i("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return i("[Минулої] dddd [").call(this);case 1:case 2:case 4:return i("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",ss:e,m:e,mm:e,h:"годину",hh:e,d:"день",dd:e,M:"місяць",MM:e,y:"рік",yy:e},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(t){return/^(дня|вечора)$/.test(t)},meridiem:function(t,e,i){return t<4?"ночі":t<12?"ранку":t<17?"дня":"вечора"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":case"w":case"W":return t+"-й";case"D":return t+"-го";default:return t}},week:{dow:1,doy:7}})}(o.exports);var s=Function.prototype,a=s.bind,l=s.call,h=a&&a.bind(l),u=a?function(t){return t&&h(l,t)}:function(t){return t&&function(){return l.apply(t,arguments)}},d=Math.ceil,c=Math.floor,p=function(t){var e=+t;return e!=e||0===e?0:(e>0?c:d)(e)},f=function(t){return t&&t.Math==Math&&t},m=f("object"==typeof globalThis&&globalThis)||f("object"==typeof window&&window)||f("object"==typeof self&&self)||f("object"==typeof e&&e)||function(){return this}()||Function("return this")(),v={exports:{}},g=m,y=Object.defineProperty,b=function(t,e){try{y(g,t,{value:e,configurable:!0,writable:!0})}catch(i){g[t]=e}return e},_="__core-js_shared__",w=m[_]||b(_,{}),k=w;(v.exports=function(t,e){return k[t]||(k[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.1",mode:"pure",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});var x,D,S=m.TypeError,C=function(t){if(null==t)throw S("Can't call method on "+t);return t},T=C,M=m.Object,O=function(t){return M(T(t))},E=O,P=u({}.hasOwnProperty),A=Object.hasOwn||function(t,e){return P(E(t),e)},I=u,L=0,N=Math.random(),F=I(1..toString),R=function(t){return"Symbol("+(void 0===t?"":t)+")_"+F(++L+N,36)},Y={},j=function(t){return"function"==typeof t},H=Y,z=m,G=j,B=function(t){return G(t)?t:void 0},W=function(t,e){return arguments.length<2?B(H[t])||B(z[t]):H[t]&&H[t][e]||z[t]&&z[t][e]},V=W("navigator","userAgent")||"",U=m,X=V,q=U.process,Z=U.Deno,$=q&&q.versions||Z&&Z.version,K=$&&$.v8;K&&(D=(x=K.split("."))[0]>0&&x[0]<4?1:+(x[0]+x[1])),!D&&X&&(!(x=X.match(/Edge\/(\d+)/))||x[1]>=74)&&(x=X.match(/Chrome\/(\d+)/))&&(D=+x[1]);var J=D,Q=function(t){try{return!!t()}catch(t){return!0}},tt=J,et=Q,it=!!Object.getOwnPropertySymbols&&!et((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&tt&&tt<41})),nt=it&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ot=m,rt=v.exports,st=A,at=R,lt=it,ht=nt,ut=rt("wks"),dt=ot.Symbol,ct=dt&&dt.for,pt=ht?dt:dt&&dt.withoutSetter||at,ft=function(t){if(!st(ut,t)||!lt&&"string"!=typeof ut[t]){var e="Symbol."+t;lt&&st(dt,t)?ut[t]=dt[t]:ut[t]=ht&&ct?ct(e):pt(e)}return ut[t]},mt={};mt[ft("toStringTag")]="z";var vt="[object z]"===String(mt),gt=u,yt=gt({}.toString),bt=gt("".slice),_t=function(t){return bt(yt(t),8,-1)},wt=m,kt=vt,xt=j,Dt=_t,St=ft("toStringTag"),Ct=wt.Object,Tt="Arguments"==Dt(function(){return arguments}()),Mt=kt?Dt:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ct(t),St))?i:Tt?Dt(e):"Object"==(n=Dt(e))&&xt(e.callee)?"Arguments":n},Ot=Mt,Et=m.String,Pt=function(t){if("Symbol"===Ot(t))throw TypeError("Cannot convert a Symbol value to a string");return Et(t)},At=u,It=p,Lt=Pt,Nt=C,Ft=At("".charAt),Rt=At("".charCodeAt),Yt=At("".slice),jt=function(t){return function(e,i){var n,o,r=Lt(Nt(e)),s=It(i),a=r.length;return s<0||s>=a?t?"":void 0:(n=Rt(r,s))<55296||n>56319||s+1===a||(o=Rt(r,s+1))<56320||o>57343?t?Ft(r,s):n:t?Yt(r,s,s+2):o-56320+(n-55296<<10)+65536}},Ht={codeAt:jt(!1),charAt:jt(!0)},zt=j,Gt=w,Bt=u(Function.toString);zt(Gt.inspectSource)||(Gt.inspectSource=function(t){return Bt(t)});var Wt=Gt.inspectSource,Vt=j,Ut=Wt,Xt=m.WeakMap,qt=Vt(Xt)&&/native code/.test(Ut(Xt)),Zt=j,$t=function(t){return"object"==typeof t?null!==t:Zt(t)},Kt=!Q((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Jt={},Qt=$t,te=m.document,ee=Qt(te)&&Qt(te.createElement),ie=function(t){return ee?te.createElement(t):{}},ne=ie,oe=!Kt&&!Q((function(){return 7!=Object.defineProperty(ne("div"),"a",{get:function(){return 7}}).a})),re=m,se=$t,ae=re.String,le=re.TypeError,he=function(t){if(se(t))return t;throw le(ae(t)+" is not an object")},ue=Function.prototype.call,de=ue.bind?ue.bind(ue):function(){return ue.apply(ue,arguments)},ce=u({}.isPrototypeOf),pe=W,fe=j,me=ce,ve=nt,ge=m.Object,ye=ve?function(t){return"symbol"==typeof t}:function(t){var e=pe("Symbol");return fe(e)&&me(e.prototype,ge(t))},be=m.String,_e=function(t){try{return be(t)}catch(t){return"Object"}},we=j,ke=_e,xe=m.TypeError,De=function(t){if(we(t))return t;throw xe(ke(t)+" is not a function")},Se=De,Ce=function(t,e){var i=t[e];return null==i?void 0:Se(i)},Te=de,Me=j,Oe=$t,Ee=m.TypeError,Pe=de,Ae=$t,Ie=ye,Le=Ce,Ne=function(t,e){var i,n;if("string"===e&&Me(i=t.toString)&&!Oe(n=Te(i,t)))return n;if(Me(i=t.valueOf)&&!Oe(n=Te(i,t)))return n;if("string"!==e&&Me(i=t.toString)&&!Oe(n=Te(i,t)))return n;throw Ee("Can't convert object to primitive value")},Fe=ft,Re=m.TypeError,Ye=Fe("toPrimitive"),je=function(t,e){if(!Ae(t)||Ie(t))return t;var i,n=Le(t,Ye);if(n){if(void 0===e&&(e="default"),i=Pe(n,t,e),!Ae(i)||Ie(i))return i;throw Re("Can't convert object to primitive value")}return void 0===e&&(e="number"),Ne(t,e)},He=ye,ze=function(t){var e=je(t,"string");return He(e)?e:e+""},Ge=Kt,Be=oe,We=he,Ve=ze,Ue=m.TypeError,Xe=Object.defineProperty;Jt.f=Ge?Xe:function(t,e,i){if(We(t),e=Ve(e),We(i),Be)try{return Xe(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Ue("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var qe,Ze,$e,Ke=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},Je=Jt,Qe=Ke,ti=Kt?function(t,e,i){return Je.f(t,e,Qe(1,i))}:function(t,e,i){return t[e]=i,t},ei=v.exports,ii=R,ni=ei("keys"),oi=function(t){return ni[t]||(ni[t]=ii(t))},ri={},si=qt,ai=m,li=u,hi=$t,ui=ti,di=A,ci=w,pi=oi,fi=ri,mi="Object already initialized",vi=ai.TypeError,gi=ai.WeakMap;if(si||ci.state){var yi=ci.state||(ci.state=new gi),bi=li(yi.get),_i=li(yi.has),wi=li(yi.set);qe=function(t,e){if(_i(yi,t))throw new vi(mi);return e.facade=t,wi(yi,t,e),e},Ze=function(t){return bi(yi,t)||{}},$e=function(t){return _i(yi,t)}}else{var ki=pi("state");fi[ki]=!0,qe=function(t,e){if(di(t,ki))throw new vi(mi);return e.facade=t,ui(t,ki,e),e},Ze=function(t){return di(t,ki)?t[ki]:{}},$e=function(t){return di(t,ki)}}var xi={set:qe,get:Ze,has:$e,enforce:function(t){return $e(t)?Ze(t):qe(t,{})},getterFor:function(t){return function(e){var i;if(!hi(e)||(i=Ze(e)).type!==t)throw vi("Incompatible receiver, "+t+" required");return i}}},Di=Function.prototype,Si=Di.apply,Ci=Di.bind,Ti=Di.call,Mi="object"==typeof Reflect&&Reflect.apply||(Ci?Ti.bind(Si):function(){return Ti.apply(Si,arguments)}),Oi={},Ei={},Pi={}.propertyIsEnumerable,Ai=Object.getOwnPropertyDescriptor,Ii=Ai&&!Pi.call({1:2},1);Ei.f=Ii?function(t){var e=Ai(this,t);return!!e&&e.enumerable}:Pi;var Li=u,Ni=Q,Fi=_t,Ri=m.Object,Yi=Li("".split),ji=Ni((function(){return!Ri("z").propertyIsEnumerable(0)}))?function(t){return"String"==Fi(t)?Yi(t,""):Ri(t)}:Ri,Hi=ji,zi=C,Gi=function(t){return Hi(zi(t))},Bi=Kt,Wi=de,Vi=Ei,Ui=Ke,Xi=Gi,qi=ze,Zi=A,$i=oe,Ki=Object.getOwnPropertyDescriptor;Oi.f=Bi?Ki:function(t,e){if(t=Xi(t),e=qi(e),$i)try{return Ki(t,e)}catch(t){}if(Zi(t,e))return Ui(!Wi(Vi.f,t,e),t[e])};var Ji,Qi=Q,tn=j,en=/#|\.prototype\./,nn=function(t,e){var i=rn[on(t)];return i==an||i!=sn&&(tn(e)?Qi(e):!!e)},on=nn.normalize=function(t){return String(t).replace(en,".").toLowerCase()},rn=nn.data={},sn=nn.NATIVE="N",an=nn.POLYFILL="P",ln=nn,hn=De,un=u(u.bind),dn=function(t,e){return hn(t),void 0===e?t:un?un(t,e):function(){return t.apply(e,arguments)}},cn=m,pn=Mi,fn=u,mn=j,vn=Oi.f,gn=ln,yn=Y,bn=dn,_n=ti,wn=A,kn=function(t){var e=function(i,n,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(i);case 2:return new t(i,n)}return new t(i,n,o)}return pn(t,this,arguments)};return e.prototype=t.prototype,e},xn=function(t,e){var i,n,o,r,s,a,l,h,u=t.target,d=t.global,c=t.stat,p=t.proto,f=d?cn:c?cn[u]:(cn[u]||{}).prototype,m=d?yn:yn[u]||_n(yn,u,{})[u],v=m.prototype;for(o in e)i=!gn(d?o:u+(c?".":"#")+o,t.forced)&&f&&wn(f,o),s=m[o],i&&(a=t.noTargetGet?(h=vn(f,o))&&h.value:f[o]),r=i&&a?a:e[o],i&&typeof s==typeof r||(l=t.bind&&i?bn(r,cn):t.wrap&&i?kn(r):p&&mn(r)?fn(r):r,(t.sham||r&&r.sham||s&&s.sham)&&_n(l,"sham",!0),_n(m,o,l),p&&(wn(yn,n=u+"Prototype")||_n(yn,n,{}),_n(yn[n],o,r),t.real&&v&&!v[o]&&_n(v,o,r)))},Dn=Kt,Sn=A,Cn=Function.prototype,Tn=Dn&&Object.getOwnPropertyDescriptor,Mn=Sn(Cn,"name"),On={EXISTS:Mn,PROPER:Mn&&"something"===function(){}.name,CONFIGURABLE:Mn&&(!Dn||Dn&&Tn(Cn,"name").configurable)},En=p,Pn=Math.max,An=Math.min,In=function(t,e){var i=En(t);return i<0?Pn(i+e,0):An(i,e)},Ln=p,Nn=Math.min,Fn=function(t){return t>0?Nn(Ln(t),9007199254740991):0},Rn=function(t){return Fn(t.length)},Yn=Gi,jn=In,Hn=Rn,zn=function(t){return function(e,i,n){var o,r=Yn(e),s=Hn(r),a=jn(n,s);if(t&&i!=i){for(;s>a;)if((o=r[a++])!=o)return!0}else for(;s>a;a++)if((t||a in r)&&r[a]===i)return t||a||0;return!t&&-1}},Gn={includes:zn(!0),indexOf:zn(!1)},Bn=A,Wn=Gi,Vn=Gn.indexOf,Un=ri,Xn=u([].push),qn=function(t,e){var i,n=Wn(t),o=0,r=[];for(i in n)!Bn(Un,i)&&Bn(n,i)&&Xn(r,i);for(;e.length>o;)Bn(n,i=e[o++])&&(~Vn(r,i)||Xn(r,i));return r},Zn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$n=qn,Kn=Zn,Jn=Object.keys||function(t){return $n(t,Kn)},Qn=Jt,to=he,eo=Gi,io=Jn,no=Kt?Object.defineProperties:function(t,e){to(t);for(var i,n=eo(e),o=io(e),r=o.length,s=0;r>s;)Qn.f(t,i=o[s++],n[i]);return t},oo=W("document","documentElement"),ro=he,so=no,ao=Zn,lo=ri,ho=oo,uo=ie,co=oi("IE_PROTO"),po=function(){},fo=function(t){return"