commspliant-html-editor 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +220 -13
  2. package/dist/chrome/ChromeTheme.d.ts +14 -0
  3. package/dist/chrome/ChromeTheme.d.ts.map +1 -0
  4. package/dist/commspliant-html-editor.css +1 -1
  5. package/dist/components/Editor.d.ts +1 -1
  6. package/dist/components/Editor.d.ts.map +1 -1
  7. package/dist/components/VisualSurface.d.ts.map +1 -1
  8. package/dist/core/commandTypes.d.ts +25 -3
  9. package/dist/core/commandTypes.d.ts.map +1 -1
  10. package/dist/core/customActions.d.ts.map +1 -1
  11. package/dist/core/documentStyles.d.ts +4 -0
  12. package/dist/core/documentStyles.d.ts.map +1 -0
  13. package/dist/core/horizontalRule.d.ts +4 -0
  14. package/dist/core/horizontalRule.d.ts.map +1 -0
  15. package/dist/core/selection.d.ts +3 -0
  16. package/dist/core/selection.d.ts.map +1 -1
  17. package/dist/hooks/useAutoSave.d.ts +9 -0
  18. package/dist/hooks/useAutoSave.d.ts.map +1 -0
  19. package/dist/i18n/en.d.ts.map +1 -1
  20. package/dist/i18n/es.d.ts.map +1 -1
  21. package/dist/i18n/types.d.ts +36 -2
  22. package/dist/i18n/types.d.ts.map +1 -1
  23. package/dist/icons/CustomizeToolbarIcon.d.ts +3 -0
  24. package/dist/icons/CustomizeToolbarIcon.d.ts.map +1 -0
  25. package/dist/icons/DarkModeIcon.d.ts +3 -0
  26. package/dist/icons/DarkModeIcon.d.ts.map +1 -0
  27. package/dist/icons/FontFamilyIcon.d.ts +3 -0
  28. package/dist/icons/FontFamilyIcon.d.ts.map +1 -0
  29. package/dist/icons/FontSizeIcon.d.ts +3 -0
  30. package/dist/icons/FontSizeIcon.d.ts.map +1 -0
  31. package/dist/icons/HorizontalRuleIcon.d.ts +3 -0
  32. package/dist/icons/HorizontalRuleIcon.d.ts.map +1 -0
  33. package/dist/icons/LightModeIcon.d.ts +3 -0
  34. package/dist/icons/LightModeIcon.d.ts.map +1 -0
  35. package/dist/icons/ParagraphStyleIcon.d.ts +3 -0
  36. package/dist/icons/ParagraphStyleIcon.d.ts.map +1 -0
  37. package/dist/icons/PreviewIcon.d.ts +3 -0
  38. package/dist/icons/PreviewIcon.d.ts.map +1 -0
  39. package/dist/icons/index.d.ts +8 -0
  40. package/dist/icons/index.d.ts.map +1 -1
  41. package/dist/index.cjs +4 -4
  42. package/dist/index.d.ts +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +6854 -5691
  45. package/dist/modules/contextMenu/ContextMenu.d.ts +1 -1
  46. package/dist/modules/contextMenu/ContextMenu.d.ts.map +1 -1
  47. package/dist/modules/contextMenu/index.d.ts +1 -0
  48. package/dist/modules/contextMenu/index.d.ts.map +1 -1
  49. package/dist/modules/contextMenu/shouldOpenEditorContextMenu.d.ts +6 -0
  50. package/dist/modules/contextMenu/shouldOpenEditorContextMenu.d.ts.map +1 -0
  51. package/dist/modules/file/fileDialogs.d.ts.map +1 -1
  52. package/dist/modules/file/htmlFile.d.ts +5 -0
  53. package/dist/modules/file/htmlFile.d.ts.map +1 -0
  54. package/dist/modules/file/printHtml.d.ts.map +1 -1
  55. package/dist/modules/file/useHtmlFileDrop.d.ts +14 -0
  56. package/dist/modules/file/useHtmlFileDrop.d.ts.map +1 -0
  57. package/dist/modules/format/ColorField.d.ts.map +1 -1
  58. package/dist/modules/format/ColorSelect.d.ts.map +1 -1
  59. package/dist/modules/format/CustomParagraphStyleDialog.d.ts +1 -1
  60. package/dist/modules/format/CustomParagraphStyleDialog.d.ts.map +1 -1
  61. package/dist/modules/format/FontFamilySelect.d.ts.map +1 -1
  62. package/dist/modules/format/FontPropertiesDialog.d.ts +1 -1
  63. package/dist/modules/format/FontPropertiesDialog.d.ts.map +1 -1
  64. package/dist/modules/format/FontSizeCombobox.d.ts.map +1 -1
  65. package/dist/modules/format/PagePropertiesDialog.d.ts +1 -1
  66. package/dist/modules/format/PagePropertiesDialog.d.ts.map +1 -1
  67. package/dist/modules/format/ParagraphPropertiesDialog.d.ts +1 -1
  68. package/dist/modules/format/ParagraphPropertiesDialog.d.ts.map +1 -1
  69. package/dist/modules/format/ParagraphStyleSelect.d.ts.map +1 -1
  70. package/dist/modules/format/catalog.d.ts.map +1 -1
  71. package/dist/modules/insert/BookmarkDialog.d.ts +1 -1
  72. package/dist/modules/insert/BookmarkDialog.d.ts.map +1 -1
  73. package/dist/modules/insert/ImageDialog.d.ts +1 -1
  74. package/dist/modules/insert/ImageDialog.d.ts.map +1 -1
  75. package/dist/modules/insert/ImagePropertiesDialog.d.ts +1 -1
  76. package/dist/modules/insert/ImagePropertiesDialog.d.ts.map +1 -1
  77. package/dist/modules/insert/ImageSizeField.d.ts.map +1 -1
  78. package/dist/modules/insert/LinkDialog.d.ts +1 -1
  79. package/dist/modules/insert/LinkDialog.d.ts.map +1 -1
  80. package/dist/modules/insert/catalog.d.ts.map +1 -1
  81. package/dist/modules/insert/commands.d.ts +1 -1
  82. package/dist/modules/insert/commands.d.ts.map +1 -1
  83. package/dist/modules/table/CellPropertiesDialog.d.ts +1 -1
  84. package/dist/modules/table/CellPropertiesDialog.d.ts.map +1 -1
  85. package/dist/modules/table/RowPropertiesDialog.d.ts +1 -1
  86. package/dist/modules/table/RowPropertiesDialog.d.ts.map +1 -1
  87. package/dist/modules/table/TableDialog.d.ts +1 -1
  88. package/dist/modules/table/TableDialog.d.ts.map +1 -1
  89. package/dist/modules/table/TablePropertiesDialog.d.ts +1 -1
  90. package/dist/modules/table/TablePropertiesDialog.d.ts.map +1 -1
  91. package/dist/modules/view/DocumentPreviewDialog.d.ts +7 -0
  92. package/dist/modules/view/DocumentPreviewDialog.d.ts.map +1 -0
  93. package/dist/modules/view/catalog.d.ts.map +1 -1
  94. package/dist/modules/view/commands.d.ts +2 -2
  95. package/dist/modules/view/commands.d.ts.map +1 -1
  96. package/dist/modules/view/darkModePersistence.d.ts +5 -0
  97. package/dist/modules/view/darkModePersistence.d.ts.map +1 -0
  98. package/dist/modules/view/toolbarPositionPersistence.d.ts +6 -0
  99. package/dist/modules/view/toolbarPositionPersistence.d.ts.map +1 -0
  100. package/dist/toolbar/CustomizeToolbarDialog.d.ts +16 -0
  101. package/dist/toolbar/CustomizeToolbarDialog.d.ts.map +1 -0
  102. package/dist/toolbar/EditorToolbar.d.ts +3 -1
  103. package/dist/toolbar/EditorToolbar.d.ts.map +1 -1
  104. package/dist/toolbar/IconNav.d.ts.map +1 -1
  105. package/dist/toolbar/MenuBar.d.ts.map +1 -1
  106. package/dist/toolbar/Tooltip.d.ts.map +1 -1
  107. package/dist/toolbar/allowedChrome.d.ts +4 -0
  108. package/dist/toolbar/allowedChrome.d.ts.map +1 -0
  109. package/dist/toolbar/defaultLayout.d.ts.map +1 -1
  110. package/dist/toolbar/index.d.ts +3 -0
  111. package/dist/toolbar/index.d.ts.map +1 -1
  112. package/dist/toolbar/toolbarCustomization.d.ts +14 -0
  113. package/dist/toolbar/toolbarCustomization.d.ts.map +1 -0
  114. package/dist/types.d.ts +79 -2
  115. package/dist/types.d.ts.map +1 -1
  116. package/package.json +1 -1
  117. package/dist/toolbar/ScrollChevronIcons.d.ts +0 -4
  118. package/dist/toolbar/ScrollChevronIcons.d.ts.map +0 -1
  119. package/dist/toolbar/overflow.d.ts +0 -7
  120. package/dist/toolbar/overflow.d.ts.map +0 -1
  121. package/dist/toolbar/useIconNavOverflow.d.ts +0 -9
  122. package/dist/toolbar/useIconNavOverflow.d.ts.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),le=require("react-dom");function jo({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-center",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M7 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function Ta({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-justify",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M4 18h16"})]})}function No({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-left",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function Lo({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-right",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M10 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function Ts({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bold",children:[o.jsx("path",{d:"M7 5h6.5a3.5 3.5 0 0 1 0 7H7z"}),o.jsx("path",{d:"M7 12h7.5a3.5 3.5 0 0 1 0 7H7z"}),o.jsx("path",{d:"M7 5v14"})]})}function Ms({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bookmark",children:o.jsx("path",{d:"M6 4h12a1 1 0 0 1 1 1v16l-7-4-7 4V5a1 1 0 0 1 1-1z"})})}function Ma({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bullet-list",children:[o.jsx("path",{d:"M9 6h12"}),o.jsx("path",{d:"M9 12h12"}),o.jsx("path",{d:"M9 18h12"}),o.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"})]})}function Rs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"cell-properties",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 12h18"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("rect",{x:"12.5",y:"4.5",width:"8",height:"7",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function _s({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"clear-formatting",children:[o.jsx("path",{d:"M4 5h12"}),o.jsx("path",{d:"M10 5v8"}),o.jsx("path",{d:"m14 15 6 6"}),o.jsx("path",{d:"m20 15-6 6"})]})}function He({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"close",children:[o.jsx("path",{d:"M18 6L6 18"}),o.jsx("path",{d:"M6 6l12 12"})]})}function Fs({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 616.23 542.09",width:"45",height:"40","aria-hidden":"true","data-icon":"commspliant-shield",children:o.jsxs("g",{transform:"translate(129.79555,688.75474)",children:[o.jsx("path",{fill:"#334E68",d:"m 92.41768,-326.31771 a 0.3,0.3 0 0 1 0.48,0.05 q 5.04,8.55 15.34,22.7 5.5,7.55 11.93,14.77 11.84,13.3 12.69,14.16 11.29,11.41 26.17,23.51 c 4.66,3.79 9.84,8.83 15.07,12.39 18.71,12.72 34.7,23.08 52.84,31.97 q 15.29,7.5 16.67,8.12 5.77,2.59 8.73,3.54 c 1.66,0.54 2.74,-0.25 4.17,-0.93 q 27.98,-13.14 49.38,-25.74 21.15,-12.47 41.94,-29.56 1.28,-1.05 12.72,-11.11 c 11.11,-9.78 22.59,-22.12 30.48,-31.94 q 10.87,-13.52 16.67,-23.55 c 3.7,-6.41 7.66,-12.73 10.29,-18.63 q 9.41,-21.06 13.67,-35.18 8.51,-28.19 9.46,-61.31 0.96,-33.72 0.31,-64.55 -0.09,-4.4 2.81,-7.26 5.42,-5.33 7.5,-7.38 c 6.37,-6.25 11.24,-13.29 18.07,-19.23 q 7.84,-6.84 14.74,-16.11 0.14,-0.19 0.39,-0.15 0.61,0.1 0.52,0.7 -0.37,2.69 -0.35,4.95 c 0.37,45.85 0.81,76.35 -0.95,110.71 q -0.66,12.89 -2.71,28.52 -2.84,21.57 -7.17,36.03 -2.02,6.75 -5.4,17.5 c -5.64,17.94 -13.55,35.09 -23.13,50.9 q -1.72,2.86 -12.91,19.22 c -10.81,15.81 -22.83,29.61 -35.06,41.83 q -4.06,4.07 -17.47,16.38 -9.77,8.98 -18.52,15.14 -19.27,13.56 -32.8,21.84 c -8.27,5.05 -17.73,9.75 -26.22,14.7 q -3.66,2.13 -10.7,5.47 -27.19,12.89 -34.36,16.16 -3.92,1.79 -7.2,0.44 -3.47,-1.43 -11.46,-4.85 c -9.07,-3.89 -16.98,-8.27 -24.9,-11.89 -8.4,-3.84 -18.78,-9.89 -28.06,-15.14 q -43.25,-24.5 -76.54,-56.22 -11.98,-11.41 -24.94,-26.56 -12.76,-14.92 -26.13,-34.48 a 0.43,0.44 56.8 0 1 0.13,-0.61 c 12.12,-7.82 23.12,-17.82 33.81,-29.32 z"}),o.jsx("path",{fill:"#334E68",d:"m -128.82232,-375.77771 a 0.96,0.96 0 0 1 -0.8,-1.51 l 28.86,-41.82 a 3.24,3.2 6.2 0 1 1.45,-1.15 q 0.69,-0.27 3.64,-0.32 15.37,-0.27 46.58,-0.45 12.44,-0.07 19.69,-1.84 c 26.32,-6.42 44.55,-29.39 47.76,-55.67 q 1.05,-8.54 0.87,-20.92 c -0.55,-39.95 0.23,-77.15 -0.1,-117.57 a 0.94,0.95 85.4 0 1 0.81,-0.94 c 35.7,-5.08 70.26,-12.78 104.11,-23.86 q 9.4,-3.07 22.28,-7.05 8.6,-2.65 22.1,-7.58 18.33,-6.69 43.02,-16.74 23.04,-9.38 35.12,-15.34 1.17,-0.58 3.29,0.39 c 14.96,6.81 34.27,13.39 42.79,16.68 q 14.24,5.5 27.59,10.33 23.24,8.41 27.7,10.07 2.01,0.75 9.42,3.41 5.07,1.82 9.47,3.13 40.54,12.1 57.07,16.58 2.54,0.68 4.26,0.82 a 0.48,0.48 0 0 1 0.32,0.79 l -33.68,37.82 a 0.58,0.58 0 0 1 -0.68,0.13 q -3.43,-1.67 -5.84,-2.43 -8.74,-2.79 -47.37,-15.63 -8.92,-2.96 -17.51,-6.16 c -17.92,-6.67 -32.21,-11.74 -65.83,-24.24 -2.89,-1.08 -8.28,-3.56 -11.57,-2.33 -11.44,4.27 -27.67,11.24 -40.6,15.93 q -8.12,2.94 -26.33,9.89 c -21.86,8.35 -43.57,14.34 -67.25,21.47 q -20.07,6.03 -48.78,11.52 a 0.71,0.7 84.6 0 0 -0.57,0.7 q 0.1,95.52 0.1,95.57 c -0.53,30.1 -14.63,58.57 -36,79.25 -10.83,10.49 -23.5,17.98 -37.57,23.68 -10.14,4.1 -18.76,4.57 -31.18,4.79 q -3.1,0.05 -86.64,0.6 z"}),o.jsx("path",{fill:"#C9A227",d:"m 169.86768,-422.45771 q 0.04,-0.4 0.24,-0.59 c 3.41,-3.3 5.96,-6.99 9.56,-10.8 q 10.13,-10.72 15.25,-16.65 2.05,-2.38 5.38,-4.3 a 0.68,0.69 53.4 0 1 0.84,0.12 l 49.51,50.92 a 1.06,1.06 0 0 0 1.52,0 q 17.38,-17.8 26.4,-27.94 c 6.36,-7.14 15.04,-14.76 20.1,-20.56 q 10.29,-11.81 17.14,-18.67 7.41,-7.41 17.44,-18.41 13.85,-15.18 23.56,-24.67 c 3.68,-3.59 5.5,-6.17 8.54,-10.08 2.38,-3.06 4.42,-4.87 8.16,-8.31 6.16,-5.66 10.48,-11.49 16.47,-17.22 6.29,-6.03 12.87,-14.23 18.87,-20.24 q 5.56,-5.56 13.49,-14.45 c 6.79,-7.6 12.13,-13.02 18.46,-19.66 4.83,-5.06 9.88,-11.22 15.21,-16.21 a 1.91,1.91 0 0 1 1.3,-0.51 h 28.15 a 0.83,0.83 0 0 1 0.83,0.82 q 0.28,14.3 0.03,31.53 c -0.07,4.93 -1.9,6.19 -5.19,9.51 -5.86,5.92 -12.79,12.1 -18.21,18.16 q -6.63,7.4 -16.64,16.86 c -2.68,2.53 -6.31,6.91 -8.5,9.17 -8.76,9.01 -14.72,16.05 -22.55,23.36 q -1.37,1.28 -9.09,9.75 -4.93,5.41 -24.32,25.01 c -9.96,10.07 -19.18,20.45 -27.83,28.95 q -11.52,11.33 -20.29,20.96 c -19.16,21.01 -41.14,42.93 -58.64,61.61 q -10.7,11.42 -22.21,22 a 1.97,1.94 24 0 1 -1.38,0.52 q -1.9,-0.06 -3.83,-2.08 c -19.01,-19.93 -45.74,-44.39 -67.08,-67.5 q -5.05,-5.47 -10.42,-9.75 -0.31,-0.24 -0.27,-0.65 z"}),o.jsx("path",{fill:"#5B7B9C",d:"m 351.58768,-544.71771 a 0.41,0.41 0 0 1 0.17,0.69 q -15.9,15.29 -29.64,31.76 a 1.16,1.19 33.7 0 1 -1.44,0.3 c -5.87,-3 -10.72,-6.65 -16.97,-10.42 -17.2,-10.37 -38.83,-14.16 -59.18,-13.16 -12.15,0.6 -23.67,3.62 -34.54,8.11 -5.15,2.13 -9.08,4.66 -14.86,8.63 q -14.63,10.05 -22.02,17.75 -6.98,7.27 -17.47,22.45 c -5.11,7.4 -9.03,15.18 -13.55,23.27 q -5.09,9.08 -10.38,20.93 c -4.39,9.81 -8.53,17.45 -13.72,27.5 q -6,11.58 -11.58,19.91 c -6.74,10.09 -11.32,17.91 -17.68,26.12 -4.94,6.38 -10.92,12.4 -15.22,17.55 q -3.48,4.18 -9.33,9.51 c -20.66,18.83 -45.19,33.15 -72.9,38.24 q -15.17,2.79 -26.21,3.08 -22.84,0.6 -52.01,0.23 a 0.29,0.29 0 0 1 -0.24,-0.43 c 6.02,-10.58 11.85,-19.61 23.29,-37.61 q 2.27,-3.58 5.02,-6.38 a 3.39,3.4 24.3 0 1 2.63,-1 q 16.4,1.07 32.77,-1.23 c 15.39,-2.16 29.33,-7.66 42.1,-15.59 q 4.42,-2.75 14.17,-10.6 3.58,-2.89 14.27,-14.03 6.08,-6.33 9.69,-12.1 c 3.25,-5.19 7.59,-10.59 11.55,-17.24 q 16.77,-28.19 29.52,-56.84 c 4.49,-10.08 8.7,-16.87 15.5,-28.37 q 5.49,-9.29 14.18,-21.09 5.94,-8.07 12.61,-14.76 12.65,-12.7 13.8,-13.72 5.51,-4.84 19.01,-13.66 49.89,-32.59 109.07,-20.31 7.95,1.65 15.41,4.34 14.58,5.25 20.68,8.05 c 10.41,4.78 21.11,12.36 31.15,19.28 a 2.65,2.62 70.1 0 0 0.78,0.37 z"}),o.jsx("path",{fill:"#5B7B9C",d:"m 143.16768,-394.65771 q 0.46,0.11 0.45,0.6 -0.03,2.2 0.62,4.89 2.72,11.27 9.81,22.88 7.25,11.89 15.4,22.7 c 4.71,6.26 10.61,13.06 17.11,18.9 9.38,8.42 15.79,14.58 25.02,21.29 q 13.29,9.65 15.1,10.72 10.62,6.29 20.67,12.58 1.94,1.22 4,1.86 a 2.56,2.59 42.2 0 0 1.81,-0.1 c 7.1,-3.08 12.92,-6.7 21.76,-11.78 q 6.63,-3.81 11.42,-7.45 c 4.56,-3.47 9.98,-6.63 14.83,-10.52 q 18.45,-14.82 32.58,-32 6.8,-8.28 11.17,-16.16 c 7.76,-14.01 13.11,-25.52 16.26,-40.82 1.49,-7.23 1.56,-11.99 2.41,-21.26 a 3.66,3.67 70 0 1 1.06,-2.26 q 9.34,-9.27 20.72,-20.12 c 6.47,-6.15 12.23,-13.51 18.33,-19.07 a 0.67,0.67 0 0 1 1.11,0.43 q 1.92,19.96 1.77,37.52 -0.18,19.95 -4.43,40.76 -3.4,16.65 -11.34,32.24 -0.55,1.09 -4.75,9.06 -3,5.69 -5.08,8.85 c -9.56,14.55 -19.75,27.73 -31.99,39.39 q -7.6,7.24 -9.98,9.35 -10.58,9.37 -24.17,18.04 c -4.91,3.14 -9.19,7.11 -13.77,9.89 q -24.03,14.58 -42.68,23.19 -3.32,1.53 -8.02,-0.31 -1.97,-0.78 -11.41,-5.19 c -8.92,-4.17 -16.04,-8.65 -24.58,-13.03 q -6.75,-3.47 -13.06,-7.8 -18.87,-12.96 -21.03,-14.68 -15.47,-12.4 -29.21,-26.05 -5.39,-5.35 -13.86,-16.13 -6.45,-8.2 -14.56,-19.38 c -3.42,-4.72 -6.19,-10.2 -9.49,-14.45 a 1.33,1.32 44.2 0 1 -0.03,-1.59 c 5.8,-7.95 10.64,-13.7 15.23,-21.14 q 8.66,-14.03 14.39,-23.68 a 0.38,0.39 23.4 0 1 0.41,-0.17 z"})]})})}function Is({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"custom-action",children:[o.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),o.jsx("path",{d:"M9 8.5c0-1 .7-1.5 1.5-1.5S12 7.5 12 8.5c0 1.2-3 1.2-3 3.2"}),o.jsx("path",{d:"M10.5 14v.5"}),o.jsx("path",{d:"M15 10v4"}),o.jsx("path",{d:"M13 12h4"})]})}function Bs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-color",children:[o.jsx("path",{d:"M6 18L12 4l6 14"}),o.jsx("path",{d:"M8.5 13h7"})]})}function Hs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-properties",children:[o.jsx("path",{d:"M4 20h4"}),o.jsx("path",{d:"M6 20V6"}),o.jsx("path",{d:"M4 6h4"}),o.jsx("path",{d:"M12 20V9"}),o.jsx("path",{d:"M12 9h8"}),o.jsx("path",{d:"M16 9v11"})]})}function Os({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"fullscreen",children:[o.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),o.jsx("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),o.jsx("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),o.jsx("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]})}function zs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"highlight-color",children:[o.jsx("path",{d:"M15.5 4.5l4 4-9 9H6.5v-4.5z"}),o.jsx("path",{d:"M13.5 6.5l4 4"}),o.jsx("path",{d:"M4 20h8"})]})}function Ks({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"html",children:[o.jsx("path",{d:"M8 8l-4 4 4 4"}),o.jsx("path",{d:"M16 8l4 4-4 4"})]})}function Ra({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"image",children:[o.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),o.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),o.jsx("path",{d:"m21 15-4.5-4.5L7 20"})]})}function $s({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"indent",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M12 12h8"}),o.jsx("path",{d:"M4 18h16"}),o.jsx("path",{d:"M4 9l4 3-4 3"})]})}function Us({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"italic",children:[o.jsx("path",{d:"M10 4h9"}),o.jsx("path",{d:"M5 20h9"}),o.jsx("path",{d:"M14 4L8 20"})]})}function Ws({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"link",children:[o.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function qs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"menu",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M4 18h16"})]})}function _a({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"numbered-list",children:[o.jsx("path",{d:"M10 6h11"}),o.jsx("path",{d:"M10 12h11"}),o.jsx("path",{d:"M10 18h11"}),o.jsx("path",{d:"M4 5v3h2"}),o.jsx("path",{d:"M4 11h2l-2 2h2"}),o.jsx("path",{d:"M4 19h2"}),o.jsx("path",{d:"M4 17h2v2"})]})}function Gs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"open",children:[o.jsx("path",{d:"M3 7h6l2 2h10v3"}),o.jsx("path",{d:"M3 10l2.2 9h13.6L21 10H3z"})]})}function Vs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"outdent",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M12 12h8"}),o.jsx("path",{d:"M4 18h16"}),o.jsx("path",{d:"M8 9l-4 3 4 3"})]})}function Xs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"page-properties",children:[o.jsx("path",{d:"M6 3h8l6 6v12H6z"}),o.jsx("path",{d:"M14 3v6h6"})]})}function Ys({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"paragraph-properties",children:[o.jsx("path",{d:"M13 4H9a4 4 0 0 0 0 8h2"}),o.jsx("path",{d:"M15 4v16"}),o.jsx("path",{d:"M11 4v16"})]})}function Js({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"plus",children:[o.jsx("path",{d:"M12 5v14"}),o.jsx("path",{d:"M5 12h14"})]})}function Zs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"print",children:[o.jsx("path",{d:"M6 9V3h12v6"}),o.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M6 14h12v8H6z"})]})}function Qs({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"redo",children:[o.jsx("path",{d:"M21 10H10a5 5 0 0 0 0 10h1"}),o.jsx("path",{d:"M17 6l4 4-4 4"})]})}function ec({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"row-properties",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function tc({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"save",children:[o.jsx("path",{d:"M5 3h11l5 5v13H5V3z"}),o.jsx("path",{d:"M15 3v6H9V3"}),o.jsx("path",{d:"M8 21v-7h8v7"})]})}function Vr({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table-column",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("path",{d:"M9 4v16"}),o.jsx("path",{d:"M15 4v16"}),o.jsx("rect",{x:"9.5",y:"5",width:"5",height:"14",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Bi({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("path",{d:"M9 4v16"}),o.jsx("path",{d:"M15 4v16"})]})}function Xr({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table-row",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("rect",{x:"4",y:"10.5",width:"16",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function nc({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"strikethrough",children:[o.jsx("path",{d:"M6 7.5C6 5.5 8 4 12 4s6 1.5 6 3.5-1.8 2.8-6 3.5"}),o.jsx("path",{d:"M6 16.5C6 18.5 8 20 12 20s6-1.5 6-3.5c0-1-.5-1.8-1.8-2.5"}),o.jsx("path",{d:"M4 12h16"})]})}function rc({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"underline",children:[o.jsx("path",{d:"M7 4v8a5 5 0 0 0 10 0V4"}),o.jsx("path",{d:"M5 20h14"})]})}function oc({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"undo",children:[o.jsx("path",{d:"M3 10h11a5 5 0 0 1 0 10h-1"}),o.jsx("path",{d:"M7 6L3 10l4 4"})]})}function ic({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"visual",children:[o.jsx("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}const be="---";function Qe(e){return e===be}function an(e){return typeof e=="object"&&e!==null&&"submenu"in e}const To=new Set(["save","open","print","undo","redo","link","bookmark","visual","html","fullscreen","bold","italic","underline","strikethrough","clearFormatting","fontSize","fontFamily","paragraphStyle","fontProperties","paragraphProperties","pageProperties","imageProperties","fontColor","highlightColor","alignLeft","alignCenter","alignRight","alignJustify","indent","outdent","bulletList","numberedList"]),ac=new Set(["file","edit","insert","view","format"]),Fa="custom",Ia="custom";function Ba(e){return`custom:${e}`}function lc(e){return e==="menu"||e==="both"}function sc(e){return e==="toolbar"||e==="both"}function Ha(e){return e.map(t=>an(t)?{submenu:t.submenu,items:Ha(t.items)}:t)}function cc(e){return{menus:e.menus.map(t=>({id:t.id,items:Ha(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function Oa(e){return Qe(e)?!0:an(e)?e.items.every(Oa):To.has(e)}function za(e,t){for(const n of e)if(n===t||an(n)&&za(n.items,t))return!0;return!1}function uc(e){const t=e.tooltip??e.label;return{id:e.id,command:Ba(e.id),icon:e.icon??Is,label:e.label,ariaLabel:e.label,tooltip:t}}function dc(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!ac.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===Fa&&!r)e.menus[n]={id:n,labelKey:"menuCustom",ariaKey:"menuCustomAria"};else{const i=r??n;e.menus[n]={id:n,label:i,ariaLabel:i}}t.menus.some(i=>i.id===n)||t.menus.push({id:n,items:[]})}function mc(e,t,n){e.groups[n]||(n===Ia?e.groups[n]={id:n,labelKey:"toolbarGroupCustom"}:e.groups[n]={id:n,label:n}),t.iconGroups.some(r=>r.id===n)||t.iconGroups.push({id:n,items:[]})}function fc(e,t,n){var a,l;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},i=cc(n);for(const c of e??[])if(!(To.has(c.id)||Qe(c.id))){if(r.items[c.id]=uc(c),lc(c.showIn)){const m=((a=c.menu)==null?void 0:a.id)??Fa;dc(r,i,m,(l=c.menu)==null?void 0:l.label);const p=i.menus.find(b=>b.id===m);if(p&&!za(p.items,c.id)){const b=p.items[p.items.length-1];b!==void 0&&!Qe(b)&&p.items.every(Oa)&&p.items.push(be),p.items.push(c.id)}}if(sc(c.showIn)){const m=c.toolbarGroup??Ia;mc(r,i,m);const p=i.iconGroups.find(b=>b.id===m);p&&!p.items.includes(c.id)&&p.items.push(c.id)}}return{catalog:r,layout:i}}function pc(e,t){const n={};for(const r of e??[])To.has(r.id)||Qe(r.id)||(n[Ba(r.id)]=()=>r.onAction(t()));return n}function hc(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}function Mo(e,t){const n=e[t];n==null||n()}const Ro={modeVisual:"Visual",modeHtml:"HTML",modeVisualAria:"Switch to visual mode",modeHtmlAria:"Switch to HTML mode",modeFullscreen:"Full screen",modeFullscreenAria:"Toggle full screen",exitFullscreenAria:"Exit full screen",visualEditorAria:"Visual editor",htmlEditorAria:"HTML editor",menuFile:"File",menuFileAria:"File menu",menuEdit:"Edit",menuEditAria:"Edit menu",menuInsert:"Insert",menuInsertAria:"Insert menu",menuView:"View",menuViewAria:"View menu",menuFormat:"Format",menuFormatAria:"Format menu",menuFont:"Fonts",menuFontAria:"Fonts submenu",menuParagraph:"Paragraph",menuParagraphAria:"Paragraph submenu",menuParagraphStyles:"Paragraph styles",menuParagraphStylesAria:"Paragraph styles submenu",menuPage:"Page",menuPageAria:"Page submenu",menuImage:"Image",menuImageAria:"Image properties",menuInsertRow:"Row",menuInsertRowAria:"Insert or delete row",menuInsertColumn:"Column",menuInsertColumnAria:"Insert or delete column",menuTable:"Table",menuTableAria:"Table properties",menuCustom:"Custom",menuCustomAria:"Custom menu",menuHamburgerAria:"Open menu",menuCloseAria:"Close menu",menuOverlayAria:"Editor menu",brandMarkAria:"CommsPliant HTML editor",commandSave:"Save",commandSaveAria:"Save as HTML file",commandOpen:"Open",commandOpenAria:"Open HTML file",commandPrint:"Print",commandPrintAria:"Print document",commandUndo:"Undo",commandUndoAria:"Undo",commandRedo:"Redo",commandRedoAria:"Redo",commandCut:"Cut",commandCutAria:"Cut",commandCopy:"Copy",commandCopyAria:"Copy",commandDelete:"Delete",commandDeleteAria:"Delete",commandLink:"Link",commandLinkAria:"Link",commandBookmark:"Bookmark",commandBookmarkAria:"Bookmark",commandImage:"Image",commandImageAria:"Insert image",commandImageProperties:"Image properties…",commandImagePropertiesAria:"Image properties",commandTable:"Table",commandTableAria:"Insert table",commandTableProperties:"Table properties…",commandTablePropertiesAria:"Table properties",commandCellProperties:"Cell properties…",commandCellPropertiesAria:"Cell properties",commandRowProperties:"Row properties…",commandRowPropertiesAria:"Row properties",commandInsertRowBelow:"Add below",commandInsertRowBelowAria:"Add row below",commandInsertRowBefore:"Add before",commandInsertRowBeforeAria:"Add row before",commandDeleteRow:"Delete",commandDeleteRowAria:"Delete row",commandInsertColumnAfter:"Add after",commandInsertColumnAfterAria:"Add column after",commandInsertColumnBefore:"Add before",commandInsertColumnBeforeAria:"Add column before",commandDeleteColumn:"Delete",commandDeleteColumnAria:"Delete column",contextMenuAria:"Editor context menu",commandBold:"Bold",commandBoldAria:"Bold",commandItalic:"Italic",commandItalicAria:"Italic",commandUnderline:"Underline",commandUnderlineAria:"Underline",commandStrikethrough:"Strikethrough",commandStrikethroughAria:"Strikethrough",commandClearFormatting:"Reset formatting",commandClearFormattingAria:"Reset formatting",commandFontSize:"Font size",commandFontSizeAria:"Font size",commandFontSizeUnitAria:"Font size unit",commandFontFamily:"Font",commandFontFamilyAria:"Font family",commandFontProperties:"Font properties…",commandFontPropertiesAria:"Font properties",commandParagraphProperties:"Paragraph properties…",commandParagraphPropertiesAria:"Paragraph properties",commandPageProperties:"Page properties…",commandPagePropertiesAria:"Page properties",commandFontColor:"Font color",commandFontColorAria:"Font color",commandHighlightColor:"Highlight color",commandHighlightColorAria:"Highlight color",commandParagraphStyle:"Styles",commandParagraphStyleAria:"Paragraph styles",commandAlignLeft:"Align left",commandAlignLeftAria:"Align left",commandAlignCenter:"Align center",commandAlignCenterAria:"Align center",commandAlignRight:"Align right",commandAlignRightAria:"Align right",commandAlignJustify:"Justify",commandAlignJustifyAria:"Justify",commandIndent:"Increase indent",commandIndentAria:"Increase indent",commandOutdent:"Decrease indent",commandOutdentAria:"Decrease indent",commandBulletList:"Bullet list",commandBulletListAria:"Bullet list",commandNumberedList:"Numbered list",commandNumberedListAria:"Numbered list",styleParagraph:"Paragraph",styleHeading1:"Heading 1",styleHeading2:"Heading 2",styleHeading3:"Heading 3",styleHeading4:"Heading 4",styleHeading5:"Heading 5",styleHeading6:"Heading 6",styleAddNew:"Add new",styleAddNewAria:"Add new paragraph style",customStyleDialogAddTitle:"Add paragraph style",customStyleDialogEditTitle:"Edit paragraph style",customStyleDialogTabFont:"Font",customStyleDialogTabParagraph:"Paragraph",customStyleDialogName:"Name",customStyleDialogDelete:"Delete",customStyleDialogDeleteConfirm:"Delete this paragraph style?",customStyleDialogCloseAria:"Close",customStyleLoading:"Loading paragraph styles",colorAutomatic:"Automatic",colorNone:"No color",colorCustom:"Custom color",colorHex:"Hex",colorRgbR:"R",colorRgbG:"G",colorRgbB:"B",colorPickFromScreen:"Pick from screen",colorRecent:"Recent colors",fontDialogTitle:"Font properties",fontDialogTabGeneral:"General",fontDialogFamily:"Font",fontFamilyDefault:"Default",fontDialogSize:"Size",fontDialogUnit:"Unit",fontDialogStyle:"Style",fontDialogOk:"OK",fontDialogCancel:"Cancel",linkDialogTitle:"Insert link",linkDialogTabLink:"Link",linkDialogTabBookmark:"Bookmark",linkDialogHref:"URL",linkDialogHoverTitle:"Title",linkDialogTargetBlank:"Open in a new tab",linkDialogTextDecorationNone:"No underline",linkDialogHover:"On hover",linkDialogHoverColor:"Color",linkDialogHoverColorField:"Hover color",linkDialogHoverHtml:"HTML",linkDialogHoverHtmlAria:"Custom hover HTML",linkDialogBookmark:"Bookmark",linkDialogBookmarkEmpty:"No bookmarks in this document.",linkDialogSelect:"Select",bookmarkDialogTitle:"Insert bookmark",bookmarkDialogName:"Bookmark name",bookmarkDialogHelp:"Start with a letter. Use only letters, numbers, hyphens, and underscores. Must be unique in the document.",bookmarkDialogHelpAria:"Bookmark name format",bookmarkDialogCloseAria:"Close",bookmarkDialogErrorEmpty:"Enter a bookmark name.",bookmarkDialogErrorInvalid:"Start with a letter. Use only letters, numbers, hyphens, and underscores.",bookmarkDialogErrorDuplicate:"A bookmark with this name already exists.",imageDialogTitle:"Insert image",imageDialogSource:"Source",imageDialogFile:"File",imageDialogChooseFile:"Choose file",imageDialogUrl:"Image URL",imageDialogAlt:"Alt text",imageDialogTitleField:"Title",imageDialogCloseAria:"Close",imageDialogErrorEmpty:"Choose a file or enter an image URL.",imageDialogErrorInvalid:"Enter a valid image URL.",imageDialogErrorType:"Use a JPEG, PNG, GIF, WebP, BMP, or AVIF image.",imageDialogErrorTooLarge:"Choose an image smaller than 2 MB.",imagePropertiesDialogTitle:"Image properties",imagePropertiesDialogCloseAria:"Close",imagePropertiesTabAlignment:"Alignment",imagePropertiesTabBorder:"Border & margin",imagePropertiesTabAdvanced:"Advanced",imagePropertiesTabHover:"Hover",imagePropertiesSize:"Size",imagePropertiesSizeMode:"Size mode",imagePropertiesSizeWidth:"Width only",imagePropertiesSizeHeight:"Height only",imagePropertiesSizeLock:"Lock together",imagePropertiesWidth:"Width",imagePropertiesHeight:"Height",imagePropertiesWidthAria:"Image width",imagePropertiesHeightAria:"Image height",imagePropertiesSizeUnitAria:"Image size unit",imagePropertiesFit:"Fit",imagePropertiesFitDefault:"Default",imagePropertiesFitFill:"Fill",imagePropertiesFitContain:"Contain",imagePropertiesFitCover:"Cover",imagePropertiesFitNoneValue:"None",imagePropertiesFitScaleDown:"Scale down",imagePropertiesPosition:"Position",imagePropertiesPositionDefault:"Default",imagePropertiesPositionCenter:"Center",imagePropertiesPositionTop:"Top",imagePropertiesPositionBottom:"Bottom",imagePropertiesPositionLeft:"Left",imagePropertiesPositionRight:"Right",imagePropertiesPositionTopLeft:"Top left",imagePropertiesPositionTopRight:"Top right",imagePropertiesPositionBottomLeft:"Bottom left",imagePropertiesPositionBottomRight:"Bottom right",imagePropertiesRotation:"Rotation",imagePropertiesRotationUnit:"deg",imagePropertiesHoverCss:"Hover CSS",imagePropertiesHoverCssAria:"Custom hover CSS",imagePropertiesHoverHelp:"CSS applied when the pointer is over the image.",imageResizeHandleEastAria:"Resize image width, keep aspect ratio",imageResizeHandleSouthAria:"Resize image height, keep aspect ratio",imageResizeHandleSouthEastAria:"Resize image freely",tableDialogTitle:"Insert table",tableDialogCloseAria:"Close",tableDialogRows:"Rows",tableDialogColumns:"Columns",tableDialogSize:"Size",tableDialogGridAria:"Table size grid",tableDialogInsert:"Insert",tablePropertiesDialogTitle:"Table properties",tablePropertiesDialogCloseAria:"Close",tablePropertiesCollapse:"Border collapse",tablePropertiesCollapseCollapse:"Collapse",tablePropertiesCollapseSeparate:"Separate",tablePropertiesSpacing:"Border spacing",tablePropertiesWidth:"Width",cellPropertiesDialogTitle:"Cell properties",cellPropertiesDialogCloseAria:"Close",cellPropertiesColor:"Text color",cellPropertiesVerticalAlign:"Vertical align",cellPropertiesVerticalAlignDefault:"Default",cellPropertiesVerticalAlignTop:"Top",cellPropertiesVerticalAlignMiddle:"Middle",cellPropertiesVerticalAlignBottom:"Bottom",cellPropertiesVerticalAlignBaseline:"Baseline",cellPropertiesWidth:"Width",rowPropertiesDialogTitle:"Row properties",rowPropertiesDialogCloseAria:"Close",rowPropertiesHeight:"Height",paragraphDialogTitle:"Paragraph properties",pageDialogTitle:"Page properties",paragraphDialogTabBorder:"Border",paragraphDialogTabBackground:"Background",paragraphDialogAlignment:"Alignment",paragraphDialogLists:"Lists",paragraphDialogSpacing:"Spacing",paragraphDialogMargin:"Margin",paragraphDialogPadding:"Padding",paragraphDialogLineHeight:"Line height",paragraphDialogLineHeightNormal:"Normal",paragraphDialogLineHeightUnitless:"×",paragraphDialogLinkSides:"Same on all sides",paragraphDialogSideTop:"Top",paragraphDialogSideRight:"Right",paragraphDialogSideBottom:"Bottom",paragraphDialogSideLeft:"Left",paragraphDialogBorder:"Border",paragraphDialogBorderStyle:"Style",paragraphDialogBorderWidth:"Width",paragraphDialogBorderColor:"Color",paragraphDialogBorderRadius:"Corner radius",paragraphDialogBoxShadow:"Box shadow",paragraphDialogShadowOffsetX:"Offset X",paragraphDialogShadowOffsetY:"Offset Y",paragraphDialogShadowBlur:"Blur",paragraphDialogShadowSpread:"Spread",paragraphDialogShadowColor:"Color",paragraphDialogShadowInset:"Inset",paragraphDialogLengthUnitAria:"Unit",paragraphDialogBorderStyleNone:"None",paragraphDialogBorderStyleSolid:"Solid",paragraphDialogBorderStyleDotted:"Dotted",paragraphDialogBorderStyleDashed:"Dashed",paragraphDialogBorderStyleDouble:"Double",paragraphDialogBorderStyleGroove:"Groove",paragraphDialogBorderStyleRidge:"Ridge",paragraphDialogBorderStyleInset:"Inset",paragraphDialogBorderStyleOutset:"Outset",paragraphDialogBackgroundColor:"Background color",paragraphDialogOpacity:"Opacity",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Formatting toolbar",toolbarGroupFile:"File",toolbarGroupPrint:"Print",toolbarGroupEdit:"Edit",toolbarGroupInsert:"Insert",toolbarGroupFont:"Fonts",toolbarGroupAlign:"Align",toolbarGroupParagraph:"Paragraph",toolbarGroupView:"View",toolbarGroupCustom:"Custom",toolbarScrollLeftAria:"Scroll toolbar left",toolbarScrollRightAria:"Scroll toolbar right"},gc={modeVisual:"Visual",modeHtml:"HTML",modeVisualAria:"Cambiar al modo visual",modeHtmlAria:"Cambiar al modo HTML",modeFullscreen:"Pantalla completa",modeFullscreenAria:"Activar o desactivar pantalla completa",exitFullscreenAria:"Salir de pantalla completa",visualEditorAria:"Editor visual",htmlEditorAria:"Editor HTML",menuFile:"Archivo",menuFileAria:"Menú Archivo",menuEdit:"Editar",menuEditAria:"Menú Editar",menuInsert:"Insertar",menuInsertAria:"Menú Insertar",menuView:"Vista",menuViewAria:"Menú Vista",menuFormat:"Formato",menuFormatAria:"Menú Formato",menuFont:"Fuentes",menuFontAria:"Submenú Fuentes",menuParagraph:"Párrafo",menuParagraphAria:"Submenú Párrafo",menuParagraphStyles:"Estilos de párrafo",menuParagraphStylesAria:"Submenú Estilos de párrafo",menuPage:"Página",menuPageAria:"Submenú Página",menuImage:"Imagen",menuImageAria:"Propiedades de imagen",menuInsertRow:"Fila",menuInsertRowAria:"Insertar o eliminar fila",menuInsertColumn:"Columna",menuInsertColumnAria:"Insertar o eliminar columna",menuTable:"Tabla",menuTableAria:"Propiedades de tabla",menuCustom:"Personalizado",menuCustomAria:"Menú personalizado",menuHamburgerAria:"Abrir menú",menuCloseAria:"Cerrar menú",menuOverlayAria:"Menú del editor",brandMarkAria:"Editor HTML de CommsPliant",commandSave:"Guardar",commandSaveAria:"Guardar como archivo HTML",commandOpen:"Abrir",commandOpenAria:"Abrir archivo HTML",commandPrint:"Imprimir",commandPrintAria:"Imprimir documento",commandUndo:"Deshacer",commandUndoAria:"Deshacer",commandRedo:"Rehacer",commandRedoAria:"Rehacer",commandCut:"Cortar",commandCutAria:"Cortar",commandCopy:"Copiar",commandCopyAria:"Copiar",commandDelete:"Eliminar",commandDeleteAria:"Eliminar",commandLink:"Enlace",commandLinkAria:"Enlace",commandBookmark:"Marcador",commandBookmarkAria:"Marcador",commandImage:"Imagen",commandImageAria:"Insertar imagen",commandImageProperties:"Propiedades de imagen…",commandImagePropertiesAria:"Propiedades de imagen",commandTable:"Tabla",commandTableAria:"Insertar tabla",commandTableProperties:"Propiedades de tabla…",commandTablePropertiesAria:"Propiedades de tabla",commandCellProperties:"Propiedades de celda…",commandCellPropertiesAria:"Propiedades de celda",commandRowProperties:"Propiedades de fila…",commandRowPropertiesAria:"Propiedades de fila",commandInsertRowBelow:"Añadir debajo",commandInsertRowBelowAria:"Añadir fila debajo",commandInsertRowBefore:"Añadir antes",commandInsertRowBeforeAria:"Añadir fila antes",commandDeleteRow:"Eliminar",commandDeleteRowAria:"Eliminar fila",commandInsertColumnAfter:"Añadir después",commandInsertColumnAfterAria:"Añadir columna después",commandInsertColumnBefore:"Añadir antes",commandInsertColumnBeforeAria:"Añadir columna antes",commandDeleteColumn:"Eliminar",commandDeleteColumnAria:"Eliminar columna",contextMenuAria:"Menú contextual del editor",commandBold:"Negrita",commandBoldAria:"Negrita",commandItalic:"Cursiva",commandItalicAria:"Cursiva",commandUnderline:"Subrayado",commandUnderlineAria:"Subrayado",commandStrikethrough:"Tachado",commandStrikethroughAria:"Tachado",commandClearFormatting:"Restablecer formato",commandClearFormattingAria:"Restablecer formato",commandFontSize:"Tamaño de fuente",commandFontSizeAria:"Tamaño de fuente",commandFontSizeUnitAria:"Unidad de tamaño de fuente",commandFontFamily:"Fuente",commandFontFamilyAria:"Familia tipográfica",commandFontProperties:"Propiedades de fuente…",commandFontPropertiesAria:"Propiedades de fuente",commandParagraphProperties:"Propiedades de párrafo…",commandParagraphPropertiesAria:"Propiedades de párrafo",commandPageProperties:"Propiedades de página…",commandPagePropertiesAria:"Propiedades de página",commandFontColor:"Color de fuente",commandFontColorAria:"Color de fuente",commandHighlightColor:"Color de resaltado",commandHighlightColorAria:"Color de resaltado",commandParagraphStyle:"Estilos",commandParagraphStyleAria:"Estilos de párrafo",commandAlignLeft:"Alinear a la izquierda",commandAlignLeftAria:"Alinear a la izquierda",commandAlignCenter:"Alinear al centro",commandAlignCenterAria:"Alinear al centro",commandAlignRight:"Alinear a la derecha",commandAlignRightAria:"Alinear a la derecha",commandAlignJustify:"Justificar",commandAlignJustifyAria:"Justificar",commandIndent:"Aumentar sangría",commandIndentAria:"Aumentar sangría",commandOutdent:"Disminuir sangría",commandOutdentAria:"Disminuir sangría",commandBulletList:"Lista con viñetas",commandBulletListAria:"Lista con viñetas",commandNumberedList:"Lista numerada",commandNumberedListAria:"Lista numerada",styleParagraph:"Párrafo",styleHeading1:"Encabezado 1",styleHeading2:"Encabezado 2",styleHeading3:"Encabezado 3",styleHeading4:"Encabezado 4",styleHeading5:"Encabezado 5",styleHeading6:"Encabezado 6",styleAddNew:"Añadir nuevo",styleAddNewAria:"Añadir un estilo de párrafo",customStyleDialogAddTitle:"Añadir estilo de párrafo",customStyleDialogEditTitle:"Editar estilo de párrafo",customStyleDialogTabFont:"Fuente",customStyleDialogTabParagraph:"Párrafo",customStyleDialogName:"Nombre",customStyleDialogDelete:"Eliminar",customStyleDialogDeleteConfirm:"¿Eliminar este estilo de párrafo?",customStyleDialogCloseAria:"Cerrar",customStyleLoading:"Cargando estilos de párrafo",colorAutomatic:"Automático",colorNone:"Sin color",colorCustom:"Color personalizado",colorHex:"Hex",colorRgbR:"R",colorRgbG:"G",colorRgbB:"B",colorPickFromScreen:"Seleccionar de la pantalla",colorRecent:"Colores recientes",fontDialogTitle:"Propiedades de fuente",fontDialogTabGeneral:"General",fontDialogFamily:"Fuente",fontFamilyDefault:"Predeterminada",fontDialogSize:"Tamaño",fontDialogUnit:"Unidad",fontDialogStyle:"Estilo",fontDialogOk:"Aceptar",fontDialogCancel:"Cancelar",linkDialogTitle:"Insertar enlace",linkDialogTabLink:"Enlace",linkDialogTabBookmark:"Marcador",linkDialogHref:"URL",linkDialogHoverTitle:"Título",linkDialogTargetBlank:"Abrir en una pestaña nueva",linkDialogTextDecorationNone:"Sin subrayado",linkDialogHover:"Al pasar el cursor",linkDialogHoverColor:"Color",linkDialogHoverColorField:"Color al pasar el cursor",linkDialogHoverHtml:"HTML",linkDialogHoverHtmlAria:"HTML personalizado al pasar el cursor",linkDialogBookmark:"Marcador",linkDialogBookmarkEmpty:"No hay marcadores en este documento.",linkDialogSelect:"Seleccionar",bookmarkDialogTitle:"Insertar marcador",bookmarkDialogName:"Nombre del marcador",bookmarkDialogHelp:"Empieza por una letra. Usa solo letras, números, guiones y guiones bajos. Debe ser único en el documento.",bookmarkDialogHelpAria:"Formato del nombre del marcador",bookmarkDialogCloseAria:"Cerrar",bookmarkDialogErrorEmpty:"Introduce un nombre de marcador.",bookmarkDialogErrorInvalid:"Empieza por una letra. Usa solo letras, números, guiones y guiones bajos.",bookmarkDialogErrorDuplicate:"Ya existe un marcador con este nombre.",imageDialogTitle:"Insertar imagen",imageDialogSource:"Origen",imageDialogFile:"Archivo",imageDialogChooseFile:"Elegir archivo",imageDialogUrl:"URL de la imagen",imageDialogAlt:"Texto alternativo",imageDialogTitleField:"Título",imageDialogCloseAria:"Cerrar",imageDialogErrorEmpty:"Elige un archivo o introduce una URL de imagen.",imageDialogErrorInvalid:"Introduce una URL de imagen válida.",imageDialogErrorType:"Usa una imagen JPEG, PNG, GIF, WebP, BMP o AVIF.",imageDialogErrorTooLarge:"Elige una imagen de menos de 2 MB.",imagePropertiesDialogTitle:"Propiedades de imagen",imagePropertiesDialogCloseAria:"Cerrar",imagePropertiesTabAlignment:"Alineación",imagePropertiesTabBorder:"Borde y margen",imagePropertiesTabAdvanced:"Avanzado",imagePropertiesTabHover:"Al pasar el puntero",imagePropertiesSize:"Tamaño",imagePropertiesSizeMode:"Modo de tamaño",imagePropertiesSizeWidth:"Solo ancho",imagePropertiesSizeHeight:"Solo alto",imagePropertiesSizeLock:"Bloquear juntos",imagePropertiesWidth:"Ancho",imagePropertiesHeight:"Alto",imagePropertiesWidthAria:"Ancho de la imagen",imagePropertiesHeightAria:"Alto de la imagen",imagePropertiesSizeUnitAria:"Unidad de tamaño de imagen",imagePropertiesFit:"Ajuste",imagePropertiesFitDefault:"Predeterminado",imagePropertiesFitFill:"Rellenar",imagePropertiesFitContain:"Contener",imagePropertiesFitCover:"Cubrir",imagePropertiesFitNoneValue:"Ninguno",imagePropertiesFitScaleDown:"Reducir",imagePropertiesPosition:"Posición",imagePropertiesPositionDefault:"Predeterminada",imagePropertiesPositionCenter:"Centro",imagePropertiesPositionTop:"Arriba",imagePropertiesPositionBottom:"Abajo",imagePropertiesPositionLeft:"Izquierda",imagePropertiesPositionRight:"Derecha",imagePropertiesPositionTopLeft:"Arriba izquierda",imagePropertiesPositionTopRight:"Arriba derecha",imagePropertiesPositionBottomLeft:"Abajo izquierda",imagePropertiesPositionBottomRight:"Abajo derecha",imagePropertiesRotation:"Rotación",imagePropertiesRotationUnit:"deg",imagePropertiesHoverCss:"CSS al pasar el puntero",imagePropertiesHoverCssAria:"CSS personalizado al pasar el puntero",imagePropertiesHoverHelp:"CSS que se aplica cuando el puntero está sobre la imagen.",imageResizeHandleEastAria:"Redimensionar el ancho de la imagen, mantener la proporción",imageResizeHandleSouthAria:"Redimensionar el alto de la imagen, mantener la proporción",imageResizeHandleSouthEastAria:"Redimensionar la imagen sin mantener la proporción",tableDialogTitle:"Insertar tabla",tableDialogCloseAria:"Cerrar",tableDialogRows:"Filas",tableDialogColumns:"Columnas",tableDialogSize:"Tamaño",tableDialogGridAria:"Cuadrícula de tamaño de tabla",tableDialogInsert:"Insertar",tablePropertiesDialogTitle:"Propiedades de tabla",tablePropertiesDialogCloseAria:"Cerrar",tablePropertiesCollapse:"Contracción de bordes",tablePropertiesCollapseCollapse:"Contraídos",tablePropertiesCollapseSeparate:"Separados",tablePropertiesSpacing:"Espaciado de bordes",tablePropertiesWidth:"Ancho",cellPropertiesDialogTitle:"Propiedades de celda",cellPropertiesDialogCloseAria:"Cerrar",cellPropertiesColor:"Color de texto",cellPropertiesVerticalAlign:"Alineación vertical",cellPropertiesVerticalAlignDefault:"Predeterminada",cellPropertiesVerticalAlignTop:"Arriba",cellPropertiesVerticalAlignMiddle:"Centro",cellPropertiesVerticalAlignBottom:"Abajo",cellPropertiesVerticalAlignBaseline:"Línea base",cellPropertiesWidth:"Ancho",rowPropertiesDialogTitle:"Propiedades de fila",rowPropertiesDialogCloseAria:"Cerrar",rowPropertiesHeight:"Alto",paragraphDialogTitle:"Propiedades de párrafo",pageDialogTitle:"Propiedades de página",paragraphDialogTabBorder:"Borde",paragraphDialogTabBackground:"Fondo",paragraphDialogAlignment:"Alineación",paragraphDialogLists:"Listas",paragraphDialogSpacing:"Espaciado",paragraphDialogMargin:"Margen",paragraphDialogPadding:"Relleno",paragraphDialogLineHeight:"Interlineado",paragraphDialogLineHeightNormal:"Normal",paragraphDialogLineHeightUnitless:"×",paragraphDialogLinkSides:"Igual en todos los lados",paragraphDialogSideTop:"Superior",paragraphDialogSideRight:"Derecho",paragraphDialogSideBottom:"Inferior",paragraphDialogSideLeft:"Izquierdo",paragraphDialogBorder:"Borde",paragraphDialogBorderStyle:"Estilo",paragraphDialogBorderWidth:"Grosor",paragraphDialogBorderColor:"Color",paragraphDialogBorderRadius:"Radio de esquina",paragraphDialogBoxShadow:"Sombra",paragraphDialogShadowOffsetX:"Desplazamiento X",paragraphDialogShadowOffsetY:"Desplazamiento Y",paragraphDialogShadowBlur:"Desenfoque",paragraphDialogShadowSpread:"Extensión",paragraphDialogShadowColor:"Color",paragraphDialogShadowInset:"Interior",paragraphDialogLengthUnitAria:"Unidad",paragraphDialogBorderStyleNone:"Ninguno",paragraphDialogBorderStyleSolid:"Sólido",paragraphDialogBorderStyleDotted:"Punteado",paragraphDialogBorderStyleDashed:"Discontinuo",paragraphDialogBorderStyleDouble:"Doble",paragraphDialogBorderStyleGroove:"Surco",paragraphDialogBorderStyleRidge:"Relieve",paragraphDialogBorderStyleInset:"Hundido",paragraphDialogBorderStyleOutset:"Saliente",paragraphDialogBackgroundColor:"Color de fondo",paragraphDialogOpacity:"Opacidad",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Barra de herramientas",toolbarGroupFile:"Archivo",toolbarGroupPrint:"Imprimir",toolbarGroupEdit:"Editar",toolbarGroupInsert:"Insertar",toolbarGroupFont:"Fuentes",toolbarGroupAlign:"Alinear",toolbarGroupParagraph:"Párrafo",toolbarGroupView:"Vista",toolbarGroupCustom:"Personalizado",toolbarScrollLeftAria:"Desplazar la barra a la izquierda",toolbarScrollRightAria:"Desplazar la barra a la derecha"},bc={en:Ro,es:gc},Ka=s.createContext(e=>Ro[e]);function yc({locale:e="en",children:t}){const n=s.useMemo(()=>{const r=bc[e]??Ro;return i=>r[i]},[e]);return o.jsx(Ka.Provider,{value:n,children:t})}function V(){return s.useContext(Ka)}const xc="_menu_uy4s1_1",wc="_item_uy4s1_17",Sc="_separator_uy4s1_57",Yr={menu:xc,item:wc,separator:Sc},Nn=8,kc=[{type:"item",command:"deleteSelection",labelKey:"commandDelete",ariaKey:"commandDeleteAria",enabled:e=>e==="text"||e==="image"},{type:"item",command:"cut",labelKey:"commandCut",ariaKey:"commandCutAria",enabled:e=>e==="text"||e==="image"},{type:"item",command:"copy",labelKey:"commandCopy",ariaKey:"commandCopyAria",enabled:e=>e==="text"||e==="image"},{type:"separator"},{type:"item",command:"openLinkDialog",labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:e=>e!=="image"},{type:"separator"},{type:"item",command:"openFontProperties",labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openParagraphProperties",labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openImageProperties",labelKey:"commandImageProperties",ariaKey:"commandImagePropertiesAria",enabled:e=>e==="image"},{type:"item",command:"openTableProperties",labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:(e,t)=>t},{type:"item",command:"openCellProperties",labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:(e,t)=>t},{type:"item",command:"openRowProperties",labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:(e,t)=>t}];function Hi(){return'[role="menuitem"]:not(:disabled)'}function Cc({open:e,x:t,y:n,kind:r,inTable:i=!1,commands:a,onClose:l}){const c=V(),m=s.useId(),p=s.useRef(null);if(s.useLayoutEffect(()=>{var y;if(!e)return;const h=p.current;if(!h)return;const w=h.getBoundingClientRect(),x=Math.max(Nn,Math.min(t,window.innerWidth-w.width-Nn)),S=Math.max(Nn,Math.min(n,window.innerHeight-w.height-Nn));h.style.left=`${x}px`,h.style.top=`${S}px`,(y=h.querySelector(Hi()))==null||y.focus()},[e,t,n,r]),s.useEffect(()=>{if(!e)return;const h=y=>{var C;(C=p.current)!=null&&C.contains(y.target)||l()},w=y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),l())},x=()=>{l()},S=y=>{var C;if((C=p.current)!=null&&C.contains(y.target)){y.preventDefault();return}y.defaultPrevented||l()};return document.addEventListener("pointerdown",h),document.addEventListener("keydown",w,!0),window.addEventListener("scroll",x,!0),document.addEventListener("contextmenu",S),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",w,!0),window.removeEventListener("scroll",x,!0),document.removeEventListener("contextmenu",S)}},[e,l]),!e)return null;const b=h=>{var C;if(h.key!=="ArrowDown"&&h.key!=="ArrowUp")return;const w=[...((C=p.current)==null?void 0:C.querySelectorAll(Hi()))??[]];if(w.length===0)return;const x=w.indexOf(document.activeElement),S=h.key==="ArrowDown"?1:-1,y=w[(x+S+w.length)%w.length];h.preventDefault(),y==null||y.focus()};return le.createPortal(o.jsxs("div",{ref:p,className:Yr.menu,role:"menu","aria-labelledby":m,style:{left:t,top:n},onMouseDown:h=>h.preventDefault(),onKeyDown:b,children:[o.jsx("span",{id:m,hidden:!0,children:c("contextMenuAria")}),kc.map((h,w)=>{if(h.type==="separator")return o.jsx("div",{role:"separator",className:Yr.separator},`separator-${w}`);const x=h.enabled(r,i);return o.jsx("button",{type:"button",role:"menuitem",className:Yr.item,"aria-label":c(h.ariaKey),disabled:!x,onClick:()=>{x&&(l(),Mo(a,h.command))},children:c(h.labelKey)},h.command)})]}),document.body)}const $a={description:"HTML",accept:{"text/html":[".html",".htm"]}},vc="document.html";function Ua(){return window}function Wa(e){return e instanceof DOMException&&e.name==="AbortError"}function qa(e){return typeof e.text=="function"?e.text():new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(String(r.result??"")),r.onerror=()=>n(r.error??new Error("Failed to read file")),r.readAsText(e)})}function Dc(e,t){const n=new Blob([e],{type:"text/html;charset=utf-8"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=t,i.rel="noopener",document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(r)}function Ac(){return new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept=".html,.htm,text/html",t.hidden=!0;const n=r=>{t.remove(),e(r)};t.addEventListener("change",()=>{var i;const r=(i=t.files)==null?void 0:i[0];if(!r){n(null);return}qa(r).then(a=>n(a),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function Pc(e,t=vc){const n=Ua().showSaveFilePicker;if(typeof n=="function"){try{const i=await(await n({suggestedName:t,types:[$a]})).createWritable();await i.write(e),await i.close()}catch(r){if(Wa(r))return;throw r}return}Dc(e,t)}async function Ec(){const e=Ua().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[$a]}),n=await t.getFile();return await qa(n)}catch(t){if(Wa(t))return null;throw t}return Ac()}const jc=new Set(["span","strong","b","em","i","u","s","strike","del"]);function ae(e,t){return t?e===t||e.contains(t):!1}function Ve(e){return jc.has(e.tagName.toLowerCase())}function Nc(e,t){const n=document.createRange();return n.selectNodeContents(t),e.compareBoundaryPoints(Range.END_TO_START,n)<0&&e.compareBoundaryPoints(Range.START_TO_END,n)>0}function Ne(e){const t=e.commonAncestorContainer;if(t.nodeType===Node.TEXT_NODE)return t.nodeValue?[t]:[];const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let i;for(;i=r.nextNode();)i.nodeValue&&Nc(e,i)&&n.push(i);return n}function et(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType===Node.TEXT_NODE){const a=t;if(n>0&&n<a.length){const l=a.splitText(n);e.setStart(l,0),e.endContainer===a&&e.setEnd(l,e.endOffset-n)}}const r=e.endContainer,i=e.endOffset;if(r.nodeType===Node.TEXT_NODE){const a=r;i>0&&i<a.length&&(a.splitText(i),e.setEnd(a,a.length))}}function mt(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function Re(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function ft(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<=-1||n.length===1)return;const i=e.parentNode;if(!i)return;const a=n.slice(0,r),l=n.slice(r+1);if(a.length>0){const c=e.cloneNode(!1);for(const m of a)c.appendChild(m);i.insertBefore(c,e)}if(l.length>0){const c=e.cloneNode(!1);for(const m of l)c.appendChild(m);i.insertBefore(c,e.nextSibling)}}function Nt(e){if(e.length===0)return;const t=e[0],n=e[e.length-1],r=document.createRange();r.setStart(t,0),r.setEnd(n,n.data.length);const i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function Qn(e,t){const n=e.parentElement;if(n&&n.tagName.toLowerCase()==="span"&&n.childNodes.length===1)return t(n),n;const r=document.createElement("span");return t(r),n==null||n.insertBefore(r,e),r.appendChild(e),r}const er="data-wysiwyg-font",Lc=[{name:"Arial",family:"Arial, Helvetica, sans-serif"},{name:"Arial Black",family:"'Arial Black', Gadget, sans-serif"},{name:"Comic Sans MS",family:"'Comic Sans MS', Textile, cursive"},{name:"Courier New",family:"'Courier New', Courier, monospace"},{name:"Georgia",family:"Georgia, serif"},{name:"Helvetica",family:"Helvetica, Arial, sans-serif"},{name:"Impact",family:"Impact, Charcoal, sans-serif"},{name:"Lucida Console",family:"'Lucida Console', Monaco, monospace"},{name:"Lucida Sans Unicode",family:"'Lucida Sans Unicode', 'Lucida Grande', sans-serif"},{name:"Palatino Linotype",family:"'Palatino Linotype', Palatino, serif"},{name:"Tahoma",family:"Tahoma, Geneva, sans-serif"},{name:"Times New Roman",family:"'Times New Roman', Times, serif"},{name:"Trebuchet MS",family:"'Trebuchet MS', Helvetica, sans-serif"},{name:"Verdana",family:"Verdana, Geneva, sans-serif"}];function nn(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function ln(e,t){return e===t?!0:!e||!t?!1:nn(e)===nn(t)}function Ga(e=[]){var r;const t=[],n=new Set;for(const i of[...Lc,...e]){const a=i.family.trim();if(!a)continue;const l=nn(a);if(n.has(l))continue;n.add(l);const c=(r=i.css)==null?void 0:r.trim();t.push({name:i.name.trim()||a,family:a,...c?{css:c}:{}})}return t}function Tc(e,t){return e?t.find(n=>ln(n.family,e))??null:null}function Mc(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Rc(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function tr(e){const t=new Set,n=[];for(const r of e){const i=r.trim();!i||!Mc(i)||t.has(i)||(t.add(i),n.push(i))}return n}function _c(e){return e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&amp;/g,"&")}const Fc=new RegExp(`<link\\b[^>]*\\b${er}\\b[^>]*>`,"gi");function rn(e){if(!e.includes(er))return{hrefs:[],body:e};const t=[],n=e.replace(Fc,r=>{var a,l;const i=((a=r.match(/\bhref\s*=\s*"([^"]*)"/i))==null?void 0:a[1])??((l=r.match(/\bhref\s*=\s*'([^']*)'/i))==null?void 0:l[1]);return i&&t.push(_c(i)),""});return{hrefs:tr(t),body:n}}function Jr(e,t){const n=tr(t);return n.length===0?e:`${n.map(i=>`<link rel="stylesheet" href="${Rc(i)}" ${er}="">`).join("")}${e}`}function Ic(e,t){const n=nn(t);if(!n)return!1;const r=new DOMParser().parseFromString(e,"text/html"),i=r.createTreeWalker(r.body,NodeFilter.SHOW_ELEMENT);let a=i.currentNode;for(;a;){if(a instanceof HTMLElement){const l=a.style.fontFamily;if(l&&nn(l)===n)return!0}a=i.nextNode()}return!1}function Zr(e,t,n=[]){const r=rn(t).hrefs,i=n.filter(a=>a.css&&Ic(e,a.family)).map(a=>a.css??"");return tr([...r,...i])}function Bc(e,t=[]){const n=rn(e).hrefs,r=t.map(i=>i.css??"");return tr([...n,...r])}function Hc(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Va(e){return e.style.fontFamily.trim()||null}function _o(e,t){let n=Hc(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Va(n);if(r)return r;n=n.parentElement}return null}function po(e){return e instanceof HTMLElement&&Va(e)!==null}function Fo(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function Oc(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Ve(r)||!po(r)){n=r;continue}if(ft(r,n),po(r)&&(Fo(r),mt(r))){Re(r);continue}n=r}}function Xa(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function zc(e){const t=Xa(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:Ne(t).filter(c=>c.data.length>0),i=(n.length>0?n:[t.startContainer]).map(c=>_o(e,c)),a=i[0]??null;return i.every(c=>ln(c,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function Oi(e,t){const n=Xa(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;et(n);const i=Ne(n).filter(a=>a.data.length>0);for(const a of i){const l=_o(e,a);if(r===null){if(l===null)continue;Oc(e,a);continue}ln(l,r)||Qn(a,c=>{c.style.fontFamily=r})}return Nt(i),!0}function Kc(e,t){if(t){if(t.value===null){Fo(e);return}e.style.fontFamily=t.value}}function $c(e){return e!=null}function Uc(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function Wc(e){var r,i,a;let t=e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0?e.startContainer:e.startContainer.childNodes[e.startOffset]??e.startContainer.lastChild??e.startContainer;if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset>0){const l=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(l,e.startContainer.nextSibling),l}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const l=document.createTextNode("");return(i=e.startContainer.parentNode)==null||i.insertBefore(l,e.startContainer),l}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function ho(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Ve(r)||!po(r)){n=r;continue}if(ft(r,n),Fo(r),mt(r)){Re(r);continue}n=r.isConnected?r:t}return t}function qc(e,t){Uc(t);const n=Wc(t);return ho(e,n)}function Gc(e,t,n){return!!(n&&n.value===null&&_o(e,t))}const Vc=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),Ul=require("react-dom");function pi({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-center",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M7 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function Wl({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-justify",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M4 18h16"})]})}function hi({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-left",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function gi({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-right",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M10 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function Jc({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bold",children:[o.jsx("path",{d:"M7 5h6.5a3.5 3.5 0 0 1 0 7H7z"}),o.jsx("path",{d:"M7 12h7.5a3.5 3.5 0 0 1 0 7H7z"}),o.jsx("path",{d:"M7 5v14"})]})}function Zc({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bookmark",children:o.jsx("path",{d:"M6 4h12a1 1 0 0 1 1 1v16l-7-4-7 4V5a1 1 0 0 1 1-1z"})})}function Gl({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bullet-list",children:[o.jsx("path",{d:"M9 6h12"}),o.jsx("path",{d:"M9 12h12"}),o.jsx("path",{d:"M9 18h12"}),o.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"})]})}function Qc({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"cell-properties",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 12h18"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("rect",{x:"12.5",y:"4.5",width:"8",height:"7",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function eu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"clear-formatting",children:[o.jsx("path",{d:"M4 5h12"}),o.jsx("path",{d:"M10 5v8"}),o.jsx("path",{d:"m14 15 6 6"}),o.jsx("path",{d:"m20 15-6 6"})]})}function We({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"close",children:[o.jsx("path",{d:"M18 6L6 18"}),o.jsx("path",{d:"M6 6l12 12"})]})}function tu({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 616.23 542.09",width:"45",height:"40","aria-hidden":"true","data-icon":"commspliant-shield",children:o.jsxs("g",{transform:"translate(129.79555,688.75474)",children:[o.jsx("path",{fill:"#334E68",d:"m 92.41768,-326.31771 a 0.3,0.3 0 0 1 0.48,0.05 q 5.04,8.55 15.34,22.7 5.5,7.55 11.93,14.77 11.84,13.3 12.69,14.16 11.29,11.41 26.17,23.51 c 4.66,3.79 9.84,8.83 15.07,12.39 18.71,12.72 34.7,23.08 52.84,31.97 q 15.29,7.5 16.67,8.12 5.77,2.59 8.73,3.54 c 1.66,0.54 2.74,-0.25 4.17,-0.93 q 27.98,-13.14 49.38,-25.74 21.15,-12.47 41.94,-29.56 1.28,-1.05 12.72,-11.11 c 11.11,-9.78 22.59,-22.12 30.48,-31.94 q 10.87,-13.52 16.67,-23.55 c 3.7,-6.41 7.66,-12.73 10.29,-18.63 q 9.41,-21.06 13.67,-35.18 8.51,-28.19 9.46,-61.31 0.96,-33.72 0.31,-64.55 -0.09,-4.4 2.81,-7.26 5.42,-5.33 7.5,-7.38 c 6.37,-6.25 11.24,-13.29 18.07,-19.23 q 7.84,-6.84 14.74,-16.11 0.14,-0.19 0.39,-0.15 0.61,0.1 0.52,0.7 -0.37,2.69 -0.35,4.95 c 0.37,45.85 0.81,76.35 -0.95,110.71 q -0.66,12.89 -2.71,28.52 -2.84,21.57 -7.17,36.03 -2.02,6.75 -5.4,17.5 c -5.64,17.94 -13.55,35.09 -23.13,50.9 q -1.72,2.86 -12.91,19.22 c -10.81,15.81 -22.83,29.61 -35.06,41.83 q -4.06,4.07 -17.47,16.38 -9.77,8.98 -18.52,15.14 -19.27,13.56 -32.8,21.84 c -8.27,5.05 -17.73,9.75 -26.22,14.7 q -3.66,2.13 -10.7,5.47 -27.19,12.89 -34.36,16.16 -3.92,1.79 -7.2,0.44 -3.47,-1.43 -11.46,-4.85 c -9.07,-3.89 -16.98,-8.27 -24.9,-11.89 -8.4,-3.84 -18.78,-9.89 -28.06,-15.14 q -43.25,-24.5 -76.54,-56.22 -11.98,-11.41 -24.94,-26.56 -12.76,-14.92 -26.13,-34.48 a 0.43,0.44 56.8 0 1 0.13,-0.61 c 12.12,-7.82 23.12,-17.82 33.81,-29.32 z"}),o.jsx("path",{fill:"#334E68",d:"m -128.82232,-375.77771 a 0.96,0.96 0 0 1 -0.8,-1.51 l 28.86,-41.82 a 3.24,3.2 6.2 0 1 1.45,-1.15 q 0.69,-0.27 3.64,-0.32 15.37,-0.27 46.58,-0.45 12.44,-0.07 19.69,-1.84 c 26.32,-6.42 44.55,-29.39 47.76,-55.67 q 1.05,-8.54 0.87,-20.92 c -0.55,-39.95 0.23,-77.15 -0.1,-117.57 a 0.94,0.95 85.4 0 1 0.81,-0.94 c 35.7,-5.08 70.26,-12.78 104.11,-23.86 q 9.4,-3.07 22.28,-7.05 8.6,-2.65 22.1,-7.58 18.33,-6.69 43.02,-16.74 23.04,-9.38 35.12,-15.34 1.17,-0.58 3.29,0.39 c 14.96,6.81 34.27,13.39 42.79,16.68 q 14.24,5.5 27.59,10.33 23.24,8.41 27.7,10.07 2.01,0.75 9.42,3.41 5.07,1.82 9.47,3.13 40.54,12.1 57.07,16.58 2.54,0.68 4.26,0.82 a 0.48,0.48 0 0 1 0.32,0.79 l -33.68,37.82 a 0.58,0.58 0 0 1 -0.68,0.13 q -3.43,-1.67 -5.84,-2.43 -8.74,-2.79 -47.37,-15.63 -8.92,-2.96 -17.51,-6.16 c -17.92,-6.67 -32.21,-11.74 -65.83,-24.24 -2.89,-1.08 -8.28,-3.56 -11.57,-2.33 -11.44,4.27 -27.67,11.24 -40.6,15.93 q -8.12,2.94 -26.33,9.89 c -21.86,8.35 -43.57,14.34 -67.25,21.47 q -20.07,6.03 -48.78,11.52 a 0.71,0.7 84.6 0 0 -0.57,0.7 q 0.1,95.52 0.1,95.57 c -0.53,30.1 -14.63,58.57 -36,79.25 -10.83,10.49 -23.5,17.98 -37.57,23.68 -10.14,4.1 -18.76,4.57 -31.18,4.79 q -3.1,0.05 -86.64,0.6 z"}),o.jsx("path",{fill:"#C9A227",d:"m 169.86768,-422.45771 q 0.04,-0.4 0.24,-0.59 c 3.41,-3.3 5.96,-6.99 9.56,-10.8 q 10.13,-10.72 15.25,-16.65 2.05,-2.38 5.38,-4.3 a 0.68,0.69 53.4 0 1 0.84,0.12 l 49.51,50.92 a 1.06,1.06 0 0 0 1.52,0 q 17.38,-17.8 26.4,-27.94 c 6.36,-7.14 15.04,-14.76 20.1,-20.56 q 10.29,-11.81 17.14,-18.67 7.41,-7.41 17.44,-18.41 13.85,-15.18 23.56,-24.67 c 3.68,-3.59 5.5,-6.17 8.54,-10.08 2.38,-3.06 4.42,-4.87 8.16,-8.31 6.16,-5.66 10.48,-11.49 16.47,-17.22 6.29,-6.03 12.87,-14.23 18.87,-20.24 q 5.56,-5.56 13.49,-14.45 c 6.79,-7.6 12.13,-13.02 18.46,-19.66 4.83,-5.06 9.88,-11.22 15.21,-16.21 a 1.91,1.91 0 0 1 1.3,-0.51 h 28.15 a 0.83,0.83 0 0 1 0.83,0.82 q 0.28,14.3 0.03,31.53 c -0.07,4.93 -1.9,6.19 -5.19,9.51 -5.86,5.92 -12.79,12.1 -18.21,18.16 q -6.63,7.4 -16.64,16.86 c -2.68,2.53 -6.31,6.91 -8.5,9.17 -8.76,9.01 -14.72,16.05 -22.55,23.36 q -1.37,1.28 -9.09,9.75 -4.93,5.41 -24.32,25.01 c -9.96,10.07 -19.18,20.45 -27.83,28.95 q -11.52,11.33 -20.29,20.96 c -19.16,21.01 -41.14,42.93 -58.64,61.61 q -10.7,11.42 -22.21,22 a 1.97,1.94 24 0 1 -1.38,0.52 q -1.9,-0.06 -3.83,-2.08 c -19.01,-19.93 -45.74,-44.39 -67.08,-67.5 q -5.05,-5.47 -10.42,-9.75 -0.31,-0.24 -0.27,-0.65 z"}),o.jsx("path",{fill:"#5B7B9C",d:"m 351.58768,-544.71771 a 0.41,0.41 0 0 1 0.17,0.69 q -15.9,15.29 -29.64,31.76 a 1.16,1.19 33.7 0 1 -1.44,0.3 c -5.87,-3 -10.72,-6.65 -16.97,-10.42 -17.2,-10.37 -38.83,-14.16 -59.18,-13.16 -12.15,0.6 -23.67,3.62 -34.54,8.11 -5.15,2.13 -9.08,4.66 -14.86,8.63 q -14.63,10.05 -22.02,17.75 -6.98,7.27 -17.47,22.45 c -5.11,7.4 -9.03,15.18 -13.55,23.27 q -5.09,9.08 -10.38,20.93 c -4.39,9.81 -8.53,17.45 -13.72,27.5 q -6,11.58 -11.58,19.91 c -6.74,10.09 -11.32,17.91 -17.68,26.12 -4.94,6.38 -10.92,12.4 -15.22,17.55 q -3.48,4.18 -9.33,9.51 c -20.66,18.83 -45.19,33.15 -72.9,38.24 q -15.17,2.79 -26.21,3.08 -22.84,0.6 -52.01,0.23 a 0.29,0.29 0 0 1 -0.24,-0.43 c 6.02,-10.58 11.85,-19.61 23.29,-37.61 q 2.27,-3.58 5.02,-6.38 a 3.39,3.4 24.3 0 1 2.63,-1 q 16.4,1.07 32.77,-1.23 c 15.39,-2.16 29.33,-7.66 42.1,-15.59 q 4.42,-2.75 14.17,-10.6 3.58,-2.89 14.27,-14.03 6.08,-6.33 9.69,-12.1 c 3.25,-5.19 7.59,-10.59 11.55,-17.24 q 16.77,-28.19 29.52,-56.84 c 4.49,-10.08 8.7,-16.87 15.5,-28.37 q 5.49,-9.29 14.18,-21.09 5.94,-8.07 12.61,-14.76 12.65,-12.7 13.8,-13.72 5.51,-4.84 19.01,-13.66 49.89,-32.59 109.07,-20.31 7.95,1.65 15.41,4.34 14.58,5.25 20.68,8.05 c 10.41,4.78 21.11,12.36 31.15,19.28 a 2.65,2.62 70.1 0 0 0.78,0.37 z"}),o.jsx("path",{fill:"#5B7B9C",d:"m 143.16768,-394.65771 q 0.46,0.11 0.45,0.6 -0.03,2.2 0.62,4.89 2.72,11.27 9.81,22.88 7.25,11.89 15.4,22.7 c 4.71,6.26 10.61,13.06 17.11,18.9 9.38,8.42 15.79,14.58 25.02,21.29 q 13.29,9.65 15.1,10.72 10.62,6.29 20.67,12.58 1.94,1.22 4,1.86 a 2.56,2.59 42.2 0 0 1.81,-0.1 c 7.1,-3.08 12.92,-6.7 21.76,-11.78 q 6.63,-3.81 11.42,-7.45 c 4.56,-3.47 9.98,-6.63 14.83,-10.52 q 18.45,-14.82 32.58,-32 6.8,-8.28 11.17,-16.16 c 7.76,-14.01 13.11,-25.52 16.26,-40.82 1.49,-7.23 1.56,-11.99 2.41,-21.26 a 3.66,3.67 70 0 1 1.06,-2.26 q 9.34,-9.27 20.72,-20.12 c 6.47,-6.15 12.23,-13.51 18.33,-19.07 a 0.67,0.67 0 0 1 1.11,0.43 q 1.92,19.96 1.77,37.52 -0.18,19.95 -4.43,40.76 -3.4,16.65 -11.34,32.24 -0.55,1.09 -4.75,9.06 -3,5.69 -5.08,8.85 c -9.56,14.55 -19.75,27.73 -31.99,39.39 q -7.6,7.24 -9.98,9.35 -10.58,9.37 -24.17,18.04 c -4.91,3.14 -9.19,7.11 -13.77,9.89 q -24.03,14.58 -42.68,23.19 -3.32,1.53 -8.02,-0.31 -1.97,-0.78 -11.41,-5.19 c -8.92,-4.17 -16.04,-8.65 -24.58,-13.03 q -6.75,-3.47 -13.06,-7.8 -18.87,-12.96 -21.03,-14.68 -15.47,-12.4 -29.21,-26.05 -5.39,-5.35 -13.86,-16.13 -6.45,-8.2 -14.56,-19.38 c -3.42,-4.72 -6.19,-10.2 -9.49,-14.45 a 1.33,1.32 44.2 0 1 -0.03,-1.59 c 5.8,-7.95 10.64,-13.7 15.23,-21.14 q 8.66,-14.03 14.39,-23.68 a 0.38,0.39 23.4 0 1 0.41,-0.17 z"})]})})}function nu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"custom-action",children:[o.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),o.jsx("path",{d:"M9 8.5c0-1 .7-1.5 1.5-1.5S12 7.5 12 8.5c0 1.2-3 1.2-3 3.2"}),o.jsx("path",{d:"M10.5 14v.5"}),o.jsx("path",{d:"M15 10v4"}),o.jsx("path",{d:"M13 12h4"})]})}function ru({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"customize-toolbar",children:[o.jsx("rect",{x:"3",y:"4",width:"7",height:"7",rx:"1"}),o.jsx("rect",{x:"14",y:"4",width:"7",height:"7",rx:"1"}),o.jsx("rect",{x:"3",y:"13",width:"7",height:"7",rx:"1"}),o.jsx("rect",{x:"14",y:"13",width:"7",height:"7",rx:"1"})]})}function ou({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"dark-mode",children:o.jsx("path",{d:"M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z"})})}function Vl({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-color",children:[o.jsx("path",{d:"M6 18L12 4l6 14"}),o.jsx("path",{d:"M8.5 13h7"})]})}function iu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-family",children:[o.jsx("path",{d:"M4 18L9 6l5 12"}),o.jsx("path",{d:"M6.2 13h5.6"}),o.jsx("path",{d:"M16 18V9"}),o.jsx("path",{d:"M16 9h5"})]})}function au({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-properties",children:[o.jsx("path",{d:"M4 20h4"}),o.jsx("path",{d:"M6 20V6"}),o.jsx("path",{d:"M4 6h4"}),o.jsx("path",{d:"M12 20V9"}),o.jsx("path",{d:"M12 9h8"}),o.jsx("path",{d:"M16 9v11"})]})}function lu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-size",children:[o.jsx("path",{d:"M4 18V8h3"}),o.jsx("path",{d:"M4 8h8"}),o.jsx("path",{d:"M10 8v10"}),o.jsx("path",{d:"M16 18V12h2"}),o.jsx("path",{d:"M16 12h5"}),o.jsx("path",{d:"M19 12v6"})]})}function su({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"fullscreen",children:[o.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),o.jsx("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),o.jsx("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),o.jsx("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]})}function ql({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"highlight-color",children:[o.jsx("path",{d:"M15.5 4.5l4 4-9 9H6.5v-4.5z"}),o.jsx("path",{d:"M13.5 6.5l4 4"}),o.jsx("path",{d:"M4 20h8"})]})}function cu({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"horizontalRule",children:o.jsx("path",{d:"M4 12h16"})})}function uu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"html",children:[o.jsx("path",{d:"M8 8l-4 4 4 4"}),o.jsx("path",{d:"M16 8l4 4-4 4"})]})}function Xl({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"image",children:[o.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),o.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),o.jsx("path",{d:"m21 15-4.5-4.5L7 20"})]})}function du({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"indent",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M12 12h8"}),o.jsx("path",{d:"M4 18h16"}),o.jsx("path",{d:"M4 9l4 3-4 3"})]})}function mu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"italic",children:[o.jsx("path",{d:"M10 4h9"}),o.jsx("path",{d:"M5 20h9"}),o.jsx("path",{d:"M14 4L8 20"})]})}function fu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"light-mode",children:[o.jsx("circle",{cx:"12",cy:"12",r:"4"}),o.jsx("path",{d:"M12 2v2"}),o.jsx("path",{d:"M12 20v2"}),o.jsx("path",{d:"M4.93 4.93l1.41 1.41"}),o.jsx("path",{d:"M17.66 17.66l1.41 1.41"}),o.jsx("path",{d:"M2 12h2"}),o.jsx("path",{d:"M20 12h2"}),o.jsx("path",{d:"M4.93 19.07l1.41-1.41"}),o.jsx("path",{d:"M17.66 6.34l1.41-1.41"})]})}function pu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"link",children:[o.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function hu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"menu",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M4 18h16"})]})}function Yl({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"numbered-list",children:[o.jsx("path",{d:"M10 6h11"}),o.jsx("path",{d:"M10 12h11"}),o.jsx("path",{d:"M10 18h11"}),o.jsx("path",{d:"M4 5v3h2"}),o.jsx("path",{d:"M4 11h2l-2 2h2"}),o.jsx("path",{d:"M4 19h2"}),o.jsx("path",{d:"M4 17h2v2"})]})}function gu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"open",children:[o.jsx("path",{d:"M3 7h6l2 2h10v3"}),o.jsx("path",{d:"M3 10l2.2 9h13.6L21 10H3z"})]})}function bu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"outdent",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M12 12h8"}),o.jsx("path",{d:"M4 18h16"}),o.jsx("path",{d:"M8 9l-4 3 4 3"})]})}function yu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"page-properties",children:[o.jsx("path",{d:"M6 3h8l6 6v12H6z"}),o.jsx("path",{d:"M14 3v6h6"})]})}function xu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"paragraph-properties",children:[o.jsx("path",{d:"M13 4H9a4 4 0 0 0 0 8h2"}),o.jsx("path",{d:"M15 4v16"}),o.jsx("path",{d:"M11 4v16"})]})}function wu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"preview",children:[o.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),o.jsx("path",{d:"M14 2v6h6"}),o.jsx("path",{d:"M8 13h8"}),o.jsx("path",{d:"M8 17h5"})]})}function vu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"paragraph-style",children:[o.jsx("path",{d:"M5 6h14"}),o.jsx("path",{d:"M5 10h10"}),o.jsx("path",{d:"M5 14h14"}),o.jsx("path",{d:"M5 18h8"})]})}function Su({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"plus",children:[o.jsx("path",{d:"M12 5v14"}),o.jsx("path",{d:"M5 12h14"})]})}function Cu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"print",children:[o.jsx("path",{d:"M6 9V3h12v6"}),o.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M6 14h12v8H6z"})]})}function ku({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"redo",children:[o.jsx("path",{d:"M21 10H10a5 5 0 0 0 0 10h1"}),o.jsx("path",{d:"M17 6l4 4-4 4"})]})}function Du({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"row-properties",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Pu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"save",children:[o.jsx("path",{d:"M5 3h11l5 5v13H5V3z"}),o.jsx("path",{d:"M15 3v6H9V3"}),o.jsx("path",{d:"M8 21v-7h8v7"})]})}function Eo({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table-column",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("path",{d:"M9 4v16"}),o.jsx("path",{d:"M15 4v16"}),o.jsx("rect",{x:"9.5",y:"5",width:"5",height:"14",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function $a({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("path",{d:"M9 4v16"}),o.jsx("path",{d:"M15 4v16"})]})}function To({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table-row",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("rect",{x:"4",y:"10.5",width:"16",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Au({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"strikethrough",children:[o.jsx("path",{d:"M6 7.5C6 5.5 8 4 12 4s6 1.5 6 3.5-1.8 2.8-6 3.5"}),o.jsx("path",{d:"M6 16.5C6 18.5 8 20 12 20s6-1.5 6-3.5c0-1-.5-1.8-1.8-2.5"}),o.jsx("path",{d:"M4 12h16"})]})}function ju({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"underline",children:[o.jsx("path",{d:"M7 4v8a5 5 0 0 0 10 0V4"}),o.jsx("path",{d:"M5 20h14"})]})}function Eu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"undo",children:[o.jsx("path",{d:"M3 10h11a5 5 0 0 1 0 10h-1"}),o.jsx("path",{d:"M7 6L3 10l4 4"})]})}function Tu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"visual",children:[o.jsx("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}const de="---";function ct(e){return e===de}function Cn(e){return typeof e=="object"&&e!==null&&"submenu"in e}const bi=new Set(["save","open","print","undo","redo","link","bookmark","horizontalRule","visual","html","customizeToolbar","toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom","lightMode","darkMode","preview","fullscreen","bold","italic","underline","strikethrough","clearFormatting","fontSize","fontFamily","paragraphStyle","fontProperties","paragraphProperties","pageProperties","imageProperties","fontColor","highlightColor","alignLeft","alignCenter","alignRight","alignJustify","indent","outdent","bulletList","numberedList"]),Nu=new Set(["file","edit","insert","view","format"]),Jl="custom",Zl="custom";function Ql(e){return`custom:${e}`}function Lu(e){return e==="menu"||e==="both"}function Mu(e){return e==="toolbar"||e==="both"}function es(e){return e.map(t=>Cn(t)?{submenu:t.submenu,items:es(t.items)}:t)}function Ru(e){return{menus:e.menus.map(t=>({id:t.id,items:es(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function ts(e){return ct(e)?!0:Cn(e)?e.items.every(ts):bi.has(e)}function ns(e,t){for(const n of e)if(n===t||Cn(n)&&ns(n.items,t))return!0;return!1}function _u(e){const t=e.tooltip??e.label;return{id:e.id,command:Ql(e.id),icon:e.icon??nu,label:e.label,ariaLabel:e.label,tooltip:t}}function Iu(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Nu.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===Jl&&!r)e.menus[n]={id:n,labelKey:"menuCustom",ariaKey:"menuCustomAria"};else{const i=r??n;e.menus[n]={id:n,label:i,ariaLabel:i}}t.menus.some(i=>i.id===n)||t.menus.push({id:n,items:[]})}function Fu(e,t,n){if(e.groups[n]||(n===Zl?e.groups[n]={id:n,labelKey:"toolbarGroupCustom"}:e.groups[n]={id:n,label:n}),!t.iconGroups.some(r=>r.id===n)){const r={id:n,items:[]},i=t.iconGroups.findIndex(a=>a.items.includes("fullscreen"));i===-1?t.iconGroups.push(r):t.iconGroups.splice(i,0,r)}}function Bu(e,t,n){var a,l;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},i=Ru(n);for(const c of e??[])if(!(bi.has(c.id)||ct(c.id))){if(r.items[c.id]=_u(c),Lu(c.showIn)){const m=((a=c.menu)==null?void 0:a.id)??Jl;Iu(r,i,m,(l=c.menu)==null?void 0:l.label);const p=i.menus.find(b=>b.id===m);if(p&&!ns(p.items,c.id)){const b=p.items[p.items.length-1];b!==void 0&&!ct(b)&&p.items.every(ts)&&p.items.push(de),p.items.push(c.id)}}if(Mu(c.showIn)){const m=c.toolbarGroup??Zl;Fu(r,i,m);const p=i.iconGroups.find(b=>b.id===m);p&&!p.items.includes(c.id)&&p.items.push(c.id)}}return{catalog:r,layout:i}}function Hu(e,t){const n={};for(const r of e??[])bi.has(r.id)||ct(r.id)||(n[Ql(r.id)]=()=>r.onAction(t()));return n}function zu(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const Ou="_chrome_boy0f_1",Ku={chrome:Ou},rs=s.createContext(!1);function $u({dark:e,children:t}){return o.jsx(rs.Provider,{value:e,children:t})}function Uu(){return s.useContext(rs)}function Xo(e){return{className:Ku.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function ie({children:e}){const t=Uu(),n=Xo(t);return Ul.createPortal(o.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function yi(e,t){const n=e[t];n==null||n()}const xi={modeVisual:"Visual",modeHtml:"HTML",modeVisualAria:"Switch to visual mode",modeHtmlAria:"Switch to HTML mode",modeFullscreen:"Full screen",modeFullscreenAria:"Toggle full screen",modeLight:"Light mode",modeLightAria:"Switch to light mode",modeDark:"Dark mode",modeDarkAria:"Switch to dark mode",exitFullscreenAria:"Exit full screen",visualEditorAria:"Visual editor",htmlEditorAria:"HTML editor",menuFile:"File",menuFileAria:"File menu",menuEdit:"Edit",menuEditAria:"Edit menu",menuInsert:"Insert",menuInsertAria:"Insert menu",menuView:"View",menuViewAria:"View menu",menuFormat:"Format",menuFormatAria:"Format menu",menuFont:"Fonts",menuFontAria:"Fonts submenu",menuParagraph:"Paragraph",menuParagraphAria:"Paragraph submenu",menuParagraphStyles:"Paragraph styles",menuParagraphStylesAria:"Paragraph styles submenu",menuPage:"Page",menuPageAria:"Page submenu",menuToolbar:"Toolbar",menuToolbarAria:"Toolbar submenu",menuToolbarPosition:"Position",menuToolbarPositionAria:"Toolbar position submenu",toolbarPositionTop:"Top",toolbarPositionTopAria:"Dock toolbar at the top",toolbarPositionLeft:"Left",toolbarPositionLeftAria:"Dock toolbar on the left",toolbarPositionRight:"Right",toolbarPositionRightAria:"Dock toolbar on the right",toolbarPositionBottom:"Bottom",toolbarPositionBottomAria:"Dock toolbar at the bottom",menuImage:"Image",menuImageAria:"Image properties",menuInsertRow:"Row",menuInsertRowAria:"Insert or delete row",menuInsertColumn:"Column",menuInsertColumnAria:"Insert or delete column",menuTable:"Table",menuTableAria:"Table properties",menuCustom:"Custom",menuCustomAria:"Custom menu",menuHamburgerAria:"Open menu",menuCloseAria:"Close menu",menuOverlayAria:"Editor menu",brandMarkAria:"CommsPliant HTML editor",commandSave:"Save",commandSaveAria:"Save as HTML file",commandOpen:"Open",commandOpenAria:"Open HTML file",htmlFileDropOverlay:"Drop HTML file to open",commandPrint:"Print",commandPrintAria:"Print document",commandUndo:"Undo",commandUndoAria:"Undo",commandRedo:"Redo",commandRedoAria:"Redo",commandCut:"Cut",commandCutAria:"Cut",commandCopy:"Copy",commandCopyAria:"Copy",commandDelete:"Delete",commandDeleteAria:"Delete",commandLink:"Link",commandLinkAria:"Link",commandBookmark:"Bookmark",commandBookmarkAria:"Bookmark",commandImage:"Image",commandImageAria:"Insert image",commandImageProperties:"Image properties…",commandImagePropertiesAria:"Image properties",commandTable:"Table",commandTableAria:"Insert table",commandHorizontalRule:"Horizontal line",commandHorizontalRuleAria:"Insert horizontal line",commandTableProperties:"Table properties…",commandTablePropertiesAria:"Table properties",commandCellProperties:"Cell properties…",commandCellPropertiesAria:"Cell properties",commandRowProperties:"Row properties…",commandRowPropertiesAria:"Row properties",commandInsertRowBelow:"Add below",commandInsertRowBelowAria:"Add row below",commandInsertRowBefore:"Add before",commandInsertRowBeforeAria:"Add row before",commandDeleteRow:"Delete",commandDeleteRowAria:"Delete row",commandInsertColumnAfter:"Add after",commandInsertColumnAfterAria:"Add column after",commandInsertColumnBefore:"Add before",commandInsertColumnBeforeAria:"Add column before",commandDeleteColumn:"Delete",commandDeleteColumnAria:"Delete column",contextMenuAria:"Editor context menu",commandBold:"Bold",commandBoldAria:"Bold",commandItalic:"Italic",commandItalicAria:"Italic",commandUnderline:"Underline",commandUnderlineAria:"Underline",commandStrikethrough:"Strikethrough",commandStrikethroughAria:"Strikethrough",commandClearFormatting:"Reset formatting",commandClearFormattingAria:"Reset formatting",commandFontSize:"Font size",commandFontSizeAria:"Font size",commandFontSizeUnitAria:"Font size unit",commandFontFamily:"Font",commandFontFamilyAria:"Font family",commandFontProperties:"Font properties…",commandFontPropertiesAria:"Font properties",commandParagraphProperties:"Paragraph properties…",commandParagraphPropertiesAria:"Paragraph properties",commandPageProperties:"Page properties…",commandPagePropertiesAria:"Page properties",commandFontColor:"Font color",commandFontColorAria:"Font color",commandHighlightColor:"Highlight color",commandHighlightColorAria:"Highlight color",commandParagraphStyle:"Styles",commandParagraphStyleAria:"Paragraph styles",commandAlignLeft:"Align left",commandAlignLeftAria:"Align left",commandAlignCenter:"Align center",commandAlignCenterAria:"Align center",commandAlignRight:"Align right",commandAlignRightAria:"Align right",commandAlignJustify:"Justify",commandAlignJustifyAria:"Justify",commandIndent:"Increase indent",commandIndentAria:"Increase indent",commandOutdent:"Decrease indent",commandOutdentAria:"Decrease indent",commandBulletList:"Bullet list",commandBulletListAria:"Bullet list",commandNumberedList:"Numbered list",commandNumberedListAria:"Numbered list",commandCustomizeToolbar:"Customize toolbar",commandCustomizeToolbarAria:"Customize toolbar",commandPreview:"Preview",commandPreviewAria:"Preview document",styleParagraph:"Paragraph",styleHeading1:"Heading 1",styleHeading2:"Heading 2",styleHeading3:"Heading 3",styleHeading4:"Heading 4",styleHeading5:"Heading 5",styleHeading6:"Heading 6",styleAddNew:"Add new",styleAddNewAria:"Add new paragraph style",customStyleDialogAddTitle:"Add paragraph style",customStyleDialogEditTitle:"Edit paragraph style",customStyleDialogTabFont:"Font",customStyleDialogTabParagraph:"Paragraph",customStyleDialogName:"Name",customStyleDialogDelete:"Delete",customStyleDialogDeleteConfirm:"Delete this paragraph style?",customStyleDialogCloseAria:"Close",customStyleLoading:"Loading paragraph styles",colorAutomatic:"Automatic",colorNone:"No color",colorCustom:"Custom color",colorHex:"Hex",colorRgbR:"R",colorRgbG:"G",colorRgbB:"B",colorPickFromScreen:"Pick from screen",colorRecent:"Recent colors",fontDialogTitle:"Font properties",fontDialogTabGeneral:"General",fontDialogFamily:"Font",fontFamilyDefault:"Default",fontDialogSize:"Size",fontDialogUnit:"Unit",fontDialogStyle:"Style",fontDialogOk:"OK",fontDialogCancel:"Cancel",linkDialogTitle:"Insert link",linkDialogTabLink:"Link",linkDialogTabBookmark:"Bookmark",linkDialogHref:"URL",linkDialogHoverTitle:"Title",linkDialogTargetBlank:"Open in a new tab",linkDialogTextDecorationNone:"No underline",linkDialogHover:"On hover",linkDialogHoverColor:"Color",linkDialogHoverColorField:"Hover color",linkDialogHoverHtml:"HTML",linkDialogHoverHtmlAria:"Custom hover HTML",linkDialogBookmark:"Bookmark",linkDialogBookmarkEmpty:"No bookmarks in this document.",linkDialogSelect:"Select",bookmarkDialogTitle:"Insert bookmark",bookmarkDialogName:"Bookmark name",bookmarkDialogHelp:"Start with a letter. Use only letters, numbers, hyphens, and underscores. Must be unique in the document.",bookmarkDialogHelpAria:"Bookmark name format",bookmarkDialogCloseAria:"Close",bookmarkDialogErrorEmpty:"Enter a bookmark name.",bookmarkDialogErrorInvalid:"Start with a letter. Use only letters, numbers, hyphens, and underscores.",bookmarkDialogErrorDuplicate:"A bookmark with this name already exists.",imageDialogTitle:"Insert image",imageDialogSource:"Source",imageDialogFile:"File",imageDialogChooseFile:"Choose file",imageDialogUrl:"Image URL",imageDialogAlt:"Alt text",imageDialogTitleField:"Title",imageDialogCloseAria:"Close",imageDialogErrorEmpty:"Choose a file or enter an image URL.",imageDialogErrorInvalid:"Enter a valid image URL.",imageDialogErrorType:"Use a JPEG, PNG, GIF, WebP, BMP, or AVIF image.",imageDialogErrorTooLarge:"Choose an image smaller than 2 MB.",imagePropertiesDialogTitle:"Image properties",imagePropertiesDialogCloseAria:"Close",imagePropertiesTabAlignment:"Alignment",imagePropertiesTabBorder:"Border & margin",imagePropertiesTabAdvanced:"Advanced",imagePropertiesTabHover:"Hover",imagePropertiesSize:"Size",imagePropertiesSizeMode:"Size mode",imagePropertiesSizeWidth:"Width only",imagePropertiesSizeHeight:"Height only",imagePropertiesSizeLock:"Lock together",imagePropertiesWidth:"Width",imagePropertiesHeight:"Height",imagePropertiesWidthAria:"Image width",imagePropertiesHeightAria:"Image height",imagePropertiesSizeUnitAria:"Image size unit",imagePropertiesFit:"Fit",imagePropertiesFitDefault:"Default",imagePropertiesFitFill:"Fill",imagePropertiesFitContain:"Contain",imagePropertiesFitCover:"Cover",imagePropertiesFitNoneValue:"None",imagePropertiesFitScaleDown:"Scale down",imagePropertiesPosition:"Position",imagePropertiesPositionDefault:"Default",imagePropertiesPositionCenter:"Center",imagePropertiesPositionTop:"Top",imagePropertiesPositionBottom:"Bottom",imagePropertiesPositionLeft:"Left",imagePropertiesPositionRight:"Right",imagePropertiesPositionTopLeft:"Top left",imagePropertiesPositionTopRight:"Top right",imagePropertiesPositionBottomLeft:"Bottom left",imagePropertiesPositionBottomRight:"Bottom right",imagePropertiesRotation:"Rotation",imagePropertiesRotationUnit:"deg",imagePropertiesHoverCss:"Hover CSS",imagePropertiesHoverCssAria:"Custom hover CSS",imagePropertiesHoverHelp:"CSS applied when the pointer is over the image.",imageResizeHandleEastAria:"Resize image width, keep aspect ratio",imageResizeHandleSouthAria:"Resize image height, keep aspect ratio",imageResizeHandleSouthEastAria:"Resize image freely",tableDialogTitle:"Insert table",tableDialogCloseAria:"Close",tableDialogRows:"Rows",tableDialogColumns:"Columns",tableDialogSize:"Size",tableDialogGridAria:"Table size grid",tableDialogInsert:"Insert",tablePropertiesDialogTitle:"Table properties",tablePropertiesDialogCloseAria:"Close",tablePropertiesCollapse:"Border collapse",tablePropertiesCollapseCollapse:"Collapse",tablePropertiesCollapseSeparate:"Separate",tablePropertiesSpacing:"Border spacing",tablePropertiesWidth:"Width",cellPropertiesDialogTitle:"Cell properties",cellPropertiesDialogCloseAria:"Close",cellPropertiesColor:"Text color",cellPropertiesVerticalAlign:"Vertical align",cellPropertiesVerticalAlignDefault:"Default",cellPropertiesVerticalAlignTop:"Top",cellPropertiesVerticalAlignMiddle:"Middle",cellPropertiesVerticalAlignBottom:"Bottom",cellPropertiesVerticalAlignBaseline:"Baseline",cellPropertiesWidth:"Width",rowPropertiesDialogTitle:"Row properties",rowPropertiesDialogCloseAria:"Close",rowPropertiesHeight:"Height",paragraphDialogTitle:"Paragraph properties",pageDialogTitle:"Page properties",paragraphDialogTabBorder:"Border",paragraphDialogTabBackground:"Background",paragraphDialogAlignment:"Alignment",paragraphDialogLists:"Lists",paragraphDialogSpacing:"Spacing",paragraphDialogMargin:"Margin",paragraphDialogPadding:"Padding",paragraphDialogLineHeight:"Line height",paragraphDialogLineHeightNormal:"Normal",paragraphDialogLineHeightUnitless:"×",paragraphDialogLinkSides:"Same on all sides",paragraphDialogSideTop:"Top",paragraphDialogSideRight:"Right",paragraphDialogSideBottom:"Bottom",paragraphDialogSideLeft:"Left",paragraphDialogBorder:"Border",paragraphDialogBorderStyle:"Style",paragraphDialogBorderWidth:"Width",paragraphDialogBorderColor:"Color",paragraphDialogBorderRadius:"Corner radius",paragraphDialogBoxShadow:"Box shadow",paragraphDialogShadowOffsetX:"Offset X",paragraphDialogShadowOffsetY:"Offset Y",paragraphDialogShadowBlur:"Blur",paragraphDialogShadowSpread:"Spread",paragraphDialogShadowColor:"Color",paragraphDialogShadowInset:"Inset",paragraphDialogLengthUnitAria:"Unit",paragraphDialogBorderStyleNone:"None",paragraphDialogBorderStyleSolid:"Solid",paragraphDialogBorderStyleDotted:"Dotted",paragraphDialogBorderStyleDashed:"Dashed",paragraphDialogBorderStyleDouble:"Double",paragraphDialogBorderStyleGroove:"Groove",paragraphDialogBorderStyleRidge:"Ridge",paragraphDialogBorderStyleInset:"Inset",paragraphDialogBorderStyleOutset:"Outset",paragraphDialogBackgroundColor:"Background color",paragraphDialogOpacity:"Opacity",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Formatting toolbar",toolbarGroupFile:"File",toolbarGroupPrint:"Print",toolbarGroupEdit:"Edit",toolbarGroupInsert:"Insert",toolbarGroupFont:"Fonts",toolbarGroupAlign:"Align",toolbarGroupParagraph:"Paragraph",toolbarGroupView:"View",toolbarGroupFullscreen:"Full screen",toolbarGroupCustom:"Custom",customizeToolbarDialogTitle:"Customize toolbar",customizeToolbarDialogReset:"Reset",customizeToolbarDialogClose:"Close",customizeToolbarDialogCloseAria:"Close",customizeToolbarDialogLoading:"Loading toolbar settings",customizeToolbarItemVisible:"Show on toolbar",customizeToolbarDragHandle:"Drag to reorder group",customizeToolbarMoveUp:"Move group up",customizeToolbarMoveDown:"Move group down",previewDialogTitle:"Document preview",previewDialogClose:"Close",previewDialogCloseAria:"Close"},Wu={modeVisual:"Visual",modeHtml:"HTML",modeVisualAria:"Cambiar al modo visual",modeHtmlAria:"Cambiar al modo HTML",modeFullscreen:"Pantalla completa",modeFullscreenAria:"Activar o desactivar pantalla completa",modeLight:"Modo claro",modeLightAria:"Cambiar al modo claro",modeDark:"Modo oscuro",modeDarkAria:"Cambiar al modo oscuro",exitFullscreenAria:"Salir de pantalla completa",visualEditorAria:"Editor visual",htmlEditorAria:"Editor HTML",menuFile:"Archivo",menuFileAria:"Menú Archivo",menuEdit:"Editar",menuEditAria:"Menú Editar",menuInsert:"Insertar",menuInsertAria:"Menú Insertar",menuView:"Vista",menuViewAria:"Menú Vista",menuFormat:"Formato",menuFormatAria:"Menú Formato",menuFont:"Fuentes",menuFontAria:"Submenú Fuentes",menuParagraph:"Párrafo",menuParagraphAria:"Submenú Párrafo",menuParagraphStyles:"Estilos de párrafo",menuParagraphStylesAria:"Submenú Estilos de párrafo",menuPage:"Página",menuPageAria:"Submenú Página",menuToolbar:"Barra de herramientas",menuToolbarAria:"Submenú Barra de herramientas",menuToolbarPosition:"Posición",menuToolbarPositionAria:"Submenú Posición de la barra de herramientas",toolbarPositionTop:"Arriba",toolbarPositionTopAria:"Acoplar la barra de herramientas arriba",toolbarPositionLeft:"Izquierda",toolbarPositionLeftAria:"Acoplar la barra de herramientas a la izquierda",toolbarPositionRight:"Derecha",toolbarPositionRightAria:"Acoplar la barra de herramientas a la derecha",toolbarPositionBottom:"Abajo",toolbarPositionBottomAria:"Acoplar la barra de herramientas abajo",menuImage:"Imagen",menuImageAria:"Propiedades de imagen",menuInsertRow:"Fila",menuInsertRowAria:"Insertar o eliminar fila",menuInsertColumn:"Columna",menuInsertColumnAria:"Insertar o eliminar columna",menuTable:"Tabla",menuTableAria:"Propiedades de tabla",menuCustom:"Personalizado",menuCustomAria:"Menú personalizado",menuHamburgerAria:"Abrir menú",menuCloseAria:"Cerrar menú",menuOverlayAria:"Menú del editor",brandMarkAria:"Editor HTML de CommsPliant",commandSave:"Guardar",commandSaveAria:"Guardar como archivo HTML",commandOpen:"Abrir",commandOpenAria:"Abrir archivo HTML",htmlFileDropOverlay:"Suelte un archivo HTML para abrirlo",commandPrint:"Imprimir",commandPrintAria:"Imprimir documento",commandUndo:"Deshacer",commandUndoAria:"Deshacer",commandRedo:"Rehacer",commandRedoAria:"Rehacer",commandCut:"Cortar",commandCutAria:"Cortar",commandCopy:"Copiar",commandCopyAria:"Copiar",commandDelete:"Eliminar",commandDeleteAria:"Eliminar",commandLink:"Enlace",commandLinkAria:"Enlace",commandBookmark:"Marcador",commandBookmarkAria:"Marcador",commandImage:"Imagen",commandImageAria:"Insertar imagen",commandImageProperties:"Propiedades de imagen…",commandImagePropertiesAria:"Propiedades de imagen",commandTable:"Tabla",commandTableAria:"Insertar tabla",commandHorizontalRule:"Línea horizontal",commandHorizontalRuleAria:"Insertar línea horizontal",commandTableProperties:"Propiedades de tabla…",commandTablePropertiesAria:"Propiedades de tabla",commandCellProperties:"Propiedades de celda…",commandCellPropertiesAria:"Propiedades de celda",commandRowProperties:"Propiedades de fila…",commandRowPropertiesAria:"Propiedades de fila",commandInsertRowBelow:"Añadir debajo",commandInsertRowBelowAria:"Añadir fila debajo",commandInsertRowBefore:"Añadir antes",commandInsertRowBeforeAria:"Añadir fila antes",commandDeleteRow:"Eliminar",commandDeleteRowAria:"Eliminar fila",commandInsertColumnAfter:"Añadir después",commandInsertColumnAfterAria:"Añadir columna después",commandInsertColumnBefore:"Añadir antes",commandInsertColumnBeforeAria:"Añadir columna antes",commandDeleteColumn:"Eliminar",commandDeleteColumnAria:"Eliminar columna",contextMenuAria:"Menú contextual del editor",commandBold:"Negrita",commandBoldAria:"Negrita",commandItalic:"Cursiva",commandItalicAria:"Cursiva",commandUnderline:"Subrayado",commandUnderlineAria:"Subrayado",commandStrikethrough:"Tachado",commandStrikethroughAria:"Tachado",commandClearFormatting:"Restablecer formato",commandClearFormattingAria:"Restablecer formato",commandFontSize:"Tamaño de fuente",commandFontSizeAria:"Tamaño de fuente",commandFontSizeUnitAria:"Unidad de tamaño de fuente",commandFontFamily:"Fuente",commandFontFamilyAria:"Familia tipográfica",commandFontProperties:"Propiedades de fuente…",commandFontPropertiesAria:"Propiedades de fuente",commandParagraphProperties:"Propiedades de párrafo…",commandParagraphPropertiesAria:"Propiedades de párrafo",commandPageProperties:"Propiedades de página…",commandPagePropertiesAria:"Propiedades de página",commandFontColor:"Color de fuente",commandFontColorAria:"Color de fuente",commandHighlightColor:"Color de resaltado",commandHighlightColorAria:"Color de resaltado",commandParagraphStyle:"Estilos",commandParagraphStyleAria:"Estilos de párrafo",commandAlignLeft:"Alinear a la izquierda",commandAlignLeftAria:"Alinear a la izquierda",commandAlignCenter:"Alinear al centro",commandAlignCenterAria:"Alinear al centro",commandAlignRight:"Alinear a la derecha",commandAlignRightAria:"Alinear a la derecha",commandAlignJustify:"Justificar",commandAlignJustifyAria:"Justificar",commandIndent:"Aumentar sangría",commandIndentAria:"Aumentar sangría",commandOutdent:"Disminuir sangría",commandOutdentAria:"Disminuir sangría",commandBulletList:"Lista con viñetas",commandBulletListAria:"Lista con viñetas",commandNumberedList:"Lista numerada",commandNumberedListAria:"Lista numerada",commandCustomizeToolbar:"Personalizar barra de herramientas",commandCustomizeToolbarAria:"Personalizar barra de herramientas",commandPreview:"Vista previa",commandPreviewAria:"Vista previa del documento",styleParagraph:"Párrafo",styleHeading1:"Encabezado 1",styleHeading2:"Encabezado 2",styleHeading3:"Encabezado 3",styleHeading4:"Encabezado 4",styleHeading5:"Encabezado 5",styleHeading6:"Encabezado 6",styleAddNew:"Añadir nuevo",styleAddNewAria:"Añadir un estilo de párrafo",customStyleDialogAddTitle:"Añadir estilo de párrafo",customStyleDialogEditTitle:"Editar estilo de párrafo",customStyleDialogTabFont:"Fuente",customStyleDialogTabParagraph:"Párrafo",customStyleDialogName:"Nombre",customStyleDialogDelete:"Eliminar",customStyleDialogDeleteConfirm:"¿Eliminar este estilo de párrafo?",customStyleDialogCloseAria:"Cerrar",customStyleLoading:"Cargando estilos de párrafo",colorAutomatic:"Automático",colorNone:"Sin color",colorCustom:"Color personalizado",colorHex:"Hex",colorRgbR:"R",colorRgbG:"G",colorRgbB:"B",colorPickFromScreen:"Seleccionar de la pantalla",colorRecent:"Colores recientes",fontDialogTitle:"Propiedades de fuente",fontDialogTabGeneral:"General",fontDialogFamily:"Fuente",fontFamilyDefault:"Predeterminada",fontDialogSize:"Tamaño",fontDialogUnit:"Unidad",fontDialogStyle:"Estilo",fontDialogOk:"Aceptar",fontDialogCancel:"Cancelar",linkDialogTitle:"Insertar enlace",linkDialogTabLink:"Enlace",linkDialogTabBookmark:"Marcador",linkDialogHref:"URL",linkDialogHoverTitle:"Título",linkDialogTargetBlank:"Abrir en una pestaña nueva",linkDialogTextDecorationNone:"Sin subrayado",linkDialogHover:"Al pasar el cursor",linkDialogHoverColor:"Color",linkDialogHoverColorField:"Color al pasar el cursor",linkDialogHoverHtml:"HTML",linkDialogHoverHtmlAria:"HTML personalizado al pasar el cursor",linkDialogBookmark:"Marcador",linkDialogBookmarkEmpty:"No hay marcadores en este documento.",linkDialogSelect:"Seleccionar",bookmarkDialogTitle:"Insertar marcador",bookmarkDialogName:"Nombre del marcador",bookmarkDialogHelp:"Empieza por una letra. Usa solo letras, números, guiones y guiones bajos. Debe ser único en el documento.",bookmarkDialogHelpAria:"Formato del nombre del marcador",bookmarkDialogCloseAria:"Cerrar",bookmarkDialogErrorEmpty:"Introduce un nombre de marcador.",bookmarkDialogErrorInvalid:"Empieza por una letra. Usa solo letras, números, guiones y guiones bajos.",bookmarkDialogErrorDuplicate:"Ya existe un marcador con este nombre.",imageDialogTitle:"Insertar imagen",imageDialogSource:"Origen",imageDialogFile:"Archivo",imageDialogChooseFile:"Elegir archivo",imageDialogUrl:"URL de la imagen",imageDialogAlt:"Texto alternativo",imageDialogTitleField:"Título",imageDialogCloseAria:"Cerrar",imageDialogErrorEmpty:"Elige un archivo o introduce una URL de imagen.",imageDialogErrorInvalid:"Introduce una URL de imagen válida.",imageDialogErrorType:"Usa una imagen JPEG, PNG, GIF, WebP, BMP o AVIF.",imageDialogErrorTooLarge:"Elige una imagen de menos de 2 MB.",imagePropertiesDialogTitle:"Propiedades de imagen",imagePropertiesDialogCloseAria:"Cerrar",imagePropertiesTabAlignment:"Alineación",imagePropertiesTabBorder:"Borde y margen",imagePropertiesTabAdvanced:"Avanzado",imagePropertiesTabHover:"Al pasar el puntero",imagePropertiesSize:"Tamaño",imagePropertiesSizeMode:"Modo de tamaño",imagePropertiesSizeWidth:"Solo ancho",imagePropertiesSizeHeight:"Solo alto",imagePropertiesSizeLock:"Bloquear juntos",imagePropertiesWidth:"Ancho",imagePropertiesHeight:"Alto",imagePropertiesWidthAria:"Ancho de la imagen",imagePropertiesHeightAria:"Alto de la imagen",imagePropertiesSizeUnitAria:"Unidad de tamaño de imagen",imagePropertiesFit:"Ajuste",imagePropertiesFitDefault:"Predeterminado",imagePropertiesFitFill:"Rellenar",imagePropertiesFitContain:"Contener",imagePropertiesFitCover:"Cubrir",imagePropertiesFitNoneValue:"Ninguno",imagePropertiesFitScaleDown:"Reducir",imagePropertiesPosition:"Posición",imagePropertiesPositionDefault:"Predeterminada",imagePropertiesPositionCenter:"Centro",imagePropertiesPositionTop:"Arriba",imagePropertiesPositionBottom:"Abajo",imagePropertiesPositionLeft:"Izquierda",imagePropertiesPositionRight:"Derecha",imagePropertiesPositionTopLeft:"Arriba izquierda",imagePropertiesPositionTopRight:"Arriba derecha",imagePropertiesPositionBottomLeft:"Abajo izquierda",imagePropertiesPositionBottomRight:"Abajo derecha",imagePropertiesRotation:"Rotación",imagePropertiesRotationUnit:"deg",imagePropertiesHoverCss:"CSS al pasar el puntero",imagePropertiesHoverCssAria:"CSS personalizado al pasar el puntero",imagePropertiesHoverHelp:"CSS que se aplica cuando el puntero está sobre la imagen.",imageResizeHandleEastAria:"Redimensionar el ancho de la imagen, mantener la proporción",imageResizeHandleSouthAria:"Redimensionar el alto de la imagen, mantener la proporción",imageResizeHandleSouthEastAria:"Redimensionar la imagen sin mantener la proporción",tableDialogTitle:"Insertar tabla",tableDialogCloseAria:"Cerrar",tableDialogRows:"Filas",tableDialogColumns:"Columnas",tableDialogSize:"Tamaño",tableDialogGridAria:"Cuadrícula de tamaño de tabla",tableDialogInsert:"Insertar",tablePropertiesDialogTitle:"Propiedades de tabla",tablePropertiesDialogCloseAria:"Cerrar",tablePropertiesCollapse:"Contracción de bordes",tablePropertiesCollapseCollapse:"Contraídos",tablePropertiesCollapseSeparate:"Separados",tablePropertiesSpacing:"Espaciado de bordes",tablePropertiesWidth:"Ancho",cellPropertiesDialogTitle:"Propiedades de celda",cellPropertiesDialogCloseAria:"Cerrar",cellPropertiesColor:"Color de texto",cellPropertiesVerticalAlign:"Alineación vertical",cellPropertiesVerticalAlignDefault:"Predeterminada",cellPropertiesVerticalAlignTop:"Arriba",cellPropertiesVerticalAlignMiddle:"Centro",cellPropertiesVerticalAlignBottom:"Abajo",cellPropertiesVerticalAlignBaseline:"Línea base",cellPropertiesWidth:"Ancho",rowPropertiesDialogTitle:"Propiedades de fila",rowPropertiesDialogCloseAria:"Cerrar",rowPropertiesHeight:"Alto",paragraphDialogTitle:"Propiedades de párrafo",pageDialogTitle:"Propiedades de página",paragraphDialogTabBorder:"Borde",paragraphDialogTabBackground:"Fondo",paragraphDialogAlignment:"Alineación",paragraphDialogLists:"Listas",paragraphDialogSpacing:"Espaciado",paragraphDialogMargin:"Margen",paragraphDialogPadding:"Relleno",paragraphDialogLineHeight:"Interlineado",paragraphDialogLineHeightNormal:"Normal",paragraphDialogLineHeightUnitless:"×",paragraphDialogLinkSides:"Igual en todos los lados",paragraphDialogSideTop:"Superior",paragraphDialogSideRight:"Derecho",paragraphDialogSideBottom:"Inferior",paragraphDialogSideLeft:"Izquierdo",paragraphDialogBorder:"Borde",paragraphDialogBorderStyle:"Estilo",paragraphDialogBorderWidth:"Grosor",paragraphDialogBorderColor:"Color",paragraphDialogBorderRadius:"Radio de esquina",paragraphDialogBoxShadow:"Sombra",paragraphDialogShadowOffsetX:"Desplazamiento X",paragraphDialogShadowOffsetY:"Desplazamiento Y",paragraphDialogShadowBlur:"Desenfoque",paragraphDialogShadowSpread:"Extensión",paragraphDialogShadowColor:"Color",paragraphDialogShadowInset:"Interior",paragraphDialogLengthUnitAria:"Unidad",paragraphDialogBorderStyleNone:"Ninguno",paragraphDialogBorderStyleSolid:"Sólido",paragraphDialogBorderStyleDotted:"Punteado",paragraphDialogBorderStyleDashed:"Discontinuo",paragraphDialogBorderStyleDouble:"Doble",paragraphDialogBorderStyleGroove:"Surco",paragraphDialogBorderStyleRidge:"Relieve",paragraphDialogBorderStyleInset:"Hundido",paragraphDialogBorderStyleOutset:"Saliente",paragraphDialogBackgroundColor:"Color de fondo",paragraphDialogOpacity:"Opacidad",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Barra de herramientas",toolbarGroupFile:"Archivo",toolbarGroupPrint:"Imprimir",toolbarGroupEdit:"Editar",toolbarGroupInsert:"Insertar",toolbarGroupFont:"Fuentes",toolbarGroupAlign:"Alinear",toolbarGroupParagraph:"Párrafo",toolbarGroupView:"Vista",toolbarGroupFullscreen:"Pantalla completa",toolbarGroupCustom:"Personalizado",customizeToolbarDialogTitle:"Personalizar barra de herramientas",customizeToolbarDialogReset:"Restablecer",customizeToolbarDialogClose:"Cerrar",customizeToolbarDialogCloseAria:"Cerrar",customizeToolbarDialogLoading:"Cargando la configuración de la barra",customizeToolbarItemVisible:"Mostrar en la barra",customizeToolbarDragHandle:"Arrastrar para reordenar el grupo",customizeToolbarMoveUp:"Mover el grupo hacia arriba",customizeToolbarMoveDown:"Mover el grupo hacia abajo",previewDialogTitle:"Vista previa del documento",previewDialogClose:"Cerrar",previewDialogCloseAria:"Cerrar"},Gu={en:xi,es:Wu},os=s.createContext(e=>xi[e]);function Vu({locale:e="en",children:t}){const n=s.useMemo(()=>{const r=Gu[e]??xi;return i=>r[i]},[e]);return o.jsx(os.Provider,{value:n,children:t})}function V(){return s.useContext(os)}const qu="_menu_labh4_1",Xu="_item_labh4_17",Yu="_separator_labh4_57",No={menu:qu,item:Xu,separator:Yu},nr=8,Ju=[{type:"item",command:"deleteSelection",labelKey:"commandDelete",ariaKey:"commandDeleteAria",enabled:e=>e==="text"||e==="image"},{type:"item",command:"cut",labelKey:"commandCut",ariaKey:"commandCutAria",enabled:e=>e==="text"||e==="image"},{type:"item",command:"copy",labelKey:"commandCopy",ariaKey:"commandCopyAria",enabled:e=>e==="text"||e==="image"},{type:"separator"},{type:"item",command:"openLinkDialog",labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:e=>e!=="image"},{type:"separator"},{type:"item",command:"openFontProperties",labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openParagraphProperties",labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openImageProperties",labelKey:"commandImageProperties",ariaKey:"commandImagePropertiesAria",enabled:e=>e==="image"},{type:"item",command:"openTableProperties",labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:(e,t)=>t},{type:"item",command:"openCellProperties",labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:(e,t)=>t},{type:"item",command:"openRowProperties",labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:(e,t)=>t}];function Ua(){return'[role="menuitem"]:not(:disabled)'}function Zu({open:e,x:t,y:n,kind:r,inTable:i=!1,commands:a,onClose:l}){const c=V(),m=s.useId(),p=s.useRef(null);if(s.useLayoutEffect(()=>{var x;if(!e)return;const h=p.current;if(!h)return;const w=h.getBoundingClientRect(),y=Math.max(nr,Math.min(t,window.innerWidth-w.width-nr)),v=Math.max(nr,Math.min(n,window.innerHeight-w.height-nr));h.style.left=`${y}px`,h.style.top=`${v}px`,(x=h.querySelector(Ua()))==null||x.focus()},[e,t,n,r]),s.useEffect(()=>{if(!e)return;const h=x=>{var k;(k=p.current)!=null&&k.contains(x.target)||l()},w=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),l())},y=()=>{l()},v=x=>{var k;if((k=p.current)!=null&&k.contains(x.target)){x.preventDefault();return}x.defaultPrevented||l()};return document.addEventListener("pointerdown",h),document.addEventListener("keydown",w,!0),window.addEventListener("scroll",y,!0),document.addEventListener("contextmenu",v),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",w,!0),window.removeEventListener("scroll",y,!0),document.removeEventListener("contextmenu",v)}},[e,l]),!e)return null;const b=h=>{var k;if(h.key!=="ArrowDown"&&h.key!=="ArrowUp")return;const w=[...((k=p.current)==null?void 0:k.querySelectorAll(Ua()))??[]];if(w.length===0)return;const y=w.indexOf(document.activeElement),v=h.key==="ArrowDown"?1:-1,x=w[(y+v+w.length)%w.length];h.preventDefault(),x==null||x.focus()};return o.jsx(ie,{children:o.jsxs("div",{ref:p,className:No.menu,role:"menu","aria-labelledby":m,style:{left:t,top:n},onMouseDown:h=>h.preventDefault(),onKeyDown:b,children:[o.jsx("span",{id:m,hidden:!0,children:c("contextMenuAria")}),Ju.map((h,w)=>{if(h.type==="separator")return o.jsx("div",{role:"separator",className:No.separator},`separator-${w}`);const y=h.enabled(r,i);return o.jsx("button",{type:"button",role:"menuitem",className:No.item,"aria-label":c(h.ariaKey),disabled:!y,onClick:()=>{y&&(l(),yi(a,h.command))},children:c(h.labelKey)},h.command)})]})})}function Qu(e){return e==="touch"||e==="pen"}function ed(e,t){return e.button===2||e.ctrlKey?!0:!Qu(t)}function wi(e){return typeof e.text=="function"?e.text():new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(String(r.result??"")),r.onerror=()=>n(r.error??new Error("Failed to read file")),r.readAsText(e)})}function td(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function rr(e){var r;if(!e)return!1;if(Array.from(e.types??[]).includes("Files")||e.files&&e.files.length>0)return!0;const n=e.items;if(n){for(let i=0;i<n.length;i++)if(((r=n[i])==null?void 0:r.kind)==="file")return!0}return!1}function nd(e){var r;const t=[],n=e.files;if(n)for(let i=0;i<n.length;i++){const a=((r=n.item)==null?void 0:r.call(n,i))??n[i];a&&t.push(a)}if(t.length===0&&e.items)for(let i=0;i<e.items.length;i++){const a=e.items[i];if((a==null?void 0:a.kind)!=="file")continue;const l=a.getAsFile();l&&t.push(l)}return t}function rd(e){return e?nd(e).find(td)??null:null}const is={description:"HTML",accept:{"text/html":[".html",".htm"]}},od="document.html";function as(){return window}function ls(e){return e instanceof DOMException&&e.name==="AbortError"}function id(e,t){const n=new Blob([e],{type:"text/html;charset=utf-8"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=t,i.rel="noopener",document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(r)}function ad(){return new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept=".html,.htm,text/html",t.hidden=!0;const n=r=>{t.remove(),e(r)};t.addEventListener("change",()=>{var i;const r=(i=t.files)==null?void 0:i[0];if(!r){n(null);return}wi(r).then(a=>n(a),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function ld(e,t=od){const n=as().showSaveFilePicker;if(typeof n=="function"){try{const i=await(await n({suggestedName:t,types:[is]})).createWritable();await i.write(e),await i.close()}catch(r){if(ls(r))return;throw r}return}id(e,t)}async function sd(){const e=as().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[is]}),n=await t.getFile();return await wi(n)}catch(t){if(ls(t))return null;throw t}return ad()}const cd=new Set(["span","strong","b","em","i","u","s","strike","del"]);function se(e,t){return t?e===t||e.contains(t):!1}function qe(e){return cd.has(e.tagName.toLowerCase())}function ud(e,t){const n=document.createRange();return n.selectNodeContents(t),e.compareBoundaryPoints(Range.END_TO_START,n)<0&&e.compareBoundaryPoints(Range.START_TO_END,n)>0}function Be(e){const t=e.commonAncestorContainer;if(t.nodeType===Node.TEXT_NODE)return t.nodeValue?[t]:[];const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let i;for(;i=r.nextNode();)i.nodeValue&&ud(e,i)&&n.push(i);return n}function ut(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType===Node.TEXT_NODE){const a=t;if(n>0&&n<a.length){const l=a.splitText(n);e.setStart(l,0),e.endContainer===a&&e.setEnd(l,e.endOffset-n)}}const r=e.endContainer,i=e.endOffset;if(r.nodeType===Node.TEXT_NODE){const a=r;i>0&&i<a.length&&(a.splitText(i),e.setEnd(a,a.length))}}function Dt(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function _e(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function pt(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<=-1||n.length===1)return;const i=e.parentNode;if(!i)return;const a=n.slice(0,r),l=n.slice(r+1);if(a.length>0){const c=e.cloneNode(!1);for(const m of a)c.appendChild(m);i.insertBefore(c,e)}if(l.length>0){const c=e.cloneNode(!1);for(const m of l)c.appendChild(m);i.insertBefore(c,e.nextSibling)}}function Ut(e){if(e.length===0)return;const t=e[0],n=e[e.length-1],r=document.createRange();r.setStart(t,0),r.setEnd(n,n.data.length);const i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function Ar(e,t){const n=e.parentElement;if(n&&n.tagName.toLowerCase()==="span"&&n.childNodes.length===1)return t(n),n;const r=document.createElement("span");return t(r),n==null||n.insertBefore(r,e),r.appendChild(e),r}const jr="data-wysiwyg-font",dd=[{name:"Arial",family:"Arial, Helvetica, sans-serif"},{name:"Arial Black",family:"'Arial Black', Gadget, sans-serif"},{name:"Comic Sans MS",family:"'Comic Sans MS', Textile, cursive"},{name:"Courier New",family:"'Courier New', Courier, monospace"},{name:"Georgia",family:"Georgia, serif"},{name:"Helvetica",family:"Helvetica, Arial, sans-serif"},{name:"Impact",family:"Impact, Charcoal, sans-serif"},{name:"Lucida Console",family:"'Lucida Console', Monaco, monospace"},{name:"Lucida Sans Unicode",family:"'Lucida Sans Unicode', 'Lucida Grande', sans-serif"},{name:"Palatino Linotype",family:"'Palatino Linotype', Palatino, serif"},{name:"Tahoma",family:"Tahoma, Geneva, sans-serif"},{name:"Times New Roman",family:"'Times New Roman', Times, serif"},{name:"Trebuchet MS",family:"'Trebuchet MS', Helvetica, sans-serif"},{name:"Verdana",family:"Verdana, Geneva, sans-serif"}];function wn(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function kn(e,t){return e===t?!0:!e||!t?!1:wn(e)===wn(t)}function ss(e=[]){var r;const t=[],n=new Set;for(const i of[...dd,...e]){const a=i.family.trim();if(!a)continue;const l=wn(a);if(n.has(l))continue;n.add(l);const c=(r=i.css)==null?void 0:r.trim();t.push({name:i.name.trim()||a,family:a,...c?{css:c}:{}})}return t}function md(e,t){return e?t.find(n=>kn(n.family,e))??null:null}function fd(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function pd(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Er(e){const t=new Set,n=[];for(const r of e){const i=r.trim();!i||!fd(i)||t.has(i)||(t.add(i),n.push(i))}return n}function hd(e){return e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&amp;/g,"&")}const gd=new RegExp(`<link\\b[^>]*\\b${jr}\\b[^>]*>`,"gi");function vn(e){if(!e.includes(jr))return{hrefs:[],body:e};const t=[],n=e.replace(gd,r=>{var a,l;const i=((a=r.match(/\bhref\s*=\s*"([^"]*)"/i))==null?void 0:a[1])??((l=r.match(/\bhref\s*=\s*'([^']*)'/i))==null?void 0:l[1]);return i&&t.push(hd(i)),""});return{hrefs:Er(t),body:n}}function Lo(e,t){const n=Er(t);return n.length===0?e:`${n.map(i=>`<link rel="stylesheet" href="${pd(i)}" ${jr}="">`).join("")}${e}`}function bd(e,t){const n=wn(t);if(!n)return!1;const r=new DOMParser().parseFromString(e,"text/html"),i=r.createTreeWalker(r.body,NodeFilter.SHOW_ELEMENT);let a=i.currentNode;for(;a;){if(a instanceof HTMLElement){const l=a.style.fontFamily;if(l&&wn(l)===n)return!0}a=i.nextNode()}return!1}function Mo(e,t,n=[]){const r=vn(t).hrefs,i=n.filter(a=>a.css&&bd(e,a.family)).map(a=>a.css??"");return Er([...r,...i])}function yd(e,t=[]){const n=vn(e).hrefs,r=t.map(i=>i.css??"");return Er([...n,...r])}function xd(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function cs(e){return e.style.fontFamily.trim()||null}function vi(e,t){let n=xd(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=cs(n);if(r)return r;n=n.parentElement}return null}function Yo(e){return e instanceof HTMLElement&&cs(e)!==null}function Si(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function wd(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!qe(r)||!Yo(r)){n=r;continue}if(pt(r,n),Yo(r)&&(Si(r),Dt(r))){_e(r);continue}n=r}}function us(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n:null}function vd(e){const t=us(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:Be(t).filter(c=>c.data.length>0),i=(n.length>0?n:[t.startContainer]).map(c=>vi(e,c)),a=i[0]??null;return i.every(c=>kn(c,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function Wa(e,t){const n=us(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;ut(n);const i=Be(n).filter(a=>a.data.length>0);for(const a of i){const l=vi(e,a);if(r===null){if(l===null)continue;wd(e,a);continue}kn(l,r)||Ar(a,c=>{c.style.fontFamily=r})}return Ut(i),!0}function Sd(e,t){if(t){if(t.value===null){Si(e);return}e.style.fontFamily=t.value}}function Cd(e){return e!=null}function kd(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function Dd(e){var r,i,a;let t=e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0?e.startContainer:e.startContainer.childNodes[e.startOffset]??e.startContainer.lastChild??e.startContainer;if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset>0){const l=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(l,e.startContainer.nextSibling),l}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const l=document.createTextNode("");return(i=e.startContainer.parentNode)==null||i.insertBefore(l,e.startContainer),l}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function Jo(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!qe(r)||!Yo(r)){n=r;continue}if(pt(r,n),Si(r),Dt(r)){_e(r);continue}n=r.isConnected?r:t}return t}function Pd(e,t){kd(t);const n=Dd(t);return Jo(e,n)}function Ad(e,t,n){return!!(n&&n.value===null&&vi(e,t))}const jd=`
2
2
  @page {
3
3
  margin: 0;
4
4
  }
@@ -87,6 +87,6 @@ img {
87
87
  height: auto;
88
88
  vertical-align: middle;
89
89
  }
90
- `.trim(),Xc=1e3;function Yc(e){const t=document.createElement("iframe");t.setAttribute("aria-hidden","true"),t.setAttribute("data-wysiwyg-print",""),t.style.position="fixed",t.style.right="0",t.style.bottom="0",t.style.width="0",t.style.height="0",t.style.border="0",document.body.append(t);const n=t.contentDocument,r=t.contentWindow;if(!n||!r){t.remove();return}const{hrefs:i,body:a}=rn(e),l=n.createElement("meta");l.setAttribute("charset","utf-8");const c=n.createElement("title");c.textContent="​";const m=n.createElement("style");m.textContent=Vc;const p=i.map(w=>{const x=n.createElement("link");return x.rel="stylesheet",x.href=w,x});n.head.replaceChildren(l,c,m,...p),n.title="​",n.body.innerHTML=a;let b=!1;const h=()=>{b||(b=!0,t.remove())};r.addEventListener("afterprint",h),r.focus(),r.print(),window.setTimeout(h,Xc)}function Jc(e){return{save:async()=>{await Pc(e.getHtml())},open:async()=>{const t=await Ec();t!==null&&e.setHtml(t)},print:()=>{Yc(e.getHtml())}}}function Zc(e){return{toggleBold:()=>{e.toggleFontMark("bold")},toggleItalic:()=>{e.toggleFontMark("italic")},toggleUnderline:()=>{e.toggleFontMark("underline")},toggleStrikethrough:()=>{e.toggleFontMark("strikethrough")},clearFormatting:()=>{e.clearFormatting()},setFontSize:(t,n)=>{e.setFontSize(t,n)},setFontSizeUnit:t=>{e.setFontSizeUnit(t)},setFontFamily:t=>{e.setFontFamily(t)},setFontColor:t=>{e.setFontColor(t)},setHighlightColor:t=>{e.setHighlightColor(t)},setParagraphStyle:t=>{e.setParagraphStyle(t)},alignLeft:()=>{e.setTextAlign("left")},alignCenter:()=>{e.setTextAlign("center")},alignRight:()=>{e.setTextAlign("right")},alignJustify:()=>{e.setTextAlign("justify")},indent:()=>{e.indent()},outdent:()=>{e.outdent()},toggleBulletList:()=>{e.toggleList("ul")},toggleNumberedList:()=>{e.toggleList("ol")},openFontProperties:t=>{e.openFontProperties(t??"general")},applyFontProperties:t=>{e.applyFontProperties(t)},openParagraphProperties:t=>{e.openParagraphProperties(t??"general")},applyParagraphProperties:t=>{e.applyParagraphProperties(t)},openPageProperties:t=>{e.openPageProperties(t??"font")},applyPageProperties:t=>{e.applyPageProperties(t)},openCustomParagraphStyleDialog:t=>{e.openCustomParagraphStyleDialog(t)},applyCustomParagraphStyle:t=>{e.applyCustomParagraphStyle(t)}}}function Qc(e){return{isBold:()=>e.isFontMarkActive("bold"),isItalic:()=>e.isFontMarkActive("italic"),isUnderline:()=>e.isFontMarkActive("underline"),isStrikethrough:()=>e.isFontMarkActive("strikethrough"),getFontSize:()=>e.getFontSize(),getFontSizeUnit:()=>e.getFontSizeUnit(),isFontSizeMixed:()=>e.isFontSizeMixed(),getFontFamily:()=>e.getFontFamily(),isFontFamilyMixed:()=>e.isFontFamilyMixed(),getFontFaces:()=>e.getFontFaces(),getFontColor:()=>e.getFontColor(),isFontColorMixed:()=>e.isFontColorMixed(),getHighlightColor:()=>e.getHighlightColor(),isHighlightColorMixed:()=>e.isHighlightColorMixed(),getParagraphStyle:()=>e.getParagraphStyle(),isParagraphStyleMixed:()=>e.isParagraphStyleMixed(),isAlignLeft:()=>e.getTextAlign()==="left"&&!e.isTextAlignMixed(),isAlignCenter:()=>e.getTextAlign()==="center"&&!e.isTextAlignMixed(),isAlignRight:()=>e.getTextAlign()==="right"&&!e.isTextAlignMixed(),isAlignJustify:()=>e.getTextAlign()==="justify"&&!e.isTextAlignMixed(),canOutdent:()=>e.canOutdent(),isBulletList:()=>e.isBulletList(),isNumberedList:()=>e.isNumberedList(),hasTextSelection:()=>e.hasTextSelection(),customParagraphStylesEnabled:()=>e.customParagraphStylesEnabled(),getCustomParagraphStyles:()=>e.getCustomParagraphStyles(),isCustomParagraphStylesLoading:()=>e.isCustomParagraphStylesLoading()}}function eu(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function tu(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function nu(e){return{openLinkDialog:t=>{e.openLinkDialog(t)},applyLink:t=>{e.applyLink(t)},openBookmarkDialog:()=>{e.openBookmarkDialog()},applyBookmark:t=>{e.applyBookmark(t)},openImageDialog:()=>{e.openImageDialog()},applyImage:t=>{e.applyImage(t)},openImageProperties:t=>{e.openImageProperties(t)},applyImageProperties:t=>{e.applyImageProperties(t)}}}function ru(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected()}}function ou(e){return{openTableDialog:()=>{e.openTableDialog()},applyTable:t=>{e.applyTable(t)},openTableProperties:()=>{e.openTableProperties()},applyTableProperties:t=>{e.applyTableProperties(t)},openCellProperties:()=>{e.openCellProperties()},applyCellProperties:t=>{e.applyCellProperties(t)},openRowProperties:()=>{e.openRowProperties()},applyRowProperties:t=>{e.applyRowProperties(t)},insertRowBelow:()=>{e.insertRowBelow()},insertRowBefore:()=>{e.insertRowBefore()},deleteRow:()=>{e.deleteRow()},insertColumnAfter:()=>{e.insertColumnAfter()},insertColumnBefore:()=>{e.insertColumnBefore()},deleteColumn:()=>{e.deleteColumn()}}}function iu(e){return{isInTable:()=>e.isInTable()}}function au(e){return{setVisualMode:()=>{e.setMode("visual")},setHtmlMode:()=>{e.setMode("html")},toggleFullscreen:()=>{e.setFullscreen(!e.getFullscreen())}}}function lu(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen()}}function su(e){return{...Jc(e),...eu(e),...hc(e),...nu(e),...ou(e),...au(e),...Zc(e)}}function cu(e){return{...lu(e),...tu(e),...ru(e),...iu(e),...Qc(e)}}const Io=["pt","px","em","rem","%"],ut="pt",uu={pt:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],px:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],em:[.5,.75,1,1.25,1.5,2,2.5,3],rem:[.5,.75,1,1.25,1.5,2,2.5,3],"%":[50,75,100,125,150,200,250,300]},du={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},mu=new Set(Io),fu=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function nr(e){return mu.has(e)}function xe(e){return Math.round(e*100)/100}function Y(e){const t=xe(e);return Number.isInteger(t),String(t)}function Bo(e,t){return`${Y(e)}${t}`}function Ho(e){const t=e.trim();if(!t)return null;const n=t.match(fu);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return{value:r,unit:i}}function pu(e,t){const n=e.trim();if(!n)return null;const r=Ho(n);if(r)return nr(r.unit)?dt(r.value,r.unit):null;const i=Number(n.replace(",","."));return Number.isFinite(i)?dt(i,t):null}function dt(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=du[t];return{value:xe(Math.min(r,Math.max(n,e))),unit:t}}function Ya(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return xe(e);case"pt":return xe(e*.75);case"em":return xe(e/i);case"rem":return xe(e/a);case"%":return xe(e/i*100)}}function hu(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return e;case"pt":return e*(4/3);case"em":return e*i;case"rem":return e*a;case"%":return e/100*i}}function Ja(e,t,n,r,i){if(t===n)return xe(e);const a=hu(e,t,r,i);return Ya(a,n,r,i)}function Kn(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function gu(e){const t=e.style.fontSize;if(!t)return null;const n=Ho(t);return!n||!nr(n.unit)?null:{value:n.value,unit:n.unit}}function Za(e,t){let n=Kn(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=gu(n);if(r)return r;n=n.parentElement}return null}function bu(e,t){const n=Kn(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function Qa(e,t){var a;let n=Kn(t);for(;n&&n!==e;){if(n.style.fontSize){const c=n.parentElement??e,m=parseFloat(getComputedStyle(c).fontSize);return Number.isFinite(m)&&m>0?m:16}n=n.parentElement}const r=((a=Kn(t))==null?void 0:a.parentElement)??e,i=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(i)&&i>0?i:16}function el(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function yu(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function zi(e=ut){return{value:null,unit:e,mixed:!1}}function xu(e,t=ut){const n=window.getSelection();if(!n||n.rangeCount===0)return zi(t);const r=n.getRangeAt(0);if(!ae(e,r.commonAncestorContainer))return zi(t);const i=r.collapsed?[]:Ne(r).filter(p=>p.data.length>0),a=i.length>0?i:[r.startContainer],l=a.map(p=>Za(e,p)),c=l[0];if(l.every(p=>yu(p,c))&&c)return{value:c.value,unit:c.unit,mixed:!1};if(l.every(p=>p===null)){const p=a.map(h=>bu(h,e)),b=p[0];if(p.every(h=>Math.abs(h-b)<.05)){const h=Qa(e,a[0]),w=el(e);return{value:Ya(b,t,h,w),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function wu(e,t){return{parentPx:Qa(e,t),rootPx:el(e)}}function Su(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function Ki(e,t,n){const r=dt(t,n);if(!r)return!1;const i=Su(e);if(!i||i.collapsed)return!1;const a=Bo(r.value,r.unit);et(i);const l=Ne(i).filter(c=>c.data.length>0);for(const c of l){const m=Za(e,c);m&&m.value===r.value&&m.unit===r.unit||Qn(c,p=>{p.style.fontSize=a})}return Nt(l),!0}function ku(e,t){e.style.fontSize=Bo(t.value,t.unit)}function Cu(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Qr(e){const t=e.trim().match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d*\.?\d+))?\s*\)$/i);if(!t)return null;const n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),a=t[4]===void 0?1:Number(t[4]);return[n,r,i,a].every(l=>Number.isFinite(l))?{r:n,g:r,b:i,a}:null}function eo(e,t,n){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function to(e){const t=e.trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(t)?t:/^#[0-9a-f]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:null}const vu={black:"#000000",silver:"#c0c0c0",gray:"#808080",grey:"#808080",white:"#ffffff",maroon:"#800000",red:"#ff0000",purple:"#800080",fuchsia:"#ff00ff",magenta:"#ff00ff",green:"#008000",lime:"#00ff00",olive:"#808000",yellow:"#ffff00",navy:"#000080",blue:"#0000ff",teal:"#008080",aqua:"#00ffff",cyan:"#00ffff",orange:"#ffa500"};function Du(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function se(e){const t=e.trim();if(!t||Du(t))return null;const n=to(t);if(n)return n;const r=Qr(t);if(r)return r.a===0?null:eo(r.r,r.g,r.b);const i=vu[t.toLowerCase()];if(i)return i;const a=document.createElement("canvas").getContext("2d");if(!a)return null;a.fillStyle="#010203";try{a.fillStyle=t}catch{return null}const l=String(a.fillStyle);if(l==="#010203"){const m=to(t);if(m==="#010203")return m;const p=Qr(t);return p&&eo(p.r,p.g,p.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(l.startsWith("#"))return to(l);const c=Qr(l);return!c||c.a===0?null:eo(c.r,c.g,c.b)}function tl(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?se(n):null}function $n(e,t,n){let r=Cu(t);for(;r&&r!==e&&r instanceof HTMLElement;){const i=tl(r,n);if(i)return i;r=r.parentElement}return null}function Un(e,t){return e instanceof HTMLElement?tl(e,t)!==null:!1}function Oo(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function nl(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function Au(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!Ve(i)||!Un(i,n)){r=i;continue}if(ft(i,r),Un(i,n)&&(Oo(i,n),mt(i))){Re(i);continue}r=i}}function rl(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function $i(e,t){const n=rl(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:Ne(n).filter(m=>m.data.length>0),a=(r.length>0?r:[n.startContainer]).map(m=>$n(e,m,t)),l=a[0]??null;return a.every(m=>m===l)?{value:l,mixed:!1}:{value:null,mixed:!0}}function no(e,t,n){const r=rl(e);if(!r||r.collapsed)return!1;const i=n===null?null:se(n);if(n!==null&&i===null)return!1;et(r);const a=Ne(r).filter(l=>l.data.length>0);for(const l of a){const c=$n(e,l,t);if(i===null){if(c===null)continue;Au(e,l,t);continue}c!==i&&Qn(l,m=>{nl(m,t,i)})}return Nt(a),!0}function Ui(e,t,n){if(n.value===null){Oo(e,t);return}const r=se(n.value);r&&nl(e,t,r)}function Pu(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function Eu(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function ju(e){var r,i,a;let t=e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0?e.startContainer:e.startContainer.childNodes[e.startOffset]??e.startContainer.lastChild??e.startContainer;if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset>0){const l=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(l,e.startContainer.nextSibling),l}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const l=document.createTextNode("");return(i=e.startContainer.parentNode)==null||i.insertBefore(l,e.startContainer),l}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function ol(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!Ve(i)||!n.some(a=>Un(i,a))){r=i;continue}ft(i,r);for(const a of n)Un(i,a)&&Oo(i,a);if(mt(i)){Re(i);continue}r=i.isConnected?i:t}return t}function Nu(e,t,n){Eu(t);const r=ju(t);return ol(e,r,n)}function Lu(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&$n(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&$n(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const _e=["bold","italic","underline","strikethrough"],yt={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},Tu=new Set(["underline","line-through","overline"]);function $e(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function Mu(e,t){return _e.every(n=>e[n]===t[n])}function Ru(e){return _e.some(t=>e[t]!==void 0)}function il(e,t){const n={...e};if(!t)return n;for(const r of _e){const i=t[r];i!==void 0&&(n[r]=i)}return n}function _u(e,t,n){const r=e[n]??t[n],i={...e,[n]:!r};return i[n]===t[n]&&delete i[n],i}function tt(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>Tu.has(n))}function kt(e,t){if(t.length===0){e.style.textDecorationLine="",e.style.removeProperty("text-decoration-line"),e.style.textDecoration&&(e.style.textDecoration="",e.style.removeProperty("text-decoration"));return}e.style.textDecorationLine=t.join(" ")}function al(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(yt.bold.has(r))return!0;const l=n.style.fontWeight;if(!l)return null;if(l==="bold"||l==="bolder")return!0;const c=Number(l);return Number.isNaN(c)?l==="normal"||l==="lighter"?!1:null:c>=700}if(t==="italic"){if(yt.italic.has(r))return!0;const l=n.style.fontStyle;return l?l==="italic"||l==="oblique"?!0:l==="normal"?!1:null:null}if(t==="underline"){if(yt.underline.has(r))return!0;const l=n.style.textDecorationLine||n.style.textDecoration;if(!l)return null;if(l==="none")return!1;const c=tt(n);return c.includes("underline")?!0:c.length>0?!1:null}if(yt.strikethrough.has(r))return!0;const i=n.style.textDecorationLine||n.style.textDecoration;if(!i)return null;if(i==="none")return!1;const a=tt(n);return a.includes("line-through")?!0:a.length>0?!1:null}function Wn(e,t){return al(e,t)===!0}function Ct(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const i=al(r,n);if(i!==null)return i;r=r.parentElement}return!1}function ll(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=tt(e);r.includes("underline")||r.push("underline"),kt(e,r);return}const n=tt(e);n.includes("line-through")||n.push("line-through"),kt(e,n)}function sl(e,t){if(t==="bold"){e.style.fontWeight="",e.style.removeProperty("font-weight");return}if(t==="italic"){e.style.fontStyle="",e.style.removeProperty("font-style");return}if(t==="underline"){kt(e,tt(e).filter(n=>n!=="underline"));return}kt(e,tt(e).filter(n=>n!=="line-through"))}function Fu(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=tt(e).filter(i=>i!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}kt(e,r);return}const n=tt(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}kt(e,n)}function Iu(e,t){Qn(e,n=>ll(n,t))}function Bu(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!Ve(i)||!Wn(i,n)){r=i;continue}if(ft(i,r),Wn(i,n)){if(yt[n].has(i.tagName.toLowerCase())){Re(i);continue}if(sl(i,n),mt(i)){Re(i);continue}}r=i}}function Hu(e,t,n){const r=Ne(t).filter(i=>i.data.length>0);return r.length===0?Ct(e,t.startContainer,n):r.every(i=>Ct(e,i,n))}function Ou(e,t,n,r){et(t);const i=Ne(t).filter(a=>a.data.length>0);for(const a of i)r?Ct(e,a,n)||Iu(a,n):Bu(e,a,n);Nt(i)}function Ln(e){const t=window.getSelection();if(!t||t.rangeCount===0)return $e();const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return $e();if(n.collapsed)return go(e,n);const r=Ne(n).filter(a=>a.data.length>0);if(r.length===0)return go(e,n);const i=$e();for(const a of _e)i[a]=Ct(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const l of _e)i[l]=i[l]&&Ct(e,r[a],l);return i}function go(e,t){const n=$e();for(const r of _e)n[r]=Ct(e,t.startContainer,r);return n}function Wi(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!ae(e,r.commonAncestorContainer)||r.collapsed)return!1;const i=Hu(e,r,t);return Ou(e,r,t,!i),!0}function zu(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function Ku(e,t,n){var a,l,c;zu(t);let r=t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0?t.startContainer:t.startContainer.childNodes[t.startOffset]??t.startContainer.lastChild??t.startContainer;if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset>0){const m=document.createTextNode("");(a=t.startContainer.parentNode)==null||a.insertBefore(m,t.startContainer.nextSibling),r=m}else if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0){const m=document.createTextNode("");(l=t.startContainer.parentNode)==null||l.insertBefore(m,t.startContainer),r=m}else{const m=document.createTextNode("");r&&r!==t.startContainer?(c=r.parentNode)==null||c.insertBefore(m,r):t.startContainer.appendChild(m),r=m}let i=r;for(;i.parentElement&&i.parentElement!==e;){const m=i.parentElement;if(!Ve(m)){i=m;continue}if(!n.some(b=>Wn(m,b))){i=m;continue}ft(m,i);for(const b of n)if(Wn(m,b)){if(yt[b].has(m.tagName.toLowerCase())){Re(m);break}if(sl(m,b),mt(m)){Re(m);break}}i=m.isConnected?m:r}return r}function $u(e,t,n){for(const r of _e)n[r]!==t[r]&&(n[r]?ll(e,r):Fu(e,r))}function Uu(e,t,n,r,i,a){var g,k;const l=window.getSelection();if(!l||l.rangeCount===0)return;const c=l.getRangeAt(0);if(!ae(e,c.commonAncestorContainer))return;const m=go(e,c),p=il(m,n),b=_e.filter(P=>m[P]&&!p[P]),h=Lu(e,c.startContainer,i),w=Gc(e,c.startContainer,a);let x=null;b.length>0?(x=Ku(e,c,b),h.length>0&&ol(e,x,h),w&&ho(e,x)):h.length>0?(x=Nu(e,c,h),w&&ho(e,x)):w?x=qc(e,c):c.deleteContents();const S=document.createElement("span");$u(S,m,p),r&&ku(S,r),i!=null&&i.color&&Ui(S,"color",i.color),i!=null&&i.backgroundColor&&Ui(S,"backgroundColor",i.backgroundColor),a&&Kc(S,a),S.textContent=t;const y=S.style.cssText.trim()?S:document.createTextNode(t);x?((g=x.parentNode)==null||g.insertBefore(y,x),x.nodeType===Node.TEXT_NODE&&!x.data&&((k=x.parentNode)==null||k.removeChild(x))):c.insertNode(y);const C=document.createRange();C.setStartAfter(y),C.collapse(!0),l.removeAllRanges(),l.addRange(C)}const qn="data-page";function cl(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(qn)}function ul(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function Wu(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function sn(e){return ul(e).find(n=>n.hasAttribute(qn))??null}function qu(e){if(Wu(e))return null;const t=ul(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"?null:n}function Gu(e){const t=sn(e);if(t)return t;const n=qu(e);if(n)return n.setAttribute(qn,""),n;const r=document.createElement("div");for(r.setAttribute(qn,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),r}function zo(e){return sn(e)??e}function dl(e){const t=sn(e),n=(t==null?void 0:t.style.backgroundColor.trim())??"";n?e.style.backgroundColor=n:e.style.removeProperty("background-color")}function qi(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function Vu(e,t){return t?e===t||e.contains(t):!1}function Gi(e,t){var a;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=0,i;for(;i=n.nextNode();){if(i===t||t.contains(i)||t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)return r;r+=((a=i.textContent)==null?void 0:a.length)??0}return r}function Vi(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return Gi(e,t)+n;let r=0;const i=t.childNodes;for(let l=0;l<n&&l<i.length;l+=1)r+=((a=i[l].textContent)==null?void 0:a.length)??0;return Gi(e,t)+r}function Xi(e,t){var l,c;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=Math.max(0,t),i,a=null;for(;i=n.nextNode();){a=i;const m=((l=i.textContent)==null?void 0:l.length)??0;if(r<=m)return{node:i,offset:r};r-=m}return a?{node:a,offset:((c=a.textContent)==null?void 0:c.length)??0}:{node:e,offset:e.childNodes.length}}function ml(e,t,n){const r=document.createRange(),i=Xi(e,t),a=Xi(e,n);return r.setStart(i.node,i.offset),r.setEnd(a.node,a.offset),r}function Xu(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Je(e){var n;if(e.mode==="html"&&e.htmlEl){const r=e.htmlEl.selectionStart,i=e.htmlEl.selectionEnd;return{mode:"html",text:e.htmlEl.value.slice(r,i),collapsed:r===i,start:r,end:i,visualRange:null}}const t=e.visualEl;if(e.mode==="visual"&&t){const r=window.getSelection();if(r&&r.rangeCount>0){const a=r.getRangeAt(0);if(Vu(t,a.commonAncestorContainer)){const l=Vi(t,a.startContainer,a.startOffset),c=Vi(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(l,c),end:Math.max(l,c),visualRange:a.cloneRange()}}}const i=((n=t.textContent)==null?void 0:n.length)??0;return{mode:"visual",text:"",collapsed:!0,start:i,end:i,visualRange:null}}return{mode:e.mode,text:"",collapsed:!0,start:0,end:0,visualRange:null}}function Yi(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yu(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),l=e.snapshot.start,c=e.snapshot.end,m=e.asHtml?e.content:Yi(e.content);e.setHtml(a.slice(0,l)+m+a.slice(c));const p=e.htmlEl;if(p){const b=l+m.length;p.focus(),p.setSelectionRange(b,b)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:Yi(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&Xu(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??ml(t,e.snapshot.start,e.snapshot.end);if(r.deleteContents(),e.content)if(e.asHtml){const a=r.createContextualFragment(e.content),l=a.lastChild;r.insertNode(a),l&&(r.setStartAfter(l),r.collapse(!0))}else{const a=document.createTextNode(e.content);r.insertNode(a),r.setStartAfter(a),r.collapse(!0)}const i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r),e.setHtml(t.innerHTML)}const Ko=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),fl=new Set(["table","thead","tbody","tr","td","th"]),$o=new Set([...fl,"ul","ol","li","pre"]);function ie(e){return e.tagName.toLowerCase()}function rr(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Uo(e){return e instanceof HTMLElement&&(ie(e)==="ul"||ie(e)==="ol")}function Ee(e){return e instanceof HTMLElement&&ie(e)==="li"}function nt(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function Wo(e){const t=e.collapsed?[]:Ne(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function vt(e,t,n){var m,p,b;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let w=0,x;for(;x=h.nextNode();){if(x===t)return w+n;w+=((m=x.textContent)==null?void 0:m.length)??0}return w}let r=0;const i=t.childNodes;for(let h=0;h<n&&h<i.length;h+=1)r+=((p=i[h].textContent)==null?void 0:p.length)??0;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let l=0,c;for(;c=a.nextNode();){if(t.contains(c)||t.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING)return l+r;l+=((b=c.textContent)==null?void 0:b.length)??0}return l+r}function qo(e,t,n){const r=ml(e,t,n),i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function Lt(e,t){const n=nt(e);if(!n)return!1;const r=vt(e,n.startContainer,n.startOffset),i=vt(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),c=t();return qo(e,a,l),c}function Go(e,t){if(ie(e)===t)return e;const n=document.createElement(t);for(const r of[...e.attributes])n.setAttribute(r.name,r.value);for(;e.firstChild;)n.appendChild(e.firstChild);return e.replaceWith(n),n}function rt(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function Ju(e,t){let n=rr(t);for(;n&&n!==e;){if(cl(n,e)){n=n.parentElement;continue}const r=ie(n);if(Ko.has(r)&&n instanceof HTMLElement)return n;if(fl.has(r)||r==="pre")return null;n=n.parentElement}return null}function Tt(e){const t=nt(e);if(!t)return[];const n=new Set,r=[];for(const i of Wo(t)){const a=Ju(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function bo(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ie(e);return Ko.has(t)||$o.has(t)?!1:Ve(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Zu(e,t){let n=rr(t);for(;n&&n!==e;){if($o.has(ie(n)))return!0;n=n.parentElement}return!1}function Qu(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function ed(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&bo(n[i-1]);)i-=1;for(;a<n.length-1&&bo(n[a+1]);)a+=1;return n.slice(i,a+1)}function td(e,t,n){return n.startContainer===e?e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild:n.startContainer===t&&e!==t?e.firstChild:Qu(e,n.startContainer)}function nd(e,t){const n=zo(e);if(Zu(e,t.startContainer))return null;if(!n.firstChild){const l=document.createElement("p");return l.appendChild(document.createElement("br")),n.appendChild(l),l}const r=td(n,e,t);if(!r||r instanceof Element&&$o.has(ie(r))||r instanceof HTMLElement&&Ko.has(ie(r))||!bo(r))return null;const i=ed(n,r),a=document.createElement("p");n.insertBefore(a,i[0]);for(const l of i)a.appendChild(l);return a}function cn(e){const t=Tt(e);if(t.length>0)return t;const n=nt(e);if(!n)return[];const r=nd(e,n);return r?[r]:[]}function Dt(e){const t=e.parentElement;return t&&Uo(t)?t:null}function pl(e){if(e.length===0)return[];const t=[[e[0]]];for(let n=1;n<e.length;n+=1){const r=e[n-1],i=e[n];r.parentNode===i.parentNode&&rd(r,i)?t[t.length-1].push(i):t.push([i])}return t}function rd(e,t){var r;let n=e.nextSibling;for(;n;){if(n===t)return!0;if(n.nodeType===Node.TEXT_NODE&&!((r=n.textContent)!=null&&r.trim())){n=n.nextSibling;continue}return!1}return!1}const Gn=["p","h1","h2","h3","h4","h5","h6"],od=new Set(Gn),hl=new Set([...Gn,"div"]),or=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),id=()=>({tag:null,mixed:!1});function gl(e){return od.has(e)}function ad(e){return gl(e)?e:e==="div"?"p":null}function ld(e){return e instanceof Element&&or.has(ie(e))}function bl(e){return e instanceof HTMLElement&&hl.has(ie(e))}function yo(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ie(e);return hl.has(t)||or.has(t)?!1:Ve(e)||t==="br"||t==="a"||t==="img"||t==="span"}function sd(e,t){let n=rr(t);for(;n&&n!==e;){if(or.has(ie(n)))return!0;n=n.parentElement}return!1}function yl(e,t){let n=rr(t);for(;n&&n!==e;){if(cl(n,e)){n=n.parentElement;continue}if(bl(n))return n;if(or.has(ie(n)))return null;n=n.parentElement}return null}function cd(e,t){const n=new Set,r=[];for(const i of Wo(t)){const a=yl(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function ud(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function dd(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&yo(n[i-1]);)i-=1;for(;a<n.length-1&&yo(n[a+1]);)a+=1;return n.slice(i,a+1)}function md(e,t,n){return n.startContainer===e?e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild:n.startContainer===t&&e!==t?e.firstChild:ud(e,n.startContainer)}function fd(e,t,n){const r=zo(e);if(sd(e,t.startContainer))return!1;if(!r.firstChild){const c=document.createElement(n);return c.appendChild(document.createElement("br")),r.appendChild(c),!0}const i=md(r,e,t);if(!i||ld(i)||bl(i)||!yo(i))return!1;const a=dd(r,i),l=document.createElement(n);r.insertBefore(l,a[0]);for(const c of a)l.appendChild(c);return!0}function pd(e){const t=nt(e);if(!t)return id();const n=Wo(t).map(i=>{const a=yl(e,i);return a?ad(ie(a)):null}),r=n[0];return n.every(i=>i===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function hd(e,t){if(!gl(t))return!1;const n=nt(e);if(!n)return!1;const r=vt(e,n.startContainer,n.startOffset),i=vt(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),c=cd(e,n);let m=!1;if(c.length===0)m=fd(e,n,t);else for(const p of c)ie(p)!==t&&(Go(p,t),m=!0);return qo(e,a,l),m}function Vo(e){if(!Ee(e))return null;const t=Dt(e);if(!t)return null;const n=ie(t);return n==="ul"||n==="ol"?n:null}function xl(e){const t=Tt(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(Vo),r=n[0];return n.every(i=>i===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function gd(e,t,n){const r=[...e.children].filter(i=>Uo(i));for(const i of r)t.insertBefore(i,n)}function wl(e){const t=Dt(e),n=document.createElement("p");for(const p of[...e.attributes])n.setAttribute(p.name,p.value);for(n.style.marginLeft="",rt(n);e.firstChild&&!Uo(e.firstChild);)n.appendChild(e.firstChild);const r=[];let i=e.nextElementSibling;for(;i;)r.push(i),i=i.nextElementSibling;const a=(t==null?void 0:t.parentNode)??e.parentNode;if(!t||!a)return e.replaceWith(n),n;const l=Ee(a)?a.parentNode??a:a,c=Ee(a)?a.nextSibling:t.nextSibling;e.remove();let m=null;if(r.length>0){m=document.createElement(t.tagName);for(const p of r)m.appendChild(p)}return l.insertBefore(n,c),m&&l.insertBefore(m,n.nextSibling),gd(e,l,n.nextSibling),t.childElementCount===0&&t.remove(),n}function bd(e){if(Ee(e))return e;const t=Go(e,"li");return t.style.marginLeft="",rt(t),t}function Sl(e,t){if(e.length===0)return!1;if(e.every(Ee)){const a=Dt(e[0]);if(a&&e.every(l=>l.parentElement===a)&&[...a.children].every(c=>c instanceof HTMLElement&&e.includes(c)))return ie(a)===t?!1:(Go(a,t),!0)}const n=e[0],r=n.parentNode;if(!r)return!1;const i=document.createElement(t);r.insertBefore(i,n);for(const a of e){const l=Ee(a)?Dt(a):null;i.appendChild(bd(a)),l&&l!==i&&l.childElementCount===0&&l.remove()}return!0}function kl(e){let t=!1;for(const n of[...e].reverse())Ee(n)&&(wl(n),t=!0);return t}function yd(e,t){return Lt(e,()=>{const n=cn(e);if(n.length===0)return!1;if(n.every(a=>Vo(a)===t))return kl(n);let i=!1;for(const a of pl(n))Sl(a,t)&&(i=!0);return i})}function xd(e,t){return Lt(e,()=>{const n=cn(e);if(n.length===0)return!1;if(t===null)return kl(n);if(n.every(a=>Vo(a)===t))return!1;let i=!1;for(const a of pl(n))Sl(a,t)&&(i=!0);return i})}const Cl=40;function Xo(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function vl(e,t){if(t<=0){e.style.marginLeft="",rt(e);return}e.style.marginLeft=`${t}px`}function wd(e){let t=e.previousElementSibling;for(;t;){if(Ee(t))return t;t=t.previousElementSibling}return null}function Sd(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(ie(n)==="ul"||ie(n)==="ol"))return n}return null}function kd(e){const t=wd(e);if(!t)return!1;const n=Dt(e);if(!n)return!1;const r=ie(n)==="ol"?"ol":"ul";let i=Sd(t);return(!i||ie(i)!==r)&&(i=document.createElement(r),t.appendChild(i)),i.appendChild(e),!0}function Cd(e){const t=Dt(e);if(!t)return!1;const n=t.parentElement;if(n&&Ee(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return wl(e),!0}function vd(e){return Tt(e).some(n=>Ee(n)||Xo(n)>0)}function Dd(e){return Lt(e,()=>{const t=cn(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(Ee(r)){kd(r)&&(n=!0);continue}vl(r,Xo(r)+Cl),n=!0}return n})}function Ad(e){return Lt(e,()=>{const t=Tt(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(Ee(r)){Cd(r)&&(n=!0);continue}const i=Xo(r);i<=0||(vl(r,Math.max(0,i-Cl)),n=!0)}return n})}const Dl="pt",Pd=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,Ed=/^[+-]?0(?:\.0+)?$/;function Ae(e){return`${Y(e.value)}${e.unit}`}function Le(e){const t=e.trim();if(!t)return null;if(Ed.test(t))return{value:0,unit:"px"};const n=t.match(Pd);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return nr(i)?{value:xe(r),unit:i}:null}function Vn(e,t,n){const r=e.trim();if(!r)return null;const i=Le(r);if(i)return!n&&i.value<0?{...i,value:0}:i;const a=Number(r.replace(",","."));return Number.isFinite(a)?!n&&a<0?{value:0,unit:t}:{value:xe(a),unit:t}:null}function ot(e){return e.value>=0?e:{value:0,unit:e.unit}}function Pe(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}const Oe=["top","right","bottom","left"],ir=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],We={top:null,right:null,bottom:null,left:null},Yo={style:"none",width:null,color:null},jd=new Set(ir),Ji={value:0,unit:"px"};function Nd(){return{margin:{...We},padding:{...We},lineHeight:null,border:{...Yo},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null}}function Jo(){const e=Nd();return{margin:e.margin,marginMixed:!1,padding:e.padding,paddingMixed:!1,lineHeight:e.lineHeight,lineHeightMixed:!1,border:e.border,borderMixed:!1,borderRadius:e.borderRadius,radiusMixed:!1,boxShadow:e.boxShadow,shadowMixed:!1,backgroundColor:e.backgroundColor,backgroundMixed:!1,opacity:e.opacity,opacityMixed:!1}}function qe(e,t){return Oe.every(n=>Pe(e[n],t[n]))}function Al(e,t){return e===t?!0:!e||!t||e.kind!==t.kind?!1:e.kind==="normal"||t.kind==="normal"?!0:e.kind==="number"&&t.kind==="number"?e.value===t.value:e.kind==="length"&&t.kind==="length"&&e.value===t.value&&e.unit===t.unit}function Pl(e,t){return e.style===t.style&&Pe(e.width,t.width)&&e.color===t.color}function El(e,t){return e===t?!0:!e||!t?!1:Pe(e.offsetX,t.offsetX)&&Pe(e.offsetY,t.offsetY)&&Pe(e.blur,t.blur)&&Pe(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function Ld(e){return e.kind==="normal"?"normal":e.kind==="number"?Y(e.value):Ae({value:e.value,unit:e.unit})}function Td(e){const t=e.trim();if(!t)return null;if(t.endsWith("%")){const r=Number(t.slice(0,-1).trim().replace(",","."));return Number.isFinite(r)?At(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?At(n):null}function At(e){return xe(Math.min(1,Math.max(0,e)))}function Xn(e){return xe(At(e)*100)}function jl(e){return At(e/100)}function Md(e){return Y(At(e))}function Rd(e){const t=e.trim();if(!t)return null;if(t.toLowerCase()==="normal")return{kind:"normal"};if(/^[+]?(?:\d+(?:\.\d+)?|\.\d+)$/.test(t)){const r=Number(t);return!Number.isFinite(r)||r<0?null:{kind:"number",value:xe(r)}}const n=Le(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function _d(e,t){const n=[];let r="",i=0;for(const a of e){if(a==="("){i+=1,r+=a;continue}if(a===")"){i=Math.max(0,i-1),r+=a;continue}if(a===t&&i===0){r.trim()&&n.push(r.trim()),r="";continue}r+=a}return r.trim()&&n.push(r.trim()),n}function Fd(e){const t=[];let n="",r=0;for(const i of e){if(i==="("){r+=1,n+=i;continue}if(i===")"){r=Math.max(0,r-1),n+=i;continue}if(/\s/.test(i)&&r===0){n&&t.push(n),n="";continue}n+=i}return n&&t.push(n),t}function Id(e){const t=[Ae(e.offsetX),Ae(e.offsetY),Ae(e.blur),Ae(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function Bd(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=_d(t,",")[0];if(!n)return null;const r=Fd(n);let i=!1,a=null;const l=[];for(const c of r){if(c.toLowerCase()==="inset"){i=!0;continue}const m=Le(c);if(m){l.push(m);continue}const p=se(c);if(p){a=p;continue}return null}return l.length<2||l.length>4?null:{offsetX:l[0],offsetY:l[1],blur:l[2]??Ji,spread:l[3]??Ji,color:a,inset:i}}function xt(e,t){return Le(e.style.getPropertyValue(t))}function Hd(e,t,n,r){const i=n&&r?ot(n):n,a=i?Ae(i):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function Zi(e,t){return{top:xt(e,`${t}-top`),right:xt(e,`${t}-right`),bottom:xt(e,`${t}-bottom`),left:xt(e,`${t}-left`)}}function Qi(e,t,n,r){let i=!1;for(const a of Oe)Hd(e,`${t}-${a}`,n[a],r)&&(i=!0);return i}function Od(e){const t=e.trim().toLowerCase();return jd.has(t)?t:"none"}function Nl(e){const t=Od(e.style.borderStyle||e.style.borderTopStyle),n=xt(e,"border-width")??xt(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,i=r?se(r):null;return{style:t,width:n,color:i}}function zd(e,t){const n=Nl(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?ot(t.width):null,color:t.color};return Pl(n,r)?!1:r.style==="none"?(e.style.removeProperty("border"),e.style.removeProperty("border-style"),e.style.removeProperty("border-width"),e.style.removeProperty("border-color"),!0):(e.style.borderStyle=r.style,r.width?e.style.borderWidth=Ae(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function Ll(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return Le(n)}function Kd(e,t){const n=t?ot(t):null,r=Ll(e);return Pe(r,n)?!1:(n?e.style.borderRadius=Ae(n):e.style.removeProperty("border-radius"),!0)}function Tl(e){return Bd(e.style.boxShadow)}function $d(e,t){const n=Tl(e),r=t?{...t,blur:ot(t.blur)}:null;return El(n,r)?!1:(r?e.style.boxShadow=Id(r):e.style.removeProperty("box-shadow"),!0)}function Ml(e){return Rd(e.style.lineHeight)}function Ud(e,t){const n=Ml(e);return Al(n,t)?!1:(t?e.style.lineHeight=Ld(t):e.style.removeProperty("line-height"),!0)}function Rl(e){const t=e.style.backgroundColor;return t?se(t):null}function Wd(e,t){const n=t?se(t):null;return Rl(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function _l(e){return Td(e.style.opacity)}function qd(e,t){const n=_l(e),r=t===null?null:At(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Md(r),!0)}function Mt(e){return{margin:Zi(e,"margin"),padding:Zi(e,"padding"),lineHeight:Ml(e),border:Nl(e),borderRadius:Ll(e),boxShadow:Tl(e),backgroundColor:Rl(e),opacity:_l(e)}}function Rt(e,t){let n=!1;return!t.marginMixed&&Qi(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&Qi(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&Ud(e,t.lineHeight)&&(n=!0),!t.borderMixed&&zd(e,t.border)&&(n=!0),!t.radiusMixed&&Kd(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&$d(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&Wd(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&qd(e,t.opacity)&&(n=!0),n&&rt(e),n}function Gd(e){const t=Jo(),n=Tt(e);if(n.length===0)return t;const r=n.map(Mt),i=r[0];return{margin:i.margin,marginMixed:r.some(a=>!qe(a.margin,i.margin)),padding:i.padding,paddingMixed:r.some(a=>!qe(a.padding,i.padding)),lineHeight:i.lineHeight,lineHeightMixed:r.some(a=>!Al(a.lineHeight,i.lineHeight)),border:i.border,borderMixed:r.some(a=>!Pl(a.border,i.border)),borderRadius:i.borderRadius,radiusMixed:r.some(a=>!Pe(a.borderRadius,i.borderRadius)),boxShadow:i.boxShadow,shadowMixed:r.some(a=>!El(a.boxShadow,i.boxShadow)),backgroundColor:i.backgroundColor,backgroundMixed:r.some(a=>a.backgroundColor!==i.backgroundColor),opacity:i.opacity,opacityMixed:r.some(a=>a.opacity!==i.opacity)}}function Vd(e,t){return Lt(e,()=>{const n=cn(e);if(n.length===0)return!1;let r=!1;for(const i of n)Rt(i,t)&&(r=!0);return r})}const Fl=["left","center","right","justify"];function Xd(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function Yd(e){return Xd(e.style.textAlign)}function Il(e){const t=Tt(e);if(t.length===0)return nt(e)?{align:"left",mixed:!1}:{align:null,mixed:!1};const n=t.map(Yd),r=n[0];return n.every(i=>i===r)?{align:r,mixed:!1}:{align:null,mixed:!0}}function Bl(e,t){return Fl.includes(t)?Lt(e,()=>{const n=cn(e);if(n.length===0)return!1;let r=!1;for(const i of n)i.style.textAlign!==t&&(i.style.textAlign=t,r=!0);return r}):!1}function Jt(){return{...Jo(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function ea(e){const t=Gd(e),n=Il(e),r=xl(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function Hl(e,t){let n=!1;return!t.alignMixed&&t.align&&Bl(e,t.align)&&(n=!0),t.listMixed||xd(e,t.list)&&(n=!0),Vd(e,t)&&(n=!0),n}function Jd(e,t){return Hl(e,xo(t))}function Ol(e){return{align:e.alignMixed?void 0:e.align??"left",list:e.listMixed?void 0:e.list,margin:e.marginMixed?void 0:e.margin,padding:e.paddingMixed?void 0:e.padding,lineHeight:e.lineHeightMixed?void 0:e.lineHeight,border:e.borderMixed?void 0:e.border,borderRadius:e.radiusMixed?void 0:e.borderRadius,boxShadow:e.shadowMixed?void 0:e.boxShadow,backgroundColor:e.backgroundMixed?void 0:e.backgroundColor,opacity:e.opacityMixed?void 0:e.opacity}}function xo(e){const t=Jt();return e?{align:e.align??t.align,alignMixed:e.align===void 0,list:e.list===void 0?t.list:e.list,listMixed:e.list===void 0,margin:e.margin??t.margin,marginMixed:e.margin===void 0,padding:e.padding??t.padding,paddingMixed:e.padding===void 0,lineHeight:e.lineHeight===void 0?t.lineHeight:e.lineHeight,lineHeightMixed:e.lineHeight===void 0,border:e.border??t.border,borderMixed:e.border===void 0,borderRadius:e.borderRadius===void 0?t.borderRadius:e.borderRadius,radiusMixed:e.borderRadius===void 0,boxShadow:e.boxShadow===void 0?t.boxShadow:e.boxShadow,shadowMixed:e.boxShadow===void 0,backgroundColor:e.backgroundColor===void 0?t.backgroundColor:e.backgroundColor,backgroundMixed:e.backgroundColor===void 0,opacity:e.opacity===void 0?t.opacity:e.opacity,opacityMixed:e.opacity===void 0}:{...t,alignMixed:!0,listMixed:!0,marginMixed:!0,paddingMixed:!0,lineHeightMixed:!0,borderMixed:!0,radiusMixed:!0,shadowMixed:!0,backgroundMixed:!0,opacityMixed:!0}}function Zd(){return{size:null,unit:ut,marks:$e(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function wo(){return{font:Zd(),box:Jo()}}function Qd(e){const t=e.style.fontSize,n=t?Ho(t):null,r=n&&nr(n.unit)?{value:n.value,unit:n.unit}:null,i=`${e.style.textDecorationLine} ${e.style.textDecoration}`.toLowerCase(),a=e.style.fontWeight.trim().toLowerCase(),l={bold:a==="bold"||Number(a)>=700,italic:e.style.fontStyle.trim().toLowerCase()==="italic",underline:/\bunderline\b/.test(i),strikethrough:/\bline-through\b/.test(i)},c=e.style.color,m=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??ut,marks:l,fontFamily:m||null,fontFamilyMixed:!1,fontColor:c?se(c):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function em(e,t){const n=e.style.fontSize,r=t.size===null?null:dt(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const i=Bo(r.value,r.unit);return n===i?!1:(e.style.fontSize=i,!0)}function tm(e,t){var i;if(t.fontFamilyMixed)return!1;const n=(i=t.fontFamily)!=null&&i.trim()?t.fontFamily.trim():null,r=e.style.fontFamily.trim()||null;return ln(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function nm(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?se(t.fontColor):null;return(e.style.color?se(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function rm(e,t){let n=!1;const r=t.bold?"bold":"";e.style.fontWeight!==r&&(r?e.style.fontWeight=r:e.style.removeProperty("font-weight"),n=!0);const i=t.italic?"italic":"";e.style.fontStyle!==i&&(i?e.style.fontStyle=i:e.style.removeProperty("font-style"),n=!0);const a=[];t.underline&&a.push("underline"),t.strikethrough&&a.push("line-through");const l=a.join(" ");return(e.style.textDecorationLine||e.style.textDecoration).trim()!==l&&(l?e.style.textDecoration=l:(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),n=!0),n}function om(e,t){let n=!1;return em(e,t)&&(n=!0),tm(e,t)&&(n=!0),nm(e,t)&&(n=!0),rm(e,t.marks)&&(n=!0),n&&rt(e),n}function im(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function am(e){const t=sn(e);if(!t)return wo();const n=Mt(t);return{font:Qd(t),box:{margin:n.margin,marginMixed:!1,padding:n.padding,paddingMixed:!1,lineHeight:n.lineHeight,lineHeightMixed:!1,border:n.border,borderMixed:!1,borderRadius:n.borderRadius,radiusMixed:!1,boxShadow:n.boxShadow,shadowMixed:!1,backgroundColor:n.backgroundColor,backgroundMixed:!1,opacity:n.opacity,opacityMixed:!1}}}function lm(e,t){const n=nt(e),r=n?vt(e,n.startContainer,n.startOffset):null,i=n?vt(e,n.endContainer,n.endOffset):null,a=sn(e),l=Gu(e),c=om(l,t.font),m=Rt(l,im(t));return dl(e),r!==null&&i!==null&&qo(e,Math.min(r,i),Math.max(r,i)),!a||c||m}const Zo="data-hover-html",sm="noopener noreferrer",cm="var n=this._hoverBox;if(!n){n=document.createElement('div');n.style.cssText='position:absolute;z-index:2147483646;background:#fff;border:1px solid #c8c8c8;border-radius:4px;padding:0.35rem 0.5rem;color:#222;max-width:18rem';this._hoverBox=n}n.innerHTML=this.getAttribute('data-hover-html')||'';var r=this.getBoundingClientRect();n.style.left=r.left+window.scrollX+'px';n.style.top=r.bottom+4+window.scrollY+'px';document.body.appendChild(n)",um="this._hoverBox&&this._hoverBox.remove()",dm=/^(#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*(?:0|0?\.\d+|1))?\s*\))$/;function ar(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function mm(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function on(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&mm(n))return n;n=n.parentNode}return null}function zl(e){return dm.test(e)}function fm(e){var i;const t=e.getAttribute("onmouseover")??"",n=/this\.style\.color\s*=\s*'([^']+)'/.exec(t),r=((i=n==null?void 0:n[1])==null?void 0:i.trim())??"";return r&&zl(r)?r:null}function Kl(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function pm(e){const t=e.getAttribute(Zo)??"",n=fm(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:Kl(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function $l(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return null;const r=on(e,n.commonAncestorContainer);return r?pm(r):null}function hm(e){return $l(e)!==null}function gm(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(Zo)}function bm(e,t){var r;if(gm(e),t.hoverMode==="html"){const i=t.hoverHtml.trim();if(!i)return;e.setAttribute(Zo,i),e.setAttribute("onmouseover",cm),e.setAttribute("onmouseout",um);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!zl(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function Qo(e,t){const n=ar(t);e.setAttribute("href",n.href);const r=n.title.trim();r?e.setAttribute("title",r):e.removeAttribute("title"),n.targetBlank?(e.setAttribute("target","_blank"),e.setAttribute("rel",sm)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":Kl(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),bm(e,n)}function ym(e,t){const n=new Set;for(const r of t){const i=on(e,r);i&&!n.has(i)&&n.add(i)}for(const r of n)Re(r)}function xm(e,t,n){et(t);const r=Ne(t).filter(c=>c.data.length>0);ym(e,r),r.length>0&&Nt(r);const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);et(a);const l=document.createElement("a");Qo(l,n);try{return a.surroundContents(l),!0}catch{const c=a.extractContents();return c.hasChildNodes()?(l.appendChild(c),a.insertNode(l),!0):!1}}function wm(e,t){const n=document.createElement("a");Qo(n,t),n.textContent=t.href,e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();return r==null||r.removeAllRanges(),r==null||r.addRange(e),!0}function Sm(e,t){const n=t.href.trim();if(!n)return!1;const r=ar({...t,href:n}),i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!ae(e,a.commonAncestorContainer))return!1;const l=on(e,a.startContainer),c=on(e,a.endContainer);return l&&l===c?(Qo(l,r),!0):a.collapsed?wm(a,r):xm(e,a,r)}const km=/^[A-Za-z][A-Za-z0-9_-]*$/,Ul="​";function So(e){var r;const t=zo(e),n=new Set;for(const i of t.querySelectorAll("[id]")){if(i===t)continue;const a=i.id.trim();a&&n.add(a)}for(const i of t.querySelectorAll("a[name]")){const a=(r=i.getAttribute("name"))==null?void 0:r.trim();a&&n.add(a)}return[...n].sort((i,a)=>i.localeCompare(a)).map(i=>({id:i}))}function Cm(e){return new Set(So(e).map(t=>t.id))}function Wl(e,t){const n=e.trim();return n?km.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function ta(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Ul)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function vm(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Ul)),(r=e.parentNode)==null||r.insertBefore(n,e)}function Dm(e,t){const n=t.trim();if(Wl(n,Cm(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ae(e,i.commonAncestorContainer))return!1;const a=on(e,i.startContainer);if(a)return vm(a,n),!0;if(i.collapsed)return ta(i,n),!0;et(i);const l=document.createElement("span");l.id=n;try{return i.surroundContents(l),!0}catch{return ta(i,n),!0}}function ql(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function Am(e){const t=ql(e);if(!t||t.collapsed)return null;const n=document.createElement("div");n.appendChild(t.cloneContents());const r=n.innerHTML;if(!r)return null;let i=t.toString();if(!i){const a=n.querySelector("img");i=(a==null?void 0:a.getAttribute("alt"))??(a==null?void 0:a.getAttribute("src"))??""}return{html:r,text:i}}function Gl(e){const t=ql(e);if(!t||t.collapsed)return!1;t.deleteContents();const n=window.getSelection();return n==null||n.removeAllRanges(),n==null||n.addRange(t),!0}async function Pm(e){const t=navigator.clipboard;if(!t)return!1;try{if(typeof ClipboardItem=="function"&&typeof t.write=="function"){const n=new ClipboardItem({"text/plain":new Blob([e.text],{type:"text/plain"}),"text/html":new Blob([e.html],{type:"text/html"})});return await t.write([n]),!0}if(typeof t.writeText=="function")return await t.writeText(e.text),!0}catch{if(typeof t.writeText=="function")try{return await t.writeText(e.text),!0}catch{return!1}return!1}return!1}async function Vl(e){const t=Am(e);return t?Pm(t):!1}async function Em(e){return await Vl(e)?Gl(e):!1}const jm=new Set(["strong","b","em","i","u","s","strike","del"]),Nm=["font","font-weight","font-style","font-family","font-size","color","background","background-color","text-decoration","text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness"];function Lm(e){for(const t of Nm)e.style.removeProperty(t)}function Tm(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Ve(r)){n=r;continue}if(ft(r,n),jm.has(r.tagName.toLowerCase())){Re(r);continue}if(Lm(r),mt(r)){Re(r);continue}n=r.isConnected?r:t}}function Mm(e){const t=nt(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;et(t);const r=Ne(t).filter(i=>i.data.length>0);if(r.length===0)return!1;for(const i of r)Tm(e,i);return Nt(r),e.innerHTML!==n}const Rm=2*1024*1024,_m="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",Fm=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),Im=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),Bm=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,Hm=/^(javascript|vbscript|file|blob):/i;function Om(e={}){return{src:"",alt:"",title:"",...e}}function ei(e){const t=e.trim();if(!t)return"empty";if(Hm.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return Bm.test(t)?null:"invalid";if(/^[a-z][a-z0-9+.-]*:/i.test(t)){const n=t.slice(0,t.indexOf(":")).toLowerCase();return n==="http"||n==="https"?null:"invalid"}return null}function zm(e){return e.size>Rm?"tooLarge":qm(e)?null:"type"}function Km(e){const t=zm(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(ei(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function $m(e,t){e.setAttribute("src",t.src.trim());const n=t.alt.trim(),r=t.title.trim();n?e.setAttribute("alt",n):e.removeAttribute("alt"),r?e.setAttribute("title",r):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.height="auto",Um(e,t.css)}function Um(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&e.style.setProperty(a,l)}}function Wm(e,t){const n=Om(t);if(ei(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ae(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("img");return $m(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function ko(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function ro(e,t){if(!ae(e,t)||t===e)return!1;const n=document.createRange();n.selectNode(t);const r=window.getSelection();return r?(r.removeAllRanges(),r.addRange(n),!0):!1}function qm(e){const t=e.type.trim().toLowerCase();if(t&&Fm.has(t))return!0;const n=Gm(e.name);return!!(!t&&n&&Im.has(n))}function Gm(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Xl=["%","px","pt","pc","em","rem"],Vm="%",Xm={"%":[25,50,75,100,125,150,200],px:[50,100,150,200,300,400,600,800],pt:[36,48,72,96,144,192,288],pc:[3,4,6,8,12,16,24],em:[2,4,6,8,12,16,24],rem:[2,4,6,8,12,16,24]},Pt={"%":{min:1,max:1e3},px:{min:1,max:4e3},pt:{min:1,max:3e3},pc:{min:.1,max:250},em:{min:.1,max:200},rem:{min:.1,max:200}},Ym=new Set(Xl),Jm=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function Zm(e){return Ym.has(e)}function na(e){return`${Y(e.value)}${e.unit}`}function Co(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(Jm);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r)||r<=0)return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return Zm(i)?Et(r,i):null}function ra(e,t){const n=e.trim();if(!n)return null;const r=Co(n);if(r)return r;const i=Number(n.replace(",","."));return Number.isFinite(i)?Et(i,t):null}function Et(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=Pt[t];return{value:xe(Math.min(r,Math.max(n,e))),unit:t}}function Zt(e,t,n){const r=n>0?n:1;if(e==="width"){const a=Et(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:Et(t.value*r,t.unit)??t,height:t}}const zn="data-hover-css",Yl=["fill","contain","cover","none","scale-down"],Jl=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],Qm=new Set(Yl),ef=new Set(Jl),oa="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",tf="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",nf=/^-?[a-z][a-z0-9-]*$/i,rf=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,vo=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function Zl(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...We},border:{...Yo},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function of(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function af(e,t){const n=e.objectFit;if(n!=="cover"&&n!=="contain"&&n!=="fill"||e.width&&e.height||!e.width&&!e.height)return e;if(e.width){const r=Zt("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=Zt("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function lf(e){const t=[];for(const n of e.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim().toLowerCase(),l=r.slice(i+1).trim();!a||!l||nf.test(a)&&(a==="behavior"||a.endsWith("binding")||rf.test(l)||t.push(`${a}: ${l}`))}return t.join("; ")}function Qt(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return null;if(n.startContainer instanceof HTMLImageElement)return n.startContainer;if(n.startContainer.nodeType===Node.ELEMENT_NODE){const r=n.startContainer.childNodes[n.startOffset];if(r instanceof HTMLImageElement&&ae(e,r))return r}return ko(e,n.commonAncestorContainer)}function sf(e){const t=Qt(e);return t?Ql(t):null}function Ql(e){const t=Mt(e),n=ff(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,i=uf(e);return Zl({sizeMode:i.sizeMode,width:i.width,height:i.height,align:n,margin:r,border:t.border,borderRadius:t.borderRadius,boxShadow:t.boxShadow,opacity:t.opacity,objectFit:ts(e),objectPosition:bf(e),rotateDeg:ns(e),hoverCss:e.getAttribute(zn)??""})}function es(e,t){let n=!1;return df(e,t)&&(n=!0),Rt(e,{margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:We,paddingMixed:!0,lineHeight:null,lineHeightMixed:!0,border:t.border,borderMixed:!1,borderRadius:t.borderRadius,radiusMixed:!1,boxShadow:t.boxShadow,shadowMixed:!1,backgroundColor:null,backgroundMixed:!0,opacity:t.opacity,opacityMixed:!1})&&(n=!0),pf(e,t.align)&&(n=!0),hf(e,t.objectFit)&&(n=!0),gf(e,t.objectPosition)&&(n=!0),xf(e,t.rotateDeg)&&(n=!0),wf(e,t.hoverCss)&&(n=!0),n}function cf(e,t){const n=Qt(e);return n?es(n,t):!1}function uf(e){const t=Co(e.style.width),n=Co(e.style.height);return t&&n?{sizeMode:"lock",width:t,height:n}:n&&!t?{sizeMode:"height",width:null,height:n}:{sizeMode:"width",width:t,height:null}}function df(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=mf(t);return r.width?e.style.width=na(r.width):e.style.removeProperty("width"),r.height?e.style.height=na(r.height):e.style.height="auto",r.width||r.height?e.style.removeProperty("max-width"):e.style.maxWidth="100%",n.width!==e.style.width||n.height!==e.style.height||n.maxWidth!==e.style.maxWidth}function mf(e){return e.sizeMode==="width"?{sizeMode:"width",width:e.width,height:null}:e.sizeMode==="height"?{sizeMode:"height",width:null,height:e.height}:{sizeMode:"lock",width:e.width,height:e.height}}function ff(e){const t=e.style.float.trim().toLowerCase();if(t==="left")return"left";if(t==="right")return"right";const n=e.style.display.trim().toLowerCase(),r=e.style.marginLeft.trim().toLowerCase(),i=e.style.marginRight.trim().toLowerCase();return n==="block"&&r==="auto"&&i==="auto"?"center":null}function pf(e,t){const n={float:e.style.float,display:e.style.display,marginLeft:e.style.marginLeft,marginRight:e.style.marginRight};return t==="left"?(e.style.float="left",e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")):t==="right"?(e.style.float="right",e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")):t==="center"?(e.style.removeProperty("float"),e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="auto"):(e.style.removeProperty("float"),e.style.display.trim().toLowerCase()==="block"&&e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")),n.float!==e.style.float||n.display!==e.style.display||n.marginLeft!==e.style.marginLeft||n.marginRight!==e.style.marginRight}function ts(e){const t=e.style.objectFit.trim().toLowerCase();return Qm.has(t)?t:null}function hf(e,t){return ts(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function gf(e,t){const n=(t==null?void 0:t.trim().toLowerCase().replace(/\s+/g," "))||"";return e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ")===n?!1:(n?e.style.objectPosition=n:e.style.removeProperty("object-position"),!0)}function bf(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(ef.has(t),t):null}function ns(e){const t=vo.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?xe(n):null}function yf(e){const t=e.trim();return t?vo.test(t)&&t.replace(vo,"").trim()==="":!0}function xf(e,t){const n=ns(e),r=t===null||t===0?null:xe(t);return n===r?!1:r===null?yf(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${Y(r)}deg)`,!0)}function wf(e,t){const n=lf(t),r=e.getAttribute(zn)??"",i=e.getAttribute("onmouseover")??"";return r===n&&(n&&i===oa||!n&&!i)?!1:n?(e.setAttribute(zn,n),e.setAttribute("onmouseover",oa),e.setAttribute("onmouseout",tf),!0):(e.removeAttribute(zn),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const Ge=16;function ia(e){return Math.min(Pt.px.max,Math.max(Ge,e))}function Sf(e){return e.width>0&&e.height>0?e.width/e.height:1}function kf(e,t){const n=Math.max(Ge,Ge*t),r=Math.min(Pt.px.max,Pt.px.max*t),i=Math.min(r,Math.max(n,e));return{width:i,height:i/t}}function Cf(e,t){const n=Math.max(Ge,Ge/t),r=Math.min(Pt.px.max,Pt.px.max/t),i=Math.min(r,Math.max(n,e));return{width:i*t,height:i}}function vf(e,t,n){const r=Sf(t);return e==="e"?kf(t.width+n.x,r):e==="s"?Cf(t.height+n.y,r):{width:ia(t.width+n.x),height:ia(t.height+n.y)}}function Df(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:Ge,height:r>0?r:Ge}}function Af(e,t,n){const r=Et(Math.max(Ge,t),"px"),i=Et(Math.max(Ge,n),"px");return!r||!i?!1:es(e,{...Ql(e),sizeMode:"lock",width:r,height:i})}const aa=10,wt=1,St=50,Pf="1px solid #000",Ef="0.25em",jf=new Set(["td","th"]);function rs(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=wt&&t>=wt&&e<=St&&t<=St}function Be(e,t){return ti(e,t,n=>n instanceof HTMLTableElement)}function Yn(e,t){return ti(e,t,n=>Bf(n))}function Nf(e,t){return ti(e,t,n=>n instanceof HTMLTableRowElement)}function en(e){return Be(e,ni(e))}function _t(e){return Yn(e,ni(e))}function os(e){return Nf(e,ni(e))}function Lf(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function Tf(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return[];const r=Yn(e,n.startContainer),i=Yn(e,n.endContainer);if(!r)return[];if(!i||r===i)return[r];const a=Be(e,r);if(!a||Be(e,i)!==a)return[r];const l=sa(r),c=sa(i);if(!l||!c)return[r];const m=Math.min(l.row,c.row),p=Math.max(l.row,c.row),b=Math.min(l.col,c.col),h=Math.max(l.col,c.col),w=[];for(const x of Array.from(a.rows))if(!(x.rowIndex<m||x.rowIndex>p))for(const S of Array.from(x.cells))S.cellIndex>=b&&S.cellIndex<=h&&w.push(S);return w.length>0?w:[r]}function Mf(e,t){if(!rs(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!ae(e,r.commonAncestorContainer))return!1;const i=document.createElement("table");i.style.borderCollapse="collapse",i.style.width="100%";const a=document.createElement("tbody");for(let c=0;c<t.rows;c+=1){const m=document.createElement("tr");for(let p=0;p<t.cols;p+=1)m.appendChild(ri("td"));a.appendChild(m)}i.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(i),Of(e,i);const l=i.querySelector("td, th");return l instanceof HTMLTableCellElement&&Ue(l),!0}function Do(e,t){var m;const n=_t(e);if(!n)return!1;const r=n.parentElement;if(!(r instanceof HTMLTableRowElement)||!Be(e,n))return!1;const a=document.createElement("tr"),l=Math.max(1,r.cells.length);for(let p=0;p<l;p+=1){const b=r.cells[p];a.appendChild(ri((b==null?void 0:b.tagName)==="TH"?"th":"td"))}t==="before"?(m=r.parentNode)==null||m.insertBefore(a,r):r.insertAdjacentElement("afterend",a);const c=a.cells[Math.min(n.cellIndex,a.cells.length-1)];return c&&Ue(c),!0}function la(e,t){const n=_t(e);if(!n)return!1;const r=Be(e,n);if(!r)return!1;const i=n.cellIndex,a=t==="before"?i:i+1;let l=null;for(const c of Array.from(r.rows)){const m=c.cells[Math.min(i,c.cells.length-1)]??null,p=ri((m==null?void 0:m.tagName)==="TH"?"th":"td");Hf(c,a,p),c===n.parentElement&&(l=p)}return l&&Ue(l),!0}function Rf(e){const t=_t(e);if(!t)return!1;const n=t.parentElement;if(!(n instanceof HTMLTableRowElement))return!1;const r=Be(e,t);if(!r)return!1;const i=t.cellIndex,a=n.rowIndex;if(r.rows.length<=1)return is(e,r);const l=n.parentNode;n.remove();const c=r.rows[Math.min(a,r.rows.length-1)],m=c==null?void 0:c.cells[Math.min(i,c.cells.length-1)];return m?Ue(m):l&&Kf(r),!0}function _f(e){const t=_t(e);if(!t)return!1;const n=Be(e,t);if(!n)return!1;const r=t.cellIndex,i=t.parentElement;if(Math.max(0,...Array.from(n.rows,p=>p.cells.length))<=1)return is(e,n);const l=i instanceof HTMLTableRowElement?i.rowIndex:0;for(const p of Array.from(n.rows)){const b=p.cells[r];b&&b.remove()}const c=n.rows[Math.min(l,n.rows.length-1)],m=c==null?void 0:c.cells[Math.min(r,c.cells.length-1)];return m&&Ue(m),!0}function Ff(e,t){const n=_t(e);if(!n)return!1;const r=Be(e,n);if(!r)return!1;const i=Lf(r),a=i.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(Ue(i[a-1]),{changed:!1});if(a<i.length-1)return Ue(i[a+1]),{changed:!1};const l=n.parentElement;if(!Do(e,"below"))return!1;const c=l instanceof HTMLTableRowElement?l.nextElementSibling:null;return c instanceof HTMLTableRowElement&&c.cells[0]&&Ue(c.cells[0]),{changed:!0}}function If(e,t){return!ae(e,t)||t===e?!1:(Ue(t),!0)}function ti(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function Bf(e){return jf.has(e.tagName.toLowerCase())}function ni(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n.startContainer:null}function sa(e){const t=e.parentElement;return t instanceof HTMLTableRowElement?{row:t.rowIndex,col:e.cellIndex}:null}function ri(e){const t=document.createElement(e);return t.style.border=Pf,t.style.padding=Ef,t.appendChild(document.createElement("br")),t}function Hf(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Of(e,t){var i;const n=t.parentElement;if(!n||n===e)return;const r=n.tagName.toLowerCase();r==="td"||r==="th"||(r==="p"||/^h[1-6]$/.test(r))&&((i=n.parentNode)==null||i.insertBefore(t,n.nextSibling),zf(n)&&n.remove())}function zf(e){var t;return e.childNodes.length===0||e.childNodes.length===1&&((t=e.firstChild)==null?void 0:t.nodeName)==="BR"?!0:(e.textContent??"").trim().length===0&&e.querySelector("img, table, ul, ol")===null}function is(e,t){if(!t.parentNode||!ae(e,t))return!1;const r=document.createRange();r.setStartBefore(t),r.collapse(!0),t.remove();const i=window.getSelection();return i&&(i.removeAllRanges(),i.addRange(r)),!0}function Ue(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function Kf(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function $f(e={}){return{border:{...Yo},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function Uf(e){const t=Mt(e);return{border:t.border,borderCollapse:Vf(e),borderSpacing:as(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:Le(e.style.width)}}function Wf(e,t){let n=Rt(e,{margin:{top:null,right:null,bottom:null,left:null},marginMixed:!0,padding:{top:null,right:null,bottom:null,left:null},paddingMixed:!0,lineHeight:null,lineHeightMixed:!0,border:t.border,borderMixed:!1,borderRadius:t.borderRadius,radiusMixed:!1,boxShadow:t.boxShadow,shadowMixed:!1,backgroundColor:null,backgroundMixed:!0,opacity:null,opacityMixed:!0});return Xf(e,t.borderCollapse)&&(n=!0),Yf(e,t.borderCollapse,t.borderSpacing)&&(n=!0),Jf(e,t.width)&&(n=!0),n&&rt(e),n}function qf(e){const t=en(e);return t?Uf(t):null}function Gf(e,t){const n=en(e);return n?Wf(n,t):!1}function Vf(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function Xf(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function as(e){const t=e.style.borderSpacing.trim();return t?Le(t.split(/\s+/)[0]??""):null}function Yf(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?ot(n):null,i=as(e);return Pe(i,r)?!1:(r?e.style.borderSpacing=Ae(r):e.style.removeProperty("border-spacing"),!0)}function Jf(e,t){const n=t?ot(t):null,r=Le(e.style.width);return Pe(r,n)?!1:(n?e.style.width=Ae(n):e.style.removeProperty("width"),!0)}const lr=["top","middle","bottom","baseline"],Zf=new Set(lr);function Qf(e={}){return{backgroundColor:null,color:null,padding:{...We},verticalAlign:null,width:null,...e}}function ep(e){const t=Mt(e);return{backgroundColor:t.backgroundColor,color:ls(e),padding:t.padding,verticalAlign:ss(e),width:Le(e.style.width)}}function tp(e,t){let n=Rt(e,{margin:{...We},marginMixed:!0,padding:t.padding,paddingMixed:!1,lineHeight:null,lineHeightMixed:!0,border:{style:"none",width:null,color:null},borderMixed:!0,borderRadius:null,radiusMixed:!0,boxShadow:null,shadowMixed:!0,backgroundColor:t.backgroundColor,backgroundMixed:!1,opacity:null,opacityMixed:!0});return op(e,t.color)&&(n=!0),ip(e,t.verticalAlign)&&(n=!0),ap(e,t.width)&&(n=!0),n&&rt(e),n}function np(e){const t=_t(e);return t?ep(t):null}function rp(e,t){const n=Tf(e);if(n.length===0)return!1;let r=!1;for(const i of n)tp(i,t)&&(r=!0);return r}function ls(e){const t=e.style.color;return t?se(t):null}function op(e,t){const n=t?se(t):null;return ls(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function ss(e){const t=e.style.verticalAlign.trim().toLowerCase();return Zf.has(t)?t:null}function ip(e,t){return ss(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function ap(e,t){const n=t?ot(t):null,r=Le(e.style.width);return Pe(r,n)?!1:(n?e.style.width=Ae(n):e.style.removeProperty("width"),!0)}const lp=new Set(lr);function sp(e={}){return{backgroundColor:null,color:null,padding:{...We},height:null,verticalAlign:null,...e}}function cp(e){const t=e.cells[0],n=t?Mt(t).padding:{...We};return{backgroundColor:cs(e),color:us(e),padding:n,height:Le(e.style.height),verticalAlign:ds(e)}}function up(e,t){let n=!1;fp(e,t.backgroundColor)&&(n=!0),pp(e,t.color)&&(n=!0),gp(e,t.height)&&(n=!0),hp(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))Rt(r,{margin:{...We},marginMixed:!0,padding:t.padding,paddingMixed:!1,lineHeight:null,lineHeightMixed:!0,border:{style:"none",width:null,color:null},borderMixed:!0,borderRadius:null,radiusMixed:!0,boxShadow:null,shadowMixed:!0,backgroundColor:null,backgroundMixed:!0,opacity:null,opacityMixed:!0})&&(n=!0);return n&&rt(e),n}function dp(e){const t=os(e);return t?cp(t):null}function mp(e,t){const n=os(e);return n?up(n,t):!1}function cs(e){const t=e.style.backgroundColor;return t?se(t):null}function fp(e,t){const n=t?se(t):null;return cs(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function us(e){const t=e.style.color;return t?se(t):null}function pp(e,t){const n=t?se(t):null;return us(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function ds(e){const t=e.style.verticalAlign.trim().toLowerCase();return lp.has(t)?t:null}function hp(e,t){return ds(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function gp(e,t){const n=t?ot(t):null,r=Le(e.style.height);return Pe(r,n)?!1:(n?e.style.height=Ae(n):e.style.removeProperty("height"),!0)}function oo({value:e,defaultValue:t,onChange:n}){const[r,i]=s.useState(t),a=e!==void 0,l=a?e:r,c=s.useCallback(m=>{a||i(m),n==null||n(m)},[a,n]);return[l,c]}const ca=8,ua=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#9900ff","#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#d9d2e9","#cc4125","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6d9eeb","#8e7cc3","#660000","#990000","#b45f06","#bf9000","#38761d","#134f5c","#1155cc","#351c75"],bp=8;let Ao=[];const Po=new Set;function da(){return Ao}function yp(e){const t=se(e);t&&(Ao=[t,...Ao.filter(n=>n!==t)].slice(0,bp),Po.forEach(n=>n()))}function xp(e){return Po.add(e),()=>{Po.delete(e)}}function Tn(e){const t=se(e);return t?{r:Number.parseInt(t.slice(1,3),16),g:Number.parseInt(t.slice(3,5),16),b:Number.parseInt(t.slice(5,7),16)}:null}function st(e,t,n){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function io({r:e,g:t,b:n}){const r=e/255,i=t/255,a=n/255,l=Math.max(r,i,a),c=Math.min(r,i,a),m=l-c;let p=0;return m!==0&&(l===r?p=(i-a)/m%6:l===i?p=(a-r)/m+2:p=(r-i)/m+4,p*=60,p<0&&(p+=360)),{h:p,s:l===0?0:m/l,v:l}}function ao({h:e,s:t,v:n}){const r=(e%360+360)%360,i=n*t,a=i*(1-Math.abs(r/60%2-1)),l=n-i;let c=0,m=0,p=0;return r<60?(c=i,m=a):r<120?(c=a,m=i):r<180?(m=i,p=a):r<240?(m=a,p=i):r<300?(c=a,p=i):(c=i,p=a),{r:Math.round((c+l)*255),g:Math.round((m+l)*255),b:Math.round((p+l)*255)}}function ms(){return typeof window<"u"&&"EyeDropper"in window}async function wp(){if(!ms())return null;const e=window.EyeDropper;try{const t=await new e().open();return se(t.sRGBHex)}catch{return null}}const Sp="_picker_vmqkv_1",kp="_none_vmqkv_12",Cp="_customToggle_vmqkv_13",vp="_eyedrop_vmqkv_14",Dp="_swatch_vmqkv_48",Ap="_field_vmqkv_49",Pp="_grid_vmqkv_54",Ep="_recents_vmqkv_55",jp="_sectionLabel_vmqkv_84",Np="_custom_vmqkv_13",Lp="_sv_vmqkv_95",Tp="_svThumb_vmqkv_105",Mp="_hue_vmqkv_116",Rp="_rgbRow_vmqkv_155",_p="_hexRow_vmqkv_156",ge={picker:Sp,none:kp,customToggle:Cp,eyedrop:vp,swatch:Dp,field:Ap,grid:Pp,recents:Ep,sectionLabel:jp,custom:Np,sv:Lp,svThumb:Tp,hue:Mp,rgbRow:Rp,hexRow:_p};function Fp(e){if(!/^\d+$/.test(e.trim()))return null;const t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(255,t)):null}function oi({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:i,menu:a=!1,fallbackCustom:l="#000000",onChange:c,onCommit:m}){const p=V(),b=s.useId(),h=a?"menuitemradio":"option",w=t?null:e,x=Tn(w??l)??{r:0,g:0,b:0},[S,y]=s.useState(!1),[C,g]=s.useState(()=>io(x)),[k,P]=s.useState(()=>({r:String(x.r),g:String(x.g),b:String(x.b)})),[L,N]=s.useState(()=>st(x.r,x.g,x.b)),[M,T]=s.useState(()=>[...da()]),F=s.useRef(null),D=s.useRef(st(x.r,x.g,x.b));s.useEffect(()=>xp(()=>T([...da()])),[]),s.useEffect(()=>{const A=Tn(w??l);if(!A)return;const K=io(A);g(K),P({r:String(A.r),g:String(A.g),b:String(A.b)}),N(st(A.r,A.g,A.b))},[w,l]);const E=(A,K,j)=>{A&&(D.current=A),j&&A&&yp(A),c(A),K&&(m==null||m(A))},_=(A,K,j)=>{const O=st(A.r,A.g,A.b);g(io(A)),P({r:String(A.r),g:String(A.g),b:String(A.b)}),N(O),E(O,K,j)},z=(A,K,j)=>{const O=ao(A),ee=st(O.r,O.g,O.b);g(A),P({r:String(O.r),g:String(O.g),b:String(O.b)}),N(ee),E(ee,K,j)},W=A=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(A.key))return;const j=[...A.currentTarget.querySelectorAll("button")],O=j.findIndex(re=>re===document.activeElement);if(O<0)return;A.preventDefault();const ee=A.key==="ArrowLeft"?-1:A.key==="ArrowRight"?1:A.key==="ArrowUp"?-ca:ca,ye=j[Math.max(0,Math.min(j.length-1,O+ee))];ye==null||ye.focus()},X=(A,K)=>{const j=F.current;if(!j||i)return;const O=j.getBoundingClientRect(),ee=Math.max(0,Math.min(1,(A.clientX-O.left)/O.width)),ye=Math.max(0,Math.min(1,1-(A.clientY-O.top)/O.height));z({h:C.h,s:ee,v:ye},K,K)},J=A=>{i||(A.currentTarget.setPointerCapture(A.pointerId),X(A,!1))},fe=ao({h:C.h,s:1,v:1}),ce=st(fe.r,fe.g,fe.b),te=ao(C),R=st(te.r,te.g,te.b),Z=new Set(ua),Q=M.filter(A=>!Z.has(A));return o.jsxs("div",{className:ge.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[o.jsx("button",{type:"button",className:ge.none,role:h,"aria-checked":a?w===null&&!t:void 0,"aria-selected":a?void 0:w===null&&!t,disabled:i,onClick:()=>E(null,!0,!1),children:n}),o.jsx("div",{className:ge.grid,role:a?"group":"none",onKeyDown:W,children:ua.map(A=>{const K=w===A;return o.jsx("button",{type:"button",className:ge.swatch,role:h,"aria-label":A,"aria-checked":a?K:void 0,"aria-selected":a?void 0:K,disabled:i,style:{backgroundColor:A},onMouseDown:j=>j.preventDefault(),onClick:()=>E(A,!0,!1)},A)})}),Q.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:ge.sectionLabel,children:p("colorRecent")}),o.jsx("div",{className:ge.recents,role:a?"group":"none","aria-label":p("colorRecent"),children:Q.map(A=>o.jsx("button",{type:"button",className:ge.swatch,role:h,"aria-label":A,"aria-checked":a?w===A:void 0,"aria-selected":a?void 0:w===A,disabled:i,style:{backgroundColor:A},onMouseDown:K=>K.preventDefault(),onClick:()=>E(A,!0,!1)},A))})]}):null,o.jsx("button",{type:"button",className:ge.customToggle,disabled:i,"aria-expanded":S,onClick:()=>y(A=>!A),children:p("colorCustom")}),S?o.jsxs("div",{className:ge.custom,children:[o.jsx("div",{ref:F,className:ge.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${ce})`},onPointerDown:J,onPointerMove:A=>{A.currentTarget.hasPointerCapture(A.pointerId)&&X(A,!1)},onPointerUp:A=>{X(A,!0)},children:o.jsx("span",{className:ge.svThumb,style:{left:`${C.s*100}%`,top:`${(1-C.v)*100}%`}})}),o.jsx("input",{className:ge.hue,type:"range",min:0,max:360,value:Math.round(C.h),disabled:i,"aria-label":p("colorCustom"),onChange:A=>z({...C,h:Number(A.target.value)},!1,!1),onPointerUp:()=>E(D.current,!0,!0)}),o.jsx("div",{className:ge.rgbRow,children:["r","g","b"].map(A=>o.jsxs("div",{className:ge.field,children:[o.jsx("label",{htmlFor:`${b}-${A}`,children:p(A==="r"?"colorRgbR":A==="g"?"colorRgbG":"colorRgbB")}),o.jsx("input",{id:`${b}-${A}`,inputMode:"numeric",value:k[A],disabled:i,onChange:K=>{P(j=>({...j,[A]:K.target.value}))},onBlur:()=>{const K=Fp(k[A]);if(K===null){P({r:String(te.r),g:String(te.g),b:String(te.b)});return}_({...te,[A]:K},!0,!0)},onKeyDown:K=>{K.key==="Enter"&&K.currentTarget.blur()}})]},A))}),o.jsx("div",{className:ge.hexRow,children:o.jsxs("div",{className:ge.field,children:[o.jsx("label",{htmlFor:`${b}-hex`,children:p("colorHex")}),o.jsx("input",{id:`${b}-hex`,value:L,disabled:i,onChange:A=>N(A.target.value),onBlur:()=>{const A=se(L);if(!A){N(R);return}const K=Tn(A);K&&_(K,!0,!0)},onKeyDown:A=>{A.key==="Enter"&&A.currentTarget.blur()}})]})}),ms()?o.jsx("button",{type:"button",className:ge.eyedrop,disabled:i,onClick:()=>{wp().then(A=>{if(!A)return;const K=Tn(A);K&&_(K,!0,!0)})},children:p("colorPickFromScreen")}):null]}):null]})}const Ip="_wrap_mid65_1",Bp="_button_mid65_8",Hp="_icon_mid65_18",Op="_bar_mid65_24",zp="_barEmpty_mid65_33",Kp="_popover_mid65_43",ct={wrap:Ip,button:Bp,icon:Hp,bar:Op,barEmpty:zp,popover:Kp},$p="_field_pl3rn_1",Up="_label_pl3rn_8",Wp="_button_pl3rn_12",qp="_swatch_pl3rn_37",Gp="_swatchEmpty_pl3rn_44",Vt={field:$p,label:Up,button:Wp,swatch:qp,swatchEmpty:Gp},Mn=4;function je({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:i,fallbackCustom:a,onChange:l}){const c=s.useId(),m=s.useRef(null),p=s.useRef(null),b=s.useRef(null),[h,w]=s.useState(!1),[x,S]=s.useState({top:0,left:0}),y=s.useCallback(()=>{const k=p.current,P=b.current;if(!k)return;const L=k.getBoundingClientRect(),N=(P==null?void 0:P.offsetHeight)??0,M=(P==null?void 0:P.offsetWidth)??240;let T=L.bottom;T+N>window.innerHeight-Mn&&(T=Math.max(Mn,L.top-N));const F=Math.min(Math.max(L.left,Mn),window.innerWidth-M-Mn);S({top:T,left:F})},[]);s.useLayoutEffect(()=>{if(!h)return;y();const k=()=>y();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[h,y]),s.useEffect(()=>{if(!h)return;const k=L=>{var M,T;const N=L.target;(M=m.current)!=null&&M.contains(N)||(T=b.current)!=null&&T.contains(N)||w(!1)},P=L=>{var N;L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),w(!1),(N=p.current)==null||N.focus())};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",P,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",P,!0)}},[h]);const C=`${Vt.swatch}${!n||r?` ${Vt.swatchEmpty}`:""}`,g=n&&!r?{backgroundColor:n}:void 0;return o.jsxs("div",{className:Vt.field,ref:m,children:[o.jsx("span",{className:Vt.label,children:e}),o.jsx("button",{ref:p,type:"button",className:Vt.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?c:void 0,disabled:i,onClick:()=>w(k=>!k),children:o.jsx("span",{className:C,style:g})}),h?le.createPortal(o.jsx("div",{ref:b,id:c,className:ct.popover,style:{top:x.top,left:x.left,zIndex:1400},children:o.jsx(oi,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:i,fallbackCustom:a,onChange:l,onCommit:()=>w(!1)})}),document.body):null]})}const lo=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],Vp="_toolbar_xlok8_1",Xp="_menuBar_xlok8_14",Yp="_menuBarDesktop_xlok8_22",Jp="_brandMark_xlok8_28",Zp="_brandMarkIcon_xlok8_35",Qp="_menuBarCompact_xlok8_47",eh="_menuWrap_xlok8_70",th="_menuButton_xlok8_76",nh="_iconButton_xlok8_77",rh="_menuItem_xlok8_78",oh="_hamburgerButton_xlok8_121",ih="_iconNav_xlok8_128",ah="_iconTrack_xlok8_137",lh="_iconTrackInner_xlok8_152",sh="_iconGroup_xlok8_158",ch="_tooltipTrigger_xlok8_180",uh="_scrollButton_xlok8_186",dh="_scrollButtonLeft_xlok8_203",mh="_scrollButtonRight_xlok8_208",fh="_menu_xlok8_14",ph="_submenuWrap_xlok8_235",hh="_submenu_xlok8_235",gh="_submenuTrigger_xlok8_245",bh="_menuOverlay_xlok8_260",yh="_menuOverlayHeader_xlok8_272",xh="_menuOverlayTitle_xlok8_282",wh="_menuOverlayBody_xlok8_288",Sh="_menuSeparator_xlok8_339",kh="_icon_xlok8_77",Ch="_tooltip_xlok8_180",vh="_tooltipElevated_xlok8_424",U={toolbar:Vp,menuBar:Xp,menuBarDesktop:Yp,brandMark:Jp,brandMarkIcon:Zp,menuBarCompact:Qp,menuWrap:eh,menuButton:th,iconButton:nh,menuItem:rh,hamburgerButton:oh,iconNav:ih,iconTrack:ah,iconTrackInner:lh,iconGroup:sh,tooltipTrigger:ch,scrollButton:uh,scrollButtonLeft:dh,scrollButtonRight:mh,menu:fh,submenuWrap:ph,submenu:hh,submenuTrigger:gh,menuOverlay:bh,menuOverlayHeader:yh,menuOverlayTitle:xh,menuOverlayBody:wh,menuSeparator:Sh,icon:kh,tooltip:Ch,tooltipElevated:vh},Dh=400,ma=6,so=4;function Ie({label:e,children:t,className:n,elevated:r}){const i=s.useRef(null),a=s.useRef(null),l=s.useRef(null),c=s.useRef(!1),m=s.useRef(!1),[p,b]=s.useState(!1),[h,w]=s.useState({top:0,left:0}),x=s.useCallback(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),S=s.useCallback(g=>{if(!(c.current||m.current)){x(),b(!1);return}if(g||m.current){x(),b(!0);return}x(),l.current=setTimeout(()=>{l.current=null,b(!0)},Dh)},[x]),y=s.useCallback(()=>{const g=i.current,k=a.current;if(!g||!k)return;const P=g.getBoundingClientRect(),L=k.offsetWidth,N=k.offsetHeight;let M=P.bottom+ma;M+N>window.innerHeight-so&&(M=P.top-ma-N);let T=P.left+P.width/2-L/2;T=Math.min(Math.max(T,so),window.innerWidth-L-so),w({top:M,left:T})},[]);s.useEffect(()=>()=>x(),[x]),s.useEffect(()=>{const g=i.current;if(!g)return;const k=()=>{m.current=!0,S(!0)},P=()=>{m.current=!1,S(!1)};return g.addEventListener("focusin",k),g.addEventListener("focusout",P),()=>{g.removeEventListener("focusin",k),g.removeEventListener("focusout",P)}},[S]),s.useLayoutEffect(()=>{if(!p)return;y();const g=()=>y();return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[p,e,y]);const C=n?`${U.tooltipTrigger} ${n}`:U.tooltipTrigger;return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:i,className:C,"data-tooltip-trigger":"",onMouseEnter:()=>{c.current=!0,S(!1)},onMouseLeave:()=>{c.current=!1,S(!1)},children:t}),p?le.createPortal(o.jsx("span",{ref:a,className:r?`${U.tooltip} ${U.tooltipElevated}`:U.tooltip,"data-toolbar-tooltip":"",style:{top:h.top,left:h.left},"aria-hidden":"true",children:e}),document.body):null]})}const Ah="_wrap_o2uzw_1",Ph="_wrapToolbar_o2uzw_7",Eh="_field_o2uzw_12",jh="_trigger_o2uzw_20",Nh="_chevron_o2uzw_50",Lh="_list_o2uzw_73",Th="_listInline_o2uzw_88",Mh="_option_o2uzw_96",Rh="_separator_o2uzw_125",Me={wrap:Ah,wrapToolbar:Ph,field:Eh,trigger:jh,chevron:Nh,list:Lh,listInline:Th,option:Mh,separator:Rh};function _h({value:e,mixed:t=!1,fonts:n,disabled:r,listId:i,listRef:a,inline:l,style:c,onSelect:m}){const p=V(),b=!t&&e===null;return o.jsxs("ul",{ref:a,id:i,className:l?`${Me.list} ${Me.listInline}`:Me.list,role:"listbox","aria-label":p("commandFontFamilyAria"),style:c,children:[o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Me.option,role:"option","aria-checked":b,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>m(null),children:p("fontFamilyDefault")})}),o.jsx("li",{className:Me.separator,role:"separator"}),n.map(h=>{const w=!t&&ln(e,h.family);return o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Me.option,role:"option","aria-checked":w,disabled:r,style:{fontFamily:h.family},onMouseDown:x=>x.preventDefault(),onClick:()=>m(h.family),children:h.name})},h.family)})]})}function Fh(e,t,n,r){var i;return t?"":e===null?r:((i=Tc(e,n))==null?void 0:i.name)??e}const Rn=4;function fs({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:i,toolbar:a=!1,triggerId:l,onChange:c}){const m=V(),p=s.useId(),b=s.useRef(null),h=s.useRef(null),w=s.useRef(null),[x,S]=s.useState(!1),[y,C]=s.useState({top:0,left:0,width:0}),g=Fh(e,t,n,m("fontFamilyDefault")),k=s.useCallback(()=>{const L=h.current,N=w.current;if(!L)return;const M=L.getBoundingClientRect(),T=(N==null?void 0:N.offsetHeight)??0,F=Math.max(M.width,(N==null?void 0:N.offsetWidth)??0);let D=M.bottom;D+T>window.innerHeight-Rn&&(D=Math.max(Rn,M.top-T));const E=Math.min(Math.max(M.left,Rn),window.innerWidth-F-Rn);C({top:D,left:E,width:F})},[]);s.useLayoutEffect(()=>{if(!x)return;k();const L=()=>k();return window.addEventListener("scroll",L,!0),window.addEventListener("resize",L),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",L)}},[x,k,n.length]),s.useEffect(()=>{if(!x)return;const L=M=>{var F,D;const T=M.target;(F=b.current)!=null&&F.contains(T)||(D=w.current)!=null&&D.contains(T)||S(!1)},N=M=>{M.key==="Escape"&&(M.preventDefault(),M.stopPropagation(),S(!1))};return document.addEventListener("pointerdown",L),document.addEventListener("keydown",N,!0),()=>{document.removeEventListener("pointerdown",L),document.removeEventListener("keydown",N,!0)}},[x]);const P=o.jsxs("div",{className:`${Me.wrap}${a?` ${Me.wrapToolbar}`:""}`,ref:b,children:[o.jsxs("div",{className:Me.field,ref:h,children:[o.jsx("button",{type:"button",id:l,className:Me.trigger,disabled:r,"aria-label":a?m("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":x,"aria-controls":x?p:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:L=>L.preventDefault(),onClick:()=>S(L=>!L),children:g}),o.jsx("span",{className:Me.chevron,"aria-hidden":"true"})]}),x?le.createPortal(o.jsx(_h,{listRef:w,listId:p,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:y.top,left:y.left,minWidth:y.width},onSelect:L=>{c(L),S(!1)}}),document.body):null]});return i?o.jsx(Ie,{label:i,children:P}):P}function Ih({commands:e,queries:t,disabled:n}){const r=V(),i=!!(n||!t.isVisualMode());return o.jsx(fs,{family:t.isFontFamilyMixed()?null:t.getFontFamily(),mixed:t.isFontFamilyMixed(),fonts:t.getFontFaces(),disabled:i,tooltip:r("commandFontFamily"),toolbar:!0,onChange:a=>{e.setFontFamily(a)}})}const Bh="_wrap_1qhfu_1",Hh="_wrapToolbar_1qhfu_9",Oh="_field_1qhfu_14",zh="_input_1qhfu_22",Kh="_toggle_1qhfu_41",$h="_chevron_1qhfu_42",Uh="_unit_1qhfu_80",Wh="_list_1qhfu_110",qh="_option_1qhfu_125",ue={wrap:Bh,wrapToolbar:Hh,field:Oh,input:zh,toggle:Kh,chevron:$h,unit:Uh,list:Wh,option:qh},_n=4,Gh={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function ps({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:i,tooltip:a,sizeInputId:l,toolbar:c=!1}){const m=V(),p=s.useId(),b=s.useRef(null),h=s.useRef(null),w=s.useRef(null),[x,S]=s.useState(()=>e===null?"":Y(e)),[y,C]=s.useState(!1),[g,k]=s.useState(!1),[P,L]=s.useState({top:0,left:0,width:0});s.useEffect(()=>{y||S(e===null?"":Y(e))},[e,y]);const N=s.useCallback(()=>{const E=h.current,_=w.current;if(!E)return;const z=E.getBoundingClientRect(),W=(_==null?void 0:_.offsetHeight)??0;let X=z.bottom;X+W>window.innerHeight-_n&&(X=Math.max(_n,z.top-W));const J=Math.min(Math.max(z.left,_n),window.innerWidth-Math.max(z.width,72)-_n);L({top:X,left:J,width:z.width})},[]);s.useLayoutEffect(()=>{if(!g)return;N();const E=()=>N();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[g,N]),s.useEffect(()=>{if(!g)return;const E=z=>{var X,J;const W=z.target;(X=b.current)!=null&&X.contains(W)||(J=w.current)!=null&&J.contains(W)||k(!1)},_=z=>{z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",_,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",_,!0)}},[g]);const M=E=>{const _=pu(E,t);if(!_){S(e===null?"":Y(e));return}n(_.value,_.unit),S(Y(_.value))},T=uu[t],F=g?le.createPortal(o.jsx("ul",{ref:w,className:ue.list,role:"listbox",id:p,style:{top:P.top,left:P.left,minWidth:P.width},children:T.map(E=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ue.option,role:"option","aria-selected":e===E,onMouseDown:_=>_.preventDefault(),onClick:()=>{n(E,t),S(Y(E)),k(!1)},children:Y(E)})},E))}),document.body):null,D=o.jsxs("div",{className:`${ue.wrap}${c?` ${ue.wrapToolbar}`:""}`,ref:b,children:[o.jsxs("div",{className:ue.field,ref:h,children:[o.jsx("input",{id:l,className:ue.input,value:x,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":g,"aria-controls":p,role:"combobox",inputMode:"decimal",onFocus:()=>C(!0),onBlur:()=>{C(!1),M(x)},onChange:E=>S(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),M(x),k(!1),E.currentTarget.blur()),E.key==="ArrowDown"&&(E.preventDefault(),k(!0))}}),o.jsx("button",{type:"button",className:ue.toggle,tabIndex:-1,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-expanded":g,"aria-controls":p,onMouseDown:E=>E.preventDefault(),onClick:()=>k(E=>!E)})]}),o.jsxs("div",{className:ue.field,children:[o.jsx("select",{className:ue.unit,value:t,disabled:i,"aria-label":m("commandFontSizeUnitAria"),onChange:E=>{r(E.target.value)},children:Io.map(E=>o.jsx("option",{value:E,children:m(Gh[E])},E))}),o.jsx("span",{className:ue.chevron,"aria-hidden":"true"})]}),F]});return a?o.jsx(Ie,{label:a,children:D}):D}const Vh="_backdrop_po4dq_1",Xh="_dialog_po4dq_12",Yh="_dialogWide_po4dq_28",Jh="_header_po4dq_32",Zh="_tabs_po4dq_39",Qh="_tab_po4dq_39",eg="_body_po4dq_71",tg="_field_po4dq_79",ng="_label_po4dq_85",rg="_sizeRow_po4dq_89",og="_fileRow_po4dq_95",ig="_fileName_po4dq_101",ag="_marks_po4dq_108",lg="_mark_po4dq_108",sg="_actions_po4dq_123",cg="_actionsSpread_po4dq_130",ug="_actionsEnd_po4dq_134",dg="_headerRow_po4dq_139",mg="_close_po4dq_151",fg="_nameSection_po4dq_168",pg="_nameInput_po4dq_172",hg="_labelRow_po4dq_189",gg="_help_po4dq_195",bg="_textInput_po4dq_213",yg="_fullSelect_po4dq_225",xg="_error_po4dq_229",wg="_emptyHint_po4dq_234",Sg="_action_po4dq_123",kg="_textarea_po4dq_245",Cg="_actionDanger_po4dq_259",vg="_confirmBody_po4dq_265",Dg="_nestedPanel_po4dq_273",Ag="_spinnerWrap_po4dq_284",Pg="_spinner_po4dq_284",Eg="_actionPrimary_po4dq_319",jg="_iconButton_po4dq_333",Ng="_select_po4dq_334",Lg="_lengthInput_po4dq_335",Tg="_lengthUnit_po4dq_336",Mg="_group_po4dq_344",Rg="_nestedGroup_po4dq_354",_g="_subLabel_po4dq_364",Fg="_iconRow_po4dq_368",Ig="_lengthField_po4dq_400",Bg="_sideLabel_po4dq_406",Hg="_lengthRow_po4dq_410",Og="_sideGrid_po4dq_438",zg="_shadowGrid_po4dq_439",d={backdrop:Vh,dialog:Xh,dialogWide:Yh,header:Jh,tabs:Zh,tab:Qh,body:eg,field:tg,label:ng,sizeRow:rg,fileRow:og,fileName:ig,marks:ag,mark:lg,actions:sg,actionsSpread:cg,actionsEnd:ug,headerRow:dg,close:mg,nameSection:fg,nameInput:pg,labelRow:hg,help:gg,textInput:bg,fullSelect:yg,error:xg,emptyHint:wg,action:Sg,textarea:kg,actionDanger:Cg,confirmBody:vg,nestedPanel:Dg,spinnerWrap:Ag,spinner:Pg,actionPrimary:Eg,iconButton:jg,select:Ng,lengthInput:Lg,lengthUnit:Tg,group:Mg,nestedGroup:Rg,subLabel:_g,iconRow:Fg,lengthField:Ig,sideLabel:Bg,lengthRow:Hg,sideGrid:Og,shadowGrid:zg},Kg={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function ii({tab:e,value:t,fonts:n,disabled:r,onTabChange:i,onChange:a}){const l=V(),c=s.useId(),m=s.useId(),p=n??Ga(),b=lo.find(h=>h.id===e)??lo[0];return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("fontDialogTitle"),children:lo.map(h=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":h.id===e,disabled:!h.implemented,onClick:()=>i(h.id),children:l(h.labelKey)},h.id))}),o.jsx("div",{className:d.body,role:"tabpanel",children:b.implemented?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("fontDialogFamily")}),o.jsx(fs,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:p,disabled:r,triggerId:m,onChange:h=>{a({...t,fontFamily:h,fontFamilyMixed:!1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:c,children:l("fontDialogSize")}),o.jsx("div",{className:d.sizeRow,children:o.jsx(ps,{size:t.size,unit:t.unit,sizeInputId:c,disabled:r,onSizeChange:(h,w)=>{a({...t,size:h,unit:w})},onUnitChange:h=>{const w=t.size!==null?Ja(t.size,t.unit,h,16,16):t.size;a({...t,size:w,unit:h})}})})]}),o.jsx("div",{className:d.field,children:o.jsx(je,{label:l("commandFontColor"),noneLabel:l("colorAutomatic"),value:t.fontColor,mixed:t.fontColorMixed,disabled:r,onChange:h=>{a({...t,fontColor:h,fontColorMixed:!1})}})}),o.jsx("div",{className:d.field,children:o.jsx(je,{label:l("commandHighlightColor"),noneLabel:l("colorNone"),value:t.highlightColor,mixed:t.highlightColorMixed,disabled:r,fallbackCustom:"#ffff00",onChange:h=>{a({...t,highlightColor:h,highlightColorMixed:!1})}})}),o.jsxs("fieldset",{className:d.marks,children:[o.jsx("legend",{className:d.label,children:l("fontDialogStyle")}),_e.map(h=>o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.marks[h],disabled:r,onChange:()=>{a({...t,marks:{...t.marks,[h]:!t.marks[h]}})}}),l(Kg[h].label)]},h))]})]}):null})]})}const fa='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function $g({open:e,tab:t,size:n,unit:r,marks:i,fontFamily:a=null,fontFamilyMixed:l=!1,fontColor:c,fontColorMixed:m=!1,highlightColor:p,highlightColorMixed:b=!1,fonts:h,disabled:w,onTabChange:x,onApply:S,onClose:y}){const C=V(),g=s.useId(),k=s.useRef(null),[P,L]=s.useState({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:c,highlightColor:p,fontColorMixed:m,highlightColorMixed:b});return s.useEffect(()=>{e&&L({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:c,highlightColor:p,fontColorMixed:m,highlightColorMixed:b})},[e,n,r,i,a,l,c,m,p,b]),s.useEffect(()=>{if(!e)return;const N=k.current,M=N==null?void 0:N.querySelector(fa);M==null||M.focus();const T=F=>{if(F.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;F.preventDefault(),F.stopPropagation(),y();return}if(F.key!=="Tab"||!N)return;const D=[...N.querySelectorAll(fa)];if(D.length===0)return;const E=D[0],_=D[D.length-1];F.shiftKey&&document.activeElement===E?(F.preventDefault(),_.focus()):!F.shiftKey&&document.activeElement===_&&(F.preventDefault(),E.focus())};return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,y]),e?le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:y,children:o.jsxs("div",{ref:k,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":g,onMouseDown:N=>N.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:g,children:C("fontDialogTitle")}),o.jsx(ii,{tab:t,value:P,fonts:h,disabled:w,onTabChange:x,onChange:L}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:y,children:C("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:w,onClick:()=>S(P),children:C("fontDialogOk")})]})]})}),document.body):null}const Ug={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function me({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:i,inputId:a,onChange:l}){const c=V(),m=s.useId(),p=a??m,b=(t==null?void 0:t.unit)??Dl,[h,w]=s.useState(()=>t?Y(t.value):""),[x,S]=s.useState(!1);s.useEffect(()=>{x||w(t?Y(t.value):"")},[t,x]);const y=C=>{const g=C.trim();if(!g){l(null),w("");return}const k=Vn(g,b,r);if(!k){w(t?Y(t.value):"");return}l(k),w(Y(k.value))};return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:p,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:p,className:d.lengthInput,value:h,disabled:n,inputMode:"decimal",onFocus:()=>S(!0),onBlur:()=>{S(!1),y(h)},onChange:C=>w(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),y(h),C.currentTarget.blur())}}),o.jsx("select",{className:d.lengthUnit,value:b,disabled:n,"aria-label":i??c("paragraphDialogLengthUnitAria"),onChange:C=>{const g=C.target.value;if(t){l({value:t.value,unit:g});return}if(h.trim()){const k=Vn(h,g,r);l(k)}},children:Io.map(C=>o.jsx("option",{value:C,children:c(Ug[C])},C))})]})]})}function ai({shadow:e,disabled:t,onChange:n}){const r=V();return o.jsxs("div",{className:d.shadowGrid,children:[o.jsx(me,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetX:i??{value:0,unit:"px"}})}}),o.jsx(me,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetY:i??{value:0,unit:"px"}})}}),o.jsx(me,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:i=>{n({...e,blur:i??{value:0,unit:"px"}})}}),o.jsx(me,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:i=>{n({...e,spread:i??{value:0,unit:"px"}})}}),o.jsx(je,{label:r("paragraphDialogShadowColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:i=>{n({...e,color:i})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:e.inset,disabled:t,onChange:()=>{n({...e,inset:!e.inset})}}),r("paragraphDialogShadowInset")]})]})}const pa=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0}],Wg={left:No,center:jo,right:Lo,justify:Ta},qg={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},Gg={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Vg={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},Xg={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},Yg={value:1,unit:"pt"},Jg={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function Xt(e){return{top:e,right:e,bottom:e,left:e}}function ha(e){for(const t of Oe)if(e[t])return e[t];return null}function li({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:i="paragraphDialogTitle",onTabChange:a,onChange:l}){const c=V(),m=r?pa.filter(y=>r.includes(y.id)):pa,p=s.useId(),[b,h]=s.useState(()=>qe(t.margin,Xt(t.margin.top))),[w,x]=s.useState(()=>qe(t.padding,Xt(t.padding.top))),S=(y,C,g,k)=>{const P=t[y],L=C?Xt(k):{...P,[g]:k};l({...t,[y]:L,[`${y}Mixed`]:!1})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":c(i),children:m.map(y=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":y.id===e,disabled:!y.implemented,onClick:()=>a(y.id),children:c(y.labelKey)},y.id))}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[e==="general"?o.jsxs(o.Fragment,{children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":c("paragraphDialogAlignment"),children:Fl.map(y=>{const C=Wg[y],g=!t.alignMixed&&t.align===y;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":g,"aria-label":c(qg[y].aria),disabled:n,onClick:()=>{l({...t,align:y,alignMixed:!1})},children:o.jsx(C,{})},y)})})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogLists")}),o.jsxs("div",{className:d.iconRow,children:[o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ul","aria-label":c("commandBulletListAria"),disabled:n,onClick:()=>{const y=!t.listMixed&&t.list==="ul"?null:"ul";l({...t,list:y,listMixed:!1})},children:o.jsx(Ma,{})}),o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":c("commandNumberedListAria"),disabled:n,onClick:()=>{const y=!t.listMixed&&t.list==="ol"?null:"ol";l({...t,list:y,listMixed:!1})},children:o.jsx(_a,{})})]})]})]}):null,e==="spacing"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogSpacing")}),o.jsx(ga,{legend:c("paragraphDialogMargin"),sides:t.margin,linked:b,disabled:n,allowNegative:!0,onLinkedChange:y=>{h(y),y&&l({...t,margin:Xt(ha(t.margin)),marginMixed:!1})},onSideChange:(y,C)=>S("margin",b,y,C)}),o.jsx(ga,{legend:c("paragraphDialogPadding"),sides:t.padding,linked:w,disabled:n,onLinkedChange:y=>{x(y),y&&l({...t,padding:Xt(ha(t.padding)),paddingMixed:!1})},onSideChange:(y,C)=>S("padding",w,y,C)}),o.jsx(Qg,{value:t.lineHeight,disabled:n,onChange:y=>{l({...t,lineHeight:y,lineHeightMixed:!1})}})]}):null,e==="border"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:c("paragraphDialogBorderStyle")}),o.jsx("select",{id:p,className:d.select,value:t.border.style,disabled:n,onChange:y=>{const C=y.target.value;l({...t,border:{style:C,width:C==="none"?null:t.border.width??Yg,color:C==="none"?null:t.border.color},borderMixed:!1})},children:ir.map(y=>o.jsx("option",{value:y,children:c(Vg[y])},y))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(me,{label:c("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:y=>{l({...t,border:{...t.border,width:y},borderMixed:!1})}}),o.jsx(je,{label:c("paragraphDialogBorderColor"),noneLabel:c("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:y=>{l({...t,border:{...t.border,color:y},borderMixed:!1})}})]}):null,o.jsx(me,{label:c("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:y=>{l({...t,borderRadius:y,radiusMixed:!1})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{l({...t,boxShadow:t.boxShadow?null:Jg,shadowMixed:!1})}}),c("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(ai,{shadow:t.boxShadow,disabled:n,onChange:y=>{l({...t,boxShadow:y,shadowMixed:!1})}}):null]}):null,e==="background"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogTabBackground")}),o.jsx(je,{label:c("paragraphDialogBackgroundColor"),noneLabel:c("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:y=>{l({...t,backgroundColor:y,backgroundMixed:!1})}}),o.jsx(Zg,{value:t.opacity,disabled:n,onChange:y=>{l({...t,opacity:y,opacityMixed:!1})}})]}):null]})]})}function Zg({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),a=e===null?null:Xn(e),[l,c]=s.useState(()=>a===null?"":Y(a)),[m,p]=s.useState(!1);s.useEffect(()=>{m||c(a===null?"":Y(a))},[a,m]);const b=h=>{const w=h.trim();if(!w){n(null),c("");return}const x=Number(w.replace(",","."));if(!Number.isFinite(x)){c(a===null?"":Y(a));return}const S=jl(x);n(S),c(Y(Xn(S)))};return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogOpacity")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:l,disabled:t,inputMode:"decimal",onFocus:()=>p(!0),onChange:h=>c(h.target.value),onBlur:()=>{p(!1),b(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function ga({legend:e,sides:t,linked:n,disabled:r,allowNegative:i=!1,onLinkedChange:a,onSideChange:l}){const c=V(),m=n?["top"]:Oe;return o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:e}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:()=>a(!n)}),c("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:m.map(p=>o.jsx(me,{label:n?e:c(Gg[p]),value:t[p],disabled:r,allowNegative:i,onChange:b=>l(p,b)},p))})]})}function Qg({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),a=eb(e),l=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[c,m]=s.useState(()=>l===null?"":Y(l)),p=(e==null?void 0:e.kind)==="length"?e.unit:Dl;return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogLineHeight")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:a==="normal"?"":c,disabled:t||a==="normal",inputMode:"decimal",onChange:b=>m(b.target.value),onBlur:()=>{const b=c.trim();if(!b){n(null);return}if(a==="number"||a==="empty"){const w=Number(b.replace(",","."));if(!Number.isFinite(w)||w<0){m(l===null?"":Y(l));return}n({kind:"number",value:w}),m(Y(w));return}const h=Vn(b,p,!1);if(!h){m(l===null?"":Y(l));return}n({kind:"length",value:h.value,unit:h.unit}),m(Y(h.value))}}),o.jsxs("select",{className:d.lengthUnit,value:a==="length"?p:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:b=>{const h=b.target.value;if(h==="empty"){n(null),m("");return}if(h==="normal"){n({kind:"normal"}),m("");return}if(h==="number"){const y=Number((c||"1.5").replace(",",".")),C=Number.isFinite(y)&&y>=0?y:1.5;n({kind:"number",value:C}),m(Y(C));return}const w=h,x=Vn(c||"1",w,!1),S=(x==null?void 0:x.value)??1;n({kind:"length",value:S,unit:w}),m(Y(S))},children:[o.jsx("option",{value:"empty"}),o.jsx("option",{value:"normal",children:r("paragraphDialogLineHeightNormal")}),o.jsx("option",{value:"number",children:r("paragraphDialogLineHeightUnitless")}),["pt","px","em","rem","%"].map(b=>o.jsx("option",{value:b,children:r(Xg[b])},b))]})]})]})}function eb(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}const ba='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function tb({open:e,tab:t,value:n,disabled:r,onTabChange:i,onApply:a,onClose:l}){const c=V(),m=s.useId(),p=s.useRef(null),[b,h]=s.useState(n);return s.useEffect(()=>{e&&h(n)},[e,n]),s.useEffect(()=>{if(!e)return;const w=p.current,x=w==null?void 0:w.querySelector(ba);x==null||x.focus();const S=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),l();return}if(y.key!=="Tab"||!w)return;const C=[...w.querySelectorAll(ba)];if(C.length===0)return;const g=C[0],k=C[C.length-1];y.shiftKey&&document.activeElement===g?(y.preventDefault(),k.focus()):!y.shiftKey&&document.activeElement===k&&(y.preventDefault(),g.focus())};return document.addEventListener("keydown",S,!0),()=>document.removeEventListener("keydown",S,!0)},[e,l]),e?le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:l,children:o.jsxs("div",{ref:p,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":m,onMouseDown:w=>w.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:m,children:c("paragraphDialogTitle")}),o.jsx(li,{tab:t,value:b,disabled:r,onTabChange:i,onChange:h}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:l,children:c("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:r,onClick:()=>a(b),children:c("fontDialogOk")})]})]})}),document.body):null}const nb=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0}],ya='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',rb=nb.map(e=>e.id);function ob(e){return{...Jt(),...e}}function ib(e){const{align:t,alignMixed:n,list:r,listMixed:i,...a}=e;return a}function ab({open:e,tab:t,value:n,fonts:r,disabled:i,onTabChange:a,onApply:l,onClose:c}){const m=V(),p=s.useId(),b=s.useRef(null),[h,w]=s.useState("general"),[x,S]=s.useState("spacing"),[y,C]=s.useState(n.font),[g,k]=s.useState(n.box);if(s.useEffect(()=>{e&&(w("general"),S("spacing"),C(n.font),k(n.box))},[e,n]),s.useEffect(()=>{if(!e)return;const L=b.current,N=L==null?void 0:L.querySelector(ya);N==null||N.focus();const M=T=>{if(T.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;T.preventDefault(),T.stopPropagation(),c();return}if(T.key!=="Tab"||!L)return;const F=[...L.querySelectorAll(ya)];if(F.length===0)return;const D=F[0],E=F[F.length-1];T.shiftKey&&document.activeElement===D?(T.preventDefault(),E.focus()):!T.shiftKey&&document.activeElement===E&&(T.preventDefault(),D.focus())};return document.addEventListener("keydown",M,!0),()=>document.removeEventListener("keydown",M,!0)},[e,c]),!e)return null;const P=m("pageDialogTitle");return le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:c,children:o.jsxs("div",{ref:b,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":p,onMouseDown:L=>L.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:p,children:P}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":P,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="font",onClick:()=>a("font"),children:m("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="paragraph",onClick:()=>a("paragraph"),children:m("customStyleDialogTabParagraph")})]}),t==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(ii,{tab:h,value:y,fonts:r,disabled:i,onTabChange:w,onChange:C})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(li,{tab:x,value:ob(g),disabled:i,tabs:rb,tablistLabelKey:"pageDialogTitle",onTabChange:L=>{L!=="general"&&S(L)},onChange:L=>k(ib(L))})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:c,children:m("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>l({font:y,box:g}),children:m("fontDialogOk")})]})]})}),document.body)}const xa='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function lb(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function wa(e){return{size:e.size,unit:e.unit,marks:e.marks,fontFamily:e.fontFamily??null,fontFamilyMixed:!1,fontColor:e.fontColor,highlightColor:e.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}}function sb(e){return{size:e.size,unit:e.unit,marks:e.marks,fontFamily:e.fontFamilyMixed?null:e.fontFamily,fontColor:e.fontColorMixed?null:e.fontColor,highlightColor:e.highlightColorMixed?null:e.highlightColor}}function cb({open:e,mode:t,styleId:n,name:r="",font:i,paragraph:a,canDelete:l=!1,busy:c,disabled:m,fonts:p,defaultOuterTab:b="font",onSave:h,onDelete:w,onClose:x}){const S=V(),y=s.useId(),C=s.useId(),g=s.useRef(null),[k,P]=s.useState(r),[L,N]=s.useState(b),[M,T]=s.useState("general"),[F,D]=s.useState("general"),[E,_]=s.useState(()=>wa(i)),[z,W]=s.useState(()=>xo(a)),[X,J]=s.useState(!1);if(s.useEffect(()=>{e&&(P(r),N(b),T("general"),D("general"),_(wa(i)),W(xo(a)),J(!1))},[e,r,i,a,b]),s.useEffect(()=>{if(!e)return;const Z=g.current,Q=Z==null?void 0:Z.querySelector(xa);Q==null||Q.focus();const A=K=>{if(K.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;if(K.preventDefault(),K.stopPropagation(),X){J(!1);return}x();return}if(K.key!=="Tab"||!Z)return;const j=[...Z.querySelectorAll(xa)];if(j.length===0)return;const O=j[0],ee=j[j.length-1];K.shiftKey&&document.activeElement===O?(K.preventDefault(),ee.focus()):!K.shiftKey&&document.activeElement===ee&&(K.preventDefault(),O.focus())};return document.addEventListener("keydown",A,!0),()=>document.removeEventListener("keydown",A,!0)},[e,x,X]),!e)return null;const fe=S(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),ce=k.trim().length>0,te=!!(m||c),R=()=>{const Z=k.trim();Z&&h({id:n??lb(),name:Z,font:sb(E),paragraph:Ol(z)})};return le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:x,children:o.jsxs("div",{ref:g,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":y,"aria-busy":c||void 0,onMouseDown:Z=>Z.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:y,children:fe}),o.jsx("button",{type:"button",className:d.close,"aria-label":S("customStyleDialogCloseAria"),onClick:x,children:o.jsx(He,{})})]}),X?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.confirmBody,children:S("customStyleDialogDeleteConfirm")}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:te,onClick:()=>J(!1),children:S("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:te||!n,onClick:()=>{n&&(w==null||w(n))},children:S("customStyleDialogDelete")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.nameSection,children:o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:C,children:S("customStyleDialogName")}),o.jsx("input",{id:C,className:d.nameInput,value:k,disabled:te,onChange:Z=>P(Z.target.value)})]})}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":fe,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":L==="font",onClick:()=>N("font"),children:S("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":L==="paragraph",onClick:()=>N("paragraph"),children:S("customStyleDialogTabParagraph")})]}),L==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(ii,{tab:M,value:E,fonts:p,disabled:te,onTabChange:T,onChange:_})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(li,{tab:F,value:z,disabled:te,onTabChange:D,onChange:W})}),o.jsxs("div",{className:t==="edit"&&l?`${d.actions} ${d.actionsSpread}`:d.actions,children:[t==="edit"&&l?o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:te,onClick:()=>J(!0),children:S("customStyleDialogDelete")}):null,o.jsxs("div",{className:d.actionsEnd,children:[o.jsx("button",{type:"button",className:d.action,onClick:x,children:S("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:te||!ce,onClick:R,children:S("fontDialogOk")})]})]})]})]})}),document.body)}const Sa='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',ub={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function db({open:e,existingIds:t,disabled:n,onApply:r,onClose:i}){const a=V(),l=s.useId(),c=s.useId(),m=s.useId(),p=s.useRef(null),[b,h]=s.useState(""),[w,x]=s.useState(!1),S=s.useMemo(()=>new Set(t),[t]),y=Wl(b,S);if(s.useEffect(()=>{e&&(h(""),x(!1))},[e]),s.useEffect(()=>{if(!e)return;const P=p.current,L=P==null?void 0:P.querySelector(Sa);L==null||L.focus();const N=M=>{if(M.key==="Escape"){M.preventDefault(),M.stopPropagation(),i();return}if(M.key!=="Tab"||!P)return;const T=[...P.querySelectorAll(Sa)];if(T.length===0)return;const F=T[0],D=T[T.length-1];M.shiftKey&&document.activeElement===F?(M.preventDefault(),D.focus()):!M.shiftKey&&document.activeElement===D&&(M.preventDefault(),F.focus())};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[e,i]),!e)return null;const C=w||b.trim().length>0?y:null,g=y===null&&!n,k=()=>{x(!0),!(y||n)&&r(b.trim())};return le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:p,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:P=>P.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("bookmarkDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:i,children:o.jsx(He,{})})]}),o.jsx("div",{className:d.body,children:o.jsxs("div",{className:d.field,children:[o.jsxs("div",{className:d.labelRow,children:[o.jsx("label",{className:d.label,htmlFor:c,children:a("bookmarkDialogName")}),o.jsx(Ie,{label:a("bookmarkDialogHelp"),elevated:!0,children:o.jsx("button",{type:"button",className:d.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),o.jsx("input",{id:c,className:d.textInput,value:b,disabled:n,"aria-invalid":C!==null,"aria-describedby":C?m:void 0,onChange:P=>h(P.target.value)}),C?o.jsx("p",{id:m,className:d.error,children:a(ub[C])}):null]})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!g,onClick:k,children:a("fontDialogOk")})]})]})}),document.body)}const ka='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',mb={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},fb={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function pb({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=V(),c=s.useId(),m=s.useId(),p=s.useId(),b=s.useId(),h=s.useId(),w=s.useRef(null),x=s.useRef(null),[S,y]=s.useState("file"),[C,g]=s.useState(""),[k,P]=s.useState(""),[L,N]=s.useState(""),[M,T]=s.useState(""),[F,D]=s.useState(""),[E,_]=s.useState(null),[z,W]=s.useState(!1);if(s.useEffect(()=>{e&&(y("file"),g(""),P(""),N(""),T(""),D(""),_(null),W(!1),x.current&&(x.current.value=""))},[e]),s.useEffect(()=>{if(!e)return;const Q=w.current,A=Q==null?void 0:Q.querySelector(ka);A==null||A.focus();const K=j=>{if(j.key==="Escape"){j.preventDefault(),j.stopPropagation(),a();return}if(j.key!=="Tab"||!Q)return;const O=[...Q.querySelectorAll(ka)];if(O.length===0)return;const ee=O[0],ye=O[O.length-1];j.shiftKey&&document.activeElement===ee?(j.preventDefault(),ye.focus()):!j.shiftKey&&document.activeElement===ye&&(j.preventDefault(),ee.focus())};return document.addEventListener("keydown",K,!0),()=>document.removeEventListener("keydown",K,!0)},[e,a]),!e)return null;const X=S==="file"?k:S==="url"?C:"",J=S==="custom"?null:ei(X),fe=S==="custom"?null:S==="file"&&E?fb[E]:J&&(S==="file"||C.trim().length>0)?mb[J]:null,ce=S!=="custom"&&J===null&&!(S==="file"&&E)&&!t&&!z,te=()=>{t||!n||i==null||i()},R=()=>{ce&&r({src:X.trim(),alt:M.trim(),title:F.trim()})},Z=Q=>{var K;const A=(K=Q.target.files)==null?void 0:K[0];A&&(W(!0),_(null),Km(A).then(j=>{P(j),N(A.name),y("file"),W(!1)},j=>{const O=j instanceof Error?j.message:"";P(""),N(""),y("file"),_(O==="tooLarge"||O==="type"?O:"type"),W(!1),x.current&&(x.current.value="")}))};return le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:w,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":c,onMouseDown:Q=>Q.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:c,children:l("imageDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("imageDialogCloseAria"),onClick:a,children:o.jsx(He,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("imageDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("imageDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":S==="file",disabled:t,onClick:()=>y("file"),children:l("imageDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":S==="url",disabled:t,onClick:()=>y("url"),children:l("imageDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":S==="custom",disabled:t,onClick:()=>y("custom"),children:n.text}):null]}),S==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:x,type:"file",accept:_m,hidden:!0,disabled:t,"aria-label":l("imageDialogChooseFile"),onChange:Z}),o.jsx("button",{type:"button",className:d.action,disabled:t||z,onClick:()=>{var Q;return(Q=x.current)==null?void 0:Q.click()},children:l("imageDialogChooseFile")}),L?o.jsx("span",{className:d.fileName,children:L}):null]}):null,S==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("imageDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:C,disabled:t,"aria-invalid":fe!==null,"aria-describedby":fe?h:void 0,onChange:Q=>g(Q.target.value)})]}):null,S==="custom"&&n?o.jsxs("div",{className:d.field,children:[o.jsx("p",{className:d.emptyHint,children:n.description}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:te,children:n.buttonCaption})]}):null]}),S!=="custom"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("imageDialogAlt")}),o.jsx("input",{id:p,className:d.textInput,value:M,disabled:t,onChange:Q=>T(Q.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:b,children:l("imageDialogTitleField")}),o.jsx("input",{id:b,className:d.textInput,value:F,disabled:t,onChange:Q=>D(Q.target.value)})]})]}):null,fe?o.jsx("p",{id:h,className:d.error,children:l(fe)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),S!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!ce,onClick:R,children:l("fontDialogOk")}):null]})]})}),document.body)}const Fn=4,hb={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function Ca({label:e,inputAria:t,value:n,disabled:r,onChange:i}){const a=V(),l=s.useId(),c=s.useId(),m=s.useRef(null),p=s.useRef(null),b=s.useRef(null),h=(n==null?void 0:n.unit)??Vm,[w,x]=s.useState(()=>n?Y(n.value):""),[S,y]=s.useState(!1),[C,g]=s.useState(!1),[k,P]=s.useState({top:0,left:0,width:0});s.useEffect(()=>{S||x(n?Y(n.value):"")},[n,S]);const L=s.useCallback(()=>{const D=p.current,E=b.current;if(!D)return;const _=D.getBoundingClientRect(),z=(E==null?void 0:E.offsetHeight)??0;let W=_.bottom;W+z>window.innerHeight-Fn&&(W=Math.max(Fn,_.top-z));const X=Math.min(Math.max(_.left,Fn),window.innerWidth-Math.max(_.width,72)-Fn);P({top:W,left:X,width:_.width})},[]);s.useLayoutEffect(()=>{if(!C)return;L();const D=()=>L();return window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[C,L]),s.useEffect(()=>{if(!C)return;const D=_=>{var W,X;const z=_.target;(W=m.current)!=null&&W.contains(z)||(X=b.current)!=null&&X.contains(z)||g(!1)},E=_=>{_.key==="Escape"&&(_.preventDefault(),_.stopPropagation(),g(!1))};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",E,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",E,!0)}},[C]);const N=D=>{const E=D.trim();if(!E){i(null),x("");return}const _=ra(E,h);if(!_){x(n?Y(n.value):"");return}i(_),x(Y(_.value))},M=Xm[h],T=(n==null?void 0:n.value)??null,F=C?le.createPortal(o.jsx("ul",{ref:b,className:ue.list,role:"listbox",id:l,style:{top:k.top,left:k.left,minWidth:k.width},children:M.map(D=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ue.option,role:"option","aria-selected":T===D,onMouseDown:E=>E.preventDefault(),onClick:()=>{i({value:D,unit:h}),x(Y(D)),g(!1)},children:Y(D)})},D))}),document.body):null;return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:c,children:e}),o.jsxs("div",{className:`${ue.wrap} ${d.lengthRow}`,ref:m,children:[o.jsxs("div",{className:ue.field,ref:p,children:[o.jsx("input",{id:c,className:ue.input,value:w,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":C,"aria-controls":l,role:"combobox",inputMode:"decimal",onFocus:()=>y(!0),onBlur:()=>{y(!1),N(w)},onChange:D=>x(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),N(w),g(!1),D.currentTarget.blur()),D.key==="ArrowDown"&&(D.preventDefault(),g(!0))}}),o.jsx("button",{type:"button",className:ue.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":C,"aria-controls":l,onMouseDown:D=>D.preventDefault(),onClick:()=>g(D=>!D)})]}),o.jsxs("div",{className:ue.field,children:[o.jsx("select",{className:ue.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:D=>{const E=D.target.value;if(n){i({value:n.value,unit:E});return}w.trim()&&i(ra(w,E))},children:Xl.map(D=>o.jsx("option",{value:D,children:a(hb[D])},D))}),o.jsx("span",{className:ue.chevron,"aria-hidden":"true"})]}),F]})]})}const gb=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"alignment",labelKey:"imagePropertiesTabAlignment",implemented:!0},{id:"border",labelKey:"imagePropertiesTabBorder",implemented:!0},{id:"advanced",labelKey:"imagePropertiesTabAdvanced",implemented:!0},{id:"hover",labelKey:"imagePropertiesTabHover",implemented:!0}],bb={left:No,center:jo,right:Lo},yb=["left","center","right"],xb={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},wb=["width","height","lock"],Sb={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},kb={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Cb={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},vb={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},Db={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"},Ab={value:1,unit:"pt"},Pb={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function co(e){return{top:e,right:e,bottom:e,left:e}}function Eb(e){for(const t of Oe)if(e[t])return e[t];return null}function jb({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:i,onChange:a}){const l=V(),c=s.useId(),m=s.useId(),p=s.useId(),b=s.useId(),h=s.useId(),[w,x]=s.useState(()=>qe(t.margin,co(t.margin.top))),S=t.align==="center",y=(g,k)=>{if(t.sizeMode==="lock"&&k){const P=Zt(g,k,n);a({...t,width:P.width,height:P.height});return}a({...t,[g]:k})},C=g=>{if(g==="width"){a({...t,sizeMode:g,height:null});return}if(g==="height"){a({...t,sizeMode:g,width:null});return}if(t.width){const k=Zt("width",t.width,n);a({...t,sizeMode:g,width:k.width,height:k.height});return}if(t.height){const k=Zt("height",t.height,n);a({...t,sizeMode:g,width:k.width,height:k.height});return}a({...t,sizeMode:g})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("imagePropertiesDialogTitle"),children:gb.map(g=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":g.id===e,disabled:!g.implemented,onClick:()=>i(g.id),children:l(g.labelKey)},g.id))}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[e==="general"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesSize")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":l("imagePropertiesSizeMode"),children:wb.map(g=>o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":t.sizeMode===g,disabled:r,onClick:()=>C(g),children:l(Sb[g])},g))}),o.jsx(Ca,{label:l("imagePropertiesWidth"),inputAria:l("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:g=>y("width",g)}),o.jsx(Ca,{label:l("imagePropertiesHeight"),inputAria:l("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:g=>y("height",g)})]}):null,e==="alignment"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":l("paragraphDialogAlignment"),children:yb.map(g=>{const k=bb[g];return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":t.align===g,"aria-label":l(xb[g]),disabled:r,onClick:()=>{a({...t,align:t.align===g?null:g})},children:o.jsx(k,{})},g)})})]}):null,e==="border"?o.jsxs(o.Fragment,{children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogMargin")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:w,disabled:r||S,onChange:()=>{const g=!w;x(g),g&&a({...t,margin:co(Eb(t.margin))})}}),l("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(w?["top"]:Oe).map(g=>o.jsx(me,{label:l(w?"paragraphDialogMargin":kb[g]),value:t.margin[g],disabled:r||S&&(g==="left"||g==="right"),allowNegative:!0,onChange:k=>{const P=w?co(k):{...t.margin,[g]:k};a({...t,margin:P})}},g))})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:c,children:l("paragraphDialogBorderStyle")}),o.jsx("select",{id:c,className:d.select,value:t.border.style,disabled:r,onChange:g=>{const k=g.target.value;a({...t,border:{style:k,width:k==="none"?null:t.border.width??Ab,color:k==="none"?null:t.border.color}})},children:ir.map(g=>o.jsx("option",{value:g,children:l(Cb[g])},g))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(me,{label:l("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:g=>{a({...t,border:{...t.border,width:g}})}}),o.jsx(je,{label:l("paragraphDialogBorderColor"),noneLabel:l("colorNone"),value:t.border.color,disabled:r,onChange:g=>{a({...t,border:{...t.border,color:g}})}})]}):null,o.jsx(me,{label:l("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:g=>{a({...t,borderRadius:g})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:r,onChange:()=>{a({...t,boxShadow:t.boxShadow?null:Pb})}}),l("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(ai,{shadow:t.boxShadow,disabled:r,onChange:g=>{a({...t,boxShadow:g})}}):null]})]}):null,e==="advanced"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesTabAdvanced")}),o.jsx(Nb,{value:t.opacity,disabled:r,onChange:g=>{a({...t,opacity:g})}}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("imagePropertiesFit")}),o.jsxs("select",{id:m,className:d.select,value:t.objectFit??"",disabled:r,onChange:g=>{const k=g.target.value;a(af({...t,objectFit:k||null},n))},children:[o.jsx("option",{value:"",children:l("imagePropertiesFitDefault")}),Yl.map(g=>o.jsx("option",{value:g,children:l(vb[g])},g))]})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("imagePropertiesPosition")}),o.jsxs("select",{id:p,className:d.select,value:t.objectPosition??"",disabled:r,onChange:g=>{const k=g.target.value||null;a({...t,objectPosition:k})},children:[o.jsx("option",{value:"",children:l("imagePropertiesPositionDefault")}),Jl.map(g=>o.jsx("option",{value:g,children:l(Db[g])},g))]})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:b,children:l("imagePropertiesRotation")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:b,className:d.lengthInput,value:t.rotateDeg===null?"":Y(t.rotateDeg),disabled:r,inputMode:"decimal",onChange:g=>{const k=g.target.value.trim();if(!k){a({...t,rotateDeg:null});return}const P=Number(k.replace(",","."));Number.isFinite(P)&&a({...t,rotateDeg:P})}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:l("imagePropertiesRotationUnit")})]})]})]}):null,e==="hover"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesTabHover")}),o.jsx("p",{className:d.emptyHint,children:l("imagePropertiesHoverHelp")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:h,children:l("imagePropertiesHoverCss")}),o.jsx("textarea",{id:h,className:d.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":l("imagePropertiesHoverCssAria"),onChange:g=>{a({...t,hoverCss:g.target.value})}})]})]}):null]})]})}function Nb({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),a=e===null?null:Xn(e),[l,c]=s.useState(()=>a===null?"":Y(a)),[m,p]=s.useState(!1);s.useEffect(()=>{m||c(a===null?"":Y(a))},[a,m]);const b=h=>{const w=h.trim();if(!w){n(null),c("");return}const x=Number(w.replace(",","."));if(!Number.isFinite(x)){c(a===null?"":Y(a));return}const S=jl(x);n(S),c(Y(Xn(S)))};return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogOpacity")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:l,disabled:t,inputMode:"decimal",onFocus:()=>p(!0),onChange:h=>c(h.target.value),onBlur:()=>{p(!1),b(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const va='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Lb({open:e,tab:t,value:n,aspectRatio:r=1,disabled:i,onTabChange:a,onApply:l,onClose:c}){const m=V(),p=s.useId(),b=s.useRef(null),[h,w]=s.useState(n);return s.useEffect(()=>{e&&w(n)},[e,n]),s.useEffect(()=>{if(!e)return;const x=b.current,S=x==null?void 0:x.querySelector(va);S==null||S.focus();const y=C=>{if(C.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;C.preventDefault(),C.stopPropagation(),c();return}if(C.key!=="Tab"||!x)return;const g=[...x.querySelectorAll(va)];if(g.length===0)return;const k=g[0],P=g[g.length-1];C.shiftKey&&document.activeElement===k?(C.preventDefault(),P.focus()):!C.shiftKey&&document.activeElement===P&&(C.preventDefault(),k.focus())};return document.addEventListener("keydown",y,!0),()=>document.removeEventListener("keydown",y,!0)},[e,c]),e?le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:c,children:o.jsxs("div",{ref:b,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":p,onMouseDown:x=>x.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:p,children:m("imagePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":m("imagePropertiesDialogCloseAria"),onClick:c,children:o.jsx(He,{})})]}),o.jsx(jb,{tab:t,value:h,aspectRatio:r,disabled:i,onTabChange:a,onChange:w}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:c,children:m("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>l(h),children:m("fontDialogOk")})]})]})}),document.body):null}const Tb="_frame_bwkh8_1",Mb="_handle_bwkh8_9",Rb="_handleEast_bwkh8_29",_b="_handleSouth_bwkh8_37",Fb="_handleSouthEast_bwkh8_45",tn={frame:Tb,handle:Mb,handleEast:Rb,handleSouth:_b,handleSouthEast:Fb};function Yt(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const Ib=[{handle:"e",className:tn.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:tn.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:tn.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function uo(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function Bb({img:e,onResize:t,onResizeEnd:n}){const r=V(),i=s.useRef(null),a=s.useRef(e),l=s.useRef(t),c=s.useRef(n),m=s.useRef(null);a.current=e,l.current=t,c.current=n;const p=g=>{const k=i.current;k&&(k.style.left=`${g.left}px`,k.style.top=`${g.top}px`,k.style.width=`${g.width}px`,k.style.height=`${g.height}px`)};s.useLayoutEffect(()=>{p(Yt(e));const g=()=>{e.isConnected&&p(Yt(e))};return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[e]);const b=(g,k)=>{const P=m.current,L=a.current;if(!P||!L)return;const N=vf(P.handle,P.start,{x:g-P.originX,y:k-P.originY});l.current(N.width,N.height),L.isConnected&&p(Yt(L))},h=()=>{if(!m.current)return;m.current=null;const g=a.current;c.current(),g!=null&&g.isConnected&&p(Yt(g))};s.useLayoutEffect(()=>{const g=P=>{if(!m.current)return;const L=uo(P);L&&b(L.x,L.y)},k=()=>{h()};return document.addEventListener("pointermove",g),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k),document.addEventListener("mousemove",g),document.addEventListener("mouseup",k),()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",k)}},[]);const w=(g,k)=>{const P=uo(k);P&&(m.current={handle:g,start:Df(a.current),originX:P.x,originY:P.y})},x=g=>k=>{k.preventDefault(),k.stopPropagation(),w(g,k);try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}},S=g=>k=>{k.preventDefault(),k.stopPropagation(),w(g,k)},y=g=>{const k=uo(g);k&&b(k.x,k.y)};if(!e.isConnected)return null;const C=Yt(e);return le.createPortal(o.jsx("div",{ref:i,className:tn.frame,"data-image-resize-overlay":"",style:{left:C.left,top:C.top,width:C.width,height:C.height},children:Ib.map(g=>o.jsx("button",{type:"button",className:`${tn.handle} ${g.className}`,style:{cursor:g.cursor},"aria-label":r(g.ariaKey),"data-resize-handle":g.handle,onPointerDown:x(g.handle),onPointerMove:y,onPointerUp:h,onPointerCancel:h,onMouseDown:S(g.handle),onMouseMove:y,onMouseUp:h},g.handle))}),document.body)}const Da='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Hb({open:e,tab:t,href:n,title:r,targetBlank:i,textDecorationNone:a,hoverMode:l,hoverColor:c,hoverHtml:m,bookmarks:p,selectedBookmarkId:b,disabled:h,onTabChange:w,onApply:x,onClose:S}){const y=V(),C=s.useId(),g=s.useId(),k=s.useId(),P=s.useId(),L=s.useId(),N=s.useRef(null),[M,T]=s.useState(n),[F,D]=s.useState(r),[E,_]=s.useState(i),[z,W]=s.useState(a),[X,J]=s.useState(l),[fe,ce]=s.useState(c),[te,R]=s.useState(m),[Z,Q]=s.useState(b);if(s.useEffect(()=>{e&&(T(n),D(r),_(i),W(a),J(l),ce(c),R(m),Q(b))},[e,n,r,i,a,l,c,m,b]),s.useEffect(()=>{if(!e)return;const O=N.current,ee=O==null?void 0:O.querySelector(Da);ee==null||ee.focus();const ye=re=>{if(re.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;re.preventDefault(),re.stopPropagation(),S();return}if(re.key!=="Tab"||!O)return;const de=[...O.querySelectorAll(Da)];if(de.length===0)return;const we=de[0],Se=de[de.length-1];re.shiftKey&&document.activeElement===we?(re.preventDefault(),Se.focus()):!re.shiftKey&&document.activeElement===Se&&(re.preventDefault(),we.focus())};return document.addEventListener("keydown",ye,!0),()=>document.removeEventListener("keydown",ye,!0)},[e,S,t,X]),!e)return null;const A=()=>ar({title:F,targetBlank:E,textDecorationNone:z,hoverMode:X,hoverColor:fe,hoverHtml:te}),K=()=>{const O=M.trim();!O||h||x({...A(),href:O})},j=()=>{!Z||h||x({...A(),href:`#${Z}`})};return le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:S,children:o.jsxs("div",{ref:N,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":C,onMouseDown:O=>O.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:C,children:y("linkDialogTitle")}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":y("linkDialogTitle"),children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="link",onClick:()=>w("link"),children:y("linkDialogTabLink")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>w("bookmark"),children:y("linkDialogTabBookmark")})]}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[t==="link"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:g,children:y("linkDialogHref")}),o.jsx("input",{id:g,className:d.textInput,value:M,disabled:h,onChange:O=>T(O.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:k,children:y("linkDialogHoverTitle")}),o.jsx("input",{id:k,className:d.textInput,value:F,disabled:h,onChange:O=>D(O.target.value)})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:E,disabled:h,onChange:O=>_(O.target.checked)}),y("linkDialogTargetBlank")]})]}):p.length===0?o.jsx("p",{className:d.emptyHint,children:y("linkDialogBookmarkEmpty")}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:P,children:y("linkDialogBookmark")}),o.jsxs("select",{id:P,className:`${d.select} ${d.fullSelect}`,value:Z,disabled:h,onChange:O=>Q(O.target.value),children:[o.jsx("option",{value:""}),p.map(O=>o.jsx("option",{value:O.id,children:O.id},O.id))]})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:z,disabled:h,onChange:O=>W(O.target.checked)}),y("linkDialogTextDecorationNone")]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:y("linkDialogHover")}),o.jsxs("div",{className:d.sizeRow,role:"group","aria-label":y("linkDialogHover"),children:[o.jsx("button",{type:"button",className:d.action,"aria-pressed":X==="color",disabled:h,onClick:()=>J("color"),children:y("linkDialogHoverColor")}),o.jsx("button",{type:"button",className:d.action,"aria-pressed":X==="html",disabled:h,onClick:()=>J("html"),children:y("linkDialogHoverHtml")})]}),X==="color"?o.jsx(je,{label:y("linkDialogHoverColorField"),noneLabel:y("colorNone"),value:fe,disabled:h,onChange:ce}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:L,children:y("linkDialogHoverHtmlAria")}),o.jsx("textarea",{id:L,className:d.textarea,value:te,disabled:h,spellCheck:!1,onChange:O=>R(O.target.value)})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:h||!Z,onClick:j,children:y("linkDialogSelect")}),o.jsx("button",{type:"button",className:d.action,onClick:S,children:y("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:h||!M.trim(),onClick:K,children:y("fontDialogOk")})]})]})}),document.body)}const Ob="_grid_5kups_1",zb="_cell_5kups_8",Kb="_sizeLabel_5kups_27",$b="_sizeFields_5kups_33",Ub="_numberInput_5kups_37",bt={grid:Ob,cell:zb,sizeLabel:Kb,sizeFields:$b,numberInput:Ub},Aa='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])',Ze={rows:3,cols:3};function Wb({open:e,disabled:t,onApply:n,onClose:r}){const i=V(),a=s.useId(),l=s.useId(),c=s.useId(),m=s.useRef(null),[p,b]=s.useState(Ze.rows),[h,w]=s.useState(Ze.cols),[x,S]=s.useState(String(Ze.rows)),[y,C]=s.useState(String(Ze.cols)),[g,k]=s.useState(!1);if(s.useEffect(()=>{e&&(b(Ze.rows),w(Ze.cols),S(String(Ze.rows)),C(String(Ze.cols)),k(!1))},[e]),s.useEffect(()=>{if(!e)return;const D=m.current,E=D==null?void 0:D.querySelector(Aa);E==null||E.focus();const _=z=>{if(z.key==="Escape"){z.preventDefault(),z.stopPropagation(),r();return}if(z.key!=="Tab"||!D)return;const W=[...D.querySelectorAll(Aa)];if(W.length===0)return;const X=W[0],J=W[W.length-1];z.shiftKey&&document.activeElement===X?(z.preventDefault(),J.focus()):!z.shiftKey&&document.activeElement===J&&(z.preventDefault(),X.focus())};return document.addEventListener("keydown",_,!0),()=>document.removeEventListener("keydown",_,!0)},[e,r]),!e)return null;const L=rs(p,h)&&!t,N=(D,E)=>{const _=Math.min(St,Math.max(wt,D)),z=Math.min(St,Math.max(wt,E));b(_),w(z),S(String(_)),C(String(z))},M=(D,E)=>{const _=Number.parseInt(D,10);if(!Number.isFinite(_)){E==="rows"?S(String(p)):C(String(h));return}k(!0),E==="rows"?N(_,h):N(p,_)},T=(D,E)=>{const _=D.replace(/\D/g,"");if(E==="rows"?S(_):C(_),_==="")return;const z=Number.parseInt(_,10);Number.isFinite(z)&&(k(!0),E==="rows"?N(z,h):N(p,z))},F=D=>{(D.key==="e"||D.key==="E"||D.key==="+"||D.key==="-"||D.key===".")&&D.preventDefault()};return le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:r,children:o.jsxs("div",{ref:m,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:D=>D.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:a,children:i("tableDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":i("tableDialogCloseAria"),onClick:r,children:o.jsx(He,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx("div",{className:bt.grid,role:"grid","aria-label":i("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:aa},(D,E)=>Array.from({length:aa},(_,z)=>{const W=E+1,X=z+1,J=W<=p&&X<=h;return o.jsx("button",{type:"button",className:bt.cell,role:"gridcell","data-active":J?"true":void 0,"aria-label":`${W} × ${X}`,"aria-pressed":J&&W===p&&X===h,disabled:t,onMouseEnter:()=>{g||N(W,X)},onClick:()=>{k(!0),N(W,X)}},`${W}-${X}`)}))}),o.jsxs("p",{className:bt.sizeLabel,children:[i("tableDialogSize"),": ",p," × ",h]}),o.jsxs("div",{className:`${d.sizeRow} ${bt.sizeFields}`,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:i("tableDialogRows")}),o.jsx("input",{id:l,className:bt.numberInput,type:"number",inputMode:"numeric",min:wt,max:St,step:1,value:x,disabled:t,onKeyDown:F,onChange:D=>T(D.target.value,"rows"),onBlur:()=>M(x,"rows")})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:c,children:i("tableDialogColumns")}),o.jsx("input",{id:c,className:bt.numberInput,type:"number",inputMode:"numeric",min:wt,max:St,step:1,value:y,disabled:t,onKeyDown:F,onChange:D=>T(D.target.value,"cols"),onBlur:()=>M(y,"cols")})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:r,children:i("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!L,onClick:()=>{L&&n({rows:p,cols:h})},children:i("tableDialogInsert")})]})]})}),document.body)}const qb={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},Gb={value:1,unit:"pt"},Vb={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function Xb({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),a=s.useId();return o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("tablePropertiesWidth")}),o.jsx(me,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:l=>n({...e,width:l})}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("tablePropertiesCollapse")}),o.jsxs("select",{id:i,className:d.select,value:e.borderCollapse,disabled:t,onChange:l=>{const c=l.target.value==="separate"?"separate":"collapse";n({...e,borderCollapse:c,borderSpacing:c==="separate"?e.borderSpacing:null})},children:[o.jsx("option",{value:"collapse",children:r("tablePropertiesCollapseCollapse")}),o.jsx("option",{value:"separate",children:r("tablePropertiesCollapseSeparate")})]})]}),e.borderCollapse==="separate"?o.jsx(me,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:l=>n({...e,borderSpacing:l})}):null]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:r("paragraphDialogBorderStyle")}),o.jsx("select",{id:a,className:d.select,value:e.border.style,disabled:t,onChange:l=>{const c=l.target.value;n({...e,border:{style:c,width:c==="none"?null:e.border.width??Gb,color:c==="none"?null:e.border.color}})},children:ir.map(l=>o.jsx("option",{value:l,children:r(qb[l])},l))})]}),e.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(me,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:l=>n({...e,border:{...e.border,width:l}})}),o.jsx(je,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:l=>n({...e,border:{...e.border,color:l}})})]}):null,o.jsx(me,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:l=>n({...e,borderRadius:l})}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:e.boxShadow!==null,disabled:t,onChange:()=>{n({...e,boxShadow:e.boxShadow?null:Vb})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?o.jsx(ai,{shadow:e.boxShadow,disabled:t,onChange:l=>n({...e,boxShadow:l})}):null]})]})}const Pa='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Yb({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=V(),l=s.useId(),c=s.useRef(null),[m,p]=s.useState(t);return s.useEffect(()=>{e&&p(t)},[e,t]),s.useEffect(()=>{if(!e)return;const b=c.current,h=b==null?void 0:b.querySelector(Pa);h==null||h.focus();const w=x=>{if(x.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;x.preventDefault(),x.stopPropagation(),i();return}if(x.key!=="Tab"||!b)return;const S=[...b.querySelectorAll(Pa)];if(S.length===0)return;const y=S[0],C=S[S.length-1];x.shiftKey&&document.activeElement===y?(x.preventDefault(),C.focus()):!x.shiftKey&&document.activeElement===C&&(x.preventDefault(),y.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,i]),e?le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:c,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("tablePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:i,children:o.jsx(He,{})})]}),o.jsx(Xb,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})}),document.body):null}const Jb={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Zb={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function In(e){return{top:e,right:e,bottom:e,left:e}}function mo(e){for(const t of Oe)if(e[t])return e[t];return null}function Qb({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),[a,l]=s.useState(()=>qe(e.padding,In(mo(e.padding))));return s.useEffect(()=>{l(qe(e.padding,In(mo(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(je,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:c=>n({...e,backgroundColor:c})}),o.jsx(je,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:c=>n({...e,color:c})}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogPadding")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const c=!a;l(c),c&&n({...e,padding:In(mo(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(a?["top"]:Oe).map(c=>o.jsx(me,{label:r(a?"paragraphDialogPadding":Jb[c]),value:e.padding[c],disabled:t,onChange:m=>{const p=a?In(m):{...e.padding,[c]:m};n({...e,padding:p})}},c))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("cellPropertiesVerticalAlign")}),o.jsxs("select",{id:i,className:d.select,value:e.verticalAlign??"",disabled:t,onChange:c=>{const m=c.target.value;n({...e,verticalAlign:m||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),lr.map(c=>o.jsx("option",{value:c,children:r(Zb[c])},c))]})]}),o.jsx(me,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:c=>n({...e,width:c})})]})}const Ea='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function ey({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=V(),l=s.useId(),c=s.useRef(null),[m,p]=s.useState(t);return s.useEffect(()=>{e&&p(t)},[e,t]),s.useEffect(()=>{if(!e)return;const b=c.current,h=b==null?void 0:b.querySelector(Ea);h==null||h.focus();const w=x=>{if(x.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;x.preventDefault(),x.stopPropagation(),i();return}if(x.key!=="Tab"||!b)return;const S=[...b.querySelectorAll(Ea)];if(S.length===0)return;const y=S[0],C=S[S.length-1];x.shiftKey&&document.activeElement===y?(x.preventDefault(),C.focus()):!x.shiftKey&&document.activeElement===C&&(x.preventDefault(),y.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,i]),e?le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:c,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("cellPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:i,children:o.jsx(He,{})})]}),o.jsx(Qb,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})}),document.body):null}const ty={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},ny={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Bn(e){return{top:e,right:e,bottom:e,left:e}}function fo(e){for(const t of Oe)if(e[t])return e[t];return null}function ry({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),[a,l]=s.useState(()=>qe(e.padding,Bn(fo(e.padding))));return s.useEffect(()=>{l(qe(e.padding,Bn(fo(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(je,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:c=>n({...e,backgroundColor:c})}),o.jsx(je,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:c=>n({...e,color:c})}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogPadding")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const c=!a;l(c),c&&n({...e,padding:Bn(fo(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(a?["top"]:Oe).map(c=>o.jsx(me,{label:r(a?"paragraphDialogPadding":ty[c]),value:e.padding[c],disabled:t,onChange:m=>{const p=a?Bn(m):{...e.padding,[c]:m};n({...e,padding:p})}},c))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("cellPropertiesVerticalAlign")}),o.jsxs("select",{id:i,className:d.select,value:e.verticalAlign??"",disabled:t,onChange:c=>{const m=c.target.value;n({...e,verticalAlign:m||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),lr.map(c=>o.jsx("option",{value:c,children:r(ny[c])},c))]})]}),o.jsx(me,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:c=>n({...e,height:c})})]})}const ja='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function oy({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=V(),l=s.useId(),c=s.useRef(null),[m,p]=s.useState(t);return s.useEffect(()=>{e&&p(t)},[e,t]),s.useEffect(()=>{if(!e)return;const b=c.current,h=b==null?void 0:b.querySelector(ja);h==null||h.focus();const w=x=>{if(x.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;x.preventDefault(),x.stopPropagation(),i();return}if(x.key!=="Tab"||!b)return;const S=[...b.querySelectorAll(ja)];if(S.length===0)return;const y=S[0],C=S[S.length-1];x.shiftKey&&document.activeElement===y?(x.preventDefault(),C.focus()):!x.shiftKey&&document.activeElement===C&&(x.preventDefault(),y.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,i]),e?le.createPortal(o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:c,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("rowPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:i,children:o.jsx(He,{})})]}),o.jsx(ry,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})}),document.body):null}const iy={menus:{edit:{id:"edit",labelKey:"menuEdit",ariaKey:"menuEditAria"}},groups:{edit:{id:"edit",labelKey:"toolbarGroupEdit"}},items:{undo:{id:"undo",command:"undo",icon:oc,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:Qs,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"}}},ay=400;function ly(e){let t=[],n=e,r=[],i=!1,a=!1,l=0;function c(h,w){if(i){n=h,i=!1;return}if(h===n)return;const x=Date.now(),S=(w==null?void 0:w.coalesce)===!0;if(S&&a&&x-l<ay){n=h,l=x;return}t.push(n),n=h,r=[],l=x,a=S}function m(){return t.length===0?null:(a=!1,r.push(n),n=t.pop(),n)}function p(){return r.length===0?null:(a=!1,t.push(n),n=r.pop(),n)}function b(h){if(i){n=h,i=!1;return}h!==n&&(t.push(n),n=h,r=[],a=!1)}return{record:c,undo:m,redo:p,canUndo:()=>t.length>0,canRedo:()=>r.length>0,syncExternal:b,markApplying:()=>{i=!0}}}const sy={menus:{file:{id:"file",labelKey:"menuFile",ariaKey:"menuFileAria"}},groups:{file:{id:"file",labelKey:"toolbarGroupFile"},print:{id:"print",labelKey:"toolbarGroupPrint"}},items:{save:{id:"save",command:"save",icon:tc,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:Gs,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:Zs,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},Hn=4;function hs({icon:e,value:t,mixed:n,noneKey:r,labelKey:i,ariaKey:a,fallbackCustom:l,disabled:c,onChange:m}){const p=V(),b=s.useId(),h=s.useRef(null),w=s.useRef(null),x=s.useRef(null),[S,y]=s.useState(!1),[C,g]=s.useState({top:0,left:0}),k=s.useCallback(()=>{const T=w.current,F=x.current;if(!T)return;const D=T.getBoundingClientRect(),E=(F==null?void 0:F.offsetHeight)??0,_=(F==null?void 0:F.offsetWidth)??200;let z=D.bottom;z+E>window.innerHeight-Hn&&(z=Math.max(Hn,D.top-E));const W=Math.min(Math.max(D.left,Hn),window.innerWidth-_-Hn);g({top:z,left:W})},[]);s.useLayoutEffect(()=>{if(!S)return;k();const T=()=>k();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[S,k]),s.useEffect(()=>{if(!S)return;const T=D=>{var _,z;const E=D.target;(_=h.current)!=null&&_.contains(E)||(z=x.current)!=null&&z.contains(E)||y(!1)},F=D=>{var E;D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),y(!1),(E=w.current)==null||E.focus())};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",F,!0),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",F,!0)}},[S]);const P=T=>{m(T)},L=`${ct.bar}${!t||n?` ${ct.barEmpty}`:""}`,N=t&&!n?{backgroundColor:t}:void 0,M=o.jsxs("div",{className:ct.wrap,ref:h,children:[o.jsxs("button",{ref:w,type:"button",className:`${U.iconButton} ${ct.button}`,"aria-label":p(a),"aria-expanded":S,"aria-haspopup":"listbox","aria-controls":S?b:void 0,disabled:c,onClick:()=>y(T=>!T),children:[o.jsx(e,{className:`${U.icon} ${ct.icon}`}),o.jsx("span",{className:L,style:N})]}),S?le.createPortal(o.jsx("div",{ref:x,id:b,className:ct.popover,style:{top:C.top,left:C.left},children:o.jsx(oi,{value:t,mixed:n,noneLabel:p(r),ariaLabel:p(a),disabled:c,fallbackCustom:l,onChange:P,onCommit:()=>y(!1)})}),document.body):null]});return o.jsx(Ie,{label:p(i),children:M})}function cy({commands:e,queries:t,disabled:n}){return o.jsx(hs,{icon:Bs,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}function uy({commands:e,queries:t,disabled:n}){const r=V(),i=!!(n||!t.isVisualMode());return o.jsx(ps,{size:t.getFontSize(),unit:t.getFontSizeUnit(),disabled:i,tooltip:r("commandFontSize"),toolbar:!0,onSizeChange:(a,l)=>{e.setFontSize(a,l)},onUnitChange:a=>{e.setFontSizeUnit(a)}})}function dy({commands:e,queries:t,disabled:n}){return o.jsx(hs,{icon:zs,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function my({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=V(),a=!!(n||!t.isVisualMode());return o.jsx(oi,{value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneLabel:i("colorNone"),ariaLabel:i("commandHighlightColorAria"),disabled:a,menu:!0,fallbackCustom:"#ffff00",onChange:l=>e.setHighlightColor(l),onCommit:()=>r==null?void 0:r()})}const fy="_wrap_1wd6e_1",py="_wrapToolbar_1wd6e_7",hy="_field_1wd6e_12",gy="_trigger_1wd6e_20",by="_chevron_1wd6e_46",yy="_list_1wd6e_69",xy="_option_1wd6e_84",wy="_separator_1wd6e_113",Ke={wrap:fy,wrapToolbar:py,field:hy,trigger:gy,chevron:by,list:yy,option:xy,separator:wy},Eo={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},Sy={p:{fontSize:"1rem",fontWeight:"400"},h1:{fontSize:"1.75rem",fontWeight:"600"},h2:{fontSize:"1.5rem",fontWeight:"600"},h3:{fontSize:"1.25rem",fontWeight:"600"},h4:{fontSize:"1.125rem",fontWeight:"600"},h5:{fontSize:"1rem",fontWeight:"600"},h6:{fontSize:"0.875rem",fontWeight:"600"}};function Na(){const e=V();return o.jsx("div",{className:d.spinnerWrap,role:"status","aria-live":"polite","aria-label":e("customStyleLoading"),children:o.jsx("span",{className:d.spinner,"aria-hidden":"true"})})}function gs({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:i,listRef:a,style:l,customStylesEnabled:c=!1,customStyles:m=[],customStylesLoading:p=!1,onSelect:b,onSelectCustom:h,onAddNew:w}){const x=V(),S=t?null:e,y=c,C=!!(r&&c&&w);return r?o.jsxs(o.Fragment,{children:[Gn.map(g=>o.jsx("button",{type:"button",className:U.menuItem,role:"menuitemradio","aria-checked":S===g,disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>b(g),children:x(Eo[g])},g)),y?o.jsx("div",{role:"separator",className:U.menuSeparator}):null,y&&p?o.jsx(Na,{}):null,y&&!p?m.map(g=>o.jsx("button",{type:"button",className:U.menuItem,role:"menuitem",disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>h==null?void 0:h(g.id),children:g.name},g.id)):null,C?o.jsxs(o.Fragment,{children:[y&&(p||m.length>0)?o.jsx("div",{role:"separator",className:U.menuSeparator}):null,o.jsxs("button",{type:"button",className:U.menuItem,role:"menuitem","aria-label":x("styleAddNewAria"),disabled:n,onMouseDown:g=>g.preventDefault(),onClick:()=>w==null?void 0:w(),children:[o.jsx(Js,{className:U.icon}),x("styleAddNew")]})]}):null]}):o.jsxs("ul",{ref:a,className:Ke.list,role:"listbox",id:i,style:l,"aria-label":x("commandParagraphStyleAria"),"aria-busy":y&&p?!0:void 0,children:[Gn.map(g=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Ke.option,role:"option","aria-selected":S===g,disabled:n,style:Sy[g],onMouseDown:k=>k.preventDefault(),onClick:()=>b(g),children:x(Eo[g])})},g)),y&&(p||m.length>0)?o.jsx("li",{role:"separator",className:Ke.separator}):null,y&&p?o.jsx("li",{role:"presentation",children:o.jsx(Na,{})}):null,y&&!p?m.map(g=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Ke.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>h==null?void 0:h(g.id),children:g.name})},g.id)):null]})}const On=4;function ky({commands:e,queries:t,disabled:n}){const r=V(),i=s.useId(),a=s.useRef(null),l=s.useRef(null),c=s.useRef(null),[m,p]=s.useState(!1),[b,h]=s.useState({top:0,left:0,width:0}),w=!!(n||!t.isVisualMode()),x=t.isParagraphStyleMixed(),S=x?null:t.getParagraphStyle(),y=S?r(Eo[S]):"",C=t.customParagraphStylesEnabled(),g=C?t.getCustomParagraphStyles():[],k=C&&t.isCustomParagraphStylesLoading(),P=s.useCallback(()=>{const N=l.current,M=c.current;if(!N)return;const T=N.getBoundingClientRect(),F=(M==null?void 0:M.offsetHeight)??0,D=Math.max(T.width,(M==null?void 0:M.offsetWidth)??0);let E=T.bottom;E+F>window.innerHeight-On&&(E=Math.max(On,T.top-F));const _=Math.min(Math.max(T.left,On),window.innerWidth-D-On);h({top:E,left:_,width:D})},[]);s.useLayoutEffect(()=>{if(!m)return;P();const N=()=>P();return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[m,P,g.length,k]),s.useEffect(()=>{if(!m)return;const N=T=>{var D,E;const F=T.target;(D=a.current)!=null&&D.contains(F)||(E=c.current)!=null&&E.contains(F)||p(!1)},M=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),p(!1))};return document.addEventListener("pointerdown",N),document.addEventListener("keydown",M,!0),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",M,!0)}},[m]);const L=o.jsxs("div",{className:`${Ke.wrap} ${Ke.wrapToolbar}`,ref:a,children:[o.jsxs("div",{className:Ke.field,ref:l,children:[o.jsx("button",{type:"button",className:Ke.trigger,disabled:w,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":m,"aria-controls":m?i:void 0,onMouseDown:N=>N.preventDefault(),onClick:()=>p(N=>!N),children:y}),o.jsx("span",{className:Ke.chevron,"aria-hidden":"true"})]}),m?le.createPortal(o.jsx(gs,{listRef:c,listId:i,value:S,mixed:x,disabled:w,customStylesEnabled:C,customStyles:g,customStylesLoading:k,style:{top:b.top,left:b.left,minWidth:b.width},onSelect:N=>{e.setParagraphStyle(N),p(!1)},onSelectCustom:N=>{e.applyCustomParagraphStyle(N),p(!1)}}),document.body):null]});return o.jsx(Ie,{label:r("commandParagraphStyle"),children:L})}function Cy({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),l=a?null:t.getParagraphStyle(),c=t.customParagraphStylesEnabled(),m=c?t.getCustomParagraphStyles():[],p=c&&t.isCustomParagraphStylesLoading();return o.jsx(gs,{menu:!0,value:l,mixed:a,disabled:i,customStylesEnabled:c,customStyles:m,customStylesLoading:p,onSelect:b=>{e.setParagraphStyle(b),r==null||r()},onSelectCustom:b=>{e.openCustomParagraphStyleDialog(b),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const vy={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:Cy,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:my,enabled:"isVisualMode"},paragraph:{id:"paragraph",labelKey:"menuParagraph",ariaKey:"menuParagraphAria"},page:{id:"page",labelKey:"menuPage",ariaKey:"menuPageAria"}},groups:{font:{id:"font",labelKey:"toolbarGroupFont"},align:{id:"align",labelKey:"toolbarGroupAlign"},paragraph:{id:"paragraph",labelKey:"toolbarGroupParagraph"}},items:{fontFamily:{id:"fontFamily",widget:Ih,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:ky,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:uy,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:Hs,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:Ys,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:Xs,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:Ra,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:cy,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:dy,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:Ts,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:Us,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:rc,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:nc,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:_s,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},alignLeft:{id:"alignLeft",command:"alignLeft",icon:No,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:jo,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:Lo,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:Ta,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:$s,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:Vs,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:Ma,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:_a,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},Dy={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:Ws,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:Ms,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:Ra,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"}}},Ay={menus:{},submenus:{insertRow:{id:"insertRow",labelKey:"menuInsertRow",ariaKey:"menuInsertRowAria",enabled:"isInTable"},insertColumn:{id:"insertColumn",labelKey:"menuInsertColumn",ariaKey:"menuInsertColumnAria",enabled:"isInTable"}},groups:{},items:{table:{id:"table",command:"openTableDialog",icon:Bi,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:Xr,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:Xr,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:Xr,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:Vr,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:Vr,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:Vr,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:Bi,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:Rs,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:ec,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},Py={menus:{view:{id:"view",labelKey:"menuView",ariaKey:"menuViewAria"}},groups:{view:{id:"view",labelKey:"toolbarGroupView"}},items:{visual:{id:"visual",command:"setVisualMode",icon:ic,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:Ks,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:Os,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function Ey(...e){return{menus:Object.assign({},...e.map(t=>t.menus)),submenus:Object.assign({},...e.map(t=>t.submenus??{})),groups:Object.assign({},...e.map(t=>t.groups)),items:Object.assign({},...e.map(t=>t.items))}}const jy=Ey(sy,iy,Dy,Ay,Py,vy),Ny={menus:[{id:"file",items:["save","open",be,"print"]},{id:"edit",items:["undo","redo"]},{id:"insert",items:["link","bookmark",be,"image","table",be,{submenu:"insertRow",items:["insertRowBelow","insertRowBefore","deleteRow"]},{submenu:"insertColumn",items:["insertColumnAfter","insertColumnBefore","deleteColumn"]}]},{id:"view",items:["visual","html",be,"fullscreen"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},be,{submenu:"font",items:["fontProperties",be,{submenu:"highlightColor",items:[]},be,"bold","italic","underline","strikethrough"]},be,"clearFormatting",be,{submenu:"paragraph",items:["paragraphProperties",be,"alignLeft","alignCenter","alignRight","alignJustify",be,"indent","outdent",be,"bulletList","numberedList"]},be,{submenu:"page",items:["pageProperties"]},be,"imageProperties",be,"tableProperties","cellProperties","rowProperties"]}],iconGroups:[{id:"file",items:["save","open"]},{id:"print",items:["print"]},{id:"edit",items:["undo","redo"]},{id:"insert",items:["link","bookmark","image","table"]},{id:"font",items:["fontFamily","paragraphStyle","fontSize","fontColor","highlightColor","bold","italic","underline","strikethrough","clearFormatting"]},{id:"align",items:["alignLeft","alignCenter","alignRight","alignJustify"]},{id:"paragraph",items:["indent","outdent","bulletList","numberedList"]},{id:"view",items:["visual","html","fullscreen"]}]};function jt(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function Jn(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):jt(e,t):""}function Ly({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"scroll-left",children:[o.jsx("path",{d:"m11 17-5-5 5-5"}),o.jsx("path",{d:"m18 17-5-5 5-5"})]})}function Ty({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"scroll-right",children:[o.jsx("path",{d:"m6 17 5-5-5-5"}),o.jsx("path",{d:"m13 17 5-5-5-5"})]})}const La=1;function My(e){const t=Math.max(0,e.scrollWidth-e.clientWidth);return{canScrollLeft:e.scrollLeft>La,canScrollRight:e.scrollLeft<t-La}}const Ry=40;function _y(e){const t=e.querySelector("button"),n=t instanceof HTMLElement?t.offsetWidth:0;return Math.max(n||Ry,1)}const Fy={canScrollLeft:!1,canScrollRight:!1};function Iy(e){const t=s.useRef(null),n=s.useRef(null),[r,i]=s.useState(Fy),a=s.useCallback(()=>{const p=t.current;p&&i(My(p))},[]);s.useLayoutEffect(()=>{const p=t.current;if(!p)return;a(),p.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a);const b=typeof ResizeObserver>"u"?null:new ResizeObserver(a);return b==null||b.observe(p),n.current&&(b==null||b.observe(n.current)),()=>{p.removeEventListener("scroll",a),window.removeEventListener("resize",a),b==null||b.disconnect()}},[a,e]);const l=s.useCallback(p=>{const b=t.current;b&&b.scrollBy({left:p*_y(b),behavior:"smooth"})},[]),c=s.useCallback(()=>{l(-1)},[l]),m=s.useCallback(()=>{l(1)},[l]);return{trackRef:t,innerRef:n,canScrollLeft:r.canScrollLeft,canScrollRight:r.canScrollRight,scrollLeft:c,scrollRight:m}}function By({groups:e,catalog:t,commands:n,queries:r,disabled:i}){const a=V(),{trackRef:l,innerRef:c,canScrollLeft:m,canScrollRight:p,scrollLeft:b,scrollRight:h}=Iy(e);return o.jsxs("div",{className:U.iconNav,role:"toolbar","aria-label":a("toolbarAria"),children:[m?o.jsx(Ie,{label:a("toolbarScrollLeftAria"),className:`${U.scrollButton} ${U.scrollButtonLeft}`,children:o.jsx("button",{type:"button",className:U.iconButton,"aria-label":a("toolbarScrollLeftAria"),onClick:b,children:o.jsx(Ly,{className:U.icon})})}):null,o.jsx("div",{ref:l,className:U.iconTrack,"data-icon-track":"",children:o.jsx("div",{ref:c,className:U.iconTrackInner,children:e.map(w=>{const x=t.groups[w.id];return o.jsx("div",{className:U.iconGroup,role:"group","aria-label":x?jt(a,x):void 0,"data-toolbar-group":w.id,children:w.items.map(S=>{const y=t.items[S];if(!y)return null;const C=y.enabled?!r[y.enabled]():!1;if(y.widget){const L=y.widget;return o.jsx(L,{commands:n,queries:r,disabled:i||C},S)}if(!y.icon||!y.command)return null;const g=y.icon,k=y.command,P=y.active?r[y.active]():void 0;return o.jsx(Ie,{label:y.tooltip??jt(a,y),children:o.jsx("button",{type:"button",className:U.iconButton,"aria-label":Jn(a,y),"aria-pressed":P,disabled:i||C,onClick:()=>{Mo(n,k)},children:o.jsx(g,{className:U.icon})})},S)})},w.id)})})}),p?o.jsx(Ie,{label:a("toolbarScrollRightAria"),className:`${U.scrollButton} ${U.scrollButtonRight}`,children:o.jsx("button",{type:"button",className:U.iconButton,"aria-label":a("toolbarScrollRightAria"),onClick:h,children:o.jsx(Ty,{className:U.icon})})}):null]})}function Hy({menus:e,catalog:t,commands:n,queries:r,disabled:i,compact:a,openMenuId:l,onOpenMenuIdChange:c}){const m=V(),[p,b]=s.useState(!1),h=s.useRef(null),w=s.useRef(null),x=s.useRef(null),S=s.useCallback(()=>{b(!1),c(null)},[c]);s.useEffect(()=>{var C;p&&((C=w.current)==null||C.focus())},[p]),s.useEffect(()=>{if(!p)return;const C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C}},[p]),s.useEffect(()=>{if(!p)return;const C=k=>{var P;if(k.key==="Escape"){if(k.preventDefault(),k.stopPropagation(),l){c(null);return}S(),(P=h.current)==null||P.focus()}},g=k=>{var P;x.current&&!x.current.contains(k.target)&&(S(),(P=h.current)==null||P.focus())};return document.addEventListener("keydown",C,!0),document.addEventListener("pointerdown",g),()=>{document.removeEventListener("keydown",C,!0),document.removeEventListener("pointerdown",g)}},[p,l,c,S]);const y=C=>e.map(g=>{const k=t.menus[g.id];return k?o.jsx(zy,{def:k,itemIds:g.items,catalog:t,commands:n,queries:r,disabled:i,variant:C,open:(C==="overlay"||!p)&&l===g.id,onOpenChange:P=>c(P?g.id:null),onItemRun:C==="overlay"?()=>{var P;S(),(P=h.current)==null||P.focus()}:void 0},`${C}-${g.id}`):null});return o.jsxs("div",{className:U.menuBar,children:[o.jsx(Ie,{label:m("brandMarkAria"),children:o.jsx("span",{className:U.brandMark,role:"img","aria-label":m("brandMarkAria"),children:o.jsx(Fs,{className:U.brandMarkIcon})})}),o.jsx("div",{className:U.menuBarCompact,hidden:a===void 0?void 0:!a,children:o.jsx(Ie,{label:m("menuHamburgerAria"),children:o.jsx("button",{ref:h,type:"button",className:`${U.menuButton} ${U.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":p,"aria-label":m("menuHamburgerAria"),disabled:i,onClick:()=>{if(p){S();return}c(null),b(!0)},children:o.jsx(qs,{className:U.icon})})})}),o.jsx("div",{className:U.menuBarDesktop,hidden:a===void 0?void 0:a,children:y("dropdown")}),p?o.jsxs("div",{ref:x,className:U.menuOverlay,role:"dialog","aria-modal":"true","aria-label":m("menuOverlayAria"),children:[o.jsxs("div",{className:U.menuOverlayHeader,children:[o.jsx("span",{className:U.menuOverlayTitle,children:m("menuOverlayAria")}),o.jsx("button",{ref:w,type:"button",className:U.iconButton,"aria-label":m("menuCloseAria"),onClick:()=>{var C;S(),(C=h.current)==null||C.focus()},children:o.jsx(He,{className:U.icon})})]}),o.jsx("div",{className:U.menuOverlayBody,children:y("overlay")})]}):null]})}function Zn(e,t){var n,r,i;if(Qe(e))return!1;if(an(e)){const a=(n=t.submenus)==null?void 0:n[e.submenu];return a?a.panel?!0:e.items.some(l=>Zn(l,t)):!1}return!!((r=t.items[e])!=null&&r.command&&((i=t.items[e])!=null&&i.icon))}function Oy(e,t,n){if(!Qe(e[t])||!e.slice(t+1).some(a=>Zn(a,n)))return!1;let i=!1;for(let a=t-1;a>=0;a--){const l=e[a];if(Qe(l)){i=!0;continue}if(Zn(l,n))return!i}return!1}function zy({def:e,itemIds:t,catalog:n,commands:r,queries:i,disabled:a,variant:l,open:c,onOpenChange:m,onItemRun:p}){const b=V(),h=s.useRef(null),w=l==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[x,S]=s.useState(null);s.useEffect(()=>{c||S(null)},[c]),s.useEffect(()=>{if(!c||l==="overlay")return;const C=k=>{h.current&&!h.current.contains(k.target)&&m(!1)},g=k=>{if(k.key==="Escape"){if(k.preventDefault(),k.stopPropagation(),x){S(null);return}m(!1)}};return document.addEventListener("pointerdown",C),document.addEventListener("keydown",g,!0),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",g,!0)}},[c,x,m,l]);const y=()=>{m(!1),p==null||p()};return o.jsxs("div",{className:U.menuWrap,ref:h,children:[o.jsx("button",{type:"button",className:U.menuButton,"aria-haspopup":"menu","aria-expanded":c,"aria-controls":w,"aria-label":Jn(b,e),disabled:a,onClick:()=>m(!c),children:jt(b,e)}),c?o.jsx("div",{className:U.menu,role:"menu",id:w,children:o.jsx(bs,{entries:t,catalog:n,commands:r,queries:i,disabled:a,variant:l,onClose:y,openSubmenuId:x,onOpenSubmenuIdChange:S})}):null]})}function bs({entries:e,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,openSubmenuId:c,onOpenSubmenuIdChange:m}){return o.jsx(o.Fragment,{children:e.map((p,b)=>{if(Qe(p))return Oy(e,b,t)?o.jsx("div",{role:"separator",className:U.menuSeparator},`separator-${b}`):null;if(an(p))return o.jsx($y,{entry:p,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,open:c===p.submenu,onOpenChange:w=>m==null?void 0:m(w?p.submenu:null)},`submenu-${p.submenu}-${b}`);const h=t.items[p];return!h||!h.command||!h.icon?null:o.jsx(Ky,{item:h,commands:n,queries:r,disabled:i,onClose:l},p)})})}function Ky({item:e,commands:t,queries:n,disabled:r,onClose:i}){const a=V();if(!e.icon||!e.command)return null;const l=e.icon,c=e.command,m=e.active?n[e.active]():void 0,p=e.enabled?!n[e.enabled]():!1,b=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return o.jsxs("button",{type:"button",role:b,className:U.menuItem,"aria-checked":m,disabled:r||p,onClick:()=>{i(),Mo(t,c)},children:[o.jsx(l,{className:U.icon}),jt(a,e)]})}function $y({entry:e,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,open:c,onOpenChange:m}){var N;const p=V(),b=s.useRef(null),h=s.useRef(null),[w,x]=s.useState(null),S=(N=t.submenus)==null?void 0:N[e.submenu],y=a==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,C=S==null?void 0:S.panel,g=S!=null&&S.enabled?!r[S.enabled]():!1,k=a==="overlay";if(s.useEffect(()=>{c||x(null)},[c]),!S||!C&&!e.items.some(M=>Zn(M,t)))return null;const P=M=>{(M.key==="ArrowRight"||M.key==="Enter"||M.key===" ")&&(M.preventDefault(),M.stopPropagation(),m(!0),requestAnimationFrame(()=>{var F;const T=(F=h.current)==null?void 0:F.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');T==null||T.focus()}))},L=M=>{var T;M.key==="ArrowLeft"&&(M.preventDefault(),M.stopPropagation(),m(!1),(T=b.current)==null||T.focus())};return o.jsxs("div",{className:U.submenuWrap,onMouseEnter:k?void 0:()=>m(!0),onMouseLeave:k?void 0:()=>m(!1),children:[o.jsx("button",{ref:b,type:"button",role:"menuitem",className:`${U.menuItem} ${U.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":c,"aria-controls":y,"aria-label":Jn(p,S),disabled:i||g,onClick:()=>m(k?!c:!0),onKeyDown:P,children:jt(p,S)}),c?o.jsx("div",{ref:h,className:`${U.menu} ${U.submenu}`,role:"menu",id:y,"aria-label":Jn(p,S),onKeyDown:L,children:C?o.jsx(C,{commands:n,queries:r,disabled:i||g,onMenuClose:l}):o.jsx(bs,{entries:e.items,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,openSubmenuId:w,onOpenSubmenuIdChange:x})}):null]})}function Uy({catalog:e,layout:t,commands:n,queries:r,disabled:i,menuVisible:a=!0,toolbarVisible:l=!0,compact:c}){const[m,p]=s.useState(null);return!a&&!l?null:o.jsxs("div",{className:U.toolbar,"data-compact":c?"":void 0,children:[a?o.jsx(Hy,{menus:t.menus,catalog:e,commands:n,queries:r,disabled:i,compact:c,openMenuId:m,onOpenMenuIdChange:p}):null,l?o.jsx(By,{groups:t.iconGroups,catalog:e,commands:n,queries:r,disabled:i}):null]})}const Wy="_root_14tok_1",qy="_fullscreen_14tok_34",Gy="_exitFullscreen_14tok_46",Vy="_exitFullscreenIcon_14tok_77",Xy="_chrome_14tok_92",Yy="_workspace_14tok_103",Jy="_surface_14tok_113",Zy="_visual_14tok_120",Qy="_html_14tok_136",Fe={root:Wy,fullscreen:qy,exitFullscreen:Gy,exitFullscreenIcon:Vy,chrome:Xy,workspace:Yy,surface:Jy,visual:Zy,html:Qy},ex=s.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i},a){const l=V();return o.jsx("textarea",{ref:a,className:`${Fe.surface} ${Fe.html}`,value:t,onChange:c=>n(c.target.value),placeholder:r,disabled:i,"aria-label":l("htmlEditorAria"),spellCheck:!1})}),tx=s.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i,onBeforeInput:a,onPointerDown:l,onContextMenu:c},m){const p=V(),b=s.useRef(null),h=w=>{b.current=w,typeof m=="function"?m(w):m&&(m.current=w)};return s.useLayoutEffect(()=>{const w=b.current;w&&(w.innerHTML!==t&&(w.innerHTML=t),dl(w))},[t]),o.jsx("div",{ref:h,className:`${Fe.surface} ${Fe.visual}`,contentEditable:!i,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":p("visualEditorAria"),"aria-disabled":i||void 0,"data-placeholder":r,onBeforeInput:w=>{a==null||a(w.nativeEvent)},onPointerDown:l,onContextMenu:c,onInput:w=>{n(w.currentTarget.innerHTML)}})});function nx({value:e,defaultValue:t="",onChange:n,mode:r,defaultMode:i="visual",onModeChange:a,fullscreen:l,defaultFullscreen:c=!1,onFullscreenChange:m,placeholder:p,disabled:b,className:h,locale:w="en",toolbarBackground:x,menuColor:S,menuBackground:y,menuFontSize:C,menuFontFamily:g,border:k,menuVisible:P=!0,toolbarVisible:L=!0,customActions:N,customFonts:M,transformHtml:T,loadCustomParagraphStyles:F,onSaveCustomParagraphStyle:D,onDeleteCustomParagraphStyle:E,customImagePicker:_,disableBuiltinImageInsert:z}){const[W,X]=oo({value:e,defaultValue:t,onChange:n}),[J,fe]=oo({value:r,defaultValue:i,onChange:a}),[ce,te]=oo({value:l,defaultValue:c,onChange:m}),R=s.useRef(null),Z=s.useRef(null),Q=s.useRef(null);Q.current===null&&(Q.current=ly(W));const A=Q.current,K=s.useRef(W);K.current=W;const j=s.useRef(J);j.current=J;const O=s.useRef(ce);O.current=ce;const ee=s.useRef(null),ye=s.useRef(T);ye.current=T;const re=s.useRef({}),de=s.useRef(null),we=s.useRef(null),Se=s.useRef(null),Te=s.useRef(null),ve=s.useRef(null),[un,sr]=s.useState($e),cr=s.useRef(un);cr.current=un;const ze=s.useRef(ut),[Ft,dn]=s.useState({value:null,unit:ut,mixed:!1}),Xe=s.useRef(Ft);Xe.current=Ft;const[It,ur]=s.useState({value:null,mixed:!1}),Bt=s.useRef(It);Bt.current=It;const[Ht,dr]=s.useState({value:null,mixed:!1}),Ot=s.useRef(Ht);Ot.current=Ht;const[zt,mr]=s.useState({value:null,mixed:!1}),Kt=s.useRef(zt);Kt.current=zt;const[fr,pr]=s.useState({tag:null,mixed:!1}),hr=s.useRef(fr);hr.current=fr;const[si,gr]=s.useState({align:"left",mixed:!1}),br=s.useRef(si);br.current=si;const[ci,yr]=s.useState({type:null,mixed:!1}),$t=s.useRef(ci);$t.current=ci;const[ui,xr]=s.useState(!1),di=s.useRef(ui);di.current=ui;const[wr,Sr]=s.useState(!1),mi=s.useRef(wr);mi.current=wr;const[fi,pi]=s.useState(!1),hi=s.useRef(fi);hi.current=fi;const[Ut,mn]=s.useState({open:!1,tab:"general"}),[it,fn]=s.useState({open:!1,tab:"general",value:Jt()}),[at,pn]=s.useState({open:!1,tab:"font",value:wo()}),[kr,gi]=s.useState([]),[Cr,vr]=s.useState(!1),[ys,hn]=s.useState(!1),[pe,Wt]=s.useState({open:!1}),[ke,gn]=s.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[Dr,Ar]=s.useState({open:!1,existingIds:[]}),[xs,bn]=s.useState({open:!1}),[yn,xn]=s.useState({open:!1,tab:"general",value:Zl(),aspectRatio:1}),[Pr,Er]=s.useState({open:!1}),[wn,jr]=s.useState({open:!1,value:$f()}),[Sn,Nr]=s.useState({open:!1,value:Qf()}),[kn,Lr]=s.useState({open:!1,value:sp()}),[qt,Tr]=s.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1}),[he,pt]=s.useState(null),bi=s.useRef(he);bi.current=he;const[Mr,Cn]=s.useState(!1),yi=s.useRef(Mr);yi.current=Mr;const vn=s.useRef(kr);vn.current=kr;const xi=s.useRef(Cr);xi.current=Cr;const Rr=!!(F&&D),_r=s.useRef(Rr);_r.current=Rr;const wi=s.useRef(F);wi.current=F;const Si=s.useRef(D);Si.current=D;const ki=s.useRef(E);ki.current=E;const Ci=s.useRef(_);Ci.current=_;const vi=s.useRef(z);vi.current=z;const Fr=s.useRef(0),Ye=s.useMemo(()=>Ga(M),[M]),Gt=s.useRef(Ye);Gt.current=Ye;const Ir=s.useMemo(()=>Bc(W,Ye).join(`
91
- `),[W,Ye]);s.useEffect(()=>{const f=(Ir?Ir.split(`
92
- `):[]).map(v=>{const H=document.createElement("link");return H.rel="stylesheet",H.href=v,H.setAttribute(er,""),document.head.append(H),H});return()=>{for(const v of f)v.remove()}},[Ir]);const Dn=s.useCallback(async()=>{const u=wi.current;if(!u)return;const f=++Fr.current;vr(!0);try{const v=await u();if(f!==Fr.current)return;gi(v)}catch{}finally{f===Fr.current&&vr(!1)}},[]);s.useEffect(()=>{if(!F||!D){gi([]),vr(!1);return}Dn()},[F,D,Dn]);const ht=s.useCallback(u=>{var v;const f=((v=ye.current)==null?void 0:v.call(ye,u))??u;return X(f),f},[X]),De=s.useCallback((u,f)=>{const v=ht(u);return A.record(v,{coalesce:f}),v},[ht,A]),q=s.useCallback((u,f)=>De(Jr(u,Zr(u,K.current,Gt.current)),f),[De]),An=s.useCallback(()=>{const u=A.undo();u!==null&&(A.markApplying(),ht(u))},[ht,A]),Pn=s.useCallback(()=>{const u=A.redo();u!==null&&(A.markApplying(),ht(u))},[ht,A]);s.useEffect(()=>{A.syncExternal(W)},[W,A]);const B=s.useCallback(()=>{ee.current=Je({mode:j.current,visualEl:R.current,htmlEl:Z.current})},[]),ws=s.useCallback(()=>{const u=Je({mode:j.current,visualEl:R.current,htmlEl:Z.current}),f=ee.current;f&&f.mode==="visual"&&f.visualRange&&!f.collapsed&&(u.collapsed||!u.visualRange)||(ee.current=u)},[]),Br=s.useCallback(()=>{const u=R.current;if(j.current!=="visual"||!u){dn({value:null,unit:ze.current,mixed:!1});return}const f=xu(u,ze.current);de.current&&(f.value=de.current.value,f.unit=de.current.unit,f.mixed=!1),ze.current=f.unit,dn(v=>v.value===f.value&&v.unit===f.unit&&v.mixed===f.mixed?v:f)},[]),Hr=s.useCallback(()=>{const u=R.current;if(j.current!=="visual"||!u){ur({value:null,mixed:!1});return}const f=zc(u);we.current&&(f.value=we.current.value,f.mixed=!1),ur(v=>v.value===f.value&&v.mixed===f.mixed?v:f)},[]),Or=s.useCallback(()=>{const u=R.current;if(j.current!=="visual"||!u){dr({value:null,mixed:!1}),mr({value:null,mixed:!1});return}const f=$i(u,"color");Se.current&&(f.value=Se.current.value,f.mixed=!1);const v=$i(u,"backgroundColor");Te.current&&(v.value=Te.current.value,v.mixed=!1),dr(H=>H.value===f.value&&H.mixed===f.mixed?H:f),mr(H=>H.value===v.value&&H.mixed===v.mixed?H:v)},[]),zr=s.useCallback(()=>{const u=R.current;if(j.current!=="visual"||!u){pr({tag:null,mixed:!1});return}const f=pd(u);pr(v=>v.tag===f.tag&&v.mixed===f.mixed?v:f)},[]),Kr=s.useCallback(()=>{const u=R.current;if(j.current!=="visual"||!u){gr({align:null,mixed:!1}),yr({type:null,mixed:!1}),xr(!1),pi(!1);return}const f=Il(u);gr(ne=>ne.align===f.align&&ne.mixed===f.mixed?ne:f);const v=xl(u);yr(ne=>ne.type===v.type&&ne.mixed===v.mixed?ne:v);const H=vd(u);xr(ne=>ne===H?ne:H);const G=hm(u);pi(ne=>ne===G?ne:G)},[]),I=s.useCallback(()=>{const u=R.current;if(j.current!=="visual"||!u){sr($e()),Sr(!1),Br(),Hr(),Or(),zr(),Kr();return}const f=ee.current,v=!!(f&&!f.collapsed);Sr(G=>G===v?G:v);const H=il(Ln(u),re.current);sr(G=>Mu(G,H)?G:H),Br(),Hr(),Or(),zr(),Kr()},[Br,Hr,Or,zr,Kr]),Di=s.useCallback(()=>{const u=ee.current,f=ve.current;!f||!u||u.collapsed&&u.start===f.start&&u.end===f.end||(re.current={},de.current=null,we.current=null,Se.current=null,Te.current=null,ve.current=null)},[]);s.useEffect(()=>{if(J==="visual"){I();return}re.current={},de.current=null,we.current=null,Se.current=null,Te.current=null,ve.current=null,sr($e()),dn({value:null,unit:ze.current,mixed:!1}),ur({value:null,mixed:!1}),dr({value:null,mixed:!1}),mr({value:null,mixed:!1}),pr({tag:null,mixed:!1}),gr({align:null,mixed:!1}),yr({type:null,mixed:!1}),xr(!1),Sr(!1)},[J,W,I]);const gt=s.useCallback((u,f,v)=>{Yu({snapshot:u,visualEl:R.current,htmlEl:Z.current,getHtml:()=>j.current==="visual"&&R.current?R.current.innerHTML:K.current,setHtml:H=>{if(j.current==="visual"){q(rn(H).body,!1);return}De(H,!1)},content:f,asHtml:v})},[De,q]),Ai=s.useCallback(u=>{if(j.current==="visual"&&u==="html"&&R.current){const f=R.current.innerHTML,v=Jr(f,Zr(f,K.current,Gt.current));v!==K.current&&De(v,!0)}fe(u)},[De,fe]);s.useEffect(()=>{if(!ce)return;const u=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=u}},[ce]),s.useEffect(()=>{if(!ce)return;const u=f=>{f.key==="Escape"&&(f.defaultPrevented||Ut.open||it.open||at.open||Pr.open||wn.open||Sn.open||kn.open||(f.preventDefault(),te(!1)))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[ce,te,Ut.open,it.open,at.open,Pr.open,wn.open,Sn.open,kn.open]),s.useEffect(()=>{const u=()=>{if(j.current!=="visual"||!R.current)return;const f=window.getSelection();if(!f||f.rangeCount===0)return;const v=f.anchorNode;!v||!R.current.contains(v)&&R.current!==v||(B(),Di(),I(),pt(Qt(R.current)),Cn(en(R.current)!==null))};return document.addEventListener("selectionchange",u),()=>document.removeEventListener("selectionchange",u)},[B,Di,I]),s.useEffect(()=>{if(J!=="html")return;const u=Z.current;if(!u)return;const f=()=>B();return u.addEventListener("select",f),u.addEventListener("keyup",f),u.addEventListener("mouseup",f),()=>{u.removeEventListener("select",f),u.removeEventListener("keyup",f),u.removeEventListener("mouseup",f)}},[J,B]),s.useLayoutEffect(()=>{if(J!=="visual"||b){pt(null);return}const u=R.current;if(!u)return;const f=Qt(u);pt(v=>f||(v&&v.isConnected&&u.contains(v)?v:null))},[W,J,b]);const $=s.useCallback(u=>{const f=Je({mode:"visual",visualEl:u,htmlEl:Z.current}),v=ee.current,H=v&&v.mode==="visual"&&v.visualRange&&!v.collapsed&&(f.collapsed||!f.visualRange)?v:f.visualRange?f:v??f;if(ee.current=H,u.focus(),H.visualRange){const G=window.getSelection();try{G==null||G.removeAllRanges(),G==null||G.addRange(H.visualRange)}catch{}}return H},[]),$r=s.useCallback((u,f)=>{if(j.current!=="visual")return;const v=R.current;if(!v)return;const H=f??ze.current,G=dt(u,H);if(!G)return;ze.current=G.unit;const ne=$(v);if(ne.collapsed){de.current=G,ve.current={start:ne.start,end:ne.end},I();return}de.current=null,Ki(v,G.value,G.unit)&&(q(v.innerHTML,!1),B(),I())},[$,q,B,I]),Pi=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(!f)return;const v=$(f);if(v.collapsed){we.current={value:u},ve.current={start:v.start,end:v.end},I();return}we.current=null,Oi(f,u)&&(q(f.innerHTML,!1),B(),I())},[$,q,B,I]),Ur=s.useCallback((u,f)=>{if(j.current!=="visual")return;const v=R.current;if(!v)return;const H=$(v),G=u==="color"?Se:Te;if(H.collapsed){G.current={value:f},ve.current={start:H.start,end:H.end},I();return}G.current=null,no(v,u,f)&&(q(v.innerHTML,!1),B(),I())},[$,q,B,I]),Wr=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(!f)return;const v=$(f);if(mn({open:!1,tab:"general"}),v.collapsed){if(u.size!==null){const Ce=dt(u.size,u.unit);Ce&&(de.current=Ce,ze.current=Ce.unit)}const G=Ln(f),ne={};for(const Ce of _e)u.marks[Ce]!==G[Ce]&&(ne[Ce]=u.marks[Ce]);re.current=ne,u.fontColorMixed||(Se.current={value:u.fontColor}),u.highlightColorMixed||(Te.current={value:u.highlightColor}),u.fontFamilyMixed||(we.current={value:u.fontFamily}),ve.current={start:v.start,end:v.end},I();return}if(re.current={},de.current=null,we.current=null,Se.current=null,Te.current=null,ve.current=null,u.size!==null){const G=dt(u.size,u.unit);G&&(ze.current=G.unit,Ki(f,G.value,G.unit))}const H=Ln(f);for(const G of _e)u.marks[G]!==H[G]&&Wi(f,G);u.fontFamilyMixed||Oi(f,u.fontFamily),u.fontColorMixed||no(f,"color",u.fontColor),u.highlightColorMixed||no(f,"backgroundColor",u.highlightColor),q(f.innerHTML,!1),B(),I()},[$,q,B,I]),Ei=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),fn(v=>({...v,open:!1})),!Hl(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I()}},[$,q,B,I]),ji=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),pn(v=>({...v,open:!1})),!lm(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I()}},[$,q,B,I]),Ni=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),gn(v=>({...v,open:!1})),!Sm(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I()}},[$,q,B,I]),Li=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),Ar(v=>({...v,open:!1})),!Dm(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I()}},[$,q,B,I]),En=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),bn({open:!1}),!Wm(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I()}},[$,q,B,I]),Ti=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),Er({open:!1}),!Mf(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I(),Cn(!0)}},[$,q,B,I]),Mi=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),jr(v=>({...v,open:!1})),!Gf(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I()}},[$,q,B,I]),Ri=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),Nr(v=>({...v,open:!1})),!rp(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I()}},[$,q,B,I]),_i=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),Lr(v=>({...v,open:!1})),!mp(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I()}},[$,q,B,I]),lt=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),!u(f)){B(),I();return}q(f.innerHTML,!1),B(),I(),Cn(en(f)!==null)}},[$,q,B,I]),qr=s.useCallback(u=>{En({src:u.src,alt:u.alt??"",title:u.title??"",css:u.css})},[En]),Fi=s.useCallback(u=>{if(j.current!=="visual")return;const f=R.current;if(f){if($(f),xn(v=>({...v,open:!1})),!cf(f,u)){B(),I();return}q(f.innerHTML,!1),B(),I()}},[$,q,B,I]),Ss=s.useCallback((u,f)=>{he!=null&&he.isConnected&&Af(he,u,f)},[he]),ks=s.useCallback(()=>{const u=R.current;!u||!(he!=null&&he.isConnected)||(q(u.innerHTML,!1),ro(u,he),B(),I())},[he,q,B,I]),oe=s.useMemo(()=>({getHtml:()=>{if(j.current==="visual"&&R.current){const u=R.current.innerHTML,f=Jr(u,Zr(u,K.current,Gt.current));if(f!==K.current)return De(f,!0)}return K.current},setHtml:u=>{De(u,!1)},getMode:()=>j.current,setMode:Ai,getFullscreen:()=>O.current,setFullscreen:te,undo:An,redo:Pn,canUndo:()=>A.canUndo(),canRedo:()=>A.canRedo(),getSelection:()=>{const u=ee.current??Je({mode:j.current,visualEl:R.current,htmlEl:Z.current});return qi(u)},insertText:u=>{const f=ee.current??Je({mode:j.current,visualEl:R.current,htmlEl:Z.current});gt(f,u,!1)},insertHtml:(u,f)=>{const v=ee.current??Je({mode:j.current,visualEl:R.current,htmlEl:Z.current}),H=f===void 0;gt(v,H?u:f,H)},toggleFontMark:u=>{if(j.current!=="visual")return;const f=R.current;if(!f)return;const v=$(f);if(v.collapsed){const H=Ln(f);re.current=_u(re.current,H,u),ve.current={start:v.start,end:v.end},I();return}re.current={},ve.current=null,Wi(f,u)&&(q(f.innerHTML,!1),B(),I())},clearFormatting:()=>{if(j.current!=="visual")return;const u=R.current;!u||$(u).collapsed||(re.current={},de.current=null,we.current=null,Se.current=null,Te.current=null,ve.current=null,Mm(u)&&(q(u.innerHTML,!1),B(),I()))},isFontMarkActive:u=>cr.current[u],hasTextSelection:()=>j.current==="visual"&&mi.current,setFontSize:(u,f)=>{$r(u,f)},setFontSizeUnit:u=>{var Ce;const f=R.current,v=Xe.current;if(j.current!=="visual"||!f||v.value===null||v.mixed){ze.current=u,dn(Gr=>({...Gr,unit:u}));return}const H=$(f),G=wu(f,((Ce=H.visualRange)==null?void 0:Ce.startContainer)??f),ne=Ja(v.value,v.unit,u,G.parentPx,G.rootPx);$r(ne,u)},getFontSize:()=>Xe.current.value,getFontSizeUnit:()=>Xe.current.unit,isFontSizeMixed:()=>Xe.current.mixed,setFontFamily:u=>{Pi(u)},getFontFamily:()=>Bt.current.value,isFontFamilyMixed:()=>Bt.current.mixed,getFontFaces:()=>Gt.current,setFontColor:u=>{Ur("color",u)},setHighlightColor:u=>{Ur("backgroundColor",u)},getFontColor:()=>Ot.current.value,isFontColorMixed:()=>Ot.current.mixed,getHighlightColor:()=>Kt.current.value,isHighlightColorMixed:()=>Kt.current.mixed,setParagraphStyle:u=>{if(j.current!=="visual")return;const f=R.current;f&&($(f),hd(f,u)&&(q(f.innerHTML,!1),B(),I()))},getParagraphStyle:()=>hr.current.tag,isParagraphStyleMixed:()=>hr.current.mixed,setTextAlign:u=>{if(j.current!=="visual")return;const f=R.current;f&&($(f),Bl(f,u)&&(q(f.innerHTML,!1),B(),I()))},getTextAlign:()=>br.current.align,isTextAlignMixed:()=>br.current.mixed,indent:()=>{if(j.current!=="visual")return;const u=R.current;u&&($(u),Dd(u)&&(q(u.innerHTML,!1),B(),I()))},outdent:()=>{if(j.current!=="visual")return;const u=R.current;u&&($(u),Ad(u)&&(q(u.innerHTML,!1),B(),I()))},canOutdent:()=>j.current==="visual"&&di.current,toggleList:u=>{if(j.current!=="visual")return;const f=R.current;f&&($(f),yd(f,u)&&(q(f.innerHTML,!1),B(),I()))},isBulletList:()=>$t.current.type==="ul"&&!$t.current.mixed,isNumberedList:()=>$t.current.type==="ol"&&!$t.current.mixed,openFontProperties:u=>{j.current==="visual"&&mn({open:!0,tab:u??"general"})},applyFontProperties:u=>{Wr(u)},openParagraphProperties:u=>{if(j.current!=="visual")return;const f=R.current;f&&$(f),fn({open:!0,tab:u??"general",value:f?ea(f):Jt()})},applyParagraphProperties:u=>{Ei(u)},openPageProperties:u=>{if(j.current!=="visual")return;const f=R.current;f&&$(f),pn({open:!0,tab:u??"font",value:f?am(f):wo()})},applyPageProperties:u=>{ji(u)},openCustomParagraphStyleDialog:u=>{if(j.current!=="visual"||!_r.current)return;if(u){const v=vn.current.find(H=>H.id===u);if(!v)return;Wt({open:!0,mode:"edit",style:v});return}const f=R.current;f&&$(f),Wt({open:!0,mode:"create",font:{size:Xe.current.mixed?null:Xe.current.value,unit:Xe.current.unit,marks:{...cr.current},fontFamily:Bt.current.mixed?null:Bt.current.value,fontColor:Ot.current.mixed?null:Ot.current.value,highlightColor:Kt.current.mixed?null:Kt.current.value},paragraph:Ol(f?ea(f):Jt())})},applyCustomParagraphStyle:u=>{const f=vn.current.find(H=>H.id===u);if(!f||(Wr({size:f.font.size,unit:f.font.unit,marks:f.font.marks,fontFamily:f.font.fontFamily??null,fontFamilyMixed:!1,fontColor:f.font.fontColor,highlightColor:f.font.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}),!f.paragraph))return;const v=R.current;!v||j.current!=="visual"||($(v),Jd(v,f.paragraph)&&(q(v.innerHTML,!1),B(),I()))},customParagraphStylesEnabled:()=>_r.current,getCustomParagraphStyles:()=>vn.current,isCustomParagraphStylesLoading:()=>xi.current,openLinkDialog:u=>{if(j.current!=="visual")return;const f=R.current;f&&$(f);const v=f?$l(f):ar(),H=f?So(f):[],G=(v==null?void 0:v.href)??"",ne=G.startsWith("#")?G.slice(1):"",Ce=H.some(Gr=>Gr.id===ne)?ne:"";gn({open:!0,tab:u??"link",href:G,title:(v==null?void 0:v.title)??"",targetBlank:(v==null?void 0:v.targetBlank)??!1,textDecorationNone:(v==null?void 0:v.textDecorationNone)??!1,hoverMode:(v==null?void 0:v.hoverMode)??"color",hoverColor:(v==null?void 0:v.hoverColor)??null,hoverHtml:(v==null?void 0:v.hoverHtml)??"",bookmarks:H,selectedBookmarkId:Ce})},applyLink:u=>{Ni(u)},openBookmarkDialog:()=>{if(j.current!=="visual")return;const u=R.current;u&&$(u),Ar({open:!0,existingIds:u?So(u).map(f=>f.id):[]})},applyBookmark:u=>{Li(u)},openImageDialog:()=>{if(j.current!=="visual")return;const u=R.current;u&&$(u);const f=Ci.current;if(vi.current&&f){f.onPick(qr);return}bn({open:!0})},applyImage:u=>{En(u)},openImageProperties:u=>{if(j.current!=="visual")return;const f=R.current;if(!f)return;$(f);const v=Qt(f),H=sf(f);!v||!H||xn({open:!0,tab:u??"general",value:H,aspectRatio:of(v)})},applyImageProperties:u=>{Fi(u)},openTableDialog:()=>{if(j.current!=="visual")return;const u=R.current;u&&$(u),Er({open:!0})},applyTable:u=>{Ti(u)},openTableProperties:()=>{if(j.current!=="visual")return;const u=R.current;if(!u)return;$(u);const f=qf(u);f&&jr({open:!0,value:f})},applyTableProperties:u=>{Mi(u)},openCellProperties:()=>{if(j.current!=="visual")return;const u=R.current;if(!u)return;$(u);const f=np(u);f&&Nr({open:!0,value:f})},applyCellProperties:u=>{Ri(u)},openRowProperties:()=>{if(j.current!=="visual")return;const u=R.current;if(!u)return;$(u);const f=dp(u);f&&Lr({open:!0,value:f})},applyRowProperties:u=>{_i(u)},insertRowBelow:()=>{lt(u=>Do(u,"below"))},insertRowBefore:()=>{lt(u=>Do(u,"before"))},deleteRow:()=>{lt(u=>Rf(u))},insertColumnAfter:()=>{lt(u=>la(u,"after"))},insertColumnBefore:()=>{lt(u=>la(u,"before"))},deleteColumn:()=>{lt(u=>_f(u))},cut:async()=>{if(j.current!=="visual")return;const u=R.current;u&&($(u),await Em(u)&&(q(u.innerHTML,!1),B(),I()))},copy:async()=>{if(j.current!=="visual")return;const u=R.current;u&&($(u),await Vl(u))},deleteSelection:()=>{if(j.current!=="visual")return;const u=R.current;u&&($(u),Gl(u)&&(q(u.innerHTML,!1),B(),I()))},isLink:()=>hi.current,isImageSelected:()=>j.current==="visual"&&bi.current!==null,isInTable:()=>j.current==="visual"&&yi.current}),[De,q,Ai,te,gt,An,Pn,B,I,$,$r,Pi,Ur,Wr,Ei,ji,Ni,Li,En,Fi,Ti,Mi,Ri,_i,lt,qr]),Ii=s.useCallback(()=>{const u=ee.current??Je({mode:j.current,visualEl:R.current,htmlEl:Z.current});return{mode:u.mode,selection:qi(u),getHtml:oe.getHtml,setHtml:f=>{De(f,!1)},insertText:f=>gt(u,f,!1),insertHtml:(f,v)=>{const H=v===void 0;gt(u,H?f:v,H)}}},[gt,oe.getHtml,De]),{catalog:Cs,layout:vs}=s.useMemo(()=>fc(N,jy,Ny),[N]),jn=s.useMemo(()=>({...su(oe),...pc(N,Ii)}),[oe,N,Ii]),Ds=s.useMemo(()=>cu(oe),[oe,un,Ft,It,Ht,zt,fr,kr,Cr,Rr,Ye,he,Mr,wr]),As=s.useCallback(u=>{if(b||u.inputType!=="insertText"||!u.data||!Ru(re.current)&&!de.current&&!$c(we.current)&&!Pu({color:Se.current,backgroundColor:Te.current}))return;const f=R.current;f&&(u.preventDefault(),Uu(f,u.data,re.current,de.current,{color:Se.current,backgroundColor:Te.current},we.current),re.current={},de.current=null,we.current=null,Se.current=null,Te.current=null,ve.current=null,q(f.innerHTML,!0),B(),I())},[b,q,B,I]),Ps=s.useCallback(u=>{if(b)return;u.preventDefault(),u.stopPropagation();const f=R.current;if(!f)return;const v=ko(f,u.target),H=Yn(f,u.target);if(H&&If(f,H),v){ro(f,v),B(),pt(v),Tr({open:!0,x:u.clientX,y:u.clientY,kind:"image",inTable:Be(f,v)!==null});return}const G=Je({mode:"visual",visualEl:f,htmlEl:Z.current});ee.current=G,Tr({open:!0,x:u.clientX,y:u.clientY,kind:G.collapsed?"caret":"text",inTable:Be(f,u.target)!==null})},[b,B]),Es=s.useCallback(u=>{if(b)return;const f=R.current;if(!f)return;const v=ko(f,u.target);if(!v){pt(null);return}u.preventDefault(),ro(f,v),B(),pt(v)},[b,B]),js=s.useCallback(u=>{if(b)return;if(u.key==="Tab"&&!u.ctrlKey&&!u.metaKey&&!u.altKey){if(j.current!=="visual")return;const v=R.current;if(!v)return;const H=u.target;if(!(H instanceof Node)||!v.contains(H))return;$(v);const G=Ff(v,u.shiftKey);if(!G)return;u.preventDefault(),typeof G=="object"&&G.changed&&q(v.innerHTML,!1),B(),I(),Cn(en(v)!==null);return}if(!(u.ctrlKey||u.metaKey))return;const f=u.key.toLowerCase();if(f==="z"&&!u.shiftKey){u.preventDefault(),An();return}if(f==="z"&&u.shiftKey||f==="y"){u.preventDefault(),Pn();return}if(f==="b"&&!u.shiftKey){u.preventDefault(),oe.toggleFontMark("bold");return}if(f==="i"&&!u.shiftKey){u.preventDefault(),oe.toggleFontMark("italic");return}if(f==="u"&&!u.shiftKey){u.preventDefault(),oe.toggleFontMark("underline");return}if(f==="x"&&u.shiftKey){u.preventDefault(),oe.toggleFontMark("strikethrough");return}f==="p"&&!u.shiftKey&&(u.preventDefault(),jn.print())},[b,An,Pn,oe,jn,$,q,B,I]),Ns=[Fe.root,ce?Fe.fullscreen:"",h].filter(Boolean).join(" "),Ls=rx({toolbarBackground:x,menuColor:S,menuBackground:y,menuFontSize:C,menuFontFamily:g,border:k});return o.jsx(yc,{locale:w,children:o.jsxs("div",{className:Ns,style:Ls,"data-fullscreen":ce?"":void 0,onKeyDown:js,children:[P||L?o.jsx("div",{className:Fe.chrome,onPointerDownCapture:ws,children:o.jsx(Uy,{catalog:Cs,layout:vs,commands:jn,queries:Ds,disabled:b,menuVisible:P,toolbarVisible:L})}):null,o.jsx("div",{className:Fe.workspace,children:J==="visual"?o.jsx(tx,{ref:R,html:rn(W).body,onChange:u=>q(u,!0),onBeforeInput:As,onPointerDown:Es,onContextMenu:Ps,placeholder:p,disabled:b}):o.jsx(ex,{ref:Z,html:W,onChange:u=>De(u,!0),placeholder:p,disabled:b})}),ce?o.jsx(ox,{onClick:()=>te(!1)}):null,o.jsx($g,{open:Ut.open,tab:Ut.tab,size:Ft.value,unit:Ft.unit,marks:un,fontFamily:It.value,fontFamilyMixed:It.mixed,fontColor:Ht.value,fontColorMixed:Ht.mixed,highlightColor:zt.value,highlightColorMixed:zt.mixed,fonts:Ye,disabled:b,onTabChange:u=>mn({open:!0,tab:u}),onApply:u=>oe.applyFontProperties(u),onClose:()=>mn({open:!1,tab:Ut.tab})}),o.jsx(tb,{open:it.open,tab:it.tab,value:it.value,disabled:b,onTabChange:u=>fn({...it,open:!0,tab:u}),onApply:u=>oe.applyParagraphProperties(u),onClose:()=>fn({...it,open:!1})}),o.jsx(ab,{open:at.open,tab:at.tab,value:at.value,fonts:Ye,disabled:b,onTabChange:u=>pn({...at,open:!0,tab:u}),onApply:u=>oe.applyPageProperties(u),onClose:()=>pn({...at,open:!1})}),o.jsx(cb,{open:pe.open,mode:pe.open?pe.mode:"create",styleId:pe.open&&pe.mode==="edit"?pe.style.id:void 0,name:pe.open&&pe.mode==="edit"?pe.style.name:"",font:pe.open?pe.mode==="edit"?pe.style.font:pe.font:{size:null,unit:ut,marks:$e(),fontFamily:null,fontColor:null,highlightColor:null},paragraph:pe.open?pe.mode==="edit"?pe.style.paragraph:pe.paragraph:void 0,canDelete:!!E,fonts:Ye,busy:ys,disabled:b,onSave:async u=>{const f=Si.current;if(f){hn(!0);try{await f(u),Wt({open:!1}),await Dn()}finally{hn(!1)}}},onDelete:async u=>{const f=ki.current;if(f){hn(!0);try{await f(u),Wt({open:!1}),await Dn()}finally{hn(!1)}}},onClose:()=>Wt({open:!1})}),o.jsx(Hb,{open:ke.open,tab:ke.tab,href:ke.href,title:ke.title,targetBlank:ke.targetBlank,textDecorationNone:ke.textDecorationNone,hoverMode:ke.hoverMode,hoverColor:ke.hoverColor,hoverHtml:ke.hoverHtml,bookmarks:ke.bookmarks,selectedBookmarkId:ke.selectedBookmarkId,disabled:b,onTabChange:u=>gn({...ke,open:!0,tab:u}),onApply:u=>oe.applyLink(u),onClose:()=>gn({...ke,open:!1})}),o.jsx(db,{open:Dr.open,existingIds:Dr.existingIds,disabled:b,onApply:u=>oe.applyBookmark(u),onClose:()=>Ar({...Dr,open:!1})}),o.jsx(pb,{open:xs.open,disabled:b,customImagePicker:_,onApply:u=>oe.applyImage(u),onCustomPick:()=>{bn({open:!1}),_==null||_.onPick(qr)},onClose:()=>bn({open:!1})}),o.jsx(Lb,{open:yn.open,tab:yn.tab,value:yn.value,aspectRatio:yn.aspectRatio,disabled:b,onTabChange:u=>xn(f=>({...f,tab:u})),onApply:u=>oe.applyImageProperties(u),onClose:()=>xn(u=>({...u,open:!1}))}),o.jsx(Wb,{open:Pr.open,disabled:b,onApply:u=>oe.applyTable(u),onClose:()=>Er({open:!1})}),o.jsx(Yb,{open:wn.open,value:wn.value,disabled:b,onApply:u=>oe.applyTableProperties(u),onClose:()=>jr(u=>({...u,open:!1}))}),o.jsx(ey,{open:Sn.open,value:Sn.value,disabled:b,onApply:u=>oe.applyCellProperties(u),onClose:()=>Nr(u=>({...u,open:!1}))}),o.jsx(oy,{open:kn.open,value:kn.value,disabled:b,onApply:u=>oe.applyRowProperties(u),onClose:()=>Lr(u=>({...u,open:!1}))}),J==="visual"&&!b&&(he!=null&&he.isConnected)?o.jsx(Bb,{img:he,onResize:Ss,onResizeEnd:ks}):null,o.jsx(Cc,{open:qt.open,x:qt.x,y:qt.y,kind:qt.kind,inTable:qt.inTable,commands:jn,onClose:()=>Tr(u=>({...u,open:!1}))})]})})}function rx({toolbarBackground:e,menuColor:t,menuBackground:n,menuFontSize:r,menuFontFamily:i,border:a}){const l={};return e&&(l["--wysiwyg-toolbar-background"]=e),t&&(l["--wysiwyg-menu-color"]=t),n&&(l["--wysiwyg-menu-background"]=n),r&&(l["--wysiwyg-menu-font-size"]=r),i&&(l["--wysiwyg-menu-font-family"]=i),a==="none"?(l["--wysiwyg-border-width"]="0",l["--wysiwyg-border-radius"]="0",l["--wysiwyg-border-shadow"]="none"):a&&(a.width&&(l["--wysiwyg-border-width"]=a.width),a.color&&(l["--wysiwyg-border-color"]=a.color),a.radius&&(l["--wysiwyg-border-radius"]=a.radius),a.shadow&&(l["--wysiwyg-border-shadow"]=a.shadow)),Object.keys(l).length?l:void 0}function ox({onClick:e}){const t=V();return o.jsx("button",{type:"button",className:Fe.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:o.jsx(He,{className:Fe.exitFullscreenIcon})})}exports.Editor=nx;
90
+ `.trim();function Zo(e,t,n="​"){const{hrefs:r,body:i}=vn(t),a=e.createElement("meta");a.setAttribute("charset","utf-8");const l=e.createElement("title");l.textContent=n;const c=e.createElement("style");c.textContent=jd;const m=r.map(p=>{const b=e.createElement("link");return b.rel="stylesheet",b.href=p,b});e.head.replaceChildren(a,l,c,...m),e.title=n,e.body.innerHTML=i}const Ed=1e3;function Td(e){const t=document.createElement("iframe");t.setAttribute("aria-hidden","true"),t.setAttribute("data-wysiwyg-print",""),t.style.position="fixed",t.style.right="0",t.style.bottom="0",t.style.width="0",t.style.height="0",t.style.border="0",document.body.append(t);const n=t.contentDocument,r=t.contentWindow;if(!n||!r){t.remove();return}Zo(n,e);let i=!1;const a=()=>{i||(i=!0,t.remove())};r.addEventListener("afterprint",a),r.focus(),r.print(),window.setTimeout(a,Ed)}function Nd(e){return{save:async()=>{await ld(e.getHtml())},open:async()=>{const t=await sd();t!==null&&e.setHtml(t)},print:()=>{Td(e.getHtml())}}}function Ld(e){return{toggleBold:()=>{e.toggleFontMark("bold")},toggleItalic:()=>{e.toggleFontMark("italic")},toggleUnderline:()=>{e.toggleFontMark("underline")},toggleStrikethrough:()=>{e.toggleFontMark("strikethrough")},clearFormatting:()=>{e.clearFormatting()},setFontSize:(t,n)=>{e.setFontSize(t,n)},setFontSizeUnit:t=>{e.setFontSizeUnit(t)},setFontFamily:t=>{e.setFontFamily(t)},setFontColor:t=>{e.setFontColor(t)},setHighlightColor:t=>{e.setHighlightColor(t)},setParagraphStyle:t=>{e.setParagraphStyle(t)},alignLeft:()=>{e.setTextAlign("left")},alignCenter:()=>{e.setTextAlign("center")},alignRight:()=>{e.setTextAlign("right")},alignJustify:()=>{e.setTextAlign("justify")},indent:()=>{e.indent()},outdent:()=>{e.outdent()},toggleBulletList:()=>{e.toggleList("ul")},toggleNumberedList:()=>{e.toggleList("ol")},openFontProperties:t=>{e.openFontProperties(t??"general")},applyFontProperties:t=>{e.applyFontProperties(t)},openParagraphProperties:t=>{e.openParagraphProperties(t??"general")},applyParagraphProperties:t=>{e.applyParagraphProperties(t)},openPageProperties:t=>{e.openPageProperties(t??"font")},applyPageProperties:t=>{e.applyPageProperties(t)},openCustomParagraphStyleDialog:t=>{e.openCustomParagraphStyleDialog(t)},applyCustomParagraphStyle:t=>{e.applyCustomParagraphStyle(t)}}}function Md(e){return{isBold:()=>e.isFontMarkActive("bold"),isItalic:()=>e.isFontMarkActive("italic"),isUnderline:()=>e.isFontMarkActive("underline"),isStrikethrough:()=>e.isFontMarkActive("strikethrough"),getFontSize:()=>e.getFontSize(),getFontSizeUnit:()=>e.getFontSizeUnit(),isFontSizeMixed:()=>e.isFontSizeMixed(),getFontFamily:()=>e.getFontFamily(),isFontFamilyMixed:()=>e.isFontFamilyMixed(),getFontFaces:()=>e.getFontFaces(),getFontColor:()=>e.getFontColor(),isFontColorMixed:()=>e.isFontColorMixed(),getHighlightColor:()=>e.getHighlightColor(),isHighlightColorMixed:()=>e.isHighlightColorMixed(),getParagraphStyle:()=>e.getParagraphStyle(),isParagraphStyleMixed:()=>e.isParagraphStyleMixed(),isAlignLeft:()=>e.getTextAlign()==="left"&&!e.isTextAlignMixed(),isAlignCenter:()=>e.getTextAlign()==="center"&&!e.isTextAlignMixed(),isAlignRight:()=>e.getTextAlign()==="right"&&!e.isTextAlignMixed(),isAlignJustify:()=>e.getTextAlign()==="justify"&&!e.isTextAlignMixed(),canOutdent:()=>e.canOutdent(),isBulletList:()=>e.isBulletList(),isNumberedList:()=>e.isNumberedList(),hasTextSelection:()=>e.hasTextSelection(),customParagraphStylesEnabled:()=>e.customParagraphStylesEnabled(),getCustomParagraphStyles:()=>e.getCustomParagraphStyles(),isCustomParagraphStylesLoading:()=>e.isCustomParagraphStylesLoading()}}function Rd(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function _d(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function Id(e){return{openLinkDialog:t=>{e.openLinkDialog(t)},applyLink:t=>{e.applyLink(t)},openBookmarkDialog:()=>{e.openBookmarkDialog()},applyBookmark:t=>{e.applyBookmark(t)},openImageDialog:()=>{e.openImageDialog()},applyImage:t=>{e.applyImage(t)},openImageProperties:t=>{e.openImageProperties(t)},applyImageProperties:t=>{e.applyImageProperties(t)},insertHorizontalRule:()=>{e.insertHorizontalRule()}}}function Fd(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected()}}function Bd(e){return{openTableDialog:()=>{e.openTableDialog()},applyTable:t=>{e.applyTable(t)},openTableProperties:()=>{e.openTableProperties()},applyTableProperties:t=>{e.applyTableProperties(t)},openCellProperties:()=>{e.openCellProperties()},applyCellProperties:t=>{e.applyCellProperties(t)},openRowProperties:()=>{e.openRowProperties()},applyRowProperties:t=>{e.applyRowProperties(t)},insertRowBelow:()=>{e.insertRowBelow()},insertRowBefore:()=>{e.insertRowBefore()},deleteRow:()=>{e.deleteRow()},insertColumnAfter:()=>{e.insertColumnAfter()},insertColumnBefore:()=>{e.insertColumnBefore()},deleteColumn:()=>{e.deleteColumn()}}}function Hd(e){return{isInTable:()=>e.isInTable()}}function zd(e){return{setVisualMode:()=>{e.setMode("visual")},setHtmlMode:()=>{e.setMode("html")},toggleFullscreen:()=>{e.setFullscreen(!e.getFullscreen())},openCustomizeToolbar:()=>{e.openCustomizeToolbar()},openDocumentPreview:()=>{e.openDocumentPreview()},setLightMode:()=>{e.setDarkMode(!1)},setDarkMode:()=>{e.setDarkMode(!0)},setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function Od(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isToolbarPositionTop:()=>e.getToolbarPosition()==="top",isToolbarPositionLeft:()=>e.getToolbarPosition()==="left",isToolbarPositionRight:()=>e.getToolbarPosition()==="right",isToolbarPositionBottom:()=>e.getToolbarPosition()==="bottom"}}function Kd(e){return{...Nd(e),...Rd(e),...zu(e),...Id(e),...Bd(e),...zd(e),...Ld(e)}}function $d(e){return{...Od(e),..._d(e),...Fd(e),...Hd(e),...Md(e)}}const Ci=["pt","px","em","rem","%"],Ct="pt",Ud={pt:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],px:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],em:[.5,.75,1,1.25,1.5,2,2.5,3],rem:[.5,.75,1,1.25,1.5,2,2.5,3],"%":[50,75,100,125,150,200,250,300]},Wd={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},Gd=new Set(Ci),Vd=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function Tr(e){return Gd.has(e)}function ve(e){return Math.round(e*100)/100}function J(e){const t=ve(e);return Number.isInteger(t),String(t)}function ki(e,t){return`${J(e)}${t}`}function Di(e){const t=e.trim();if(!t)return null;const n=t.match(Vd);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return{value:r,unit:i}}function qd(e,t){const n=e.trim();if(!n)return null;const r=Di(n);if(r)return Tr(r.unit)?kt(r.value,r.unit):null;const i=Number(n.replace(",","."));return Number.isFinite(i)?kt(i,t):null}function kt(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=Wd[t];return{value:ve(Math.min(r,Math.max(n,e))),unit:t}}function ds(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return ve(e);case"pt":return ve(e*.75);case"em":return ve(e/i);case"rem":return ve(e/a);case"%":return ve(e/i*100)}}function Xd(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return e;case"pt":return e*(4/3);case"em":return e*i;case"rem":return e*a;case"%":return e/100*i}}function ms(e,t,n,r,i){if(t===n)return ve(e);const a=Xd(e,t,r,i);return ds(a,n,r,i)}function gr(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Yd(e){const t=e.style.fontSize;if(!t)return null;const n=Di(t);return!n||!Tr(n.unit)?null:{value:n.value,unit:n.unit}}function fs(e,t){let n=gr(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Yd(n);if(r)return r;n=n.parentElement}return null}function Jd(e,t){const n=gr(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function ps(e,t){var a;let n=gr(t);for(;n&&n!==e;){if(n.style.fontSize){const c=n.parentElement??e,m=parseFloat(getComputedStyle(c).fontSize);return Number.isFinite(m)&&m>0?m:16}n=n.parentElement}const r=((a=gr(t))==null?void 0:a.parentElement)??e,i=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(i)&&i>0?i:16}function hs(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function Zd(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function Ga(e=Ct){return{value:null,unit:e,mixed:!1}}function Qd(e,t=Ct){const n=window.getSelection();if(!n||n.rangeCount===0)return Ga(t);const r=n.getRangeAt(0);if(!se(e,r.commonAncestorContainer))return Ga(t);const i=r.collapsed?[]:Be(r).filter(p=>p.data.length>0),a=i.length>0?i:[r.startContainer],l=a.map(p=>fs(e,p)),c=l[0];if(l.every(p=>Zd(p,c))&&c)return{value:c.value,unit:c.unit,mixed:!1};if(l.every(p=>p===null)){const p=a.map(h=>Jd(h,e)),b=p[0];if(p.every(h=>Math.abs(h-b)<.05)){const h=ps(e,a[0]),w=hs(e);return{value:ds(b,t,h,w),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function em(e,t){return{parentPx:ps(e,t),rootPx:hs(e)}}function tm(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n:null}function Va(e,t,n){const r=kt(t,n);if(!r)return!1;const i=tm(e);if(!i||i.collapsed)return!1;const a=ki(r.value,r.unit);ut(i);const l=Be(i).filter(c=>c.data.length>0);for(const c of l){const m=fs(e,c);m&&m.value===r.value&&m.unit===r.unit||Ar(c,p=>{p.style.fontSize=a})}return Ut(l),!0}function nm(e,t){e.style.fontSize=ki(t.value,t.unit)}function rm(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Ro(e){const t=e.trim().match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d*\.?\d+))?\s*\)$/i);if(!t)return null;const n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),a=t[4]===void 0?1:Number(t[4]);return[n,r,i,a].every(l=>Number.isFinite(l))?{r:n,g:r,b:i,a}:null}function _o(e,t,n){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Io(e){const t=e.trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(t)?t:/^#[0-9a-f]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:null}const om={black:"#000000",silver:"#c0c0c0",gray:"#808080",grey:"#808080",white:"#ffffff",maroon:"#800000",red:"#ff0000",purple:"#800080",fuchsia:"#ff00ff",magenta:"#ff00ff",green:"#008000",lime:"#00ff00",olive:"#808000",yellow:"#ffff00",navy:"#000080",blue:"#0000ff",teal:"#008080",aqua:"#00ffff",cyan:"#00ffff",orange:"#ffa500"};function im(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function me(e){const t=e.trim();if(!t||im(t))return null;const n=Io(t);if(n)return n;const r=Ro(t);if(r)return r.a===0?null:_o(r.r,r.g,r.b);const i=om[t.toLowerCase()];if(i)return i;const a=document.createElement("canvas").getContext("2d");if(!a)return null;a.fillStyle="#010203";try{a.fillStyle=t}catch{return null}const l=String(a.fillStyle);if(l==="#010203"){const m=Io(t);if(m==="#010203")return m;const p=Ro(t);return p&&_o(p.r,p.g,p.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(l.startsWith("#"))return Io(l);const c=Ro(l);return!c||c.a===0?null:_o(c.r,c.g,c.b)}function gs(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?me(n):null}function br(e,t,n){let r=rm(t);for(;r&&r!==e&&r instanceof HTMLElement;){const i=gs(r,n);if(i)return i;r=r.parentElement}return null}function yr(e,t){return e instanceof HTMLElement?gs(e,t)!==null:!1}function Pi(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function bs(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function am(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!qe(i)||!yr(i,n)){r=i;continue}if(pt(i,r),yr(i,n)&&(Pi(i,n),Dt(i))){_e(i);continue}r=i}}function ys(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n:null}function qa(e,t){const n=ys(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:Be(n).filter(m=>m.data.length>0),a=(r.length>0?r:[n.startContainer]).map(m=>br(e,m,t)),l=a[0]??null;return a.every(m=>m===l)?{value:l,mixed:!1}:{value:null,mixed:!0}}function Fo(e,t,n){const r=ys(e);if(!r||r.collapsed)return!1;const i=n===null?null:me(n);if(n!==null&&i===null)return!1;ut(r);const a=Be(r).filter(l=>l.data.length>0);for(const l of a){const c=br(e,l,t);if(i===null){if(c===null)continue;am(e,l,t);continue}c!==i&&Ar(l,m=>{bs(m,t,i)})}return Ut(a),!0}function Xa(e,t,n){if(n.value===null){Pi(e,t);return}const r=me(n.value);r&&bs(e,t,r)}function lm(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function sm(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function cm(e){var r,i,a;let t=e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0?e.startContainer:e.startContainer.childNodes[e.startOffset]??e.startContainer.lastChild??e.startContainer;if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset>0){const l=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(l,e.startContainer.nextSibling),l}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const l=document.createTextNode("");return(i=e.startContainer.parentNode)==null||i.insertBefore(l,e.startContainer),l}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function xs(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!qe(i)||!n.some(a=>yr(i,a))){r=i;continue}pt(i,r);for(const a of n)yr(i,a)&&Pi(i,a);if(Dt(i)){_e(i);continue}r=i.isConnected?i:t}return t}function um(e,t,n){sm(t);const r=cm(t);return xs(e,r,n)}function dm(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&br(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&br(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const Ue=["bold","italic","underline","strikethrough"],Mt={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},mm=new Set(["underline","line-through","overline"]);function Qe(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function fm(e,t){return Ue.every(n=>e[n]===t[n])}function pm(e){return Ue.some(t=>e[t]!==void 0)}function ws(e,t){const n={...e};if(!t)return n;for(const r of Ue){const i=t[r];i!==void 0&&(n[r]=i)}return n}function hm(e,t,n){const r=e[n]??t[n],i={...e,[n]:!r};return i[n]===t[n]&&delete i[n],i}function dt(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>mm.has(n))}function Ft(e,t){if(t.length===0){e.style.textDecorationLine="",e.style.removeProperty("text-decoration-line"),e.style.textDecoration&&(e.style.textDecoration="",e.style.removeProperty("text-decoration"));return}e.style.textDecorationLine=t.join(" ")}function vs(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(Mt.bold.has(r))return!0;const l=n.style.fontWeight;if(!l)return null;if(l==="bold"||l==="bolder")return!0;const c=Number(l);return Number.isNaN(c)?l==="normal"||l==="lighter"?!1:null:c>=700}if(t==="italic"){if(Mt.italic.has(r))return!0;const l=n.style.fontStyle;return l?l==="italic"||l==="oblique"?!0:l==="normal"?!1:null:null}if(t==="underline"){if(Mt.underline.has(r))return!0;const l=n.style.textDecorationLine||n.style.textDecoration;if(!l)return null;if(l==="none")return!1;const c=dt(n);return c.includes("underline")?!0:c.length>0?!1:null}if(Mt.strikethrough.has(r))return!0;const i=n.style.textDecorationLine||n.style.textDecoration;if(!i)return null;if(i==="none")return!1;const a=dt(n);return a.includes("line-through")?!0:a.length>0?!1:null}function xr(e,t){return vs(e,t)===!0}function Bt(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const i=vs(r,n);if(i!==null)return i;r=r.parentElement}return!1}function Ss(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=dt(e);r.includes("underline")||r.push("underline"),Ft(e,r);return}const n=dt(e);n.includes("line-through")||n.push("line-through"),Ft(e,n)}function Cs(e,t){if(t==="bold"){e.style.fontWeight="",e.style.removeProperty("font-weight");return}if(t==="italic"){e.style.fontStyle="",e.style.removeProperty("font-style");return}if(t==="underline"){Ft(e,dt(e).filter(n=>n!=="underline"));return}Ft(e,dt(e).filter(n=>n!=="line-through"))}function gm(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=dt(e).filter(i=>i!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}Ft(e,r);return}const n=dt(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}Ft(e,n)}function bm(e,t){Ar(e,n=>Ss(n,t))}function ym(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!qe(i)||!xr(i,n)){r=i;continue}if(pt(i,r),xr(i,n)){if(Mt[n].has(i.tagName.toLowerCase())){_e(i);continue}if(Cs(i,n),Dt(i)){_e(i);continue}}r=i}}function xm(e,t,n){const r=Be(t).filter(i=>i.data.length>0);return r.length===0?Bt(e,t.startContainer,n):r.every(i=>Bt(e,i,n))}function wm(e,t,n,r){ut(t);const i=Be(t).filter(a=>a.data.length>0);for(const a of i)r?Bt(e,a,n)||bm(a,n):ym(e,a,n);Ut(i)}function or(e){const t=window.getSelection();if(!t||t.rangeCount===0)return Qe();const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return Qe();if(n.collapsed)return Qo(e,n);const r=Be(n).filter(a=>a.data.length>0);if(r.length===0)return Qo(e,n);const i=Qe();for(const a of Ue)i[a]=Bt(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const l of Ue)i[l]=i[l]&&Bt(e,r[a],l);return i}function Qo(e,t){const n=Qe();for(const r of Ue)n[r]=Bt(e,t.startContainer,r);return n}function Ya(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!se(e,r.commonAncestorContainer)||r.collapsed)return!1;const i=xm(e,r,t);return wm(e,r,t,!i),!0}function vm(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function Sm(e,t,n){var a,l,c;vm(t);let r=t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0?t.startContainer:t.startContainer.childNodes[t.startOffset]??t.startContainer.lastChild??t.startContainer;if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset>0){const m=document.createTextNode("");(a=t.startContainer.parentNode)==null||a.insertBefore(m,t.startContainer.nextSibling),r=m}else if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0){const m=document.createTextNode("");(l=t.startContainer.parentNode)==null||l.insertBefore(m,t.startContainer),r=m}else{const m=document.createTextNode("");r&&r!==t.startContainer?(c=r.parentNode)==null||c.insertBefore(m,r):t.startContainer.appendChild(m),r=m}let i=r;for(;i.parentElement&&i.parentElement!==e;){const m=i.parentElement;if(!qe(m)){i=m;continue}if(!n.some(b=>xr(m,b))){i=m;continue}pt(m,i);for(const b of n)if(xr(m,b)){if(Mt[b].has(m.tagName.toLowerCase())){_e(m);break}if(Cs(m,b),Dt(m)){_e(m);break}}i=m.isConnected?m:r}return r}function Cm(e,t,n){for(const r of Ue)n[r]!==t[r]&&(n[r]?Ss(e,r):gm(e,r))}function km(e,t,n,r,i,a){var g,S;const l=window.getSelection();if(!l||l.rangeCount===0)return;const c=l.getRangeAt(0);if(!se(e,c.commonAncestorContainer))return;const m=Qo(e,c),p=ws(m,n),b=Ue.filter(A=>m[A]&&!p[A]),h=dm(e,c.startContainer,i),w=Ad(e,c.startContainer,a);let y=null;b.length>0?(y=Sm(e,c,b),h.length>0&&xs(e,y,h),w&&Jo(e,y)):h.length>0?(y=um(e,c,h),w&&Jo(e,y)):w?y=Pd(e,c):c.deleteContents();const v=document.createElement("span");Cm(v,m,p),r&&nm(v,r),i!=null&&i.color&&Xa(v,"color",i.color),i!=null&&i.backgroundColor&&Xa(v,"backgroundColor",i.backgroundColor),a&&Sd(v,a),v.textContent=t;const x=v.style.cssText.trim()?v:document.createTextNode(t);y?((g=y.parentNode)==null||g.insertBefore(x,y),y.nodeType===Node.TEXT_NODE&&!y.data&&((S=y.parentNode)==null||S.removeChild(y))):c.insertNode(x);const k=document.createRange();k.selectNodeContents(x),k.collapse(!1),l.removeAllRanges(),l.addRange(k)}const wr="data-page";function ks(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(wr)}function Ds(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function Dm(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function Dn(e){return Ds(e).find(n=>n.hasAttribute(wr))??null}function Pm(e){if(Dm(e))return null;const t=Ds(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"?null:n}function Am(e){const t=Dn(e);if(t)return t;const n=Pm(e);if(n)return n.setAttribute(wr,""),n;const r=document.createElement("div");for(r.setAttribute(wr,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),r}function Ai(e){return Dn(e)??e}function Ps(e){const t=Dn(e),n=(t==null?void 0:t.style.backgroundColor.trim())??"";n?e.style.backgroundColor=n:e.style.removeProperty("background-color")}function Ja(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function jm(e,t){return t?e===t||e.contains(t):!1}function Za(e,t){var a;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=0,i;for(;i=n.nextNode();){if(i===t||t.contains(i)||t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)return r;r+=((a=i.textContent)==null?void 0:a.length)??0}return r}function Qa(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return Za(e,t)+n;let r=0;const i=t.childNodes;for(let l=0;l<n&&l<i.length;l+=1)r+=((a=i[l].textContent)==null?void 0:a.length)??0;return Za(e,t)+r}function el(e,t){var l,c;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=Math.max(0,t),i,a=null;for(;i=n.nextNode();){a=i;const m=((l=i.textContent)==null?void 0:l.length)??0;if(r<=m)return{node:i,offset:r};r-=m}return a?{node:a,offset:((c=a.textContent)==null?void 0:c.length)??0}:{node:e,offset:e.childNodes.length}}function ji(e,t,n){const r=document.createRange(),i=el(e,t),a=el(e,n);return r.setStart(i.node,i.offset),r.setEnd(a.node,a.offset),r}function As(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function tl(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function Em(e,t){return t.mode!=="visual"?null:t.visualRange&&As(t.visualRange,e)?t.visualRange:ji(e,t.start,t.end)}function lt(e){var n;if(e.mode==="html"&&e.htmlEl){const r=e.htmlEl.selectionStart,i=e.htmlEl.selectionEnd;return{mode:"html",text:e.htmlEl.value.slice(r,i),collapsed:r===i,start:r,end:i,visualRange:null}}const t=e.visualEl;if(e.mode==="visual"&&t){const r=window.getSelection();if(r&&r.rangeCount>0){const a=r.getRangeAt(0);if(jm(t,a.commonAncestorContainer)){const l=Qa(t,a.startContainer,a.startOffset),c=Qa(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(l,c),end:Math.max(l,c),visualRange:a.cloneRange()}}}const i=((n=t.textContent)==null?void 0:n.length)??0;return{mode:"visual",text:"",collapsed:!0,start:i,end:i,visualRange:null}}return{mode:e.mode,text:"",collapsed:!0,start:0,end:0,visualRange:null}}function nl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Tm(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),l=e.snapshot.start,c=e.snapshot.end,m=e.asHtml?e.content:nl(e.content);e.setHtml(a.slice(0,l)+m+a.slice(c));const p=e.htmlEl;if(p){const b=l+m.length;p.focus(),p.setSelectionRange(b,b)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:nl(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&As(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??ji(t,e.snapshot.start,e.snapshot.end);if(r.deleteContents(),e.content)if(e.asHtml){const a=r.createContextualFragment(e.content),l=a.lastChild;r.insertNode(a),l&&(r.setStartAfter(l),r.collapse(!0))}else{const a=document.createTextNode(e.content);r.insertNode(a),r.setStartAfter(a),r.collapse(!0)}const i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r),e.setHtml(t.innerHTML)}const Ei=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),js=new Set(["table","thead","tbody","tr","td","th"]),Ti=new Set([...js,"ul","ol","li","pre","hr"]);function oe(e){return e.tagName.toLowerCase()}function Pn(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Ni(e){return e instanceof HTMLElement&&(oe(e)==="ul"||oe(e)==="ol")}function Ie(e){return e instanceof HTMLElement&&oe(e)==="li"}function ht(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n:null}function Li(e){const t=e.collapsed?[]:Be(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function Ht(e,t,n){var m,p,b;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let w=0,y;for(;y=h.nextNode();){if(y===t)return w+n;w+=((m=y.textContent)==null?void 0:m.length)??0}return w}let r=0;const i=t.childNodes;for(let h=0;h<n&&h<i.length;h+=1)r+=((p=i[h].textContent)==null?void 0:p.length)??0;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let l=0,c;for(;c=a.nextNode();){if(t.contains(c)||t.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING)return l+r;l+=((b=c.textContent)==null?void 0:b.length)??0}return l+r}function Mi(e,t,n){const r=ji(e,t,n),i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function Wt(e,t){const n=ht(e);if(!n)return!1;const r=Ht(e,n.startContainer,n.startOffset),i=Ht(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),c=t();return Mi(e,a,l),c}function Ri(e,t){if(oe(e)===t)return e;const n=document.createElement(t);for(const r of[...e.attributes])n.setAttribute(r.name,r.value);for(;e.firstChild;)n.appendChild(e.firstChild);return e.replaceWith(n),n}function gt(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function Nm(e,t){let n=Pn(t);for(;n&&n!==e;){if(ks(n,e)){n=n.parentElement;continue}const r=oe(n);if(Ei.has(r)&&n instanceof HTMLElement)return n;if(js.has(r)||r==="pre")return null;n=n.parentElement}return null}function Gt(e){const t=ht(e);if(!t)return[];const n=new Set,r=[];for(const i of Li(t)){const a=Nm(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function ei(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=oe(e);return Ei.has(t)||Ti.has(t)?!1:qe(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Lm(e,t){let n=Pn(t);for(;n&&n!==e;){if(Ti.has(oe(n)))return!0;n=n.parentElement}return!1}function Mm(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function Rm(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&ei(n[i-1]);)i-=1;for(;a<n.length-1&&ei(n[a+1]);)a+=1;return n.slice(i,a+1)}function _m(e,t,n){return n.startContainer===e?e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild:n.startContainer===t&&e!==t?e.firstChild:Mm(e,n.startContainer)}function Im(e,t){const n=Ai(e);if(Lm(e,t.startContainer))return null;if(!n.firstChild){const l=document.createElement("p");return l.appendChild(document.createElement("br")),n.appendChild(l),l}const r=_m(n,e,t);if(!r||r instanceof Element&&Ti.has(oe(r))||r instanceof HTMLElement&&Ei.has(oe(r))||!ei(r))return null;const i=Rm(n,r),a=document.createElement("p");n.insertBefore(a,i[0]);for(const l of i)a.appendChild(l);return a}function An(e){const t=Gt(e);if(t.length>0)return t;const n=ht(e);if(!n)return[];const r=Im(e,n);return r?[r]:[]}function zt(e){const t=e.parentElement;return t&&Ni(t)?t:null}function Es(e){if(e.length===0)return[];const t=[[e[0]]];for(let n=1;n<e.length;n+=1){const r=e[n-1],i=e[n];r.parentNode===i.parentNode&&Fm(r,i)?t[t.length-1].push(i):t.push([i])}return t}function Fm(e,t){var r;let n=e.nextSibling;for(;n;){if(n===t)return!0;if(n.nodeType===Node.TEXT_NODE&&!((r=n.textContent)!=null&&r.trim())){n=n.nextSibling;continue}return!1}return!1}const vr=["p","h1","h2","h3","h4","h5","h6"],Bm=new Set(vr),Ts=new Set([...vr,"div"]),Nr=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),Hm=()=>({tag:null,mixed:!1});function Ns(e){return Bm.has(e)}function zm(e){return Ns(e)?e:e==="div"?"p":null}function Om(e){return e instanceof Element&&Nr.has(oe(e))}function Ls(e){return e instanceof HTMLElement&&Ts.has(oe(e))}function ti(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=oe(e);return Ts.has(t)||Nr.has(t)?!1:qe(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Km(e,t){let n=Pn(t);for(;n&&n!==e;){if(Nr.has(oe(n)))return!0;n=n.parentElement}return!1}function Ms(e,t){let n=Pn(t);for(;n&&n!==e;){if(ks(n,e)){n=n.parentElement;continue}if(Ls(n))return n;if(Nr.has(oe(n)))return null;n=n.parentElement}return null}function $m(e,t){const n=new Set,r=[];for(const i of Li(t)){const a=Ms(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Um(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function Wm(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&ti(n[i-1]);)i-=1;for(;a<n.length-1&&ti(n[a+1]);)a+=1;return n.slice(i,a+1)}function Gm(e,t,n){return n.startContainer===e?e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild:n.startContainer===t&&e!==t?e.firstChild:Um(e,n.startContainer)}function Vm(e,t,n){const r=Ai(e);if(Km(e,t.startContainer))return!1;if(!r.firstChild){const c=document.createElement(n);return c.appendChild(document.createElement("br")),r.appendChild(c),!0}const i=Gm(r,e,t);if(!i||Om(i)||Ls(i)||!ti(i))return!1;const a=Wm(r,i),l=document.createElement(n);r.insertBefore(l,a[0]);for(const c of a)l.appendChild(c);return!0}function qm(e){const t=ht(e);if(!t)return Hm();const n=Li(t).map(i=>{const a=Ms(e,i);return a?zm(oe(a)):null}),r=n[0];return n.every(i=>i===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function Xm(e,t){if(!Ns(t))return!1;const n=ht(e);if(!n)return!1;const r=Ht(e,n.startContainer,n.startOffset),i=Ht(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),c=$m(e,n);let m=!1;if(c.length===0)m=Vm(e,n,t);else for(const p of c)oe(p)!==t&&(Ri(p,t),m=!0);return Mi(e,a,l),m}function _i(e){if(!Ie(e))return null;const t=zt(e);if(!t)return null;const n=oe(t);return n==="ul"||n==="ol"?n:null}function Rs(e){const t=Gt(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(_i),r=n[0];return n.every(i=>i===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function Ym(e,t,n){const r=[...e.children].filter(i=>Ni(i));for(const i of r)t.insertBefore(i,n)}function _s(e){const t=zt(e),n=document.createElement("p");for(const p of[...e.attributes])n.setAttribute(p.name,p.value);for(n.style.marginLeft="",gt(n);e.firstChild&&!Ni(e.firstChild);)n.appendChild(e.firstChild);const r=[];let i=e.nextElementSibling;for(;i;)r.push(i),i=i.nextElementSibling;const a=(t==null?void 0:t.parentNode)??e.parentNode;if(!t||!a)return e.replaceWith(n),n;const l=Ie(a)?a.parentNode??a:a,c=Ie(a)?a.nextSibling:t.nextSibling;e.remove();let m=null;if(r.length>0){m=document.createElement(t.tagName);for(const p of r)m.appendChild(p)}return l.insertBefore(n,c),m&&l.insertBefore(m,n.nextSibling),Ym(e,l,n.nextSibling),t.childElementCount===0&&t.remove(),n}function Jm(e){if(Ie(e))return e;const t=Ri(e,"li");return t.style.marginLeft="",gt(t),t}function Is(e,t){if(e.length===0)return!1;if(e.every(Ie)){const a=zt(e[0]);if(a&&e.every(l=>l.parentElement===a)&&[...a.children].every(c=>c instanceof HTMLElement&&e.includes(c)))return oe(a)===t?!1:(Ri(a,t),!0)}const n=e[0],r=n.parentNode;if(!r)return!1;const i=document.createElement(t);r.insertBefore(i,n);for(const a of e){const l=Ie(a)?zt(a):null;i.appendChild(Jm(a)),l&&l!==i&&l.childElementCount===0&&l.remove()}return!0}function Fs(e){let t=!1;for(const n of[...e].reverse())Ie(n)&&(_s(n),t=!0);return t}function Zm(e,t){return Wt(e,()=>{const n=An(e);if(n.length===0)return!1;if(n.every(a=>_i(a)===t))return Fs(n);let i=!1;for(const a of Es(n))Is(a,t)&&(i=!0);return i})}function Qm(e,t){return Wt(e,()=>{const n=An(e);if(n.length===0)return!1;if(t===null)return Fs(n);if(n.every(a=>_i(a)===t))return!1;let i=!1;for(const a of Es(n))Is(a,t)&&(i=!0);return i})}const Bs=40;function Ii(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function Hs(e,t){if(t<=0){e.style.marginLeft="",gt(e);return}e.style.marginLeft=`${t}px`}function ef(e){let t=e.previousElementSibling;for(;t;){if(Ie(t))return t;t=t.previousElementSibling}return null}function tf(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(oe(n)==="ul"||oe(n)==="ol"))return n}return null}function nf(e){const t=ef(e);if(!t)return!1;const n=zt(e);if(!n)return!1;const r=oe(n)==="ol"?"ol":"ul";let i=tf(t);return(!i||oe(i)!==r)&&(i=document.createElement(r),t.appendChild(i)),i.appendChild(e),!0}function rf(e){const t=zt(e);if(!t)return!1;const n=t.parentElement;if(n&&Ie(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return _s(e),!0}function of(e){return Gt(e).some(n=>Ie(n)||Ii(n)>0)}function af(e){return Wt(e,()=>{const t=An(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(Ie(r)){nf(r)&&(n=!0);continue}Hs(r,Ii(r)+Bs),n=!0}return n})}function lf(e){return Wt(e,()=>{const t=Gt(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(Ie(r)){rf(r)&&(n=!0);continue}const i=Ii(r);i<=0||(Hs(r,Math.max(0,i-Bs)),n=!0)}return n})}const zs="pt",sf=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,cf=/^[+-]?0(?:\.0+)?$/;function Me(e){return`${J(e.value)}${e.unit}`}function He(e){const t=e.trim();if(!t)return null;if(cf.test(t))return{value:0,unit:"px"};const n=t.match(sf);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return Tr(i)?{value:ve(r),unit:i}:null}function Sr(e,t,n){const r=e.trim();if(!r)return null;const i=He(r);if(i)return!n&&i.value<0?{...i,value:0}:i;const a=Number(r.replace(",","."));return Number.isFinite(a)?!n&&a<0?{value:0,unit:t}:{value:ve(a),unit:t}:null}function bt(e){return e.value>=0?e:{value:0,unit:e.unit}}function Re(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}const Xe=["top","right","bottom","left"],Lr=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],tt={top:null,right:null,bottom:null,left:null},Fi={style:"none",width:null,color:null},uf=new Set(Lr),rl={value:0,unit:"px"};function df(){return{margin:{...tt},padding:{...tt},lineHeight:null,border:{...Fi},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null}}function Bi(){const e=df();return{margin:e.margin,marginMixed:!1,padding:e.padding,paddingMixed:!1,lineHeight:e.lineHeight,lineHeightMixed:!1,border:e.border,borderMixed:!1,borderRadius:e.borderRadius,radiusMixed:!1,boxShadow:e.boxShadow,shadowMixed:!1,backgroundColor:e.backgroundColor,backgroundMixed:!1,opacity:e.opacity,opacityMixed:!1}}function nt(e,t){return Xe.every(n=>Re(e[n],t[n]))}function Os(e,t){return e===t?!0:!e||!t||e.kind!==t.kind?!1:e.kind==="normal"||t.kind==="normal"?!0:e.kind==="number"&&t.kind==="number"?e.value===t.value:e.kind==="length"&&t.kind==="length"&&e.value===t.value&&e.unit===t.unit}function Ks(e,t){return e.style===t.style&&Re(e.width,t.width)&&e.color===t.color}function $s(e,t){return e===t?!0:!e||!t?!1:Re(e.offsetX,t.offsetX)&&Re(e.offsetY,t.offsetY)&&Re(e.blur,t.blur)&&Re(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function mf(e){return e.kind==="normal"?"normal":e.kind==="number"?J(e.value):Me({value:e.value,unit:e.unit})}function ff(e){const t=e.trim();if(!t)return null;if(t.endsWith("%")){const r=Number(t.slice(0,-1).trim().replace(",","."));return Number.isFinite(r)?Ot(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?Ot(n):null}function Ot(e){return ve(Math.min(1,Math.max(0,e)))}function Cr(e){return ve(Ot(e)*100)}function Us(e){return Ot(e/100)}function pf(e){return J(Ot(e))}function hf(e){const t=e.trim();if(!t)return null;if(t.toLowerCase()==="normal")return{kind:"normal"};if(/^[+]?(?:\d+(?:\.\d+)?|\.\d+)$/.test(t)){const r=Number(t);return!Number.isFinite(r)||r<0?null:{kind:"number",value:ve(r)}}const n=He(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function gf(e,t){const n=[];let r="",i=0;for(const a of e){if(a==="("){i+=1,r+=a;continue}if(a===")"){i=Math.max(0,i-1),r+=a;continue}if(a===t&&i===0){r.trim()&&n.push(r.trim()),r="";continue}r+=a}return r.trim()&&n.push(r.trim()),n}function bf(e){const t=[];let n="",r=0;for(const i of e){if(i==="("){r+=1,n+=i;continue}if(i===")"){r=Math.max(0,r-1),n+=i;continue}if(/\s/.test(i)&&r===0){n&&t.push(n),n="";continue}n+=i}return n&&t.push(n),t}function yf(e){const t=[Me(e.offsetX),Me(e.offsetY),Me(e.blur),Me(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function xf(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=gf(t,",")[0];if(!n)return null;const r=bf(n);let i=!1,a=null;const l=[];for(const c of r){if(c.toLowerCase()==="inset"){i=!0;continue}const m=He(c);if(m){l.push(m);continue}const p=me(c);if(p){a=p;continue}return null}return l.length<2||l.length>4?null:{offsetX:l[0],offsetY:l[1],blur:l[2]??rl,spread:l[3]??rl,color:a,inset:i}}function Rt(e,t){return He(e.style.getPropertyValue(t))}function wf(e,t,n,r){const i=n&&r?bt(n):n,a=i?Me(i):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function ol(e,t){return{top:Rt(e,`${t}-top`),right:Rt(e,`${t}-right`),bottom:Rt(e,`${t}-bottom`),left:Rt(e,`${t}-left`)}}function il(e,t,n,r){let i=!1;for(const a of Xe)wf(e,`${t}-${a}`,n[a],r)&&(i=!0);return i}function vf(e){const t=e.trim().toLowerCase();return uf.has(t)?t:"none"}function Ws(e){const t=vf(e.style.borderStyle||e.style.borderTopStyle),n=Rt(e,"border-width")??Rt(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,i=r?me(r):null;return{style:t,width:n,color:i}}function Sf(e,t){const n=Ws(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?bt(t.width):null,color:t.color};return Ks(n,r)?!1:r.style==="none"?(e.style.removeProperty("border"),e.style.removeProperty("border-style"),e.style.removeProperty("border-width"),e.style.removeProperty("border-color"),!0):(e.style.borderStyle=r.style,r.width?e.style.borderWidth=Me(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function Gs(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return He(n)}function Cf(e,t){const n=t?bt(t):null,r=Gs(e);return Re(r,n)?!1:(n?e.style.borderRadius=Me(n):e.style.removeProperty("border-radius"),!0)}function Vs(e){return xf(e.style.boxShadow)}function kf(e,t){const n=Vs(e),r=t?{...t,blur:bt(t.blur)}:null;return $s(n,r)?!1:(r?e.style.boxShadow=yf(r):e.style.removeProperty("box-shadow"),!0)}function qs(e){return hf(e.style.lineHeight)}function Df(e,t){const n=qs(e);return Os(n,t)?!1:(t?e.style.lineHeight=mf(t):e.style.removeProperty("line-height"),!0)}function Xs(e){const t=e.style.backgroundColor;return t?me(t):null}function Pf(e,t){const n=t?me(t):null;return Xs(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Ys(e){return ff(e.style.opacity)}function Af(e,t){const n=Ys(e),r=t===null?null:Ot(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=pf(r),!0)}function Vt(e){return{margin:ol(e,"margin"),padding:ol(e,"padding"),lineHeight:qs(e),border:Ws(e),borderRadius:Gs(e),boxShadow:Vs(e),backgroundColor:Xs(e),opacity:Ys(e)}}function qt(e,t){let n=!1;return!t.marginMixed&&il(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&il(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&Df(e,t.lineHeight)&&(n=!0),!t.borderMixed&&Sf(e,t.border)&&(n=!0),!t.radiusMixed&&Cf(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&kf(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&Pf(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&Af(e,t.opacity)&&(n=!0),n&&gt(e),n}function jf(e){const t=Bi(),n=Gt(e);if(n.length===0)return t;const r=n.map(Vt),i=r[0];return{margin:i.margin,marginMixed:r.some(a=>!nt(a.margin,i.margin)),padding:i.padding,paddingMixed:r.some(a=>!nt(a.padding,i.padding)),lineHeight:i.lineHeight,lineHeightMixed:r.some(a=>!Os(a.lineHeight,i.lineHeight)),border:i.border,borderMixed:r.some(a=>!Ks(a.border,i.border)),borderRadius:i.borderRadius,radiusMixed:r.some(a=>!Re(a.borderRadius,i.borderRadius)),boxShadow:i.boxShadow,shadowMixed:r.some(a=>!$s(a.boxShadow,i.boxShadow)),backgroundColor:i.backgroundColor,backgroundMixed:r.some(a=>a.backgroundColor!==i.backgroundColor),opacity:i.opacity,opacityMixed:r.some(a=>a.opacity!==i.opacity)}}function Ef(e,t){return Wt(e,()=>{const n=An(e);if(n.length===0)return!1;let r=!1;for(const i of n)qt(i,t)&&(r=!0);return r})}const Js=["left","center","right","justify"];function Tf(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function Nf(e){return Tf(e.style.textAlign)}function Zs(e){const t=Gt(e);if(t.length===0)return ht(e)?{align:"left",mixed:!1}:{align:null,mixed:!1};const n=t.map(Nf),r=n[0];return n.every(i=>i===r)?{align:r,mixed:!1}:{align:null,mixed:!0}}function Qs(e,t){return Js.includes(t)?Wt(e,()=>{const n=An(e);if(n.length===0)return!1;let r=!1;for(const i of n)i.style.textAlign!==t&&(i.style.textAlign=t,r=!0);return r}):!1}function hn(){return{...Bi(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function al(e){const t=jf(e),n=Zs(e),r=Rs(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function ec(e,t){let n=!1;return!t.alignMixed&&t.align&&Qs(e,t.align)&&(n=!0),t.listMixed||Qm(e,t.list)&&(n=!0),Ef(e,t)&&(n=!0),n}function Lf(e,t){return ec(e,ni(t))}function tc(e){return{align:e.alignMixed?void 0:e.align??"left",list:e.listMixed?void 0:e.list,margin:e.marginMixed?void 0:e.margin,padding:e.paddingMixed?void 0:e.padding,lineHeight:e.lineHeightMixed?void 0:e.lineHeight,border:e.borderMixed?void 0:e.border,borderRadius:e.radiusMixed?void 0:e.borderRadius,boxShadow:e.shadowMixed?void 0:e.boxShadow,backgroundColor:e.backgroundMixed?void 0:e.backgroundColor,opacity:e.opacityMixed?void 0:e.opacity}}function ni(e){const t=hn();return e?{align:e.align??t.align,alignMixed:e.align===void 0,list:e.list===void 0?t.list:e.list,listMixed:e.list===void 0,margin:e.margin??t.margin,marginMixed:e.margin===void 0,padding:e.padding??t.padding,paddingMixed:e.padding===void 0,lineHeight:e.lineHeight===void 0?t.lineHeight:e.lineHeight,lineHeightMixed:e.lineHeight===void 0,border:e.border??t.border,borderMixed:e.border===void 0,borderRadius:e.borderRadius===void 0?t.borderRadius:e.borderRadius,radiusMixed:e.borderRadius===void 0,boxShadow:e.boxShadow===void 0?t.boxShadow:e.boxShadow,shadowMixed:e.boxShadow===void 0,backgroundColor:e.backgroundColor===void 0?t.backgroundColor:e.backgroundColor,backgroundMixed:e.backgroundColor===void 0,opacity:e.opacity===void 0?t.opacity:e.opacity,opacityMixed:e.opacity===void 0}:{...t,alignMixed:!0,listMixed:!0,marginMixed:!0,paddingMixed:!0,lineHeightMixed:!0,borderMixed:!0,radiusMixed:!0,shadowMixed:!0,backgroundMixed:!0,opacityMixed:!0}}function Mf(){return{size:null,unit:Ct,marks:Qe(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function ri(){return{font:Mf(),box:Bi()}}function Rf(e){const t=e.style.fontSize,n=t?Di(t):null,r=n&&Tr(n.unit)?{value:n.value,unit:n.unit}:null,i=`${e.style.textDecorationLine} ${e.style.textDecoration}`.toLowerCase(),a=e.style.fontWeight.trim().toLowerCase(),l={bold:a==="bold"||Number(a)>=700,italic:e.style.fontStyle.trim().toLowerCase()==="italic",underline:/\bunderline\b/.test(i),strikethrough:/\bline-through\b/.test(i)},c=e.style.color,m=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??Ct,marks:l,fontFamily:m||null,fontFamilyMixed:!1,fontColor:c?me(c):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function _f(e,t){const n=e.style.fontSize,r=t.size===null?null:kt(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const i=ki(r.value,r.unit);return n===i?!1:(e.style.fontSize=i,!0)}function If(e,t){var i;if(t.fontFamilyMixed)return!1;const n=(i=t.fontFamily)!=null&&i.trim()?t.fontFamily.trim():null,r=e.style.fontFamily.trim()||null;return kn(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function Ff(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?me(t.fontColor):null;return(e.style.color?me(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function Bf(e,t){let n=!1;const r=t.bold?"bold":"";e.style.fontWeight!==r&&(r?e.style.fontWeight=r:e.style.removeProperty("font-weight"),n=!0);const i=t.italic?"italic":"";e.style.fontStyle!==i&&(i?e.style.fontStyle=i:e.style.removeProperty("font-style"),n=!0);const a=[];t.underline&&a.push("underline"),t.strikethrough&&a.push("line-through");const l=a.join(" ");return(e.style.textDecorationLine||e.style.textDecoration).trim()!==l&&(l?e.style.textDecoration=l:(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),n=!0),n}function Hf(e,t){let n=!1;return _f(e,t)&&(n=!0),If(e,t)&&(n=!0),Ff(e,t)&&(n=!0),Bf(e,t.marks)&&(n=!0),n&&gt(e),n}function zf(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function Of(e){const t=Dn(e);if(!t)return ri();const n=Vt(t);return{font:Rf(t),box:{margin:n.margin,marginMixed:!1,padding:n.padding,paddingMixed:!1,lineHeight:n.lineHeight,lineHeightMixed:!1,border:n.border,borderMixed:!1,borderRadius:n.borderRadius,radiusMixed:!1,boxShadow:n.boxShadow,shadowMixed:!1,backgroundColor:n.backgroundColor,backgroundMixed:!1,opacity:n.opacity,opacityMixed:!1}}}function Kf(e,t){const n=ht(e),r=n?Ht(e,n.startContainer,n.startOffset):null,i=n?Ht(e,n.endContainer,n.endOffset):null,a=Dn(e),l=Am(e),c=Hf(l,t.font),m=qt(l,zf(t));return Ps(e),r!==null&&i!==null&&Mi(e,Math.min(r,i),Math.max(r,i)),!a||c||m}const Hi="data-hover-html",$f="noopener noreferrer",Uf="var n=this._hoverBox;if(!n){n=document.createElement('div');n.style.cssText='position:absolute;z-index:2147483646;background:#fff;border:1px solid #c8c8c8;border-radius:4px;padding:0.35rem 0.5rem;color:#222;max-width:18rem';this._hoverBox=n}n.innerHTML=this.getAttribute('data-hover-html')||'';var r=this.getBoundingClientRect();n.style.left=r.left+window.scrollX+'px';n.style.top=r.bottom+4+window.scrollY+'px';document.body.appendChild(n)",Wf="this._hoverBox&&this._hoverBox.remove()",Gf=/^(#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*(?:0|0?\.\d+|1))?\s*\))$/;function Mr(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function Vf(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function Sn(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&Vf(n))return n;n=n.parentNode}return null}function nc(e){return Gf.test(e)}function qf(e){var i;const t=e.getAttribute("onmouseover")??"",n=/this\.style\.color\s*=\s*'([^']+)'/.exec(t),r=((i=n==null?void 0:n[1])==null?void 0:i.trim())??"";return r&&nc(r)?r:null}function rc(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function Xf(e){const t=e.getAttribute(Hi)??"",n=qf(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:rc(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function oc(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return null;const r=Sn(e,n.commonAncestorContainer);return r?Xf(r):null}function Yf(e){return oc(e)!==null}function Jf(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(Hi)}function Zf(e,t){var r;if(Jf(e),t.hoverMode==="html"){const i=t.hoverHtml.trim();if(!i)return;e.setAttribute(Hi,i),e.setAttribute("onmouseover",Uf),e.setAttribute("onmouseout",Wf);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!nc(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function zi(e,t){const n=Mr(t);e.setAttribute("href",n.href);const r=n.title.trim();r?e.setAttribute("title",r):e.removeAttribute("title"),n.targetBlank?(e.setAttribute("target","_blank"),e.setAttribute("rel",$f)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":rc(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),Zf(e,n)}function Qf(e,t){const n=new Set;for(const r of t){const i=Sn(e,r);i&&!n.has(i)&&n.add(i)}for(const r of n)_e(r)}function ep(e,t,n){ut(t);const r=Be(t).filter(c=>c.data.length>0);Qf(e,r),r.length>0&&Ut(r);const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);ut(a);const l=document.createElement("a");zi(l,n);try{return a.surroundContents(l),!0}catch{const c=a.extractContents();return c.hasChildNodes()?(l.appendChild(c),a.insertNode(l),!0):!1}}function tp(e,t){const n=document.createElement("a");zi(n,t),n.textContent=t.href,e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();return r==null||r.removeAllRanges(),r==null||r.addRange(e),!0}function np(e,t){const n=t.href.trim();if(!n)return!1;const r=Mr({...t,href:n}),i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!se(e,a.commonAncestorContainer))return!1;const l=Sn(e,a.startContainer),c=Sn(e,a.endContainer);return l&&l===c?(zi(l,r),!0):a.collapsed?tp(a,r):ep(e,a,r)}const rp=/^[A-Za-z][A-Za-z0-9_-]*$/,ic="​";function oi(e){var r;const t=Ai(e),n=new Set;for(const i of t.querySelectorAll("[id]")){if(i===t)continue;const a=i.id.trim();a&&n.add(a)}for(const i of t.querySelectorAll("a[name]")){const a=(r=i.getAttribute("name"))==null?void 0:r.trim();a&&n.add(a)}return[...n].sort((i,a)=>i.localeCompare(a)).map(i=>({id:i}))}function op(e){return new Set(oi(e).map(t=>t.id))}function ac(e,t){const n=e.trim();return n?rp.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function ll(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ic)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function ip(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ic)),(r=e.parentNode)==null||r.insertBefore(n,e)}function ap(e,t){const n=t.trim();if(ac(n,op(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!se(e,i.commonAncestorContainer))return!1;const a=Sn(e,i.startContainer);if(a)return ip(a,n),!0;if(i.collapsed)return ll(i,n),!0;ut(i);const l=document.createElement("span");l.id=n;try{return i.surroundContents(l),!0}catch{return ll(i,n),!0}}function lc(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n:null}function lp(e){const t=lc(e);if(!t||t.collapsed)return null;const n=document.createElement("div");n.appendChild(t.cloneContents());const r=n.innerHTML;if(!r)return null;let i=t.toString();if(!i){const a=n.querySelector("img");i=(a==null?void 0:a.getAttribute("alt"))??(a==null?void 0:a.getAttribute("src"))??""}return{html:r,text:i}}function sc(e){const t=lc(e);if(!t||t.collapsed)return!1;t.deleteContents();const n=window.getSelection();return n==null||n.removeAllRanges(),n==null||n.addRange(t),!0}async function sp(e){const t=navigator.clipboard;if(!t)return!1;try{if(typeof ClipboardItem=="function"&&typeof t.write=="function"){const n=new ClipboardItem({"text/plain":new Blob([e.text],{type:"text/plain"}),"text/html":new Blob([e.html],{type:"text/html"})});return await t.write([n]),!0}if(typeof t.writeText=="function")return await t.writeText(e.text),!0}catch{if(typeof t.writeText=="function")try{return await t.writeText(e.text),!0}catch{return!1}return!1}return!1}async function cc(e){const t=lp(e);return t?sp(t):!1}async function cp(e){return await cc(e)?sc(e):!1}const up=new Set(["strong","b","em","i","u","s","strike","del"]),dp=["font","font-weight","font-style","font-family","font-size","color","background","background-color","text-decoration","text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness"];function mp(e){for(const t of dp)e.style.removeProperty(t)}function fp(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!qe(r)){n=r;continue}if(pt(r,n),up.has(r.tagName.toLowerCase())){_e(r);continue}if(mp(r),Dt(r)){_e(r);continue}n=r.isConnected?r:t}}function pp(e){const t=ht(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;ut(t);const r=Be(t).filter(i=>i.data.length>0);if(r.length===0)return!1;for(const i of r)fp(e,i);return Ut(r),e.innerHTML!==n}const hp=2*1024*1024,gp="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",bp=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),yp=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),xp=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,wp=/^(javascript|vbscript|file|blob):/i;function vp(e={}){return{src:"",alt:"",title:"",...e}}function Oi(e){const t=e.trim();if(!t)return"empty";if(wp.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return xp.test(t)?null:"invalid";if(/^[a-z][a-z0-9+.-]*:/i.test(t)){const n=t.slice(0,t.indexOf(":")).toLowerCase();return n==="http"||n==="https"?null:"invalid"}return null}function Sp(e){return e.size>hp?"tooLarge":Ap(e)?null:"type"}function Cp(e){const t=Sp(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(Oi(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function kp(e,t){e.setAttribute("src",t.src.trim());const n=t.alt.trim(),r=t.title.trim();n?e.setAttribute("alt",n):e.removeAttribute("alt"),r?e.setAttribute("title",r):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.height="auto",Dp(e,t.css)}function Dp(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&e.style.setProperty(a,l)}}function Pp(e,t){const n=vp(t);if(Oi(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!se(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("img");return kp(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function ii(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function Bo(e,t){if(!se(e,t)||t===e)return!1;const n=document.createRange();n.selectNode(t);const r=window.getSelection();return r?(r.removeAllRanges(),r.addRange(n),!0):!1}function Ap(e){const t=e.type.trim().toLowerCase();if(t&&bp.has(t))return!0;const n=jp(e.name);return!!(!t&&n&&yp.has(n))}function jp(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Ep="1em 0",Tp="1px solid #d0d0d0",Np=new Set(["p","h1","h2","h3","h4","h5","h6"]),Lp=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function Mp(e){var a;const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return!1;n.collapsed||n.deleteContents();const r=Rp(),i=_p(e,n.startContainer);if(i){const l=Ip(i,n);return(a=i.parentNode)==null||a.insertBefore(r,l),cl(r),!0}return n.insertNode(r),Fp(e,r),zp(r),cl(r),!0}function Rp(){const e=document.createElement("hr");return e.style.margin=Ep,e.style.border="0",e.style.borderTop=Tp,e}function _p(e,t){let n=Pn(t);for(;n&&n!==e;){const r=oe(n);if(Np.has(r)&&n instanceof HTMLElement)return n;if(Lp.has(r))return null;n=n.parentElement}return null}function Ip(e,t){var a;const n=document.createRange();n.setStart(t.startContainer,t.startOffset),n.setEnd(e,e.childNodes.length);const r=n.extractContents(),i=e.cloneNode(!1);return i.appendChild(r),sl(e),sl(i),(a=e.parentNode)==null||a.insertBefore(i,e.nextSibling),i}function Fp(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!Bp(n))return;pt(n,t),_e(n)}}function Bp(e){const t=oe(e);return qe(e)||t==="a"}function sl(e){Hp(e)&&e.appendChild(document.createElement("br"))}function Hp(e){var t;return e.childNodes.length===0||e.childNodes.length===1&&((t=e.firstChild)==null?void 0:t.nodeName)==="BR"?!0:(e.textContent??"").trim().length===0&&e.querySelector("img, table, ul, ol, hr")===null}function zp(e){var n;if(e.nextSibling)return;const t=document.createElement("p");t.appendChild(document.createElement("br")),(n=e.parentNode)==null||n.insertBefore(t,e.nextSibling)}function cl(e){const t=e.nextSibling,n=document.createRange();t instanceof HTMLElement||t?(n.setStart(t,0),n.collapse(!0)):(n.setStartAfter(e),n.collapse(!0));const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(n))}const uc=["%","px","pt","pc","em","rem"],Op="%",Kp={"%":[25,50,75,100,125,150,200],px:[50,100,150,200,300,400,600,800],pt:[36,48,72,96,144,192,288],pc:[3,4,6,8,12,16,24],em:[2,4,6,8,12,16,24],rem:[2,4,6,8,12,16,24]},Kt={"%":{min:1,max:1e3},px:{min:1,max:4e3},pt:{min:1,max:3e3},pc:{min:.1,max:250},em:{min:.1,max:200},rem:{min:.1,max:200}},$p=new Set(uc),Up=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function Wp(e){return $p.has(e)}function ul(e){return`${J(e.value)}${e.unit}`}function ai(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(Up);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r)||r<=0)return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return Wp(i)?$t(r,i):null}function dl(e,t){const n=e.trim();if(!n)return null;const r=ai(n);if(r)return r;const i=Number(n.replace(",","."));return Number.isFinite(i)?$t(i,t):null}function $t(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=Kt[t];return{value:ve(Math.min(r,Math.max(n,e))),unit:t}}function gn(e,t,n){const r=n>0?n:1;if(e==="width"){const a=$t(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:$t(t.value*r,t.unit)??t,height:t}}const hr="data-hover-css",dc=["fill","contain","cover","none","scale-down"],mc=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],Gp=new Set(dc),Vp=new Set(mc),ml="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",qp="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",Xp=/^-?[a-z][a-z0-9-]*$/i,Yp=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,li=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function fc(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...tt},border:{...Fi},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function Jp(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function Zp(e,t){const n=e.objectFit;if(n!=="cover"&&n!=="contain"&&n!=="fill"||e.width&&e.height||!e.width&&!e.height)return e;if(e.width){const r=gn("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=gn("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function Qp(e){const t=[];for(const n of e.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim().toLowerCase(),l=r.slice(i+1).trim();!a||!l||Xp.test(a)&&(a==="behavior"||a.endsWith("binding")||Yp.test(l)||t.push(`${a}: ${l}`))}return t.join("; ")}function bn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return null;if(n.startContainer instanceof HTMLImageElement)return n.startContainer;if(n.startContainer.nodeType===Node.ELEMENT_NODE){const r=n.startContainer.childNodes[n.startOffset];if(r instanceof HTMLImageElement&&se(e,r))return r}return ii(e,n.commonAncestorContainer)}function eh(e){const t=bn(e);return t?pc(t):null}function pc(e){const t=Vt(e),n=ih(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,i=nh(e);return fc({sizeMode:i.sizeMode,width:i.width,height:i.height,align:n,margin:r,border:t.border,borderRadius:t.borderRadius,boxShadow:t.boxShadow,opacity:t.opacity,objectFit:gc(e),objectPosition:ch(e),rotateDeg:bc(e),hoverCss:e.getAttribute(hr)??""})}function hc(e,t){let n=!1;return rh(e,t)&&(n=!0),qt(e,{margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:tt,paddingMixed:!0,lineHeight:null,lineHeightMixed:!0,border:t.border,borderMixed:!1,borderRadius:t.borderRadius,radiusMixed:!1,boxShadow:t.boxShadow,shadowMixed:!1,backgroundColor:null,backgroundMixed:!0,opacity:t.opacity,opacityMixed:!1})&&(n=!0),ah(e,t.align)&&(n=!0),lh(e,t.objectFit)&&(n=!0),sh(e,t.objectPosition)&&(n=!0),dh(e,t.rotateDeg)&&(n=!0),mh(e,t.hoverCss)&&(n=!0),n}function th(e,t){const n=bn(e);return n?hc(n,t):!1}function nh(e){const t=ai(e.style.width),n=ai(e.style.height);return t&&n?{sizeMode:"lock",width:t,height:n}:n&&!t?{sizeMode:"height",width:null,height:n}:{sizeMode:"width",width:t,height:null}}function rh(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=oh(t);return r.width?e.style.width=ul(r.width):e.style.removeProperty("width"),r.height?e.style.height=ul(r.height):e.style.height="auto",r.width||r.height?e.style.removeProperty("max-width"):e.style.maxWidth="100%",n.width!==e.style.width||n.height!==e.style.height||n.maxWidth!==e.style.maxWidth}function oh(e){return e.sizeMode==="width"?{sizeMode:"width",width:e.width,height:null}:e.sizeMode==="height"?{sizeMode:"height",width:null,height:e.height}:{sizeMode:"lock",width:e.width,height:e.height}}function ih(e){const t=e.style.float.trim().toLowerCase();if(t==="left")return"left";if(t==="right")return"right";const n=e.style.display.trim().toLowerCase(),r=e.style.marginLeft.trim().toLowerCase(),i=e.style.marginRight.trim().toLowerCase();return n==="block"&&r==="auto"&&i==="auto"?"center":null}function ah(e,t){const n={float:e.style.float,display:e.style.display,marginLeft:e.style.marginLeft,marginRight:e.style.marginRight};return t==="left"?(e.style.float="left",e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")):t==="right"?(e.style.float="right",e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")):t==="center"?(e.style.removeProperty("float"),e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="auto"):(e.style.removeProperty("float"),e.style.display.trim().toLowerCase()==="block"&&e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")),n.float!==e.style.float||n.display!==e.style.display||n.marginLeft!==e.style.marginLeft||n.marginRight!==e.style.marginRight}function gc(e){const t=e.style.objectFit.trim().toLowerCase();return Gp.has(t)?t:null}function lh(e,t){return gc(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function sh(e,t){const n=(t==null?void 0:t.trim().toLowerCase().replace(/\s+/g," "))||"";return e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ")===n?!1:(n?e.style.objectPosition=n:e.style.removeProperty("object-position"),!0)}function ch(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Vp.has(t),t):null}function bc(e){const t=li.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?ve(n):null}function uh(e){const t=e.trim();return t?li.test(t)&&t.replace(li,"").trim()==="":!0}function dh(e,t){const n=bc(e),r=t===null||t===0?null:ve(t);return n===r?!1:r===null?uh(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${J(r)}deg)`,!0)}function mh(e,t){const n=Qp(t),r=e.getAttribute(hr)??"",i=e.getAttribute("onmouseover")??"";return r===n&&(n&&i===ml||!n&&!i)?!1:n?(e.setAttribute(hr,n),e.setAttribute("onmouseover",ml),e.setAttribute("onmouseout",qp),!0):(e.removeAttribute(hr),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const rt=16;function fl(e){return Math.min(Kt.px.max,Math.max(rt,e))}function fh(e){return e.width>0&&e.height>0?e.width/e.height:1}function ph(e,t){const n=Math.max(rt,rt*t),r=Math.min(Kt.px.max,Kt.px.max*t),i=Math.min(r,Math.max(n,e));return{width:i,height:i/t}}function hh(e,t){const n=Math.max(rt,rt/t),r=Math.min(Kt.px.max,Kt.px.max/t),i=Math.min(r,Math.max(n,e));return{width:i*t,height:i}}function gh(e,t,n){const r=fh(t);return e==="e"?ph(t.width+n.x,r):e==="s"?hh(t.height+n.y,r):{width:fl(t.width+n.x),height:fl(t.height+n.y)}}function bh(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:rt,height:r>0?r:rt}}function yh(e,t,n){const r=$t(Math.max(rt,t),"px"),i=$t(Math.max(rt,n),"px");return!r||!i?!1:hc(e,{...pc(e),sizeMode:"lock",width:r,height:i})}const pl=10,_t=1,It=50,xh="1px solid #000",wh="0.25em",vh=new Set(["td","th"]);function yc(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=_t&&t>=_t&&e<=It&&t<=It}function Ve(e,t){return Ki(e,t,n=>n instanceof HTMLTableElement)}function kr(e,t){return Ki(e,t,n=>Th(n))}function Sh(e,t){return Ki(e,t,n=>n instanceof HTMLTableRowElement)}function yn(e){return Ve(e,$i(e))}function Xt(e){return kr(e,$i(e))}function xc(e){return Sh(e,$i(e))}function Ch(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function kh(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return[];const r=kr(e,n.startContainer),i=kr(e,n.endContainer);if(!r)return[];if(!i||r===i)return[r];const a=Ve(e,r);if(!a||Ve(e,i)!==a)return[r];const l=gl(r),c=gl(i);if(!l||!c)return[r];const m=Math.min(l.row,c.row),p=Math.max(l.row,c.row),b=Math.min(l.col,c.col),h=Math.max(l.col,c.col),w=[];for(const y of Array.from(a.rows))if(!(y.rowIndex<m||y.rowIndex>p))for(const v of Array.from(y.cells))v.cellIndex>=b&&v.cellIndex<=h&&w.push(v);return w.length>0?w:[r]}function Dh(e,t){if(!yc(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!se(e,r.commonAncestorContainer))return!1;const i=document.createElement("table");i.style.borderCollapse="collapse",i.style.width="100%";const a=document.createElement("tbody");for(let c=0;c<t.rows;c+=1){const m=document.createElement("tr");for(let p=0;p<t.cols;p+=1)m.appendChild(Ui("td"));a.appendChild(m)}i.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(i),Lh(e,i);const l=i.querySelector("td, th");return l instanceof HTMLTableCellElement&&et(l),!0}function si(e,t){var m;const n=Xt(e);if(!n)return!1;const r=n.parentElement;if(!(r instanceof HTMLTableRowElement)||!Ve(e,n))return!1;const a=document.createElement("tr"),l=Math.max(1,r.cells.length);for(let p=0;p<l;p+=1){const b=r.cells[p];a.appendChild(Ui((b==null?void 0:b.tagName)==="TH"?"th":"td"))}t==="before"?(m=r.parentNode)==null||m.insertBefore(a,r):r.insertAdjacentElement("afterend",a);const c=a.cells[Math.min(n.cellIndex,a.cells.length-1)];return c&&et(c),!0}function hl(e,t){const n=Xt(e);if(!n)return!1;const r=Ve(e,n);if(!r)return!1;const i=n.cellIndex,a=t==="before"?i:i+1;let l=null;for(const c of Array.from(r.rows)){const m=c.cells[Math.min(i,c.cells.length-1)]??null,p=Ui((m==null?void 0:m.tagName)==="TH"?"th":"td");Nh(c,a,p),c===n.parentElement&&(l=p)}return l&&et(l),!0}function Ph(e){const t=Xt(e);if(!t)return!1;const n=t.parentElement;if(!(n instanceof HTMLTableRowElement))return!1;const r=Ve(e,t);if(!r)return!1;const i=t.cellIndex,a=n.rowIndex;if(r.rows.length<=1)return wc(e,r);const l=n.parentNode;n.remove();const c=r.rows[Math.min(a,r.rows.length-1)],m=c==null?void 0:c.cells[Math.min(i,c.cells.length-1)];return m?et(m):l&&Rh(r),!0}function Ah(e){const t=Xt(e);if(!t)return!1;const n=Ve(e,t);if(!n)return!1;const r=t.cellIndex,i=t.parentElement;if(Math.max(0,...Array.from(n.rows,p=>p.cells.length))<=1)return wc(e,n);const l=i instanceof HTMLTableRowElement?i.rowIndex:0;for(const p of Array.from(n.rows)){const b=p.cells[r];b&&b.remove()}const c=n.rows[Math.min(l,n.rows.length-1)],m=c==null?void 0:c.cells[Math.min(r,c.cells.length-1)];return m&&et(m),!0}function jh(e,t){const n=Xt(e);if(!n)return!1;const r=Ve(e,n);if(!r)return!1;const i=Ch(r),a=i.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(et(i[a-1]),{changed:!1});if(a<i.length-1)return et(i[a+1]),{changed:!1};const l=n.parentElement;if(!si(e,"below"))return!1;const c=l instanceof HTMLTableRowElement?l.nextElementSibling:null;return c instanceof HTMLTableRowElement&&c.cells[0]&&et(c.cells[0]),{changed:!0}}function Eh(e,t){return!se(e,t)||t===e?!1:(et(t),!0)}function Ki(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function Th(e){return vh.has(e.tagName.toLowerCase())}function $i(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n.startContainer:null}function gl(e){const t=e.parentElement;return t instanceof HTMLTableRowElement?{row:t.rowIndex,col:e.cellIndex}:null}function Ui(e){const t=document.createElement(e);return t.style.border=xh,t.style.padding=wh,t.appendChild(document.createElement("br")),t}function Nh(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Lh(e,t){var i;const n=t.parentElement;if(!n||n===e)return;const r=n.tagName.toLowerCase();r==="td"||r==="th"||(r==="p"||/^h[1-6]$/.test(r))&&((i=n.parentNode)==null||i.insertBefore(t,n.nextSibling),Mh(n)&&n.remove())}function Mh(e){var t;return e.childNodes.length===0||e.childNodes.length===1&&((t=e.firstChild)==null?void 0:t.nodeName)==="BR"?!0:(e.textContent??"").trim().length===0&&e.querySelector("img, table, ul, ol")===null}function wc(e,t){if(!t.parentNode||!se(e,t))return!1;const r=document.createRange();r.setStartBefore(t),r.collapse(!0),t.remove();const i=window.getSelection();return i&&(i.removeAllRanges(),i.addRange(r)),!0}function et(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function Rh(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function _h(e={}){return{border:{...Fi},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function Ih(e){const t=Vt(e);return{border:t.border,borderCollapse:zh(e),borderSpacing:vc(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:He(e.style.width)}}function Fh(e,t){let n=qt(e,{margin:{top:null,right:null,bottom:null,left:null},marginMixed:!0,padding:{top:null,right:null,bottom:null,left:null},paddingMixed:!0,lineHeight:null,lineHeightMixed:!0,border:t.border,borderMixed:!1,borderRadius:t.borderRadius,radiusMixed:!1,boxShadow:t.boxShadow,shadowMixed:!1,backgroundColor:null,backgroundMixed:!0,opacity:null,opacityMixed:!0});return Oh(e,t.borderCollapse)&&(n=!0),Kh(e,t.borderCollapse,t.borderSpacing)&&(n=!0),$h(e,t.width)&&(n=!0),n&&gt(e),n}function Bh(e){const t=yn(e);return t?Ih(t):null}function Hh(e,t){const n=yn(e);return n?Fh(n,t):!1}function zh(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function Oh(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function vc(e){const t=e.style.borderSpacing.trim();return t?He(t.split(/\s+/)[0]??""):null}function Kh(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?bt(n):null,i=vc(e);return Re(i,r)?!1:(r?e.style.borderSpacing=Me(r):e.style.removeProperty("border-spacing"),!0)}function $h(e,t){const n=t?bt(t):null,r=He(e.style.width);return Re(r,n)?!1:(n?e.style.width=Me(n):e.style.removeProperty("width"),!0)}const Rr=["top","middle","bottom","baseline"],Uh=new Set(Rr);function Wh(e={}){return{backgroundColor:null,color:null,padding:{...tt},verticalAlign:null,width:null,...e}}function Gh(e){const t=Vt(e);return{backgroundColor:t.backgroundColor,color:Sc(e),padding:t.padding,verticalAlign:Cc(e),width:He(e.style.width)}}function Vh(e,t){let n=qt(e,{margin:{...tt},marginMixed:!0,padding:t.padding,paddingMixed:!1,lineHeight:null,lineHeightMixed:!0,border:{style:"none",width:null,color:null},borderMixed:!0,borderRadius:null,radiusMixed:!0,boxShadow:null,shadowMixed:!0,backgroundColor:t.backgroundColor,backgroundMixed:!1,opacity:null,opacityMixed:!0});return Yh(e,t.color)&&(n=!0),Jh(e,t.verticalAlign)&&(n=!0),Zh(e,t.width)&&(n=!0),n&&gt(e),n}function qh(e){const t=Xt(e);return t?Gh(t):null}function Xh(e,t){const n=kh(e);if(n.length===0)return!1;let r=!1;for(const i of n)Vh(i,t)&&(r=!0);return r}function Sc(e){const t=e.style.color;return t?me(t):null}function Yh(e,t){const n=t?me(t):null;return Sc(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function Cc(e){const t=e.style.verticalAlign.trim().toLowerCase();return Uh.has(t)?t:null}function Jh(e,t){return Cc(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function Zh(e,t){const n=t?bt(t):null,r=He(e.style.width);return Re(r,n)?!1:(n?e.style.width=Me(n):e.style.removeProperty("width"),!0)}const Qh=new Set(Rr);function eg(e={}){return{backgroundColor:null,color:null,padding:{...tt},height:null,verticalAlign:null,...e}}function tg(e){const t=e.cells[0],n=t?Vt(t).padding:{...tt};return{backgroundColor:kc(e),color:Dc(e),padding:n,height:He(e.style.height),verticalAlign:Pc(e)}}function ng(e,t){let n=!1;ig(e,t.backgroundColor)&&(n=!0),ag(e,t.color)&&(n=!0),sg(e,t.height)&&(n=!0),lg(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))qt(r,{margin:{...tt},marginMixed:!0,padding:t.padding,paddingMixed:!1,lineHeight:null,lineHeightMixed:!0,border:{style:"none",width:null,color:null},borderMixed:!0,borderRadius:null,radiusMixed:!0,boxShadow:null,shadowMixed:!0,backgroundColor:null,backgroundMixed:!0,opacity:null,opacityMixed:!0})&&(n=!0);return n&&gt(e),n}function rg(e){const t=xc(e);return t?tg(t):null}function og(e,t){const n=xc(e);return n?ng(n,t):!1}function kc(e){const t=e.style.backgroundColor;return t?me(t):null}function ig(e,t){const n=t?me(t):null;return kc(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Dc(e){const t=e.style.color;return t?me(t):null}function ag(e,t){const n=t?me(t):null;return Dc(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function Pc(e){const t=e.style.verticalAlign.trim().toLowerCase();return Qh.has(t)?t:null}function lg(e,t){return Pc(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function sg(e,t){const n=t?bt(t):null,r=He(e.style.height);return Re(r,n)?!1:(n?e.style.height=Me(n):e.style.removeProperty("height"),!0)}const cg=1e3;function ug(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function dg({onAutoSave:e,getHtml:t}){const n=s.useRef(e);n.current=e;const r=s.useRef(t);r.current=t;const i=s.useRef(null),a=e!=null;s.useEffect(()=>{if(!a){i.current=null;return}i.current=r.current();const l=window.setInterval(()=>{const c=n.current;if(!c)return;const m=r.current();m!==i.current&&(i.current=m,queueMicrotask(()=>ug(c,m)))},cg);return()=>{window.clearInterval(l)}},[a])}function Ho({value:e,defaultValue:t,onChange:n}){const[r,i]=s.useState(t),a=e!==void 0,l=a?e:r,c=s.useCallback(m=>{a||i(m),n==null||n(m)},[a,n]);return[l,c]}const bl=8,yl=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#9900ff","#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#d9d2e9","#cc4125","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6d9eeb","#8e7cc3","#660000","#990000","#b45f06","#bf9000","#38761d","#134f5c","#1155cc","#351c75"],mg=8;let ci=[];const ui=new Set;function xl(){return ci}function fg(e){const t=me(e);t&&(ci=[t,...ci.filter(n=>n!==t)].slice(0,mg),ui.forEach(n=>n()))}function pg(e){return ui.add(e),()=>{ui.delete(e)}}function ir(e){const t=me(e);return t?{r:Number.parseInt(t.slice(1,3),16),g:Number.parseInt(t.slice(3,5),16),b:Number.parseInt(t.slice(5,7),16)}:null}function vt(e,t,n){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function zo({r:e,g:t,b:n}){const r=e/255,i=t/255,a=n/255,l=Math.max(r,i,a),c=Math.min(r,i,a),m=l-c;let p=0;return m!==0&&(l===r?p=(i-a)/m%6:l===i?p=(a-r)/m+2:p=(r-i)/m+4,p*=60,p<0&&(p+=360)),{h:p,s:l===0?0:m/l,v:l}}function Oo({h:e,s:t,v:n}){const r=(e%360+360)%360,i=n*t,a=i*(1-Math.abs(r/60%2-1)),l=n-i;let c=0,m=0,p=0;return r<60?(c=i,m=a):r<120?(c=a,m=i):r<180?(m=i,p=a):r<240?(m=a,p=i):r<300?(c=a,p=i):(c=i,p=a),{r:Math.round((c+l)*255),g:Math.round((m+l)*255),b:Math.round((p+l)*255)}}function Ac(){return typeof window<"u"&&"EyeDropper"in window}async function hg(){if(!Ac())return null;const e=window.EyeDropper;try{const t=await new e().open();return me(t.sRGBHex)}catch{return null}}const gg="_picker_ag1yo_1",bg="_none_ag1yo_12",yg="_customToggle_ag1yo_13",xg="_eyedrop_ag1yo_14",wg="_swatch_ag1yo_48",vg="_field_ag1yo_49",Sg="_grid_ag1yo_54",Cg="_recents_ag1yo_55",kg="_sectionLabel_ag1yo_84",Dg="_custom_ag1yo_13",Pg="_sv_ag1yo_95",Ag="_svThumb_ag1yo_105",jg="_hue_ag1yo_116",Eg="_rgbRow_ag1yo_155",Tg="_hexRow_ag1yo_156",xe={picker:gg,none:bg,customToggle:yg,eyedrop:xg,swatch:wg,field:vg,grid:Sg,recents:Cg,sectionLabel:kg,custom:Dg,sv:Pg,svThumb:Ag,hue:jg,rgbRow:Eg,hexRow:Tg};function Ng(e){if(!/^\d+$/.test(e.trim()))return null;const t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(255,t)):null}function Wi({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:i,menu:a=!1,fallbackCustom:l="#000000",onChange:c,onCommit:m}){const p=V(),b=s.useId(),h=a?"menuitemradio":"option",w=t?null:e,y=ir(w??l)??{r:0,g:0,b:0},[v,x]=s.useState(!1),[k,g]=s.useState(()=>zo(y)),[S,A]=s.useState(()=>({r:String(y.r),g:String(y.g),b:String(y.b)})),[N,E]=s.useState(()=>vt(y.r,y.g,y.b)),[L,M]=s.useState(()=>[...xl()]),I=s.useRef(null),j=s.useRef(vt(y.r,y.g,y.b));s.useEffect(()=>pg(()=>M([...xl()])),[]),s.useEffect(()=>{const D=ir(w??l);if(!D)return;const $=zo(D);g($),A({r:String(D.r),g:String(D.g),b:String(D.b)}),E(vt(D.r,D.g,D.b))},[w,l]);const T=(D,$,Y)=>{D&&(j.current=D),Y&&D&&fg(D),c(D),$&&(m==null||m(D))},P=(D,$,Y)=>{const B=vt(D.r,D.g,D.b);g(zo(D)),A({r:String(D.r),g:String(D.g),b:String(D.b)}),E(B),T(B,$,Y)},R=(D,$,Y)=>{const B=Oo(D),fe=vt(B.r,B.g,B.b);g(D),A({r:String(B.r),g:String(B.g),b:String(B.b)}),E(fe),T(fe,$,Y)},W=D=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(D.key))return;const Y=[...D.currentTarget.querySelectorAll("button")],B=Y.findIndex(we=>we===document.activeElement);if(B<0)return;D.preventDefault();const fe=D.key==="ArrowLeft"?-1:D.key==="ArrowRight"?1:D.key==="ArrowUp"?-bl:bl,ue=Y[Math.max(0,Math.min(Y.length-1,B+fe))];ue==null||ue.focus()},O=(D,$)=>{const Y=I.current;if(!Y||i)return;const B=Y.getBoundingClientRect(),fe=Math.max(0,Math.min(1,(D.clientX-B.left)/B.width)),ue=Math.max(0,Math.min(1,1-(D.clientY-B.top)/B.height));R({h:k.h,s:fe,v:ue},$,$)},Z=D=>{i||(D.currentTarget.setPointerCapture(D.pointerId),O(D,!1))},te=Oo({h:k.h,s:1,v:1}),ce=vt(te.r,te.g,te.b),re=Oo(k),he=vt(re.r,re.g,re.b),ne=new Set(yl),Q=L.filter(D=>!ne.has(D));return o.jsxs("div",{className:xe.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[o.jsx("button",{type:"button",className:xe.none,role:h,"aria-checked":a?w===null&&!t:void 0,"aria-selected":a?void 0:w===null&&!t,disabled:i,onClick:()=>T(null,!0,!1),children:n}),o.jsx("div",{className:xe.grid,role:a?"group":"none",onKeyDown:W,children:yl.map(D=>{const $=w===D;return o.jsx("button",{type:"button",className:xe.swatch,role:h,"aria-label":D,"aria-checked":a?$:void 0,"aria-selected":a?void 0:$,disabled:i,style:{backgroundColor:D},onMouseDown:Y=>Y.preventDefault(),onClick:()=>T(D,!0,!1)},D)})}),Q.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:xe.sectionLabel,children:p("colorRecent")}),o.jsx("div",{className:xe.recents,role:a?"group":"none","aria-label":p("colorRecent"),children:Q.map(D=>o.jsx("button",{type:"button",className:xe.swatch,role:h,"aria-label":D,"aria-checked":a?w===D:void 0,"aria-selected":a?void 0:w===D,disabled:i,style:{backgroundColor:D},onMouseDown:$=>$.preventDefault(),onClick:()=>T(D,!0,!1)},D))})]}):null,o.jsx("button",{type:"button",className:xe.customToggle,disabled:i,"aria-expanded":v,onClick:()=>x(D=>!D),children:p("colorCustom")}),v?o.jsxs("div",{className:xe.custom,children:[o.jsx("div",{ref:I,className:xe.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${ce})`},onPointerDown:Z,onPointerMove:D=>{D.currentTarget.hasPointerCapture(D.pointerId)&&O(D,!1)},onPointerUp:D=>{O(D,!0)},children:o.jsx("span",{className:xe.svThumb,style:{left:`${k.s*100}%`,top:`${(1-k.v)*100}%`}})}),o.jsx("input",{className:xe.hue,type:"range",min:0,max:360,value:Math.round(k.h),disabled:i,"aria-label":p("colorCustom"),onChange:D=>R({...k,h:Number(D.target.value)},!1,!1),onPointerUp:()=>T(j.current,!0,!0)}),o.jsx("div",{className:xe.rgbRow,children:["r","g","b"].map(D=>o.jsxs("div",{className:xe.field,children:[o.jsx("label",{htmlFor:`${b}-${D}`,children:p(D==="r"?"colorRgbR":D==="g"?"colorRgbG":"colorRgbB")}),o.jsx("input",{id:`${b}-${D}`,inputMode:"numeric",value:S[D],disabled:i,onChange:$=>{A(Y=>({...Y,[D]:$.target.value}))},onBlur:()=>{const $=Ng(S[D]);if($===null){A({r:String(re.r),g:String(re.g),b:String(re.b)});return}P({...re,[D]:$},!0,!0)},onKeyDown:$=>{$.key==="Enter"&&$.currentTarget.blur()}})]},D))}),o.jsx("div",{className:xe.hexRow,children:o.jsxs("div",{className:xe.field,children:[o.jsx("label",{htmlFor:`${b}-hex`,children:p("colorHex")}),o.jsx("input",{id:`${b}-hex`,value:N,disabled:i,onChange:D=>E(D.target.value),onBlur:()=>{const D=me(N);if(!D){E(he);return}const $=ir(D);$&&P($,!0,!0)},onKeyDown:D=>{D.key==="Enter"&&D.currentTarget.blur()}})]})}),Ac()?o.jsx("button",{type:"button",className:xe.eyedrop,disabled:i,onClick:()=>{hg().then(D=>{if(!D)return;const $=ir(D);$&&P($,!0,!0)})},children:p("colorPickFromScreen")}):null]}):null]})}const Lg="_wrap_xzhkl_1",Mg="_button_xzhkl_8",Rg="_icon_xzhkl_18",_g="_bar_xzhkl_24",Ig="_barEmpty_xzhkl_33",Fg="_popover_xzhkl_43",St={wrap:Lg,button:Mg,icon:Rg,bar:_g,barEmpty:Ig,popover:Fg},Bg="_field_1knrr_1",Hg="_label_1knrr_8",zg="_button_1knrr_12",Og="_swatch_1knrr_37",Kg="_swatchEmpty_1knrr_44",mn={field:Bg,label:Hg,button:zg,swatch:Og,swatchEmpty:Kg},ar=4;function Fe({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:i,fallbackCustom:a,onChange:l}){const c=s.useId(),m=s.useRef(null),p=s.useRef(null),b=s.useRef(null),[h,w]=s.useState(!1),[y,v]=s.useState({top:0,left:0}),x=s.useCallback(()=>{const S=p.current,A=b.current;if(!S)return;const N=S.getBoundingClientRect(),E=(A==null?void 0:A.offsetHeight)??0,L=(A==null?void 0:A.offsetWidth)??240;let M=N.bottom;M+E>window.innerHeight-ar&&(M=Math.max(ar,N.top-E));const I=Math.min(Math.max(N.left,ar),window.innerWidth-L-ar);v({top:M,left:I})},[]);s.useLayoutEffect(()=>{if(!h)return;x();const S=()=>x();return window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[h,x]),s.useEffect(()=>{if(!h)return;const S=N=>{var L,M;const E=N.target;(L=m.current)!=null&&L.contains(E)||(M=b.current)!=null&&M.contains(E)||w(!1)},A=N=>{var E;N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),w(!1),(E=p.current)==null||E.focus())};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",A,!0)}},[h]);const k=`${mn.swatch}${!n||r?` ${mn.swatchEmpty}`:""}`,g=n&&!r?{backgroundColor:n}:void 0;return o.jsxs("div",{className:mn.field,ref:m,children:[o.jsx("span",{className:mn.label,children:e}),o.jsx("button",{ref:p,type:"button",className:mn.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?c:void 0,disabled:i,onClick:()=>w(S=>!S),children:o.jsx("span",{className:k,style:g})}),h?o.jsx(ie,{children:o.jsx("div",{ref:b,id:c,className:St.popover,style:{top:y.top,left:y.left,zIndex:1400},children:o.jsx(Wi,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:i,fallbackCustom:a,onChange:l,onCommit:()=>w(!1)})})}):null]})}const Ko=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],$g="_toolbar_2uk4l_1",Ug="_menuBar_2uk4l_35",Wg="_menuBarDesktop_2uk4l_43",Gg="_brandMark_2uk4l_49",Vg="_brandMarkIcon_2uk4l_56",qg="_menuBarCompact_2uk4l_68",Xg="_menuWrap_2uk4l_91",Yg="_menuButton_2uk4l_97",Jg="_iconButton_2uk4l_98",Zg="_menuItem_2uk4l_99",Qg="_hamburgerButton_2uk4l_142",eb="_iconNav_2uk4l_149",tb="_iconNavMain_2uk4l_160",nb="_iconNavEnd_2uk4l_169",rb="_iconGroup_2uk4l_185",ob="_tooltipTrigger_2uk4l_276",ib="_menu_2uk4l_35",ab="_submenuWrap_2uk4l_304",lb="_submenu_2uk4l_304",sb="_submenuTrigger_2uk4l_314",cb="_menuOverlay_2uk4l_329",ub="_menuOverlayHeader_2uk4l_341",db="_menuOverlayTitle_2uk4l_351",mb="_menuOverlayBody_2uk4l_357",fb="_menuSeparator_2uk4l_408",pb="_icon_2uk4l_98",hb="_tooltip_2uk4l_276",gb="_tooltipElevated_2uk4l_493",X={toolbar:$g,menuBar:Ug,menuBarDesktop:Wg,brandMark:Gg,brandMarkIcon:Vg,menuBarCompact:qg,menuWrap:Xg,menuButton:Yg,iconButton:Jg,menuItem:Zg,hamburgerButton:Qg,iconNav:eb,iconNavMain:tb,iconNavEnd:nb,iconGroup:rb,tooltipTrigger:ob,menu:ib,submenuWrap:ab,submenu:lb,submenuTrigger:sb,menuOverlay:cb,menuOverlayHeader:ub,menuOverlayTitle:db,menuOverlayBody:mb,menuSeparator:fb,icon:pb,tooltip:hb,tooltipElevated:gb},bb=400,wl=6,$o=4;function mt({label:e,children:t,className:n,elevated:r}){const i=s.useRef(null),a=s.useRef(null),l=s.useRef(null),c=s.useRef(!1),m=s.useRef(!1),[p,b]=s.useState(!1),[h,w]=s.useState({top:0,left:0}),y=s.useCallback(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),v=s.useCallback(g=>{if(!(c.current||m.current)){y(),b(!1);return}if(g||m.current){y(),b(!0);return}y(),l.current=setTimeout(()=>{l.current=null,b(!0)},bb)},[y]),x=s.useCallback(()=>{const g=i.current,S=a.current;if(!g||!S)return;const A=g.getBoundingClientRect(),N=S.offsetWidth,E=S.offsetHeight;let L=A.bottom+wl;L+E>window.innerHeight-$o&&(L=A.top-wl-E);let M=A.left+A.width/2-N/2;M=Math.min(Math.max(M,$o),window.innerWidth-N-$o),w({top:L,left:M})},[]);s.useEffect(()=>()=>y(),[y]),s.useEffect(()=>{const g=i.current;if(!g)return;const S=()=>{m.current=!0,v(!0)},A=()=>{m.current=!1,v(!1)};return g.addEventListener("focusin",S),g.addEventListener("focusout",A),()=>{g.removeEventListener("focusin",S),g.removeEventListener("focusout",A)}},[v]),s.useLayoutEffect(()=>{if(!p)return;x();const g=()=>x();return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[p,e,x]);const k=n?`${X.tooltipTrigger} ${n}`:X.tooltipTrigger;return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:i,className:k,"data-tooltip-trigger":"",onMouseEnter:()=>{c.current=!0,v(!1)},onMouseLeave:()=>{c.current=!1,v(!1)},children:t}),p?o.jsx(ie,{children:o.jsx("span",{ref:a,className:r?`${X.tooltip} ${X.tooltipElevated}`:X.tooltip,"data-toolbar-tooltip":"",style:{top:h.top,left:h.left},"aria-hidden":"true",children:e})}):null]})}const yb="_wrap_1097y_1",xb="_wrapToolbar_1097y_7",wb="_field_1097y_12",vb="_trigger_1097y_20",Sb="_chevron_1097y_50",Cb="_list_1097y_73",kb="_listInline_1097y_88",Db="_option_1097y_96",Pb="_separator_1097y_125",$e={wrap:yb,wrapToolbar:xb,field:wb,trigger:vb,chevron:Sb,list:Cb,listInline:kb,option:Db,separator:Pb};function Ab({value:e,mixed:t=!1,fonts:n,disabled:r,listId:i,listRef:a,inline:l,style:c,onSelect:m}){const p=V(),b=!t&&e===null;return o.jsxs("ul",{ref:a,id:i,className:l?`${$e.list} ${$e.listInline}`:$e.list,role:"listbox","aria-label":p("commandFontFamilyAria"),style:c,children:[o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:$e.option,role:"option","aria-checked":b,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>m(null),children:p("fontFamilyDefault")})}),o.jsx("li",{className:$e.separator,role:"separator"}),n.map(h=>{const w=!t&&kn(e,h.family);return o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:$e.option,role:"option","aria-checked":w,disabled:r,style:{fontFamily:h.family},onMouseDown:y=>y.preventDefault(),onClick:()=>m(h.family),children:h.name})},h.family)})]})}function jb(e,t,n,r){var i;return t?"":e===null?r:((i=md(e,n))==null?void 0:i.name)??e}const lr=4;function jc({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:i,toolbar:a=!1,triggerId:l,onChange:c}){const m=V(),p=s.useId(),b=s.useRef(null),h=s.useRef(null),w=s.useRef(null),[y,v]=s.useState(!1),[x,k]=s.useState({top:0,left:0,width:0}),g=jb(e,t,n,m("fontFamilyDefault")),S=s.useCallback(()=>{const N=h.current,E=w.current;if(!N)return;const L=N.getBoundingClientRect(),M=(E==null?void 0:E.offsetHeight)??0,I=Math.max(L.width,(E==null?void 0:E.offsetWidth)??0);let j=L.bottom;j+M>window.innerHeight-lr&&(j=Math.max(lr,L.top-M));const T=Math.min(Math.max(L.left,lr),window.innerWidth-I-lr);k({top:j,left:T,width:I})},[]);s.useLayoutEffect(()=>{if(!y)return;S();const N=()=>S();return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[y,S,n.length]),s.useEffect(()=>{if(!y)return;const N=L=>{var I,j;const M=L.target;(I=b.current)!=null&&I.contains(M)||(j=w.current)!=null&&j.contains(M)||v(!1)},E=L=>{L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),v(!1))};return document.addEventListener("pointerdown",N),document.addEventListener("keydown",E,!0),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",E,!0)}},[y]);const A=o.jsxs("div",{className:`${$e.wrap}${a?` ${$e.wrapToolbar}`:""}`,ref:b,children:[o.jsxs("div",{className:$e.field,ref:h,children:[o.jsx("button",{type:"button",id:l,className:$e.trigger,disabled:r,"aria-label":a?m("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":y,"aria-controls":y?p:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:N=>N.preventDefault(),onClick:()=>v(N=>!N),children:g}),o.jsx("span",{className:$e.chevron,"aria-hidden":"true"})]}),y?o.jsx(ie,{children:o.jsx(Ab,{listRef:w,listId:p,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:x.top,left:x.left,minWidth:x.width},onSelect:N=>{c(N),v(!1)}})}):null]});return i?o.jsx(mt,{label:i,children:A}):A}function Eb({commands:e,queries:t,disabled:n}){const r=V(),i=!!(n||!t.isVisualMode());return o.jsx(jc,{family:t.isFontFamilyMixed()?null:t.getFontFamily(),mixed:t.isFontFamilyMixed(),fonts:t.getFontFaces(),disabled:i,tooltip:r("commandFontFamily"),toolbar:!0,onChange:a=>{e.setFontFamily(a)}})}const Tb="_wrap_192bz_1",Nb="_wrapToolbar_192bz_9",Lb="_field_192bz_14",Mb="_input_192bz_22",Rb="_toggle_192bz_41",_b="_chevron_192bz_42",Ib="_unit_192bz_80",Fb="_list_192bz_110",Bb="_option_192bz_125",pe={wrap:Tb,wrapToolbar:Nb,field:Lb,input:Mb,toggle:Rb,chevron:_b,unit:Ib,list:Fb,option:Bb},sr=4,Hb={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Ec({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:i,tooltip:a,sizeInputId:l,toolbar:c=!1}){const m=V(),p=s.useId(),b=s.useRef(null),h=s.useRef(null),w=s.useRef(null),[y,v]=s.useState(()=>e===null?"":J(e)),[x,k]=s.useState(!1),[g,S]=s.useState(!1),[A,N]=s.useState({top:0,left:0,width:0});s.useEffect(()=>{x||v(e===null?"":J(e))},[e,x]);const E=s.useCallback(()=>{const T=h.current,P=w.current;if(!T)return;const R=T.getBoundingClientRect(),W=(P==null?void 0:P.offsetHeight)??0;let O=R.bottom;O+W>window.innerHeight-sr&&(O=Math.max(sr,R.top-W));const Z=Math.min(Math.max(R.left,sr),window.innerWidth-Math.max(R.width,72)-sr);N({top:O,left:Z,width:R.width})},[]);s.useLayoutEffect(()=>{if(!g)return;E();const T=()=>E();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[g,E]),s.useEffect(()=>{if(!g)return;const T=R=>{var O,Z;const W=R.target;(O=b.current)!=null&&O.contains(W)||(Z=w.current)!=null&&Z.contains(W)||S(!1)},P=R=>{R.key==="Escape"&&(R.preventDefault(),R.stopPropagation(),S(!1))};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",P,!0),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",P,!0)}},[g]);const L=T=>{const P=qd(T,t);if(!P){v(e===null?"":J(e));return}n(P.value,P.unit),v(J(P.value))},M=Ud[t],I=g?o.jsx(ie,{children:o.jsx("ul",{ref:w,className:pe.list,role:"listbox",id:p,style:{top:A.top,left:A.left,minWidth:A.width},children:M.map(T=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:pe.option,role:"option","aria-selected":e===T,onMouseDown:P=>P.preventDefault(),onClick:()=>{n(T,t),v(J(T)),S(!1)},children:J(T)})},T))})}):null,j=o.jsxs("div",{className:`${pe.wrap}${c?` ${pe.wrapToolbar}`:""}`,ref:b,children:[o.jsxs("div",{className:pe.field,ref:h,children:[o.jsx("input",{id:l,className:pe.input,value:y,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":g,"aria-controls":p,role:"combobox",inputMode:"decimal",onFocus:()=>k(!0),onBlur:()=>{k(!1),L(y)},onChange:T=>v(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.preventDefault(),L(y),S(!1),T.currentTarget.blur()),T.key==="ArrowDown"&&(T.preventDefault(),S(!0))}}),o.jsx("button",{type:"button",className:pe.toggle,tabIndex:-1,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-expanded":g,"aria-controls":p,onMouseDown:T=>T.preventDefault(),onClick:()=>S(T=>!T)})]}),o.jsxs("div",{className:pe.field,children:[o.jsx("select",{className:pe.unit,value:t,disabled:i,"aria-label":m("commandFontSizeUnitAria"),onChange:T=>{r(T.target.value)},children:Ci.map(T=>o.jsx("option",{value:T,children:m(Hb[T])},T))}),o.jsx("span",{className:pe.chevron,"aria-hidden":"true"})]}),I]});return a?o.jsx(mt,{label:a,children:j}):j}const zb="_backdrop_mi7ap_1",Ob="_dialog_mi7ap_12",Kb="_dialogWide_mi7ap_28",$b="_header_mi7ap_32",Ub="_tabs_mi7ap_39",Wb="_tab_mi7ap_39",Gb="_body_mi7ap_71",Vb="_field_mi7ap_79",qb="_label_mi7ap_85",Xb="_sizeRow_mi7ap_89",Yb="_fileRow_mi7ap_95",Jb="_fileName_mi7ap_101",Zb="_marks_mi7ap_108",Qb="_mark_mi7ap_108",ey="_actions_mi7ap_123",ty="_actionsSpread_mi7ap_130",ny="_actionsEnd_mi7ap_134",ry="_headerRow_mi7ap_139",oy="_close_mi7ap_151",iy="_nameSection_mi7ap_168",ay="_nameInput_mi7ap_172",ly="_labelRow_mi7ap_189",sy="_help_mi7ap_195",cy="_textInput_mi7ap_213",uy="_fullSelect_mi7ap_225",dy="_error_mi7ap_229",my="_emptyHint_mi7ap_234",fy="_action_mi7ap_123",py="_textarea_mi7ap_245",hy="_actionDanger_mi7ap_259",gy="_confirmBody_mi7ap_265",by="_nestedPanel_mi7ap_273",yy="_spinnerWrap_mi7ap_284",xy="_spinner_mi7ap_284",wy="_actionPrimary_mi7ap_319",vy="_iconButton_mi7ap_333",Sy="_select_mi7ap_334",Cy="_lengthInput_mi7ap_335",ky="_lengthUnit_mi7ap_336",Dy="_group_mi7ap_344",Py="_nestedGroup_mi7ap_354",Ay="_subLabel_mi7ap_364",jy="_iconRow_mi7ap_368",Ey="_lengthField_mi7ap_400",Ty="_sideLabel_mi7ap_406",Ny="_lengthRow_mi7ap_410",Ly="_sideGrid_mi7ap_438",My="_shadowGrid_mi7ap_439",d={backdrop:zb,dialog:Ob,dialogWide:Kb,header:$b,tabs:Ub,tab:Wb,body:Gb,field:Vb,label:qb,sizeRow:Xb,fileRow:Yb,fileName:Jb,marks:Zb,mark:Qb,actions:ey,actionsSpread:ty,actionsEnd:ny,headerRow:ry,close:oy,nameSection:iy,nameInput:ay,labelRow:ly,help:sy,textInput:cy,fullSelect:uy,error:dy,emptyHint:my,action:fy,textarea:py,actionDanger:hy,confirmBody:gy,nestedPanel:by,spinnerWrap:yy,spinner:xy,actionPrimary:wy,iconButton:vy,select:Sy,lengthInput:Cy,lengthUnit:ky,group:Dy,nestedGroup:Py,subLabel:Ay,iconRow:jy,lengthField:Ey,sideLabel:Ty,lengthRow:Ny,sideGrid:Ly,shadowGrid:My},Ry={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function Gi({tab:e,value:t,fonts:n,disabled:r,onTabChange:i,onChange:a}){const l=V(),c=s.useId(),m=s.useId(),p=n??ss(),b=Ko.find(h=>h.id===e)??Ko[0];return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("fontDialogTitle"),children:Ko.map(h=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":h.id===e,disabled:!h.implemented,onClick:()=>i(h.id),children:l(h.labelKey)},h.id))}),o.jsx("div",{className:d.body,role:"tabpanel",children:b.implemented?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("fontDialogFamily")}),o.jsx(jc,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:p,disabled:r,triggerId:m,onChange:h=>{a({...t,fontFamily:h,fontFamilyMixed:!1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:c,children:l("fontDialogSize")}),o.jsx("div",{className:d.sizeRow,children:o.jsx(Ec,{size:t.size,unit:t.unit,sizeInputId:c,disabled:r,onSizeChange:(h,w)=>{a({...t,size:h,unit:w})},onUnitChange:h=>{const w=t.size!==null?ms(t.size,t.unit,h,16,16):t.size;a({...t,size:w,unit:h})}})})]}),o.jsx("div",{className:d.field,children:o.jsx(Fe,{label:l("commandFontColor"),noneLabel:l("colorAutomatic"),value:t.fontColor,mixed:t.fontColorMixed,disabled:r,onChange:h=>{a({...t,fontColor:h,fontColorMixed:!1})}})}),o.jsx("div",{className:d.field,children:o.jsx(Fe,{label:l("commandHighlightColor"),noneLabel:l("colorNone"),value:t.highlightColor,mixed:t.highlightColorMixed,disabled:r,fallbackCustom:"#ffff00",onChange:h=>{a({...t,highlightColor:h,highlightColorMixed:!1})}})}),o.jsxs("fieldset",{className:d.marks,children:[o.jsx("legend",{className:d.label,children:l("fontDialogStyle")}),Ue.map(h=>o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.marks[h],disabled:r,onChange:()=>{a({...t,marks:{...t.marks,[h]:!t.marks[h]}})}}),l(Ry[h].label)]},h))]})]}):null})]})}const vl='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function _y({open:e,tab:t,size:n,unit:r,marks:i,fontFamily:a=null,fontFamilyMixed:l=!1,fontColor:c,fontColorMixed:m=!1,highlightColor:p,highlightColorMixed:b=!1,fonts:h,disabled:w,onTabChange:y,onApply:v,onClose:x}){const k=V(),g=s.useId(),S=s.useRef(null),[A,N]=s.useState({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:c,highlightColor:p,fontColorMixed:m,highlightColorMixed:b});return s.useEffect(()=>{e&&N({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:c,highlightColor:p,fontColorMixed:m,highlightColorMixed:b})},[e,n,r,i,a,l,c,m,p,b]),s.useEffect(()=>{if(!e)return;const E=S.current,L=E==null?void 0:E.querySelector(vl);L==null||L.focus();const M=I=>{if(I.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;I.preventDefault(),I.stopPropagation(),x();return}if(I.key!=="Tab"||!E)return;const j=[...E.querySelectorAll(vl)];if(j.length===0)return;const T=j[0],P=j[j.length-1];I.shiftKey&&document.activeElement===T?(I.preventDefault(),P.focus()):!I.shiftKey&&document.activeElement===P&&(I.preventDefault(),T.focus())};return document.addEventListener("keydown",M,!0),()=>document.removeEventListener("keydown",M,!0)},[e,x]),e?o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:x,children:o.jsxs("div",{ref:S,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":g,onMouseDown:E=>E.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:g,children:k("fontDialogTitle")}),o.jsx(Gi,{tab:t,value:A,fonts:h,disabled:w,onTabChange:y,onChange:N}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:x,children:k("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:w,onClick:()=>v(A),children:k("fontDialogOk")})]})]})})}):null}const Iy={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function ge({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:i,inputId:a,onChange:l}){const c=V(),m=s.useId(),p=a??m,b=(t==null?void 0:t.unit)??zs,[h,w]=s.useState(()=>t?J(t.value):""),[y,v]=s.useState(!1);s.useEffect(()=>{y||w(t?J(t.value):"")},[t,y]);const x=k=>{const g=k.trim();if(!g){l(null),w("");return}const S=Sr(g,b,r);if(!S){w(t?J(t.value):"");return}l(S),w(J(S.value))};return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:p,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:p,className:d.lengthInput,value:h,disabled:n,inputMode:"decimal",onFocus:()=>v(!0),onBlur:()=>{v(!1),x(h)},onChange:k=>w(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),x(h),k.currentTarget.blur())}}),o.jsx("select",{className:d.lengthUnit,value:b,disabled:n,"aria-label":i??c("paragraphDialogLengthUnitAria"),onChange:k=>{const g=k.target.value;if(t){l({value:t.value,unit:g});return}if(h.trim()){const S=Sr(h,g,r);l(S)}},children:Ci.map(k=>o.jsx("option",{value:k,children:c(Iy[k])},k))})]})]})}function Vi({shadow:e,disabled:t,onChange:n}){const r=V();return o.jsxs("div",{className:d.shadowGrid,children:[o.jsx(ge,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetX:i??{value:0,unit:"px"}})}}),o.jsx(ge,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetY:i??{value:0,unit:"px"}})}}),o.jsx(ge,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:i=>{n({...e,blur:i??{value:0,unit:"px"}})}}),o.jsx(ge,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:i=>{n({...e,spread:i??{value:0,unit:"px"}})}}),o.jsx(Fe,{label:r("paragraphDialogShadowColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:i=>{n({...e,color:i})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:e.inset,disabled:t,onChange:()=>{n({...e,inset:!e.inset})}}),r("paragraphDialogShadowInset")]})]})}const Sl=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0}],Fy={left:hi,center:pi,right:gi,justify:Wl},By={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},Hy={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},zy={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},Oy={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},Ky={value:1,unit:"pt"},$y={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function fn(e){return{top:e,right:e,bottom:e,left:e}}function Cl(e){for(const t of Xe)if(e[t])return e[t];return null}function qi({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:i="paragraphDialogTitle",onTabChange:a,onChange:l}){const c=V(),m=r?Sl.filter(x=>r.includes(x.id)):Sl,p=s.useId(),[b,h]=s.useState(()=>nt(t.margin,fn(t.margin.top))),[w,y]=s.useState(()=>nt(t.padding,fn(t.padding.top))),v=(x,k,g,S)=>{const A=t[x],N=k?fn(S):{...A,[g]:S};l({...t,[x]:N,[`${x}Mixed`]:!1})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":c(i),children:m.map(x=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":x.id===e,disabled:!x.implemented,onClick:()=>a(x.id),children:c(x.labelKey)},x.id))}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[e==="general"?o.jsxs(o.Fragment,{children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":c("paragraphDialogAlignment"),children:Js.map(x=>{const k=Fy[x],g=!t.alignMixed&&t.align===x;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":g,"aria-label":c(By[x].aria),disabled:n,onClick:()=>{l({...t,align:x,alignMixed:!1})},children:o.jsx(k,{})},x)})})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogLists")}),o.jsxs("div",{className:d.iconRow,children:[o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ul","aria-label":c("commandBulletListAria"),disabled:n,onClick:()=>{const x=!t.listMixed&&t.list==="ul"?null:"ul";l({...t,list:x,listMixed:!1})},children:o.jsx(Gl,{})}),o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":c("commandNumberedListAria"),disabled:n,onClick:()=>{const x=!t.listMixed&&t.list==="ol"?null:"ol";l({...t,list:x,listMixed:!1})},children:o.jsx(Yl,{})})]})]})]}):null,e==="spacing"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogSpacing")}),o.jsx(kl,{legend:c("paragraphDialogMargin"),sides:t.margin,linked:b,disabled:n,allowNegative:!0,onLinkedChange:x=>{h(x),x&&l({...t,margin:fn(Cl(t.margin)),marginMixed:!1})},onSideChange:(x,k)=>v("margin",b,x,k)}),o.jsx(kl,{legend:c("paragraphDialogPadding"),sides:t.padding,linked:w,disabled:n,onLinkedChange:x=>{y(x),x&&l({...t,padding:fn(Cl(t.padding)),paddingMixed:!1})},onSideChange:(x,k)=>v("padding",w,x,k)}),o.jsx(Wy,{value:t.lineHeight,disabled:n,onChange:x=>{l({...t,lineHeight:x,lineHeightMixed:!1})}})]}):null,e==="border"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:c("paragraphDialogBorderStyle")}),o.jsx("select",{id:p,className:d.select,value:t.border.style,disabled:n,onChange:x=>{const k=x.target.value;l({...t,border:{style:k,width:k==="none"?null:t.border.width??Ky,color:k==="none"?null:t.border.color},borderMixed:!1})},children:Lr.map(x=>o.jsx("option",{value:x,children:c(zy[x])},x))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(ge,{label:c("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:x=>{l({...t,border:{...t.border,width:x},borderMixed:!1})}}),o.jsx(Fe,{label:c("paragraphDialogBorderColor"),noneLabel:c("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:x=>{l({...t,border:{...t.border,color:x},borderMixed:!1})}})]}):null,o.jsx(ge,{label:c("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:x=>{l({...t,borderRadius:x,radiusMixed:!1})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{l({...t,boxShadow:t.boxShadow?null:$y,shadowMixed:!1})}}),c("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(Vi,{shadow:t.boxShadow,disabled:n,onChange:x=>{l({...t,boxShadow:x,shadowMixed:!1})}}):null]}):null,e==="background"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:c("paragraphDialogTabBackground")}),o.jsx(Fe,{label:c("paragraphDialogBackgroundColor"),noneLabel:c("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:x=>{l({...t,backgroundColor:x,backgroundMixed:!1})}}),o.jsx(Uy,{value:t.opacity,disabled:n,onChange:x=>{l({...t,opacity:x,opacityMixed:!1})}})]}):null]})]})}function Uy({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),a=e===null?null:Cr(e),[l,c]=s.useState(()=>a===null?"":J(a)),[m,p]=s.useState(!1);s.useEffect(()=>{m||c(a===null?"":J(a))},[a,m]);const b=h=>{const w=h.trim();if(!w){n(null),c("");return}const y=Number(w.replace(",","."));if(!Number.isFinite(y)){c(a===null?"":J(a));return}const v=Us(y);n(v),c(J(Cr(v)))};return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogOpacity")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:l,disabled:t,inputMode:"decimal",onFocus:()=>p(!0),onChange:h=>c(h.target.value),onBlur:()=>{p(!1),b(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function kl({legend:e,sides:t,linked:n,disabled:r,allowNegative:i=!1,onLinkedChange:a,onSideChange:l}){const c=V(),m=n?["top"]:Xe;return o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:e}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:()=>a(!n)}),c("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:m.map(p=>o.jsx(ge,{label:n?e:c(Hy[p]),value:t[p],disabled:r,allowNegative:i,onChange:b=>l(p,b)},p))})]})}function Wy({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),a=Gy(e),l=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[c,m]=s.useState(()=>l===null?"":J(l)),p=(e==null?void 0:e.kind)==="length"?e.unit:zs;return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogLineHeight")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:a==="normal"?"":c,disabled:t||a==="normal",inputMode:"decimal",onChange:b=>m(b.target.value),onBlur:()=>{const b=c.trim();if(!b){n(null);return}if(a==="number"||a==="empty"){const w=Number(b.replace(",","."));if(!Number.isFinite(w)||w<0){m(l===null?"":J(l));return}n({kind:"number",value:w}),m(J(w));return}const h=Sr(b,p,!1);if(!h){m(l===null?"":J(l));return}n({kind:"length",value:h.value,unit:h.unit}),m(J(h.value))}}),o.jsxs("select",{className:d.lengthUnit,value:a==="length"?p:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:b=>{const h=b.target.value;if(h==="empty"){n(null),m("");return}if(h==="normal"){n({kind:"normal"}),m("");return}if(h==="number"){const x=Number((c||"1.5").replace(",",".")),k=Number.isFinite(x)&&x>=0?x:1.5;n({kind:"number",value:k}),m(J(k));return}const w=h,y=Sr(c||"1",w,!1),v=(y==null?void 0:y.value)??1;n({kind:"length",value:v,unit:w}),m(J(v))},children:[o.jsx("option",{value:"empty"}),o.jsx("option",{value:"normal",children:r("paragraphDialogLineHeightNormal")}),o.jsx("option",{value:"number",children:r("paragraphDialogLineHeightUnitless")}),["pt","px","em","rem","%"].map(b=>o.jsx("option",{value:b,children:r(Oy[b])},b))]})]})]})}function Gy(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}const Dl='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function Vy({open:e,tab:t,value:n,disabled:r,onTabChange:i,onApply:a,onClose:l}){const c=V(),m=s.useId(),p=s.useRef(null),[b,h]=s.useState(n);return s.useEffect(()=>{e&&h(n)},[e,n]),s.useEffect(()=>{if(!e)return;const w=p.current,y=w==null?void 0:w.querySelector(Dl);y==null||y.focus();const v=x=>{if(x.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;x.preventDefault(),x.stopPropagation(),l();return}if(x.key!=="Tab"||!w)return;const k=[...w.querySelectorAll(Dl)];if(k.length===0)return;const g=k[0],S=k[k.length-1];x.shiftKey&&document.activeElement===g?(x.preventDefault(),S.focus()):!x.shiftKey&&document.activeElement===S&&(x.preventDefault(),g.focus())};return document.addEventListener("keydown",v,!0),()=>document.removeEventListener("keydown",v,!0)},[e,l]),e?o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:l,children:o.jsxs("div",{ref:p,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":m,onMouseDown:w=>w.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:m,children:c("paragraphDialogTitle")}),o.jsx(qi,{tab:t,value:b,disabled:r,onTabChange:i,onChange:h}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:l,children:c("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:r,onClick:()=>a(b),children:c("fontDialogOk")})]})]})})}):null}const qy=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0}],Pl='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',Xy=qy.map(e=>e.id);function Yy(e){return{...hn(),...e}}function Jy(e){const{align:t,alignMixed:n,list:r,listMixed:i,...a}=e;return a}function Zy({open:e,tab:t,value:n,fonts:r,disabled:i,onTabChange:a,onApply:l,onClose:c}){const m=V(),p=s.useId(),b=s.useRef(null),[h,w]=s.useState("general"),[y,v]=s.useState("spacing"),[x,k]=s.useState(n.font),[g,S]=s.useState(n.box);if(s.useEffect(()=>{e&&(w("general"),v("spacing"),k(n.font),S(n.box))},[e,n]),s.useEffect(()=>{if(!e)return;const N=b.current,E=N==null?void 0:N.querySelector(Pl);E==null||E.focus();const L=M=>{if(M.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;M.preventDefault(),M.stopPropagation(),c();return}if(M.key!=="Tab"||!N)return;const I=[...N.querySelectorAll(Pl)];if(I.length===0)return;const j=I[0],T=I[I.length-1];M.shiftKey&&document.activeElement===j?(M.preventDefault(),T.focus()):!M.shiftKey&&document.activeElement===T&&(M.preventDefault(),j.focus())};return document.addEventListener("keydown",L,!0),()=>document.removeEventListener("keydown",L,!0)},[e,c]),!e)return null;const A=m("pageDialogTitle");return o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:c,children:o.jsxs("div",{ref:b,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":p,onMouseDown:N=>N.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:p,children:A}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":A,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="font",onClick:()=>a("font"),children:m("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="paragraph",onClick:()=>a("paragraph"),children:m("customStyleDialogTabParagraph")})]}),t==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(Gi,{tab:h,value:x,fonts:r,disabled:i,onTabChange:w,onChange:k})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(qi,{tab:y,value:Yy(g),disabled:i,tabs:Xy,tablistLabelKey:"pageDialogTitle",onTabChange:N=>{N!=="general"&&v(N)},onChange:N=>S(Jy(N))})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:c,children:m("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>l({font:x,box:g}),children:m("fontDialogOk")})]})]})})})}const Al='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function Qy(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function jl(e){return{size:e.size,unit:e.unit,marks:e.marks,fontFamily:e.fontFamily??null,fontFamilyMixed:!1,fontColor:e.fontColor,highlightColor:e.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}}function ex(e){return{size:e.size,unit:e.unit,marks:e.marks,fontFamily:e.fontFamilyMixed?null:e.fontFamily,fontColor:e.fontColorMixed?null:e.fontColor,highlightColor:e.highlightColorMixed?null:e.highlightColor}}function tx({open:e,mode:t,styleId:n,name:r="",font:i,paragraph:a,canDelete:l=!1,busy:c,disabled:m,fonts:p,defaultOuterTab:b="font",onSave:h,onDelete:w,onClose:y}){const v=V(),x=s.useId(),k=s.useId(),g=s.useRef(null),[S,A]=s.useState(r),[N,E]=s.useState(b),[L,M]=s.useState("general"),[I,j]=s.useState("general"),[T,P]=s.useState(()=>jl(i)),[R,W]=s.useState(()=>ni(a)),[O,Z]=s.useState(!1);if(s.useEffect(()=>{e&&(A(r),E(b),M("general"),j("general"),P(jl(i)),W(ni(a)),Z(!1))},[e,r,i,a,b]),s.useEffect(()=>{if(!e)return;const ne=g.current,Q=ne==null?void 0:ne.querySelector(Al);Q==null||Q.focus();const D=$=>{if($.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;if($.preventDefault(),$.stopPropagation(),O){Z(!1);return}y();return}if($.key!=="Tab"||!ne)return;const Y=[...ne.querySelectorAll(Al)];if(Y.length===0)return;const B=Y[0],fe=Y[Y.length-1];$.shiftKey&&document.activeElement===B?($.preventDefault(),fe.focus()):!$.shiftKey&&document.activeElement===fe&&($.preventDefault(),B.focus())};return document.addEventListener("keydown",D,!0),()=>document.removeEventListener("keydown",D,!0)},[e,y,O]),!e)return null;const te=v(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),ce=S.trim().length>0,re=!!(m||c),he=()=>{const ne=S.trim();ne&&h({id:n??Qy(),name:ne,font:ex(T),paragraph:tc(R)})};return o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:y,children:o.jsxs("div",{ref:g,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":x,"aria-busy":c||void 0,onMouseDown:ne=>ne.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:x,children:te}),o.jsx("button",{type:"button",className:d.close,"aria-label":v("customStyleDialogCloseAria"),onClick:y,children:o.jsx(We,{})})]}),O?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.confirmBody,children:v("customStyleDialogDeleteConfirm")}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:re,onClick:()=>Z(!1),children:v("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:re||!n,onClick:()=>{n&&(w==null||w(n))},children:v("customStyleDialogDelete")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.nameSection,children:o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:k,children:v("customStyleDialogName")}),o.jsx("input",{id:k,className:d.nameInput,value:S,disabled:re,onChange:ne=>A(ne.target.value)})]})}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":te,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="font",onClick:()=>E("font"),children:v("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="paragraph",onClick:()=>E("paragraph"),children:v("customStyleDialogTabParagraph")})]}),N==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(Gi,{tab:L,value:T,fonts:p,disabled:re,onTabChange:M,onChange:P})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(qi,{tab:I,value:R,disabled:re,onTabChange:j,onChange:W})}),o.jsxs("div",{className:t==="edit"&&l?`${d.actions} ${d.actionsSpread}`:d.actions,children:[t==="edit"&&l?o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:re,onClick:()=>Z(!0),children:v("customStyleDialogDelete")}):null,o.jsxs("div",{className:d.actionsEnd,children:[o.jsx("button",{type:"button",className:d.action,onClick:y,children:v("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:re||!ce,onClick:he,children:v("fontDialogOk")})]})]})]})]})})})}const El='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',nx={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function rx({open:e,existingIds:t,disabled:n,onApply:r,onClose:i}){const a=V(),l=s.useId(),c=s.useId(),m=s.useId(),p=s.useRef(null),[b,h]=s.useState(""),[w,y]=s.useState(!1),v=s.useMemo(()=>new Set(t),[t]),x=ac(b,v);if(s.useEffect(()=>{e&&(h(""),y(!1))},[e]),s.useEffect(()=>{if(!e)return;const A=p.current,N=A==null?void 0:A.querySelector(El);N==null||N.focus();const E=L=>{if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),i();return}if(L.key!=="Tab"||!A)return;const M=[...A.querySelectorAll(El)];if(M.length===0)return;const I=M[0],j=M[M.length-1];L.shiftKey&&document.activeElement===I?(L.preventDefault(),j.focus()):!L.shiftKey&&document.activeElement===j&&(L.preventDefault(),I.focus())};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[e,i]),!e)return null;const k=w||b.trim().length>0?x:null,g=x===null&&!n,S=()=>{y(!0),!(x||n)&&r(b.trim())};return o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:p,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:A=>A.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("bookmarkDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:i,children:o.jsx(We,{})})]}),o.jsx("div",{className:d.body,children:o.jsxs("div",{className:d.field,children:[o.jsxs("div",{className:d.labelRow,children:[o.jsx("label",{className:d.label,htmlFor:c,children:a("bookmarkDialogName")}),o.jsx(mt,{label:a("bookmarkDialogHelp"),elevated:!0,children:o.jsx("button",{type:"button",className:d.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),o.jsx("input",{id:c,className:d.textInput,value:b,disabled:n,"aria-invalid":k!==null,"aria-describedby":k?m:void 0,onChange:A=>h(A.target.value)}),k?o.jsx("p",{id:m,className:d.error,children:a(nx[k])}):null]})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!g,onClick:S,children:a("fontDialogOk")})]})]})})})}const Tl='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',ox={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},ix={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function ax({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=V(),c=s.useId(),m=s.useId(),p=s.useId(),b=s.useId(),h=s.useId(),w=s.useRef(null),y=s.useRef(null),[v,x]=s.useState("file"),[k,g]=s.useState(""),[S,A]=s.useState(""),[N,E]=s.useState(""),[L,M]=s.useState(""),[I,j]=s.useState(""),[T,P]=s.useState(null),[R,W]=s.useState(!1);if(s.useEffect(()=>{e&&(x("file"),g(""),A(""),E(""),M(""),j(""),P(null),W(!1),y.current&&(y.current.value=""))},[e]),s.useEffect(()=>{if(!e)return;const Q=w.current,D=Q==null?void 0:Q.querySelector(Tl);D==null||D.focus();const $=Y=>{if(Y.key==="Escape"){Y.preventDefault(),Y.stopPropagation(),a();return}if(Y.key!=="Tab"||!Q)return;const B=[...Q.querySelectorAll(Tl)];if(B.length===0)return;const fe=B[0],ue=B[B.length-1];Y.shiftKey&&document.activeElement===fe?(Y.preventDefault(),ue.focus()):!Y.shiftKey&&document.activeElement===ue&&(Y.preventDefault(),fe.focus())};return document.addEventListener("keydown",$,!0),()=>document.removeEventListener("keydown",$,!0)},[e,a]),!e)return null;const O=v==="file"?S:v==="url"?k:"",Z=v==="custom"?null:Oi(O),te=v==="custom"?null:v==="file"&&T?ix[T]:Z&&(v==="file"||k.trim().length>0)?ox[Z]:null,ce=v!=="custom"&&Z===null&&!(v==="file"&&T)&&!t&&!R,re=()=>{t||!n||i==null||i()},he=()=>{ce&&r({src:O.trim(),alt:L.trim(),title:I.trim()})},ne=Q=>{var $;const D=($=Q.target.files)==null?void 0:$[0];D&&(W(!0),P(null),Cp(D).then(Y=>{A(Y),E(D.name),x("file"),W(!1)},Y=>{const B=Y instanceof Error?Y.message:"";A(""),E(""),x("file"),P(B==="tooLarge"||B==="type"?B:"type"),W(!1),y.current&&(y.current.value="")}))};return o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:w,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":c,onMouseDown:Q=>Q.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:c,children:l("imageDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("imageDialogCloseAria"),onClick:a,children:o.jsx(We,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("imageDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("imageDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":v==="file",disabled:t,onClick:()=>x("file"),children:l("imageDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":v==="url",disabled:t,onClick:()=>x("url"),children:l("imageDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":v==="custom",disabled:t,onClick:()=>x("custom"),children:n.text}):null]}),v==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:y,type:"file",accept:gp,hidden:!0,disabled:t,"aria-label":l("imageDialogChooseFile"),onChange:ne}),o.jsx("button",{type:"button",className:d.action,disabled:t||R,onClick:()=>{var Q;return(Q=y.current)==null?void 0:Q.click()},children:l("imageDialogChooseFile")}),N?o.jsx("span",{className:d.fileName,children:N}):null]}):null,v==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("imageDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:k,disabled:t,"aria-invalid":te!==null,"aria-describedby":te?h:void 0,onChange:Q=>g(Q.target.value)})]}):null,v==="custom"&&n?o.jsxs("div",{className:d.field,children:[o.jsx("p",{className:d.emptyHint,children:n.description}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:re,children:n.buttonCaption})]}):null]}),v!=="custom"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("imageDialogAlt")}),o.jsx("input",{id:p,className:d.textInput,value:L,disabled:t,onChange:Q=>M(Q.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:b,children:l("imageDialogTitleField")}),o.jsx("input",{id:b,className:d.textInput,value:I,disabled:t,onChange:Q=>j(Q.target.value)})]})]}):null,te?o.jsx("p",{id:h,className:d.error,children:l(te)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),v!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!ce,onClick:he,children:l("fontDialogOk")}):null]})]})})})}const cr=4,lx={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function Nl({label:e,inputAria:t,value:n,disabled:r,onChange:i}){const a=V(),l=s.useId(),c=s.useId(),m=s.useRef(null),p=s.useRef(null),b=s.useRef(null),h=(n==null?void 0:n.unit)??Op,[w,y]=s.useState(()=>n?J(n.value):""),[v,x]=s.useState(!1),[k,g]=s.useState(!1),[S,A]=s.useState({top:0,left:0,width:0});s.useEffect(()=>{v||y(n?J(n.value):"")},[n,v]);const N=s.useCallback(()=>{const j=p.current,T=b.current;if(!j)return;const P=j.getBoundingClientRect(),R=(T==null?void 0:T.offsetHeight)??0;let W=P.bottom;W+R>window.innerHeight-cr&&(W=Math.max(cr,P.top-R));const O=Math.min(Math.max(P.left,cr),window.innerWidth-Math.max(P.width,72)-cr);A({top:W,left:O,width:P.width})},[]);s.useLayoutEffect(()=>{if(!k)return;N();const j=()=>N();return window.addEventListener("scroll",j,!0),window.addEventListener("resize",j),()=>{window.removeEventListener("scroll",j,!0),window.removeEventListener("resize",j)}},[k,N]),s.useEffect(()=>{if(!k)return;const j=P=>{var W,O;const R=P.target;(W=m.current)!=null&&W.contains(R)||(O=b.current)!=null&&O.contains(R)||g(!1)},T=P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),g(!1))};return document.addEventListener("pointerdown",j),document.addEventListener("keydown",T,!0),()=>{document.removeEventListener("pointerdown",j),document.removeEventListener("keydown",T,!0)}},[k]);const E=j=>{const T=j.trim();if(!T){i(null),y("");return}const P=dl(T,h);if(!P){y(n?J(n.value):"");return}i(P),y(J(P.value))},L=Kp[h],M=(n==null?void 0:n.value)??null,I=k?o.jsx(ie,{children:o.jsx("ul",{ref:b,className:pe.list,role:"listbox",id:l,style:{top:S.top,left:S.left,minWidth:S.width},children:L.map(j=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:pe.option,role:"option","aria-selected":M===j,onMouseDown:T=>T.preventDefault(),onClick:()=>{i({value:j,unit:h}),y(J(j)),g(!1)},children:J(j)})},j))})}):null;return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:c,children:e}),o.jsxs("div",{className:`${pe.wrap} ${d.lengthRow}`,ref:m,children:[o.jsxs("div",{className:pe.field,ref:p,children:[o.jsx("input",{id:c,className:pe.input,value:w,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":k,"aria-controls":l,role:"combobox",inputMode:"decimal",onFocus:()=>x(!0),onBlur:()=>{x(!1),E(w)},onChange:j=>y(j.target.value),onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),E(w),g(!1),j.currentTarget.blur()),j.key==="ArrowDown"&&(j.preventDefault(),g(!0))}}),o.jsx("button",{type:"button",className:pe.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":k,"aria-controls":l,onMouseDown:j=>j.preventDefault(),onClick:()=>g(j=>!j)})]}),o.jsxs("div",{className:pe.field,children:[o.jsx("select",{className:pe.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:j=>{const T=j.target.value;if(n){i({value:n.value,unit:T});return}w.trim()&&i(dl(w,T))},children:uc.map(j=>o.jsx("option",{value:j,children:a(lx[j])},j))}),o.jsx("span",{className:pe.chevron,"aria-hidden":"true"})]}),I]})]})}const sx=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"alignment",labelKey:"imagePropertiesTabAlignment",implemented:!0},{id:"border",labelKey:"imagePropertiesTabBorder",implemented:!0},{id:"advanced",labelKey:"imagePropertiesTabAdvanced",implemented:!0},{id:"hover",labelKey:"imagePropertiesTabHover",implemented:!0}],cx={left:hi,center:pi,right:gi},ux=["left","center","right"],dx={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},mx=["width","height","lock"],fx={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},px={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},hx={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},gx={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},bx={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"},yx={value:1,unit:"pt"},xx={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function Uo(e){return{top:e,right:e,bottom:e,left:e}}function wx(e){for(const t of Xe)if(e[t])return e[t];return null}function vx({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:i,onChange:a}){const l=V(),c=s.useId(),m=s.useId(),p=s.useId(),b=s.useId(),h=s.useId(),[w,y]=s.useState(()=>nt(t.margin,Uo(t.margin.top))),v=t.align==="center",x=(g,S)=>{if(t.sizeMode==="lock"&&S){const A=gn(g,S,n);a({...t,width:A.width,height:A.height});return}a({...t,[g]:S})},k=g=>{if(g==="width"){a({...t,sizeMode:g,height:null});return}if(g==="height"){a({...t,sizeMode:g,width:null});return}if(t.width){const S=gn("width",t.width,n);a({...t,sizeMode:g,width:S.width,height:S.height});return}if(t.height){const S=gn("height",t.height,n);a({...t,sizeMode:g,width:S.width,height:S.height});return}a({...t,sizeMode:g})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("imagePropertiesDialogTitle"),children:sx.map(g=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":g.id===e,disabled:!g.implemented,onClick:()=>i(g.id),children:l(g.labelKey)},g.id))}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[e==="general"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesSize")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":l("imagePropertiesSizeMode"),children:mx.map(g=>o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":t.sizeMode===g,disabled:r,onClick:()=>k(g),children:l(fx[g])},g))}),o.jsx(Nl,{label:l("imagePropertiesWidth"),inputAria:l("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:g=>x("width",g)}),o.jsx(Nl,{label:l("imagePropertiesHeight"),inputAria:l("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:g=>x("height",g)})]}):null,e==="alignment"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":l("paragraphDialogAlignment"),children:ux.map(g=>{const S=cx[g];return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":t.align===g,"aria-label":l(dx[g]),disabled:r,onClick:()=>{a({...t,align:t.align===g?null:g})},children:o.jsx(S,{})},g)})})]}):null,e==="border"?o.jsxs(o.Fragment,{children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogMargin")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:w,disabled:r||v,onChange:()=>{const g=!w;y(g),g&&a({...t,margin:Uo(wx(t.margin))})}}),l("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(w?["top"]:Xe).map(g=>o.jsx(ge,{label:l(w?"paragraphDialogMargin":px[g]),value:t.margin[g],disabled:r||v&&(g==="left"||g==="right"),allowNegative:!0,onChange:S=>{const A=w?Uo(S):{...t.margin,[g]:S};a({...t,margin:A})}},g))})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:c,children:l("paragraphDialogBorderStyle")}),o.jsx("select",{id:c,className:d.select,value:t.border.style,disabled:r,onChange:g=>{const S=g.target.value;a({...t,border:{style:S,width:S==="none"?null:t.border.width??yx,color:S==="none"?null:t.border.color}})},children:Lr.map(g=>o.jsx("option",{value:g,children:l(hx[g])},g))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(ge,{label:l("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:g=>{a({...t,border:{...t.border,width:g}})}}),o.jsx(Fe,{label:l("paragraphDialogBorderColor"),noneLabel:l("colorNone"),value:t.border.color,disabled:r,onChange:g=>{a({...t,border:{...t.border,color:g}})}})]}):null,o.jsx(ge,{label:l("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:g=>{a({...t,borderRadius:g})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:r,onChange:()=>{a({...t,boxShadow:t.boxShadow?null:xx})}}),l("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(Vi,{shadow:t.boxShadow,disabled:r,onChange:g=>{a({...t,boxShadow:g})}}):null]})]}):null,e==="advanced"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesTabAdvanced")}),o.jsx(Sx,{value:t.opacity,disabled:r,onChange:g=>{a({...t,opacity:g})}}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("imagePropertiesFit")}),o.jsxs("select",{id:m,className:d.select,value:t.objectFit??"",disabled:r,onChange:g=>{const S=g.target.value;a(Zp({...t,objectFit:S||null},n))},children:[o.jsx("option",{value:"",children:l("imagePropertiesFitDefault")}),dc.map(g=>o.jsx("option",{value:g,children:l(gx[g])},g))]})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("imagePropertiesPosition")}),o.jsxs("select",{id:p,className:d.select,value:t.objectPosition??"",disabled:r,onChange:g=>{const S=g.target.value||null;a({...t,objectPosition:S})},children:[o.jsx("option",{value:"",children:l("imagePropertiesPositionDefault")}),mc.map(g=>o.jsx("option",{value:g,children:l(bx[g])},g))]})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:b,children:l("imagePropertiesRotation")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:b,className:d.lengthInput,value:t.rotateDeg===null?"":J(t.rotateDeg),disabled:r,inputMode:"decimal",onChange:g=>{const S=g.target.value.trim();if(!S){a({...t,rotateDeg:null});return}const A=Number(S.replace(",","."));Number.isFinite(A)&&a({...t,rotateDeg:A})}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:l("imagePropertiesRotationUnit")})]})]})]}):null,e==="hover"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesTabHover")}),o.jsx("p",{className:d.emptyHint,children:l("imagePropertiesHoverHelp")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:h,children:l("imagePropertiesHoverCss")}),o.jsx("textarea",{id:h,className:d.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":l("imagePropertiesHoverCssAria"),onChange:g=>{a({...t,hoverCss:g.target.value})}})]})]}):null]})]})}function Sx({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),a=e===null?null:Cr(e),[l,c]=s.useState(()=>a===null?"":J(a)),[m,p]=s.useState(!1);s.useEffect(()=>{m||c(a===null?"":J(a))},[a,m]);const b=h=>{const w=h.trim();if(!w){n(null),c("");return}const y=Number(w.replace(",","."));if(!Number.isFinite(y)){c(a===null?"":J(a));return}const v=Us(y);n(v),c(J(Cr(v)))};return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogOpacity")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:l,disabled:t,inputMode:"decimal",onFocus:()=>p(!0),onChange:h=>c(h.target.value),onBlur:()=>{p(!1),b(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const Ll='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Cx({open:e,tab:t,value:n,aspectRatio:r=1,disabled:i,onTabChange:a,onApply:l,onClose:c}){const m=V(),p=s.useId(),b=s.useRef(null),[h,w]=s.useState(n);return s.useEffect(()=>{e&&w(n)},[e,n]),s.useEffect(()=>{if(!e)return;const y=b.current,v=y==null?void 0:y.querySelector(Ll);v==null||v.focus();const x=k=>{if(k.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;k.preventDefault(),k.stopPropagation(),c();return}if(k.key!=="Tab"||!y)return;const g=[...y.querySelectorAll(Ll)];if(g.length===0)return;const S=g[0],A=g[g.length-1];k.shiftKey&&document.activeElement===S?(k.preventDefault(),A.focus()):!k.shiftKey&&document.activeElement===A&&(k.preventDefault(),S.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,c]),e?o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:c,children:o.jsxs("div",{ref:b,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":p,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:p,children:m("imagePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":m("imagePropertiesDialogCloseAria"),onClick:c,children:o.jsx(We,{})})]}),o.jsx(vx,{tab:t,value:h,aspectRatio:r,disabled:i,onTabChange:a,onChange:w}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:c,children:m("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>l(h),children:m("fontDialogOk")})]})]})})}):null}const kx="_frame_bwkh8_1",Dx="_handle_bwkh8_9",Px="_handleEast_bwkh8_29",Ax="_handleSouth_bwkh8_37",jx="_handleSouthEast_bwkh8_45",xn={frame:kx,handle:Dx,handleEast:Px,handleSouth:Ax,handleSouthEast:jx};function pn(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const Ex=[{handle:"e",className:xn.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:xn.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:xn.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function Wo(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function Tx({img:e,onResize:t,onResizeEnd:n}){const r=V(),i=s.useRef(null),a=s.useRef(e),l=s.useRef(t),c=s.useRef(n),m=s.useRef(null);a.current=e,l.current=t,c.current=n;const p=g=>{const S=i.current;S&&(S.style.left=`${g.left}px`,S.style.top=`${g.top}px`,S.style.width=`${g.width}px`,S.style.height=`${g.height}px`)};s.useLayoutEffect(()=>{p(pn(e));const g=()=>{e.isConnected&&p(pn(e))};return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[e]);const b=(g,S)=>{const A=m.current,N=a.current;if(!A||!N)return;const E=gh(A.handle,A.start,{x:g-A.originX,y:S-A.originY});l.current(E.width,E.height),N.isConnected&&p(pn(N))},h=()=>{if(!m.current)return;m.current=null;const g=a.current;c.current(),g!=null&&g.isConnected&&p(pn(g))};s.useLayoutEffect(()=>{const g=A=>{if(!m.current)return;const N=Wo(A);N&&b(N.x,N.y)},S=()=>{h()};return document.addEventListener("pointermove",g),document.addEventListener("pointerup",S),document.addEventListener("pointercancel",S),document.addEventListener("mousemove",g),document.addEventListener("mouseup",S),()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",S),document.removeEventListener("pointercancel",S),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",S)}},[]);const w=(g,S)=>{const A=Wo(S);A&&(m.current={handle:g,start:bh(a.current),originX:A.x,originY:A.y})},y=g=>S=>{S.preventDefault(),S.stopPropagation(),w(g,S);try{S.currentTarget.setPointerCapture(S.pointerId)}catch{}},v=g=>S=>{S.preventDefault(),S.stopPropagation(),w(g,S)},x=g=>{const S=Wo(g);S&&b(S.x,S.y)};if(!e.isConnected)return null;const k=pn(e);return Ul.createPortal(o.jsx("div",{ref:i,className:xn.frame,"data-image-resize-overlay":"",style:{left:k.left,top:k.top,width:k.width,height:k.height},children:Ex.map(g=>o.jsx("button",{type:"button",className:`${xn.handle} ${g.className}`,style:{cursor:g.cursor},"aria-label":r(g.ariaKey),"data-resize-handle":g.handle,onPointerDown:y(g.handle),onPointerMove:x,onPointerUp:h,onPointerCancel:h,onMouseDown:v(g.handle),onMouseMove:x,onMouseUp:h},g.handle))}),document.body)}const Ml='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Nx({open:e,tab:t,href:n,title:r,targetBlank:i,textDecorationNone:a,hoverMode:l,hoverColor:c,hoverHtml:m,bookmarks:p,selectedBookmarkId:b,disabled:h,onTabChange:w,onApply:y,onClose:v}){const x=V(),k=s.useId(),g=s.useId(),S=s.useId(),A=s.useId(),N=s.useId(),E=s.useRef(null),[L,M]=s.useState(n),[I,j]=s.useState(r),[T,P]=s.useState(i),[R,W]=s.useState(a),[O,Z]=s.useState(l),[te,ce]=s.useState(c),[re,he]=s.useState(m),[ne,Q]=s.useState(b);if(s.useEffect(()=>{e&&(M(n),j(r),P(i),W(a),Z(l),ce(c),he(m),Q(b))},[e,n,r,i,a,l,c,m,b]),s.useEffect(()=>{if(!e)return;const B=E.current,fe=B==null?void 0:B.querySelector(Ml);fe==null||fe.focus();const ue=we=>{if(we.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;we.preventDefault(),we.stopPropagation(),v();return}if(we.key!=="Tab"||!B)return;const _=[...B.querySelectorAll(Ml)];if(_.length===0)return;const Ce=_[0],Pt=_[_.length-1];we.shiftKey&&document.activeElement===Ce?(we.preventDefault(),Pt.focus()):!we.shiftKey&&document.activeElement===Pt&&(we.preventDefault(),Ce.focus())};return document.addEventListener("keydown",ue,!0),()=>document.removeEventListener("keydown",ue,!0)},[e,v,t,O]),!e)return null;const D=()=>Mr({title:I,targetBlank:T,textDecorationNone:R,hoverMode:O,hoverColor:te,hoverHtml:re}),$=()=>{const B=L.trim();!B||h||y({...D(),href:B})},Y=()=>{!ne||h||y({...D(),href:`#${ne}`})};return o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:v,children:o.jsxs("div",{ref:E,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":k,onMouseDown:B=>B.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:k,children:x("linkDialogTitle")}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":x("linkDialogTitle"),children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="link",onClick:()=>w("link"),children:x("linkDialogTabLink")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>w("bookmark"),children:x("linkDialogTabBookmark")})]}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[t==="link"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:g,children:x("linkDialogHref")}),o.jsx("input",{id:g,className:d.textInput,value:L,disabled:h,onChange:B=>M(B.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:S,children:x("linkDialogHoverTitle")}),o.jsx("input",{id:S,className:d.textInput,value:I,disabled:h,onChange:B=>j(B.target.value)})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:T,disabled:h,onChange:B=>P(B.target.checked)}),x("linkDialogTargetBlank")]})]}):p.length===0?o.jsx("p",{className:d.emptyHint,children:x("linkDialogBookmarkEmpty")}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:A,children:x("linkDialogBookmark")}),o.jsxs("select",{id:A,className:`${d.select} ${d.fullSelect}`,value:ne,disabled:h,onChange:B=>Q(B.target.value),children:[o.jsx("option",{value:""}),p.map(B=>o.jsx("option",{value:B.id,children:B.id},B.id))]})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:R,disabled:h,onChange:B=>W(B.target.checked)}),x("linkDialogTextDecorationNone")]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:x("linkDialogHover")}),o.jsxs("div",{className:d.sizeRow,role:"group","aria-label":x("linkDialogHover"),children:[o.jsx("button",{type:"button",className:d.action,"aria-pressed":O==="color",disabled:h,onClick:()=>Z("color"),children:x("linkDialogHoverColor")}),o.jsx("button",{type:"button",className:d.action,"aria-pressed":O==="html",disabled:h,onClick:()=>Z("html"),children:x("linkDialogHoverHtml")})]}),O==="color"?o.jsx(Fe,{label:x("linkDialogHoverColorField"),noneLabel:x("colorNone"),value:te,disabled:h,onChange:ce}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:N,children:x("linkDialogHoverHtmlAria")}),o.jsx("textarea",{id:N,className:d.textarea,value:re,disabled:h,spellCheck:!1,onChange:B=>he(B.target.value)})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:h||!ne,onClick:Y,children:x("linkDialogSelect")}),o.jsx("button",{type:"button",className:d.action,onClick:v,children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:h||!L.trim(),onClick:$,children:x("fontDialogOk")})]})]})})})}const Lx="_grid_1bpma_1",Mx="_cell_1bpma_8",Rx="_sizeLabel_1bpma_27",_x="_sizeFields_1bpma_33",Ix="_numberInput_1bpma_37",Lt={grid:Lx,cell:Mx,sizeLabel:Rx,sizeFields:_x,numberInput:Ix},Rl='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])',st={rows:3,cols:3};function Fx({open:e,disabled:t,onApply:n,onClose:r}){const i=V(),a=s.useId(),l=s.useId(),c=s.useId(),m=s.useRef(null),[p,b]=s.useState(st.rows),[h,w]=s.useState(st.cols),[y,v]=s.useState(String(st.rows)),[x,k]=s.useState(String(st.cols)),[g,S]=s.useState(!1);if(s.useEffect(()=>{e&&(b(st.rows),w(st.cols),v(String(st.rows)),k(String(st.cols)),S(!1))},[e]),s.useEffect(()=>{if(!e)return;const j=m.current,T=j==null?void 0:j.querySelector(Rl);T==null||T.focus();const P=R=>{if(R.key==="Escape"){R.preventDefault(),R.stopPropagation(),r();return}if(R.key!=="Tab"||!j)return;const W=[...j.querySelectorAll(Rl)];if(W.length===0)return;const O=W[0],Z=W[W.length-1];R.shiftKey&&document.activeElement===O?(R.preventDefault(),Z.focus()):!R.shiftKey&&document.activeElement===Z&&(R.preventDefault(),O.focus())};return document.addEventListener("keydown",P,!0),()=>document.removeEventListener("keydown",P,!0)},[e,r]),!e)return null;const N=yc(p,h)&&!t,E=(j,T)=>{const P=Math.min(It,Math.max(_t,j)),R=Math.min(It,Math.max(_t,T));b(P),w(R),v(String(P)),k(String(R))},L=(j,T)=>{const P=Number.parseInt(j,10);if(!Number.isFinite(P)){T==="rows"?v(String(p)):k(String(h));return}S(!0),T==="rows"?E(P,h):E(p,P)},M=(j,T)=>{const P=j.replace(/\D/g,"");if(T==="rows"?v(P):k(P),P==="")return;const R=Number.parseInt(P,10);Number.isFinite(R)&&(S(!0),T==="rows"?E(R,h):E(p,R))},I=j=>{(j.key==="e"||j.key==="E"||j.key==="+"||j.key==="-"||j.key===".")&&j.preventDefault()};return o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:r,children:o.jsxs("div",{ref:m,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:j=>j.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:a,children:i("tableDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":i("tableDialogCloseAria"),onClick:r,children:o.jsx(We,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx("div",{className:Lt.grid,role:"grid","aria-label":i("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:pl},(j,T)=>Array.from({length:pl},(P,R)=>{const W=T+1,O=R+1,Z=W<=p&&O<=h;return o.jsx("button",{type:"button",className:Lt.cell,role:"gridcell","data-active":Z?"true":void 0,"aria-label":`${W} × ${O}`,"aria-pressed":Z&&W===p&&O===h,disabled:t,onMouseEnter:()=>{g||E(W,O)},onClick:()=>{S(!0),E(W,O)}},`${W}-${O}`)}))}),o.jsxs("p",{className:Lt.sizeLabel,children:[i("tableDialogSize"),": ",p," × ",h]}),o.jsxs("div",{className:`${d.sizeRow} ${Lt.sizeFields}`,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:i("tableDialogRows")}),o.jsx("input",{id:l,className:Lt.numberInput,type:"number",inputMode:"numeric",min:_t,max:It,step:1,value:y,disabled:t,onKeyDown:I,onChange:j=>M(j.target.value,"rows"),onBlur:()=>L(y,"rows")})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:c,children:i("tableDialogColumns")}),o.jsx("input",{id:c,className:Lt.numberInput,type:"number",inputMode:"numeric",min:_t,max:It,step:1,value:x,disabled:t,onKeyDown:I,onChange:j=>M(j.target.value,"cols"),onBlur:()=>L(x,"cols")})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:r,children:i("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!N,onClick:()=>{N&&n({rows:p,cols:h})},children:i("tableDialogInsert")})]})]})})})}const Bx={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},Hx={value:1,unit:"pt"},zx={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function Ox({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),a=s.useId();return o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("tablePropertiesWidth")}),o.jsx(ge,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:l=>n({...e,width:l})}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("tablePropertiesCollapse")}),o.jsxs("select",{id:i,className:d.select,value:e.borderCollapse,disabled:t,onChange:l=>{const c=l.target.value==="separate"?"separate":"collapse";n({...e,borderCollapse:c,borderSpacing:c==="separate"?e.borderSpacing:null})},children:[o.jsx("option",{value:"collapse",children:r("tablePropertiesCollapseCollapse")}),o.jsx("option",{value:"separate",children:r("tablePropertiesCollapseSeparate")})]})]}),e.borderCollapse==="separate"?o.jsx(ge,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:l=>n({...e,borderSpacing:l})}):null]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:r("paragraphDialogBorderStyle")}),o.jsx("select",{id:a,className:d.select,value:e.border.style,disabled:t,onChange:l=>{const c=l.target.value;n({...e,border:{style:c,width:c==="none"?null:e.border.width??Hx,color:c==="none"?null:e.border.color}})},children:Lr.map(l=>o.jsx("option",{value:l,children:r(Bx[l])},l))})]}),e.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(ge,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:l=>n({...e,border:{...e.border,width:l}})}),o.jsx(Fe,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:l=>n({...e,border:{...e.border,color:l}})})]}):null,o.jsx(ge,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:l=>n({...e,borderRadius:l})}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:e.boxShadow!==null,disabled:t,onChange:()=>{n({...e,boxShadow:e.boxShadow?null:zx})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?o.jsx(Vi,{shadow:e.boxShadow,disabled:t,onChange:l=>n({...e,boxShadow:l})}):null]})]})}const _l='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Kx({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=V(),l=s.useId(),c=s.useRef(null),[m,p]=s.useState(t);return s.useEffect(()=>{e&&p(t)},[e,t]),s.useEffect(()=>{if(!e)return;const b=c.current,h=b==null?void 0:b.querySelector(_l);h==null||h.focus();const w=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!b)return;const v=[...b.querySelectorAll(_l)];if(v.length===0)return;const x=v[0],k=v[v.length-1];y.shiftKey&&document.activeElement===x?(y.preventDefault(),k.focus()):!y.shiftKey&&document.activeElement===k&&(y.preventDefault(),x.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,i]),e?o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:c,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("tablePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:i,children:o.jsx(We,{})})]}),o.jsx(Ox,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})})}):null}const $x={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Ux={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function ur(e){return{top:e,right:e,bottom:e,left:e}}function Go(e){for(const t of Xe)if(e[t])return e[t];return null}function Wx({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),[a,l]=s.useState(()=>nt(e.padding,ur(Go(e.padding))));return s.useEffect(()=>{l(nt(e.padding,ur(Go(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(Fe,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:c=>n({...e,backgroundColor:c})}),o.jsx(Fe,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:c=>n({...e,color:c})}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogPadding")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const c=!a;l(c),c&&n({...e,padding:ur(Go(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(a?["top"]:Xe).map(c=>o.jsx(ge,{label:r(a?"paragraphDialogPadding":$x[c]),value:e.padding[c],disabled:t,onChange:m=>{const p=a?ur(m):{...e.padding,[c]:m};n({...e,padding:p})}},c))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("cellPropertiesVerticalAlign")}),o.jsxs("select",{id:i,className:d.select,value:e.verticalAlign??"",disabled:t,onChange:c=>{const m=c.target.value;n({...e,verticalAlign:m||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),Rr.map(c=>o.jsx("option",{value:c,children:r(Ux[c])},c))]})]}),o.jsx(ge,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:c=>n({...e,width:c})})]})}const Il='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Gx({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=V(),l=s.useId(),c=s.useRef(null),[m,p]=s.useState(t);return s.useEffect(()=>{e&&p(t)},[e,t]),s.useEffect(()=>{if(!e)return;const b=c.current,h=b==null?void 0:b.querySelector(Il);h==null||h.focus();const w=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!b)return;const v=[...b.querySelectorAll(Il)];if(v.length===0)return;const x=v[0],k=v[v.length-1];y.shiftKey&&document.activeElement===x?(y.preventDefault(),k.focus()):!y.shiftKey&&document.activeElement===k&&(y.preventDefault(),x.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,i]),e?o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:c,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("cellPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:i,children:o.jsx(We,{})})]}),o.jsx(Wx,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})})}):null}const Vx={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},qx={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function dr(e){return{top:e,right:e,bottom:e,left:e}}function Vo(e){for(const t of Xe)if(e[t])return e[t];return null}function Xx({value:e,disabled:t,onChange:n}){const r=V(),i=s.useId(),[a,l]=s.useState(()=>nt(e.padding,dr(Vo(e.padding))));return s.useEffect(()=>{l(nt(e.padding,dr(Vo(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(Fe,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:c=>n({...e,backgroundColor:c})}),o.jsx(Fe,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:c=>n({...e,color:c})}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogPadding")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const c=!a;l(c),c&&n({...e,padding:dr(Vo(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(a?["top"]:Xe).map(c=>o.jsx(ge,{label:r(a?"paragraphDialogPadding":Vx[c]),value:e.padding[c],disabled:t,onChange:m=>{const p=a?dr(m):{...e.padding,[c]:m};n({...e,padding:p})}},c))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("cellPropertiesVerticalAlign")}),o.jsxs("select",{id:i,className:d.select,value:e.verticalAlign??"",disabled:t,onChange:c=>{const m=c.target.value;n({...e,verticalAlign:m||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),Rr.map(c=>o.jsx("option",{value:c,children:r(qx[c])},c))]})]}),o.jsx(ge,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:c=>n({...e,height:c})})]})}const Fl='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Yx({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=V(),l=s.useId(),c=s.useRef(null),[m,p]=s.useState(t);return s.useEffect(()=>{e&&p(t)},[e,t]),s.useEffect(()=>{if(!e)return;const b=c.current,h=b==null?void 0:b.querySelector(Fl);h==null||h.focus();const w=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!b)return;const v=[...b.querySelectorAll(Fl)];if(v.length===0)return;const x=v[0],k=v[v.length-1];y.shiftKey&&document.activeElement===x?(y.preventDefault(),k.focus()):!y.shiftKey&&document.activeElement===k&&(y.preventDefault(),x.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,i]),e?o.jsx(ie,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:c,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("rowPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:i,children:o.jsx(We,{})})]}),o.jsx(Xx,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})})}):null}const Jx="_backdrop_9d3gw_1",Zx="_dialog_9d3gw_12",Qx="_headerRow_9d3gw_29",e1="_header_9d3gw_29",t1="_close_9d3gw_44",n1="_body_9d3gw_66",r1="_frame_9d3gw_75",o1="_actions_9d3gw_83",i1="_action_9d3gw_83",Je={backdrop:Jx,dialog:Zx,headerRow:Qx,header:e1,close:t1,body:n1,frame:r1,actions:o1,action:i1},Bl='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function a1({open:e,html:t,onClose:n}){const r=V(),i=s.useId(),a=s.useRef(null),l=s.useRef(null);return s.useEffect(()=>{if(!e)return;const c=a.current,m=c==null?void 0:c.querySelector(Bl);m==null||m.focus();const p=b=>{if(b.key==="Escape"){b.preventDefault(),b.stopPropagation(),n();return}if(b.key!=="Tab"||!c)return;const h=[...c.querySelectorAll(Bl)];if(h.length===0)return;const w=h[0],y=h[h.length-1];b.shiftKey&&document.activeElement===w?(b.preventDefault(),y.focus()):!b.shiftKey&&document.activeElement===y&&(b.preventDefault(),w.focus())};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[e,n]),s.useEffect(()=>{var m;if(!e)return;const c=(m=l.current)==null?void 0:m.contentDocument;c&&Zo(c,t,r("previewDialogTitle"))},[e,t,r]),e?o.jsx(ie,{children:o.jsx("div",{className:Je.backdrop,role:"presentation",onMouseDown:n,children:o.jsxs("div",{ref:a,className:Je.dialog,role:"dialog","aria-modal":"true","aria-labelledby":i,onMouseDown:c=>c.stopPropagation(),children:[o.jsxs("div",{className:Je.headerRow,children:[o.jsx("h2",{className:Je.header,id:i,children:r("previewDialogTitle")}),o.jsx("button",{type:"button",className:Je.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:o.jsx(We,{})})]}),o.jsx("div",{className:Je.body,children:o.jsx("iframe",{ref:l,className:Je.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var m;const c=(m=l.current)==null?void 0:m.contentDocument;c&&Zo(c,t,r("previewDialogTitle"))}})}),o.jsx("div",{className:Je.actions,children:o.jsx("button",{type:"button",className:Je.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const Tc="commspliant-html-editor.darkMode";function l1(e){return typeof e=="boolean"?e:null}function Hl(){try{const e=localStorage.getItem(Tc);return e?l1(JSON.parse(e)):null}catch{return null}}function s1(e){try{localStorage.setItem(Tc,JSON.stringify(e))}catch{}}const Nc="commspliant-html-editor.toolbarPosition",c1=["top","left","right","bottom"];function Lc(e){return typeof e=="string"&&c1.includes(e)?e:null}function zl(){try{const e=localStorage.getItem(Nc);return e?Lc(JSON.parse(e)):null}catch{return null}}function u1(e){try{localStorage.setItem(Nc,JSON.stringify(e))}catch{}}function d1({enabled:e,onHtml:t}){const[n,r]=s.useState(!1),i=s.useRef(0),a=s.useRef(e),l=s.useRef(t);a.current=e,l.current=t;const c=s.useCallback(()=>{i.current=0,r(!1)},[]);s.useEffect(()=>{e||c()},[e,c]);const m=s.useCallback(w=>{!a.current||!rr(w.dataTransfer)||(w.preventDefault(),i.current+=1,r(!0))},[]),p=s.useCallback(w=>{!a.current||!rr(w.dataTransfer)||(w.preventDefault(),w.dataTransfer&&(w.dataTransfer.dropEffect="copy"))},[]),b=s.useCallback(w=>{if(!a.current||!rr(w.dataTransfer))return;const y=w.relatedTarget;y instanceof Node&&w.currentTarget.contains(y)||(i.current=Math.max(0,i.current-1),i.current===0&&r(!1))},[]),h=s.useCallback(w=>{if(!a.current||!rr(w.dataTransfer))return;w.preventDefault(),c();const y=rd(w.dataTransfer);y&&wi(y).then(v=>{a.current&&l.current(v)},()=>{})},[c]);return{dragging:n,onDragEnter:m,onDragOver:p,onDragLeave:b,onDrop:h}}const m1={menus:{edit:{id:"edit",labelKey:"menuEdit",ariaKey:"menuEditAria"}},groups:{edit:{id:"edit",labelKey:"toolbarGroupEdit"}},items:{undo:{id:"undo",command:"undo",icon:Eu,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:ku,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"}}},f1=400;function p1(e){let t=[],n=e,r=[],i=!1,a=!1,l=0;function c(h,w){if(i){n=h,i=!1;return}if(h===n)return;const y=Date.now(),v=(w==null?void 0:w.coalesce)===!0;if(v&&a&&y-l<f1){n=h,l=y;return}t.push(n),n=h,r=[],l=y,a=v}function m(){return t.length===0?null:(a=!1,r.push(n),n=t.pop(),n)}function p(){return r.length===0?null:(a=!1,t.push(n),n=r.pop(),n)}function b(h){if(i){n=h,i=!1;return}h!==n&&(t.push(n),n=h,r=[],a=!1)}return{record:c,undo:m,redo:p,canUndo:()=>t.length>0,canRedo:()=>r.length>0,syncExternal:b,markApplying:()=>{i=!0}}}function ft(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function Dr(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):ft(e,t):""}const Ge="fullscreen",di="commspliant-html-editor.toolbarCustomization";function mi(e){const t=e.filter(n=>n!==Ge);return e.includes(Ge)?[...t,Ge]:t}function Xi(e,t){if(!t||t.length===0)return mi(e);const n=new Set(e),r=t.filter(l=>n.has(l)),i=new Set(r),a=[...r];for(let l=0;l<e.length;l++){const c=e[l];if(i.has(c))continue;let m=0;for(let p=l-1;p>=0;p--){const b=e[p],h=a.indexOf(b);if(h>=0){m=h+1;break}}a.splice(m,0,c),i.add(c)}return mi(a)}function h1(e,t){const n=new Map(e.map(l=>[l.id,l])),r=Xi(e.map(l=>l.id),t==null?void 0:t.groupOrder),i=new Set((t==null?void 0:t.hiddenItemIds)??[]),a=[];for(const l of r){const c=n.get(l);if(!c)continue;const m=c.items.filter(p=>!i.has(p));m.length!==0&&a.push({id:l,items:m})}return a}function g1(e){if(e==null||typeof e!="object")return null;const t=e,n=Array.isArray(t.groupOrder)?t.groupOrder.filter(i=>typeof i=="string"):[],r=Array.isArray(t.hiddenItemIds)?[...new Set(t.hiddenItemIds.filter(i=>typeof i=="string"))]:[];return n.length===0&&r.length===0?null:{groupOrder:n,hiddenItemIds:r}}function b1(){try{const e=localStorage.getItem(di);return e?g1(JSON.parse(e)):null}catch{return null}}function y1(e){try{if(!e){localStorage.removeItem(di);return}localStorage.setItem(di,JSON.stringify(e))}catch{}}function Yi(e,t){return Xi(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function x1(e,t,n,r){const i=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?i.delete(n):i.add(n),{groupOrder:Yi(e,t),hiddenItemIds:[...i]}}function Mc(e,t,n,r){const i=Yi(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===Ge||r===Ge)return{groupOrder:i,hiddenItemIds:a};const l=i.indexOf(n),c=i.indexOf(r);if(l<0||c<0||l===c)return{groupOrder:i,hiddenItemIds:a};const m=[...i],[p]=m.splice(l,1);return m.splice(c,0,p),{groupOrder:mi(m),hiddenItemIds:a}}function Ol(e,t,n,r){const i=Yi(e,t),a=i.filter(m=>m!==Ge),l=a.indexOf(n),c=l+r;return l<0||c<0||c>=a.length?{groupOrder:i,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:Mc(e,t,n,a[c])}const w1="_backdrop_1dasl_1",v1="_dialog_1dasl_12",S1="_header_1dasl_28",C1="_body_1dasl_35",k1="_group_1dasl_43",D1="_groupDragging_1dasl_49",P1="_groupDropTarget_1dasl_53",A1="_groupHeader_1dasl_58",j1="_groupTitle_1dasl_66",E1="_dragHandle_1dasl_71",T1="_moveButton_1dasl_72",N1="_items_1dasl_113",L1="_item_1dasl_113",M1="_itemIcon_1dasl_129",R1="_itemTitle_1dasl_138",_1="_itemCheckbox_1dasl_145",I1="_actions_1dasl_149",F1="_action_1dasl_149",B1="_spinnerWrap_1dasl_184",H1="_spinner_1dasl_184",le={backdrop:w1,dialog:v1,header:S1,body:C1,group:k1,groupDragging:D1,groupDropTarget:P1,groupHeader:A1,groupTitle:j1,dragHandle:E1,moveButton:T1,items:N1,item:L1,itemIcon:M1,itemTitle:R1,itemCheckbox:_1,actions:I1,action:F1,spinnerWrap:B1,spinner:H1},Kl='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function z1(){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"currentColor",children:[o.jsx("circle",{cx:"5",cy:"4",r:"1.2"}),o.jsx("circle",{cx:"11",cy:"4",r:"1.2"}),o.jsx("circle",{cx:"5",cy:"8",r:"1.2"}),o.jsx("circle",{cx:"11",cy:"8",r:"1.2"}),o.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),o.jsx("circle",{cx:"11",cy:"12",r:"1.2"})]})}function O1({open:e,catalog:t,groups:n,settings:r,loading:i=!1,busy:a=!1,disabled:l,onChange:c,onReset:m,onClose:p}){const b=V(),h=s.useId(),w=s.useRef(null),[y,v]=s.useState(null),[x,k]=s.useState(null),g=Xi(n.map(P=>P.id),r==null?void 0:r.groupOrder),S=new Set((r==null?void 0:r.hiddenItemIds)??[]),A=new Map(n.map(P=>[P.id,P])),N=g.map(P=>A.get(P)).filter(P=>!!P),E=l||a||i;if(s.useEffect(()=>{e||(v(null),k(null))},[e]),s.useEffect(()=>{if(!e)return;const P=w.current,R=P==null?void 0:P.querySelector(Kl);R==null||R.focus();const W=O=>{if(O.key==="Escape"){O.preventDefault(),O.stopPropagation(),p();return}if(O.key!=="Tab"||!P)return;const Z=[...P.querySelectorAll(Kl)];if(Z.length===0)return;const te=Z[0],ce=Z[Z.length-1];O.shiftKey&&document.activeElement===te?(O.preventDefault(),ce.focus()):!O.shiftKey&&document.activeElement===ce&&(O.preventDefault(),te.focus())};return document.addEventListener("keydown",W,!0),()=>document.removeEventListener("keydown",W,!0)},[e,p]),!e)return null;const L=N.map(P=>P.id).filter(P=>P!==Ge),M=(P,R)=>{if(E||R===Ge){P.preventDefault();return}P.dataTransfer.setData("text/plain",R),P.dataTransfer.effectAllowed="move",v(R)},I=(P,R)=>{E||R===Ge||!y||y===R||(P.preventDefault(),P.dataTransfer&&(P.dataTransfer.dropEffect="move"),k(R))},j=(P,R)=>{var O;P.preventDefault();const W=((O=P.dataTransfer)==null?void 0:O.getData("text/plain"))||y;v(null),k(null),!(!W||W===R||E)&&c(Mc(r,n,W,R))},T=()=>{v(null),k(null)};return o.jsx(ie,{children:o.jsx("div",{className:le.backdrop,role:"presentation",onMouseDown:p,children:o.jsxs("div",{ref:w,className:le.dialog,role:"dialog","aria-modal":"true","aria-labelledby":h,"aria-busy":i||a?!0:void 0,onMouseDown:P=>P.stopPropagation(),children:[o.jsx("h2",{className:le.header,id:h,children:b("customizeToolbarDialogTitle")}),o.jsx("div",{className:le.body,children:i?o.jsx("div",{className:le.spinnerWrap,role:"status","aria-live":"polite","aria-label":b("customizeToolbarDialogLoading"),children:o.jsx("span",{className:le.spinner,"aria-hidden":"true"})}):N.map(P=>{const R=t.groups[P.id],W=R?ft(b,R):P.id,O=P.id===Ge,Z=L.indexOf(P.id);return o.jsxs("section",{className:[le.group,y===P.id?le.groupDragging:"",x===P.id?le.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":P.id,"aria-label":W,onDragOver:te=>I(te,P.id),onDrop:te=>j(te,P.id),onDragLeave:()=>{x===P.id&&k(null)},children:[o.jsxs("div",{className:le.groupHeader,children:[o.jsx("button",{type:"button",className:le.dragHandle,draggable:!E&&!O,disabled:E||O,"aria-label":b("customizeToolbarDragHandle"),onDragStart:te=>M(te,P.id),onDragEnd:T,children:o.jsx(z1,{})}),o.jsx("span",{className:le.groupTitle,children:W}),o.jsx("button",{type:"button",className:le.moveButton,disabled:E||O||Z<=0,"aria-label":b("customizeToolbarMoveUp"),onClick:()=>c(Ol(r,n,P.id,-1)),children:"↑"}),o.jsx("button",{type:"button",className:le.moveButton,disabled:E||O||Z<0||Z>=L.length-1,"aria-label":b("customizeToolbarMoveDown"),onClick:()=>c(Ol(r,n,P.id,1)),children:"↓"})]}),o.jsx("div",{className:le.items,children:P.items.map(te=>{const ce=t.items[te];if(!ce)return null;const re=ce.icon,he=ft(b,ce),ne=`${h}-${P.id}-${te}`,Q=!S.has(te);return o.jsxs("label",{className:le.item,htmlFor:ne,children:[o.jsx("span",{className:le.itemIcon,"aria-hidden":"true",children:re?o.jsx(re,{}):he.slice(0,2)}),o.jsx("span",{className:le.itemTitle,children:he}),o.jsx("input",{id:ne,className:le.itemCheckbox,type:"checkbox",checked:Q,disabled:E,"aria-label":`${he}: ${b("customizeToolbarItemVisible")}`,onChange:D=>c(x1(r,n,te,D.target.checked))})]},te)})})]},P.id)})}),o.jsxs("div",{className:le.actions,children:[o.jsx("button",{type:"button",className:le.action,disabled:E,onClick:m,children:b("customizeToolbarDialogReset")}),o.jsx("button",{type:"button",className:le.action,"aria-label":b("customizeToolbarDialogCloseAria"),onClick:p,children:b("customizeToolbarDialogClose")})]})]})})})}function K1(e,t){if(!t)return e;const n=t.menus,r=t.toolbar;if(n===void 0&&r===void 0)return e;const i=n===void 0?e.menus:e.menus.filter(l=>n.includes(l.id)),a=r===void 0?e.iconGroups:e.iconGroups.map(l=>({id:l.id,items:l.items.filter(c=>r.includes(c))})).filter(l=>l.items.length>0);return{menus:i,iconGroups:a}}const $1={menus:{file:{id:"file",labelKey:"menuFile",ariaKey:"menuFileAria"}},groups:{file:{id:"file",labelKey:"toolbarGroupFile"},print:{id:"print",labelKey:"toolbarGroupPrint"}},items:{save:{id:"save",command:"save",icon:Pu,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:gu,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:Cu,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},mr=4;function Rc({icon:e,value:t,mixed:n,noneKey:r,labelKey:i,ariaKey:a,fallbackCustom:l,disabled:c,onChange:m}){const p=V(),b=s.useId(),h=s.useRef(null),w=s.useRef(null),y=s.useRef(null),[v,x]=s.useState(!1),[k,g]=s.useState({top:0,left:0}),S=s.useCallback(()=>{const M=w.current,I=y.current;if(!M)return;const j=M.getBoundingClientRect(),T=(I==null?void 0:I.offsetHeight)??0,P=(I==null?void 0:I.offsetWidth)??200;let R=j.bottom;R+T>window.innerHeight-mr&&(R=Math.max(mr,j.top-T));const W=Math.min(Math.max(j.left,mr),window.innerWidth-P-mr);g({top:R,left:W})},[]);s.useLayoutEffect(()=>{if(!v)return;S();const M=()=>S();return window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[v,S]),s.useEffect(()=>{if(!v)return;const M=j=>{var P,R;const T=j.target;(P=h.current)!=null&&P.contains(T)||(R=y.current)!=null&&R.contains(T)||x(!1)},I=j=>{var T;j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),x(!1),(T=w.current)==null||T.focus())};return document.addEventListener("pointerdown",M),document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("pointerdown",M),document.removeEventListener("keydown",I,!0)}},[v]);const A=M=>{m(M)},N=`${St.bar}${!t||n?` ${St.barEmpty}`:""}`,E=t&&!n?{backgroundColor:t}:void 0,L=o.jsxs("div",{className:St.wrap,ref:h,children:[o.jsxs("button",{ref:w,type:"button",className:`${X.iconButton} ${St.button}`,"aria-label":p(a),"aria-expanded":v,"aria-haspopup":"listbox","aria-controls":v?b:void 0,disabled:c,onMouseDown:M=>M.preventDefault(),onClick:()=>x(M=>!M),children:[o.jsx(e,{className:`${X.icon} ${St.icon}`}),o.jsx("span",{className:N,style:E})]}),v?o.jsx(ie,{children:o.jsx("div",{ref:y,id:b,className:St.popover,style:{top:k.top,left:k.left},children:o.jsx(Wi,{value:t,mixed:n,noneLabel:p(r),ariaLabel:p(a),disabled:c,fallbackCustom:l,onChange:A,onCommit:()=>x(!1)})})}):null]});return o.jsx(mt,{label:p(i),children:L})}function U1({commands:e,queries:t,disabled:n}){return o.jsx(Rc,{icon:Vl,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}function W1({commands:e,queries:t,disabled:n}){const r=V(),i=!!(n||!t.isVisualMode());return o.jsx(Ec,{size:t.getFontSize(),unit:t.getFontSizeUnit(),disabled:i,tooltip:r("commandFontSize"),toolbar:!0,onSizeChange:(a,l)=>{e.setFontSize(a,l)},onUnitChange:a=>{e.setFontSizeUnit(a)}})}function G1({commands:e,queries:t,disabled:n}){return o.jsx(Rc,{icon:ql,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function V1({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=V(),a=!!(n||!t.isVisualMode());return o.jsx(Wi,{value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneLabel:i("colorNone"),ariaLabel:i("commandHighlightColorAria"),disabled:a,menu:!0,fallbackCustom:"#ffff00",onChange:l=>e.setHighlightColor(l),onCommit:()=>r==null?void 0:r()})}const q1="_wrap_2cawp_1",X1="_wrapToolbar_2cawp_7",Y1="_field_2cawp_12",J1="_trigger_2cawp_20",Z1="_chevron_2cawp_46",Q1="_list_2cawp_69",ew="_option_2cawp_84",tw="_separator_2cawp_113",Ze={wrap:q1,wrapToolbar:X1,field:Y1,trigger:J1,chevron:Z1,list:Q1,option:ew,separator:tw},fi={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},nw={p:{fontSize:"1rem",fontWeight:"400"},h1:{fontSize:"1.75rem",fontWeight:"600"},h2:{fontSize:"1.5rem",fontWeight:"600"},h3:{fontSize:"1.25rem",fontWeight:"600"},h4:{fontSize:"1.125rem",fontWeight:"600"},h5:{fontSize:"1rem",fontWeight:"600"},h6:{fontSize:"0.875rem",fontWeight:"600"}};function $l(){const e=V();return o.jsx("div",{className:d.spinnerWrap,role:"status","aria-live":"polite","aria-label":e("customStyleLoading"),children:o.jsx("span",{className:d.spinner,"aria-hidden":"true"})})}function _c({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:i,listRef:a,style:l,customStylesEnabled:c=!1,customStyles:m=[],customStylesLoading:p=!1,onSelect:b,onSelectCustom:h,onAddNew:w}){const y=V(),v=t?null:e,x=c,k=!!(r&&c&&w);return r?o.jsxs(o.Fragment,{children:[vr.map(g=>o.jsx("button",{type:"button",className:X.menuItem,role:"menuitemradio","aria-checked":v===g,disabled:n,onMouseDown:S=>S.preventDefault(),onClick:()=>b(g),children:y(fi[g])},g)),x?o.jsx("div",{role:"separator",className:X.menuSeparator}):null,x&&p?o.jsx($l,{}):null,x&&!p?m.map(g=>o.jsx("button",{type:"button",className:X.menuItem,role:"menuitem",disabled:n,onMouseDown:S=>S.preventDefault(),onClick:()=>h==null?void 0:h(g.id),children:g.name},g.id)):null,k?o.jsxs(o.Fragment,{children:[x&&(p||m.length>0)?o.jsx("div",{role:"separator",className:X.menuSeparator}):null,o.jsxs("button",{type:"button",className:X.menuItem,role:"menuitem","aria-label":y("styleAddNewAria"),disabled:n,onMouseDown:g=>g.preventDefault(),onClick:()=>w==null?void 0:w(),children:[o.jsx(Su,{className:X.icon}),y("styleAddNew")]})]}):null]}):o.jsxs("ul",{ref:a,className:Ze.list,role:"listbox",id:i,style:l,"aria-label":y("commandParagraphStyleAria"),"aria-busy":x&&p?!0:void 0,children:[vr.map(g=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Ze.option,role:"option","aria-selected":v===g,disabled:n,style:nw[g],onMouseDown:S=>S.preventDefault(),onClick:()=>b(g),children:y(fi[g])})},g)),x&&(p||m.length>0)?o.jsx("li",{role:"separator",className:Ze.separator}):null,x&&p?o.jsx("li",{role:"presentation",children:o.jsx($l,{})}):null,x&&!p?m.map(g=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Ze.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:S=>S.preventDefault(),onClick:()=>h==null?void 0:h(g.id),children:g.name})},g.id)):null]})}const fr=4;function rw({commands:e,queries:t,disabled:n}){const r=V(),i=s.useId(),a=s.useRef(null),l=s.useRef(null),c=s.useRef(null),[m,p]=s.useState(!1),[b,h]=s.useState({top:0,left:0,width:0}),w=!!(n||!t.isVisualMode()),y=t.isParagraphStyleMixed(),v=y?null:t.getParagraphStyle(),x=v?r(fi[v]):"",k=t.customParagraphStylesEnabled(),g=k?t.getCustomParagraphStyles():[],S=k&&t.isCustomParagraphStylesLoading(),A=s.useCallback(()=>{const E=l.current,L=c.current;if(!E)return;const M=E.getBoundingClientRect(),I=(L==null?void 0:L.offsetHeight)??0,j=Math.max(M.width,(L==null?void 0:L.offsetWidth)??0);let T=M.bottom;T+I>window.innerHeight-fr&&(T=Math.max(fr,M.top-I));const P=Math.min(Math.max(M.left,fr),window.innerWidth-j-fr);h({top:T,left:P,width:j})},[]);s.useLayoutEffect(()=>{if(!m)return;A();const E=()=>A();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[m,A,g.length,S]),s.useEffect(()=>{if(!m)return;const E=M=>{var j,T;const I=M.target;(j=a.current)!=null&&j.contains(I)||(T=c.current)!=null&&T.contains(I)||p(!1)},L=M=>{M.key==="Escape"&&(M.preventDefault(),M.stopPropagation(),p(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",L,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",L,!0)}},[m]);const N=o.jsxs("div",{className:`${Ze.wrap} ${Ze.wrapToolbar}`,ref:a,children:[o.jsxs("div",{className:Ze.field,ref:l,children:[o.jsx("button",{type:"button",className:Ze.trigger,disabled:w,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":m,"aria-controls":m?i:void 0,onMouseDown:E=>E.preventDefault(),onClick:()=>p(E=>!E),children:x}),o.jsx("span",{className:Ze.chevron,"aria-hidden":"true"})]}),m?o.jsx(ie,{children:o.jsx(_c,{listRef:c,listId:i,value:v,mixed:y,disabled:w,customStylesEnabled:k,customStyles:g,customStylesLoading:S,style:{top:b.top,left:b.left,minWidth:b.width},onSelect:E=>{e.setParagraphStyle(E),p(!1)},onSelectCustom:E=>{e.applyCustomParagraphStyle(E),p(!1)}})}):null]});return o.jsx(mt,{label:r("commandParagraphStyle"),children:N})}function ow({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),l=a?null:t.getParagraphStyle(),c=t.customParagraphStylesEnabled(),m=c?t.getCustomParagraphStyles():[],p=c&&t.isCustomParagraphStylesLoading();return o.jsx(_c,{menu:!0,value:l,mixed:a,disabled:i,customStylesEnabled:c,customStyles:m,customStylesLoading:p,onSelect:b=>{e.setParagraphStyle(b),r==null||r()},onSelectCustom:b=>{e.openCustomParagraphStyleDialog(b),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const iw={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:ow,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:V1,enabled:"isVisualMode"},paragraph:{id:"paragraph",labelKey:"menuParagraph",ariaKey:"menuParagraphAria"},page:{id:"page",labelKey:"menuPage",ariaKey:"menuPageAria"}},groups:{font:{id:"font",labelKey:"toolbarGroupFont"},align:{id:"align",labelKey:"toolbarGroupAlign"},paragraph:{id:"paragraph",labelKey:"toolbarGroupParagraph"}},items:{fontFamily:{id:"fontFamily",widget:Eb,icon:iu,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:rw,icon:vu,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:W1,icon:lu,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:au,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:xu,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:yu,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:Xl,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:U1,icon:Vl,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:G1,icon:ql,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:Jc,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:mu,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:ju,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:Au,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:eu,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},alignLeft:{id:"alignLeft",command:"alignLeft",icon:hi,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:pi,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:gi,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:Wl,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:du,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:bu,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:Gl,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:Yl,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},aw={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:pu,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:Zc,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:Xl,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:cu,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"}}},lw={menus:{},submenus:{insertRow:{id:"insertRow",labelKey:"menuInsertRow",ariaKey:"menuInsertRowAria",enabled:"isInTable"},insertColumn:{id:"insertColumn",labelKey:"menuInsertColumn",ariaKey:"menuInsertColumnAria",enabled:"isInTable"}},groups:{},items:{table:{id:"table",command:"openTableDialog",icon:$a,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:To,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:To,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:To,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:Eo,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:Eo,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:Eo,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:$a,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:Qc,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:Du,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},sw={menus:{view:{id:"view",labelKey:"menuView",ariaKey:"menuViewAria"}},submenus:{toolbar:{id:"toolbar",labelKey:"menuToolbar",ariaKey:"menuToolbarAria"},toolbarPosition:{id:"toolbarPosition",labelKey:"menuToolbarPosition",ariaKey:"menuToolbarPositionAria"}},groups:{view:{id:"view",labelKey:"toolbarGroupView"},fullscreen:{id:"fullscreen",labelKey:"toolbarGroupFullscreen"}},items:{visual:{id:"visual",command:"setVisualMode",icon:Tu,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:uu,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:ru,labelKey:"commandCustomizeToolbar",ariaKey:"commandCustomizeToolbarAria"},toolbarPositionTop:{id:"toolbarPositionTop",command:"setToolbarPositionTop",labelKey:"toolbarPositionTop",ariaKey:"toolbarPositionTopAria",active:"isToolbarPositionTop"},toolbarPositionLeft:{id:"toolbarPositionLeft",command:"setToolbarPositionLeft",labelKey:"toolbarPositionLeft",ariaKey:"toolbarPositionLeftAria",active:"isToolbarPositionLeft"},toolbarPositionRight:{id:"toolbarPositionRight",command:"setToolbarPositionRight",labelKey:"toolbarPositionRight",ariaKey:"toolbarPositionRightAria",active:"isToolbarPositionRight"},toolbarPositionBottom:{id:"toolbarPositionBottom",command:"setToolbarPositionBottom",labelKey:"toolbarPositionBottom",ariaKey:"toolbarPositionBottomAria",active:"isToolbarPositionBottom"},lightMode:{id:"lightMode",command:"setLightMode",icon:fu,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:ou,labelKey:"modeDark",ariaKey:"modeDarkAria",active:"isDarkMode"},preview:{id:"preview",command:"openDocumentPreview",icon:wu,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:su,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function cw(...e){return{menus:Object.assign({},...e.map(t=>t.menus)),submenus:Object.assign({},...e.map(t=>t.submenus??{})),groups:Object.assign({},...e.map(t=>t.groups)),items:Object.assign({},...e.map(t=>t.items))}}const uw=cw($1,m1,aw,lw,sw,iw),dw={menus:[{id:"file",items:["save","open",de,"print"]},{id:"edit",items:["undo","redo"]},{id:"insert",items:["link","bookmark",de,"image","table","horizontalRule",de,{submenu:"insertRow",items:["insertRowBelow","insertRowBefore","deleteRow"]},{submenu:"insertColumn",items:["insertColumnAfter","insertColumnBefore","deleteColumn"]}]},{id:"view",items:["visual","html",de,{submenu:"toolbar",items:["customizeToolbar",de,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},de,"lightMode","darkMode",de,"preview","fullscreen"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},de,{submenu:"font",items:["fontProperties",de,{submenu:"highlightColor",items:[]},de,"bold","italic","underline","strikethrough"]},de,"clearFormatting",de,{submenu:"paragraph",items:["paragraphProperties",de,"alignLeft","alignCenter","alignRight","alignJustify",de,"indent","outdent",de,"bulletList","numberedList"]},de,{submenu:"page",items:["pageProperties"]},de,"imageProperties",de,"tableProperties","cellProperties","rowProperties"]}],iconGroups:[{id:"file",items:["save","open"]},{id:"print",items:["print"]},{id:"edit",items:["undo","redo"]},{id:"insert",items:["link","bookmark","image","table","horizontalRule"]},{id:"font",items:["fontFamily","paragraphStyle","fontSize","fontColor","highlightColor","bold","italic","underline","strikethrough","clearFormatting"]},{id:"align",items:["alignLeft","alignCenter","alignRight","alignJustify"]},{id:"paragraph",items:["indent","outdent","bulletList","numberedList"]},{id:"view",items:["visual","html","preview"]},{id:"fullscreen",items:["fullscreen"]}]},pr="fullscreen";function mw(e){const t=[];let n=null;for(const r of e){const i=r.items.filter(a=>a!==pr);i.length>0&&t.push({id:r.id,items:i}),r.items.includes(pr)&&(n={id:pr,items:[pr]})}return{main:t,trailing:n}}function fw({groups:e,catalog:t,commands:n,queries:r,disabled:i}){const a=V(),{main:l,trailing:c}=mw(e),m=p=>{const b=t.groups[p.id];return o.jsx("div",{className:X.iconGroup,role:"group","aria-label":b?ft(a,b):void 0,"data-toolbar-group":p.id,children:p.items.map(h=>{const w=t.items[h];if(!w)return null;const y=w.enabled?!r[w.enabled]():!1;if(w.widget){const g=w.widget;return o.jsx(g,{commands:n,queries:r,disabled:i||y},h)}if(!w.icon||!w.command)return null;const v=w.icon,x=w.command,k=w.active?r[w.active]():void 0;return o.jsx(mt,{label:w.tooltip??ft(a,w),children:o.jsx("button",{type:"button",className:X.iconButton,"aria-label":Dr(a,w),"aria-pressed":k,disabled:i||y,onPointerDown:g=>g.preventDefault(),onMouseDown:g=>g.preventDefault(),onClick:()=>{yi(n,x)},children:o.jsx(v,{className:X.icon})})},h)})},p.id)};return o.jsxs("div",{className:X.iconNav,role:"toolbar","aria-label":a("toolbarAria"),children:[l.length>0?o.jsx("div",{className:X.iconNavMain,children:l.map(m)}):null,c?o.jsx("div",{className:X.iconNavEnd,children:m(c)}):null]})}const pw=["--wysiwyg-menu-color","--wysiwyg-menu-background","--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function hw(e){const t={};for(const n of pw){const r=getComputedStyle(e).getPropertyValue(n).trim();if(r){t[n]=r;continue}let i=e;for(;i;){const a=i.style.getPropertyValue(n).trim();if(a){t[n]=a;break}i=i.parentElement}}return t}function gw({menus:e,catalog:t,commands:n,queries:r,disabled:i,compact:a,openMenuId:l,onOpenMenuIdChange:c}){const m=V(),[p,b]=s.useState(!1),[h,w]=s.useState({}),y=s.useRef(null),v=s.useRef(null),x=s.useRef(null),k=s.useRef(null),g=s.useCallback(()=>{b(!1),c(null)},[c]);s.useLayoutEffect(()=>{!p||!y.current||w(hw(y.current))},[p]),s.useEffect(()=>{var A;p&&((A=x.current)==null||A.focus())},[p]),s.useEffect(()=>{if(!p)return;const A=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=A}},[p]),s.useEffect(()=>{if(!p)return;const A=E=>{var L;if(E.key==="Escape"){if(E.preventDefault(),E.stopPropagation(),l){c(null);return}g(),(L=v.current)==null||L.focus()}},N=E=>{var L;k.current&&!k.current.contains(E.target)&&(g(),(L=v.current)==null||L.focus())};return document.addEventListener("keydown",A,!0),document.addEventListener("pointerdown",N),()=>{document.removeEventListener("keydown",A,!0),document.removeEventListener("pointerdown",N)}},[p,l,c,g]);const S=A=>e.map(N=>{const E=t.menus[N.id];return E?o.jsx(yw,{def:E,itemIds:N.items,catalog:t,commands:n,queries:r,disabled:i,variant:A,open:(A==="overlay"||!p)&&l===N.id,onOpenChange:L=>c(L?N.id:null),onItemRun:A==="overlay"?()=>{var L;g(),(L=v.current)==null||L.focus()}:void 0},`${A}-${N.id}`):null});return o.jsxs("div",{className:X.menuBar,ref:y,children:[o.jsx(mt,{label:m("brandMarkAria"),children:o.jsx("span",{className:X.brandMark,role:"img","aria-label":m("brandMarkAria"),children:o.jsx(tu,{className:X.brandMarkIcon})})}),o.jsx("div",{className:X.menuBarCompact,hidden:a===void 0?void 0:!a,children:o.jsx(mt,{label:m("menuHamburgerAria"),children:o.jsx("button",{ref:v,type:"button",className:`${X.menuButton} ${X.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":p,"aria-label":m("menuHamburgerAria"),disabled:i,onClick:()=>{if(p){g();return}c(null),b(!0)},children:o.jsx(hu,{className:X.icon})})})}),o.jsx("div",{className:X.menuBarDesktop,hidden:a===void 0?void 0:a,children:S("dropdown")}),p?o.jsx(ie,{children:o.jsx("div",{className:X.toolbar,"data-menu-overlay-portal":"",style:h,children:o.jsxs("div",{ref:k,className:X.menuOverlay,role:"dialog","aria-modal":"true","aria-label":m("menuOverlayAria"),children:[o.jsxs("div",{className:X.menuOverlayHeader,children:[o.jsx("span",{className:X.menuOverlayTitle,children:m("menuOverlayAria")}),o.jsx("button",{ref:x,type:"button",className:X.iconButton,"aria-label":m("menuCloseAria"),onClick:()=>{var A;g(),(A=v.current)==null||A.focus()},children:o.jsx(We,{className:X.icon})})]}),o.jsx("div",{className:X.menuOverlayBody,children:S("overlay")})]})})}):null]})}function Pr(e,t){var n,r;if(ct(e))return!1;if(Cn(e)){const i=(n=t.submenus)==null?void 0:n[e.submenu];return i?i.panel?!0:e.items.some(a=>Pr(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function bw(e,t,n){if(!ct(e[t])||!e.slice(t+1).some(a=>Pr(a,n)))return!1;let i=!1;for(let a=t-1;a>=0;a--){const l=e[a];if(ct(l)){i=!0;continue}if(Pr(l,n))return!i}return!1}function yw({def:e,itemIds:t,catalog:n,commands:r,queries:i,disabled:a,variant:l,open:c,onOpenChange:m,onItemRun:p}){const b=V(),h=s.useRef(null),w=l==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[y,v]=s.useState(null);s.useEffect(()=>{c||v(null)},[c]),s.useEffect(()=>{if(!c||l==="overlay")return;const k=S=>{h.current&&!h.current.contains(S.target)&&m(!1)},g=S=>{if(S.key==="Escape"){if(S.preventDefault(),S.stopPropagation(),y){v(null);return}m(!1)}};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",g,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",g,!0)}},[c,y,m,l]);const x=()=>{m(!1),p==null||p()};return o.jsxs("div",{className:X.menuWrap,ref:h,children:[o.jsx("button",{type:"button",className:X.menuButton,"aria-haspopup":"menu","aria-expanded":c,"aria-controls":w,"aria-label":Dr(b,e),disabled:a,onClick:()=>m(!c),children:ft(b,e)}),c?o.jsx("div",{className:X.menu,role:"menu",id:w,children:o.jsx(Ic,{entries:t,catalog:n,commands:r,queries:i,disabled:a,variant:l,onClose:x,openSubmenuId:y,onOpenSubmenuIdChange:v})}):null]})}function Ic({entries:e,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,openSubmenuId:c,onOpenSubmenuIdChange:m}){return o.jsx(o.Fragment,{children:e.map((p,b)=>{if(ct(p))return bw(e,b,t)?o.jsx("div",{role:"separator",className:X.menuSeparator},`separator-${b}`):null;if(Cn(p))return o.jsx(ww,{entry:p,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,open:c===p.submenu,onOpenChange:w=>m==null?void 0:m(w?p.submenu:null)},`submenu-${p.submenu}-${b}`);const h=t.items[p];return!h||!h.command?null:o.jsx(xw,{item:h,commands:n,queries:r,disabled:i,onClose:l},p)})})}function xw({item:e,commands:t,queries:n,disabled:r,onClose:i}){const a=V();if(!e.command)return null;const l=e.icon,c=e.command,m=e.active?n[e.active]():void 0,p=e.enabled?!n[e.enabled]():!1,b=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return o.jsxs("button",{type:"button",role:b,className:X.menuItem,"aria-checked":m,disabled:r||p,onClick:()=>{i(),yi(t,c)},children:[l?o.jsx(l,{className:X.icon}):null,ft(a,e)]})}function ww({entry:e,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,open:c,onOpenChange:m}){var E;const p=V(),b=s.useRef(null),h=s.useRef(null),[w,y]=s.useState(null),v=(E=t.submenus)==null?void 0:E[e.submenu],x=a==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,k=v==null?void 0:v.panel,g=v!=null&&v.enabled?!r[v.enabled]():!1,S=a==="overlay";if(s.useEffect(()=>{c||y(null)},[c]),!v||!k&&!e.items.some(L=>Pr(L,t)))return null;const A=L=>{(L.key==="ArrowRight"||L.key==="Enter"||L.key===" ")&&(L.preventDefault(),L.stopPropagation(),m(!0),requestAnimationFrame(()=>{var I;const M=(I=h.current)==null?void 0:I.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');M==null||M.focus()}))},N=L=>{var M;L.key==="ArrowLeft"&&(L.preventDefault(),L.stopPropagation(),m(!1),(M=b.current)==null||M.focus())};return o.jsxs("div",{className:X.submenuWrap,onMouseEnter:S?void 0:()=>m(!0),onMouseLeave:S?void 0:()=>m(!1),children:[o.jsx("button",{ref:b,type:"button",role:"menuitem",className:`${X.menuItem} ${X.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":c,"aria-controls":x,"aria-label":Dr(p,v),disabled:i||g,onClick:()=>m(S?!c:!0),onKeyDown:A,children:ft(p,v)}),c?o.jsx("div",{ref:h,className:`${X.menu} ${X.submenu}`,role:"menu",id:x,"aria-label":Dr(p,v),onKeyDown:N,children:k?o.jsx(k,{commands:n,queries:r,disabled:i||g,onMenuClose:l}):o.jsx(Ic,{entries:e.items,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,openSubmenuId:w,onOpenSubmenuIdChange:y})}):null]})}function qo({catalog:e,layout:t,commands:n,queries:r,disabled:i,menuVisible:a=!0,toolbarVisible:l=!0,compact:c,position:m="top"}){const[p,b]=s.useState(null);return!a&&!l?null:o.jsxs("div",{className:X.toolbar,"data-compact":c?"":void 0,"data-toolbar-position":m,children:[a?o.jsx(gw,{menus:t.menus,catalog:e,commands:n,queries:r,disabled:i,compact:c,openMenuId:p,onOpenMenuIdChange:b}):null,l?o.jsx(fw,{groups:t.iconGroups,catalog:e,commands:n,queries:r,disabled:i}):null]})}const vw="_root_1621j_1",Sw="_fullscreen_1621j_36",Cw="_exitFullscreen_1621j_48",kw="_exitFullscreenIcon_1621j_79",Dw="_menuChrome_1621j_94",Pw="_body_1621j_104",Aw="_iconChrome_1621j_134",jw="_workspace_1621j_178",Ew="_htmlFileDropOverlay_1621j_190",Tw="_surface_1621j_204",Nw="_visual_1621j_211",Lw="_html_1621j_190",De={root:vw,fullscreen:Sw,exitFullscreen:Cw,exitFullscreenIcon:kw,menuChrome:Dw,body:Pw,iconChrome:Aw,workspace:jw,htmlFileDropOverlay:Ew,surface:Tw,visual:Nw,html:Lw},Mw=s.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i},a){const l=V();return o.jsx("textarea",{ref:a,className:`${De.surface} ${De.html}`,value:t,onChange:c=>n(c.target.value),placeholder:r,disabled:i,"aria-label":l("htmlEditorAria"),spellCheck:!1})}),Rw=s.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i,onBeforeInput:a,onPointerDown:l,onContextMenu:c},m){const p=V(),b=s.useRef(null),h=s.useRef(a);h.current=a;const w=y=>{b.current=y,typeof m=="function"?m(y):m&&(m.current=y)};return s.useLayoutEffect(()=>{const y=b.current;y&&(y.innerHTML!==t&&(y.innerHTML=t),Ps(y))},[t]),s.useLayoutEffect(()=>{const y=b.current;if(!y)return;const v=x=>{var k;(k=h.current)==null||k.call(h,x)};return y.addEventListener("beforeinput",v),()=>y.removeEventListener("beforeinput",v)},[]),o.jsx("div",{ref:w,className:`${De.surface} ${De.visual}`,contentEditable:!i,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":p("visualEditorAria"),"aria-disabled":i||void 0,"data-placeholder":r,onPointerDown:l,onContextMenu:c,onInput:y=>{n(y.currentTarget.innerHTML)}})});function _w({value:e,defaultValue:t="",onChange:n,onAutoSave:r,mode:i,defaultMode:a="visual",onModeChange:l,fullscreen:c,defaultFullscreen:m=!1,onFullscreenChange:p,placeholder:b,disabled:h,readOnly:w=!1,className:y,locale:v="en",toolbarBackground:x,menuColor:k,menuBackground:g,menuFontSize:S,menuFontFamily:A,border:N,menuVisible:E=!0,toolbarVisible:L=!0,allowedChrome:M,customActions:I,customFonts:j,transformHtml:T,loadCustomParagraphStyles:P,onSaveCustomParagraphStyle:R,onDeleteCustomParagraphStyle:W,customImagePicker:O,disableBuiltinImageInsert:Z,disableHtmlFileDrop:te=!1,toolbarCustomization:ce,darkMode:re=!1,darkModePersistence:he,toolbarPosition:ne="top",toolbarPositionPersistence:Q}){const D=!!(h||w),[$,Y]=Ho({value:e,defaultValue:t,onChange:n}),[B,fe]=Ho({value:i,defaultValue:a,onChange:l}),[ue,we]=Ho({value:c,defaultValue:m,onChange:p}),_=s.useRef(null),Ce=s.useRef(null),Pt=s.useRef(null);Pt.current===null&&(Pt.current=p1($));const Ee=Pt.current,ot=s.useRef($);ot.current=$;const z=s.useRef(B);z.current=B;const Ji=s.useRef(ue);Ji.current=ue;const ke=s.useRef(null),jn=s.useRef(T);jn.current=T;const Te=s.useRef({}),Pe=s.useRef(null),Ne=s.useRef(null),ze=s.useRef(null),Oe=s.useRef(null),Le=s.useRef(null),[En,_r]=s.useState(Qe),Ir=s.useRef(En);Ir.current=En;const Ye=s.useRef(Ct),[Yt,Tn]=s.useState({value:null,unit:Ct,mixed:!1}),it=s.useRef(Yt);it.current=Yt;const[Jt,Fr]=s.useState({value:null,mixed:!1}),Zt=s.useRef(Jt);Zt.current=Jt;const[Qt,Br]=s.useState({value:null,mixed:!1}),en=s.useRef(Qt);en.current=Qt;const[tn,Hr]=s.useState({value:null,mixed:!1}),nn=s.useRef(tn);nn.current=tn;const[zr,Or]=s.useState({tag:null,mixed:!1}),Kr=s.useRef(zr);Kr.current=zr;const[Zi,$r]=s.useState({align:"left",mixed:!1}),Ur=s.useRef(Zi);Ur.current=Zi;const[Qi,Wr]=s.useState({type:null,mixed:!1}),rn=s.useRef(Qi);rn.current=Qi;const[ea,Gr]=s.useState(!1),ta=s.useRef(ea);ta.current=ea;const[Vr,qr]=s.useState(!1),na=s.useRef(Vr);na.current=Vr;const[ra,oa]=s.useState(!1),ia=s.useRef(ra);ia.current=ra;const[on,Nn]=s.useState({open:!1,tab:"general"}),[Xr,aa]=s.useState(!1),[an,la]=s.useState({open:!1,html:""}),[Yr,Ln]=s.useState(null),[Fc,Jr]=s.useState(!1),[Bc,Zr]=s.useState(!1),[At,Mn]=s.useState(()=>he?re:Hl()??re),[Ke,Rn]=s.useState(()=>Q?ne:zl()??ne),[yt,_n]=s.useState({open:!1,tab:"general",value:hn()}),[xt,In]=s.useState({open:!1,tab:"font",value:ri()}),[Qr,sa]=s.useState([]),[eo,to]=s.useState(!1),[Hc,Fn]=s.useState(!1),[be,ln]=s.useState({open:!1}),[Ae,Bn]=s.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[no,ro]=s.useState({open:!1,existingIds:[]}),[zc,Hn]=s.useState({open:!1}),[zn,On]=s.useState({open:!1,tab:"general",value:fc(),aspectRatio:1}),[oo,io]=s.useState({open:!1}),[Kn,ao]=s.useState({open:!1,value:_h()}),[$n,lo]=s.useState({open:!1,value:Wh()}),[Un,so]=s.useState({open:!1,value:eg()}),[sn,co]=s.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1}),[ye,jt]=s.useState(null),ca=s.useRef(ye);ca.current=ye;const[uo,Wn]=s.useState(!1),ua=s.useRef(uo);ua.current=uo;const da=s.useRef(void 0),Gn=s.useRef(Qr);Gn.current=Qr;const ma=s.useRef(eo);ma.current=eo;const mo=!!(P&&R),fo=s.useRef(mo);fo.current=mo;const fa=s.useRef(P);fa.current=P;const pa=s.useRef(R);pa.current=R;const ha=s.useRef(W);ha.current=W;const ga=s.useRef(O);ga.current=O;const ba=s.useRef(ce);ba.current=ce;const ya=s.useRef(he);ya.current=he;const xa=s.useRef(Q);xa.current=Q;const wa=s.useRef(At);wa.current=At;const va=s.useRef(Ke);va.current=Ke;const Sa=s.useRef(Z);Sa.current=Z;const po=s.useRef(0),cn=s.useRef(0),Ca=s.useRef(0),Vn=s.useRef(0),ka=s.useRef(0),qn=s.useRef(0),Da=s.useRef(0),at=s.useMemo(()=>ss(j),[j]),un=s.useRef(at);un.current=at;const ho=s.useMemo(()=>yd($,at).join(`
91
+ `),[$,at]);s.useEffect(()=>{const f=(ho?ho.split(`
92
+ `):[]).map(C=>{const K=document.createElement("link");return K.rel="stylesheet",K.href=C,K.setAttribute(jr,""),document.head.append(K),K});return()=>{for(const C of f)C.remove()}},[ho]);const Xn=s.useCallback(async()=>{const u=fa.current;if(!u)return;const f=++po.current;to(!0);try{const C=await u();if(f!==po.current)return;sa(C)}catch{}finally{f===po.current&&to(!1)}},[]);s.useEffect(()=>{if(!P||!R){sa([]),to(!1);return}Xn()},[P,R,Xn]);const Pa=s.useCallback(async u=>{Ln(u);const f=ba.current;if(f!=null&&f.load&&f.save){const C=++Ca.current;Zr(!0);try{await f.save(u)}catch{}finally{C===Ca.current&&Zr(!1)}return}y1(u)},[]);s.useEffect(()=>{const u=ce;if(!(u!=null&&u.load)||!u.save){Ln(b1()),Jr(!1),Zr(!1);return}const f=++cn.current;return Jr(!0),(async()=>{try{const C=await u.load();if(f!==cn.current)return;Ln(C)}catch{if(f!==cn.current)return;Ln(null)}finally{f===cn.current&&Jr(!1)}})(),()=>{cn.current+=1}},[ce]);const Aa=s.useCallback(async u=>{Mn(u);const f=ya.current;if(f!=null&&f.load&&f.save){const C=++ka.current;try{await f.save(u)}catch{}finally{if(C!==ka.current)return}return}s1(u)},[]);s.useEffect(()=>{const u=he;if(!(u!=null&&u.load)||!u.save){Mn(Hl()??re);return}const f=++Vn.current;return(async()=>{try{const C=await u.load();if(f!==Vn.current)return;Mn(typeof C=="boolean"?C:re)}catch{if(f!==Vn.current)return;Mn(re)}})(),()=>{Vn.current+=1}},[he,re]);const ja=s.useCallback(async u=>{Rn(u);const f=xa.current;if(f!=null&&f.load&&f.save){const C=++Da.current;try{await f.save(u)}catch{}finally{if(C!==Da.current)return}return}u1(u)},[]);s.useEffect(()=>{const u=Q;if(!(u!=null&&u.load)||!u.save){Rn(zl()??ne);return}const f=++qn.current;return(async()=>{try{const C=await u.load();if(f!==qn.current)return;Rn(Lc(C)??ne)}catch{if(f!==qn.current)return;Rn(ne)}})(),()=>{qn.current+=1}},[Q,ne]);const Et=s.useCallback(u=>{var C;const f=((C=jn.current)==null?void 0:C.call(jn,u))??u;return Y(f),f},[Y]),Se=s.useCallback((u,f)=>{const C=Et(u);return Ee.record(C,{coalesce:f}),C},[Et,Ee]),Oc=s.useCallback(u=>{Se(u,!1)},[Se]),dn=d1({enabled:!D&&!te,onHtml:Oc}),G=s.useCallback((u,f)=>Se(Lo(u,Mo(u,ot.current,un.current)),f),[Se]),Yn=s.useCallback(()=>{const u=Ee.undo();u!==null&&(Ee.markApplying(),Et(u))},[Et,Ee]),Jn=s.useCallback(()=>{const u=Ee.redo();u!==null&&(Ee.markApplying(),Et(u))},[Et,Ee]);s.useEffect(()=>{Ee.syncExternal($)},[$,Ee]);const H=s.useCallback(()=>{ke.current=lt({mode:z.current,visualEl:_.current,htmlEl:Ce.current})},[]),go=s.useCallback(()=>{const u=lt({mode:z.current,visualEl:_.current,htmlEl:Ce.current}),f=ke.current;tl(f,u)||(ke.current=u)},[]),bo=s.useCallback(()=>{const u=_.current;if(z.current!=="visual"||!u){Tn({value:null,unit:Ye.current,mixed:!1});return}const f=Qd(u,Ye.current);Pe.current&&(f.value=Pe.current.value,f.unit=Pe.current.unit,f.mixed=!1),Ye.current=f.unit,Tn(C=>C.value===f.value&&C.unit===f.unit&&C.mixed===f.mixed?C:f)},[]),yo=s.useCallback(()=>{const u=_.current;if(z.current!=="visual"||!u){Fr({value:null,mixed:!1});return}const f=vd(u);Ne.current&&(f.value=Ne.current.value,f.mixed=!1),Fr(C=>C.value===f.value&&C.mixed===f.mixed?C:f)},[]),xo=s.useCallback(()=>{const u=_.current;if(z.current!=="visual"||!u){Br({value:null,mixed:!1}),Hr({value:null,mixed:!1});return}const f=qa(u,"color");ze.current&&(f.value=ze.current.value,f.mixed=!1);const C=qa(u,"backgroundColor");Oe.current&&(C.value=Oe.current.value,C.mixed=!1),Br(K=>K.value===f.value&&K.mixed===f.mixed?K:f),Hr(K=>K.value===C.value&&K.mixed===C.mixed?K:C)},[]),wo=s.useCallback(()=>{const u=_.current;if(z.current!=="visual"||!u){Or({tag:null,mixed:!1});return}const f=qm(u);Or(C=>C.tag===f.tag&&C.mixed===f.mixed?C:f)},[]),vo=s.useCallback(()=>{const u=_.current;if(z.current!=="visual"||!u){$r({align:null,mixed:!1}),Wr({type:null,mixed:!1}),Gr(!1),oa(!1);return}const f=Zs(u);$r(ee=>ee.align===f.align&&ee.mixed===f.mixed?ee:f);const C=Rs(u);Wr(ee=>ee.type===C.type&&ee.mixed===C.mixed?ee:C);const K=of(u);Gr(ee=>ee===K?ee:K);const q=Yf(u);oa(ee=>ee===q?ee:q)},[]),F=s.useCallback(()=>{const u=_.current;if(z.current!=="visual"||!u){_r(Qe()),qr(!1),bo(),yo(),xo(),wo(),vo();return}const f=ke.current,C=!!(f&&!f.collapsed);qr(q=>q===C?q:C);const K=ws(or(u),Te.current);_r(q=>fm(q,K)?q:K),bo(),yo(),xo(),wo(),vo()},[bo,yo,xo,wo,vo]),Ea=s.useCallback(()=>{const u=ke.current,f=Le.current;!f||!u||u.collapsed&&u.start===f.start&&u.end===f.end||(Te.current={},Pe.current=null,Ne.current=null,ze.current=null,Oe.current=null,Le.current=null)},[]);s.useEffect(()=>{if(B==="visual"){F();return}Te.current={},Pe.current=null,Ne.current=null,ze.current=null,Oe.current=null,Le.current=null,_r(Qe()),Tn({value:null,unit:Ye.current,mixed:!1}),Fr({value:null,mixed:!1}),Br({value:null,mixed:!1}),Hr({value:null,mixed:!1}),Or({tag:null,mixed:!1}),$r({align:null,mixed:!1}),Wr({type:null,mixed:!1}),Gr(!1),qr(!1)},[B,$,F]);const Tt=s.useCallback((u,f,C)=>{Tm({snapshot:u,visualEl:_.current,htmlEl:Ce.current,getHtml:()=>z.current==="visual"&&_.current?_.current.innerHTML:ot.current,setHtml:K=>{if(z.current==="visual"){G(vn(K).body,!1);return}Se(K,!1)},content:f,asHtml:C})},[Se,G]),Ta=s.useCallback(u=>{if(z.current==="visual"&&u==="html"&&_.current){const f=_.current.innerHTML,C=Lo(f,Mo(f,ot.current,un.current));C!==ot.current&&Se(C,!0)}fe(u)},[Se,fe]);s.useEffect(()=>{if(!ue)return;const u=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=u}},[ue]),s.useEffect(()=>{if(!ue)return;const u=f=>{f.key==="Escape"&&(f.defaultPrevented||on.open||yt.open||xt.open||oo.open||Kn.open||$n.open||Un.open||Xr||an.open||(f.preventDefault(),we(!1)))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[ue,we,on.open,yt.open,xt.open,oo.open,Kn.open,$n.open,Un.open,Xr,an.open]),s.useEffect(()=>{const u=()=>{if(z.current!=="visual"||!_.current)return;const f=window.getSelection();if(!f||f.rangeCount===0)return;const C=f.anchorNode;!C||!_.current.contains(C)&&_.current!==C||(H(),Ea(),F(),jt(bn(_.current)),Wn(yn(_.current)!==null))};return document.addEventListener("selectionchange",u),()=>document.removeEventListener("selectionchange",u)},[H,Ea,F]),s.useEffect(()=>{if(B!=="html")return;const u=Ce.current;if(!u)return;const f=()=>H();return u.addEventListener("select",f),u.addEventListener("keyup",f),u.addEventListener("mouseup",f),()=>{u.removeEventListener("select",f),u.removeEventListener("keyup",f),u.removeEventListener("mouseup",f)}},[B,H]),s.useLayoutEffect(()=>{if(B!=="visual"||D){jt(null);return}const u=_.current;if(!u)return;const f=bn(u);jt(C=>f||(C&&C.isConnected&&u.contains(C)?C:null))},[$,B,D]);const U=s.useCallback(u=>{const f=lt({mode:"visual",visualEl:u,htmlEl:Ce.current}),C=ke.current,K=tl(C,f)?C:f.visualRange?f:C??f;ke.current=K,u.focus();const q=Em(u,K);if(q){const ee=window.getSelection();try{ee==null||ee.removeAllRanges(),ee==null||ee.addRange(q),ke.current={...K,visualRange:q}}catch{}}return ke.current??K},[]),So=s.useCallback((u,f)=>{if(z.current!=="visual")return;const C=_.current;if(!C)return;const K=f??Ye.current,q=kt(u,K);if(!q)return;Ye.current=q.unit;const ee=U(C);if(ee.collapsed){Pe.current=q,Le.current={start:ee.start,end:ee.end},F();return}Pe.current=null,Va(C,q.value,q.unit)&&(G(C.innerHTML,!1),H(),F())},[U,G,H,F]),Na=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(!f)return;const C=U(f);if(C.collapsed){Ne.current={value:u},Le.current={start:C.start,end:C.end},F();return}Ne.current=null,Wa(f,u)&&(G(f.innerHTML,!1),H(),F())},[U,G,H,F]),Co=s.useCallback((u,f)=>{if(z.current!=="visual")return;const C=_.current;if(!C)return;const K=U(C),q=u==="color"?ze:Oe;if(K.collapsed){q.current={value:f},Le.current={start:K.start,end:K.end},F();return}q.current=null,Fo(C,u,f)&&(G(C.innerHTML,!1),H(),F())},[U,G,H,F]),ko=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(!f)return;const C=U(f);if(Nn({open:!1,tab:"general"}),C.collapsed){if(u.size!==null){const je=kt(u.size,u.unit);je&&(Pe.current=je,Ye.current=je.unit)}const q=or(f),ee={};for(const je of Ue)u.marks[je]!==q[je]&&(ee[je]=u.marks[je]);Te.current=ee,u.fontColorMixed||(ze.current={value:u.fontColor}),u.highlightColorMixed||(Oe.current={value:u.highlightColor}),u.fontFamilyMixed||(Ne.current={value:u.fontFamily}),Le.current={start:C.start,end:C.end},F();return}if(Te.current={},Pe.current=null,Ne.current=null,ze.current=null,Oe.current=null,Le.current=null,u.size!==null){const q=kt(u.size,u.unit);q&&(Ye.current=q.unit,Va(f,q.value,q.unit))}const K=or(f);for(const q of Ue)u.marks[q]!==K[q]&&Ya(f,q);u.fontFamilyMixed||Wa(f,u.fontFamily),u.fontColorMixed||Fo(f,"color",u.fontColor),u.highlightColorMixed||Fo(f,"backgroundColor",u.highlightColor),G(f.innerHTML,!1),H(),F()},[U,G,H,F]),La=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),_n(C=>({...C,open:!1})),!ec(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F()}},[U,G,H,F]),Ma=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),In(C=>({...C,open:!1})),!Kf(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F()}},[U,G,H,F]),Ra=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),Bn(C=>({...C,open:!1})),!np(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F()}},[U,G,H,F]),_a=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),ro(C=>({...C,open:!1})),!ap(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F()}},[U,G,H,F]),Zn=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),Hn({open:!1}),!Pp(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F()}},[U,G,H,F]),Ia=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),io({open:!1}),!Dh(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F(),Wn(!0)}},[U,G,H,F]),Fa=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),ao(C=>({...C,open:!1})),!Hh(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F()}},[U,G,H,F]),Ba=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),lo(C=>({...C,open:!1})),!Xh(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F()}},[U,G,H,F]),Ha=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),so(C=>({...C,open:!1})),!og(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F()}},[U,G,H,F]),wt=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),!u(f)){H(),F();return}G(f.innerHTML,!1),H(),F(),Wn(yn(f)!==null)}},[U,G,H,F]),Do=s.useCallback(u=>{Zn({src:u.src,alt:u.alt??"",title:u.title??"",css:u.css})},[Zn]),za=s.useCallback(u=>{if(z.current!=="visual")return;const f=_.current;if(f){if(U(f),On(C=>({...C,open:!1})),!th(f,u)){H(),F();return}G(f.innerHTML,!1),H(),F()}},[U,G,H,F]),Kc=s.useCallback((u,f)=>{ye!=null&&ye.isConnected&&yh(ye,u,f)},[ye]),$c=s.useCallback(()=>{const u=_.current;!u||!(ye!=null&&ye.isConnected)||(G(u.innerHTML,!1),Bo(u,ye),H(),F())},[ye,G,H,F]),Qn=s.useCallback(()=>{if(z.current==="visual"&&_.current){const u=_.current.innerHTML,f=Lo(u,Mo(u,ot.current,un.current));if(f!==ot.current)return Se(f,!0)}return ot.current},[Se]);dg({onAutoSave:r,getHtml:Qn});const ae=s.useMemo(()=>({getHtml:Qn,setHtml:u=>{Se(u,!1)},getMode:()=>z.current,setMode:Ta,getFullscreen:()=>Ji.current,setFullscreen:we,getDarkMode:()=>wa.current,setDarkMode:u=>{Aa(u)},getToolbarPosition:()=>va.current,setToolbarPosition:u=>{ja(u)},openCustomizeToolbar:()=>{aa(!0)},openDocumentPreview:()=>{la({open:!0,html:Qn()})},undo:Yn,redo:Jn,canUndo:()=>Ee.canUndo(),canRedo:()=>Ee.canRedo(),getSelection:()=>{const u=ke.current??lt({mode:z.current,visualEl:_.current,htmlEl:Ce.current});return Ja(u)},insertText:u=>{const f=ke.current??lt({mode:z.current,visualEl:_.current,htmlEl:Ce.current});Tt(f,u,!1)},insertHtml:(u,f)=>{const C=ke.current??lt({mode:z.current,visualEl:_.current,htmlEl:Ce.current}),K=f===void 0;Tt(C,K?u:f,K)},toggleFontMark:u=>{if(z.current!=="visual")return;const f=_.current;if(!f)return;const C=U(f);if(C.collapsed){const K=or(f);Te.current=hm(Te.current,K,u),Le.current={start:C.start,end:C.end},F();return}Te.current={},Le.current=null,Ya(f,u)&&(G(f.innerHTML,!1),H(),F())},clearFormatting:()=>{if(z.current!=="visual")return;const u=_.current;!u||U(u).collapsed||(Te.current={},Pe.current=null,Ne.current=null,ze.current=null,Oe.current=null,Le.current=null,pp(u)&&(G(u.innerHTML,!1),H(),F()))},isFontMarkActive:u=>Ir.current[u],hasTextSelection:()=>z.current==="visual"&&na.current,setFontSize:(u,f)=>{So(u,f)},setFontSizeUnit:u=>{var je;const f=_.current,C=it.current;if(z.current!=="visual"||!f||C.value===null||C.mixed){Ye.current=u,Tn(jo=>({...jo,unit:u}));return}const K=U(f),q=em(f,((je=K.visualRange)==null?void 0:je.startContainer)??f),ee=ms(C.value,C.unit,u,q.parentPx,q.rootPx);So(ee,u)},getFontSize:()=>it.current.value,getFontSizeUnit:()=>it.current.unit,isFontSizeMixed:()=>it.current.mixed,setFontFamily:u=>{Na(u)},getFontFamily:()=>Zt.current.value,isFontFamilyMixed:()=>Zt.current.mixed,getFontFaces:()=>un.current,setFontColor:u=>{Co("color",u)},setHighlightColor:u=>{Co("backgroundColor",u)},getFontColor:()=>en.current.value,isFontColorMixed:()=>en.current.mixed,getHighlightColor:()=>nn.current.value,isHighlightColorMixed:()=>nn.current.mixed,setParagraphStyle:u=>{if(z.current!=="visual")return;const f=_.current;f&&(U(f),Xm(f,u)&&(G(f.innerHTML,!1),H(),F()))},getParagraphStyle:()=>Kr.current.tag,isParagraphStyleMixed:()=>Kr.current.mixed,setTextAlign:u=>{if(z.current!=="visual")return;const f=_.current;f&&(U(f),Qs(f,u)&&(G(f.innerHTML,!1),H(),F()))},getTextAlign:()=>Ur.current.align,isTextAlignMixed:()=>Ur.current.mixed,indent:()=>{if(z.current!=="visual")return;const u=_.current;u&&(U(u),af(u)&&(G(u.innerHTML,!1),H(),F()))},outdent:()=>{if(z.current!=="visual")return;const u=_.current;u&&(U(u),lf(u)&&(G(u.innerHTML,!1),H(),F()))},canOutdent:()=>z.current==="visual"&&ta.current,toggleList:u=>{if(z.current!=="visual")return;const f=_.current;f&&(U(f),Zm(f,u)&&(G(f.innerHTML,!1),H(),F()))},isBulletList:()=>rn.current.type==="ul"&&!rn.current.mixed,isNumberedList:()=>rn.current.type==="ol"&&!rn.current.mixed,openFontProperties:u=>{z.current==="visual"&&Nn({open:!0,tab:u??"general"})},applyFontProperties:u=>{ko(u)},openParagraphProperties:u=>{if(z.current!=="visual")return;const f=_.current;f&&U(f),_n({open:!0,tab:u??"general",value:f?al(f):hn()})},applyParagraphProperties:u=>{La(u)},openPageProperties:u=>{if(z.current!=="visual")return;const f=_.current;f&&U(f),In({open:!0,tab:u??"font",value:f?Of(f):ri()})},applyPageProperties:u=>{Ma(u)},openCustomParagraphStyleDialog:u=>{if(z.current!=="visual"||!fo.current)return;if(u){const C=Gn.current.find(K=>K.id===u);if(!C)return;ln({open:!0,mode:"edit",style:C});return}const f=_.current;f&&U(f),ln({open:!0,mode:"create",font:{size:it.current.mixed?null:it.current.value,unit:it.current.unit,marks:{...Ir.current},fontFamily:Zt.current.mixed?null:Zt.current.value,fontColor:en.current.mixed?null:en.current.value,highlightColor:nn.current.mixed?null:nn.current.value},paragraph:tc(f?al(f):hn())})},applyCustomParagraphStyle:u=>{const f=Gn.current.find(K=>K.id===u);if(!f||(ko({size:f.font.size,unit:f.font.unit,marks:f.font.marks,fontFamily:f.font.fontFamily??null,fontFamilyMixed:!1,fontColor:f.font.fontColor,highlightColor:f.font.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}),!f.paragraph))return;const C=_.current;!C||z.current!=="visual"||(U(C),Lf(C,f.paragraph)&&(G(C.innerHTML,!1),H(),F()))},customParagraphStylesEnabled:()=>fo.current,getCustomParagraphStyles:()=>Gn.current,isCustomParagraphStylesLoading:()=>ma.current,openLinkDialog:u=>{if(z.current!=="visual")return;const f=_.current;f&&U(f);const C=f?oc(f):Mr(),K=f?oi(f):[],q=(C==null?void 0:C.href)??"",ee=q.startsWith("#")?q.slice(1):"",je=K.some(jo=>jo.id===ee)?ee:"";Bn({open:!0,tab:u??"link",href:q,title:(C==null?void 0:C.title)??"",targetBlank:(C==null?void 0:C.targetBlank)??!1,textDecorationNone:(C==null?void 0:C.textDecorationNone)??!1,hoverMode:(C==null?void 0:C.hoverMode)??"color",hoverColor:(C==null?void 0:C.hoverColor)??null,hoverHtml:(C==null?void 0:C.hoverHtml)??"",bookmarks:K,selectedBookmarkId:je})},applyLink:u=>{Ra(u)},openBookmarkDialog:()=>{if(z.current!=="visual")return;const u=_.current;u&&U(u),ro({open:!0,existingIds:u?oi(u).map(f=>f.id):[]})},applyBookmark:u=>{_a(u)},openImageDialog:()=>{if(z.current!=="visual")return;const u=_.current;u&&U(u);const f=ga.current;if(Sa.current&&f){f.onPick(Do);return}Hn({open:!0})},applyImage:u=>{Zn(u)},openImageProperties:u=>{if(z.current!=="visual")return;const f=_.current;if(!f)return;U(f);const C=bn(f),K=eh(f);!C||!K||On({open:!0,tab:u??"general",value:K,aspectRatio:Jp(C)})},applyImageProperties:u=>{za(u)},insertHorizontalRule:()=>{if(z.current!=="visual")return;const u=_.current;u&&(U(u),Mp(u)&&(G(u.innerHTML,!1),H(),F()))},openTableDialog:()=>{if(z.current!=="visual")return;const u=_.current;u&&U(u),io({open:!0})},applyTable:u=>{Ia(u)},openTableProperties:()=>{if(z.current!=="visual")return;const u=_.current;if(!u)return;U(u);const f=Bh(u);f&&ao({open:!0,value:f})},applyTableProperties:u=>{Fa(u)},openCellProperties:()=>{if(z.current!=="visual")return;const u=_.current;if(!u)return;U(u);const f=qh(u);f&&lo({open:!0,value:f})},applyCellProperties:u=>{Ba(u)},openRowProperties:()=>{if(z.current!=="visual")return;const u=_.current;if(!u)return;U(u);const f=rg(u);f&&so({open:!0,value:f})},applyRowProperties:u=>{Ha(u)},insertRowBelow:()=>{wt(u=>si(u,"below"))},insertRowBefore:()=>{wt(u=>si(u,"before"))},deleteRow:()=>{wt(u=>Ph(u))},insertColumnAfter:()=>{wt(u=>hl(u,"after"))},insertColumnBefore:()=>{wt(u=>hl(u,"before"))},deleteColumn:()=>{wt(u=>Ah(u))},cut:async()=>{if(z.current!=="visual")return;const u=_.current;u&&(U(u),await cp(u)&&(G(u.innerHTML,!1),H(),F()))},copy:async()=>{if(z.current!=="visual")return;const u=_.current;u&&(U(u),await cc(u))},deleteSelection:()=>{if(z.current!=="visual")return;const u=_.current;u&&(U(u),sc(u)&&(G(u.innerHTML,!1),H(),F()))},isLink:()=>ia.current,isImageSelected:()=>z.current==="visual"&&ca.current!==null,isInTable:()=>z.current==="visual"&&ua.current}),[Se,G,Ta,we,Aa,ja,Tt,Yn,Jn,H,F,U,So,Na,Co,ko,La,Ma,Ra,_a,Zn,za,Ia,Fa,Ba,Ha,wt,Do,Qn]),Oa=s.useCallback(()=>{const u=ke.current??lt({mode:z.current,visualEl:_.current,htmlEl:Ce.current});return{mode:u.mode,selection:Ja(u),getHtml:ae.getHtml,setHtml:f=>{Se(f,!1)},insertText:f=>Tt(u,f,!1),insertHtml:(f,C)=>{const K=C===void 0;Tt(u,K?f:C,K)}}},[Tt,ae.getHtml,Se]),{catalog:er,layout:Ka}=s.useMemo(()=>Bu(I,uw,dw),[I]),tr=s.useMemo(()=>K1(Ka,M),[Ka,M]),Po=s.useMemo(()=>({...tr,iconGroups:h1(tr.iconGroups,Yr)}),[tr,Yr]),Nt=s.useMemo(()=>({...Kd(ae),...Hu(I,Oa)}),[ae,I,Oa]),Ao=s.useMemo(()=>$d(ae),[ae,En,Yt,Jt,Qt,tn,zr,Qr,eo,mo,at,ye,uo,Vr,At,Ke]),Uc=s.useCallback(u=>{if(D||u.inputType!=="insertText"&&u.inputType!=="insertReplacementText"||!u.data||!pm(Te.current)&&!Pe.current&&!Cd(Ne.current)&&!lm({color:ze.current,backgroundColor:Oe.current}))return;const f=_.current;f&&(u.preventDefault(),km(f,u.data,Te.current,Pe.current,{color:ze.current,backgroundColor:Oe.current},Ne.current),Te.current={},Pe.current=null,Ne.current=null,ze.current=null,Oe.current=null,Le.current=null,G(f.innerHTML,!0),H(),F())},[D,G,H,F]),Wc=s.useCallback(u=>{if(D||!ed(u,da.current))return;u.preventDefault(),u.stopPropagation();const f=_.current;if(!f)return;const C=ii(f,u.target),K=kr(f,u.target);if(K&&Eh(f,K),C){Bo(f,C),H(),jt(C),co({open:!0,x:u.clientX,y:u.clientY,kind:"image",inTable:Ve(f,C)!==null});return}const q=lt({mode:"visual",visualEl:f,htmlEl:Ce.current});ke.current=q,co({open:!0,x:u.clientX,y:u.clientY,kind:q.collapsed?"caret":"text",inTable:Ve(f,u.target)!==null})},[D,H]),Gc=s.useCallback(u=>{if(da.current=u.pointerType,D)return;const f=_.current;if(!f)return;const C=ii(f,u.target);if(!C){jt(null);return}u.preventDefault(),Bo(f,C),H(),jt(C)},[D,H]),Vc=s.useCallback(u=>{if(D)return;if(u.key==="Tab"&&!u.ctrlKey&&!u.metaKey&&!u.altKey){if(z.current!=="visual")return;const C=_.current;if(!C)return;const K=u.target;if(!(K instanceof Node)||!C.contains(K))return;U(C);const q=jh(C,u.shiftKey);if(!q)return;u.preventDefault(),typeof q=="object"&&q.changed&&G(C.innerHTML,!1),H(),F(),Wn(yn(C)!==null);return}if(!(u.ctrlKey||u.metaKey))return;const f=u.key.toLowerCase();if(f==="z"&&!u.shiftKey){u.preventDefault(),Yn();return}if(f==="z"&&u.shiftKey||f==="y"){u.preventDefault(),Jn();return}if(f==="b"&&!u.shiftKey){u.preventDefault(),ae.toggleFontMark("bold");return}if(f==="i"&&!u.shiftKey){u.preventDefault(),ae.toggleFontMark("italic");return}if(f==="u"&&!u.shiftKey){u.preventDefault(),ae.toggleFontMark("underline");return}if(f==="x"&&u.shiftKey){u.preventDefault(),ae.toggleFontMark("strikethrough");return}f==="p"&&!u.shiftKey&&(u.preventDefault(),Nt.print())},[D,Yn,Jn,ae,Nt,U,G,H,F]),qc=[De.root,Xo(At).className,ue?De.fullscreen:"",y].filter(Boolean).join(" "),Xc=Iw({toolbarBackground:x,menuColor:k,menuBackground:g,menuFontSize:S,menuFontFamily:A,border:N}),Yc=Xo(At)["data-wysiwyg-theme"];return o.jsx(Vu,{locale:v,children:o.jsx($u,{dark:At,children:o.jsxs("div",{className:qc,style:Xc,"data-fullscreen":ue?"":void 0,"data-wysiwyg-theme":Yc,"data-toolbar-position":Ke,onKeyDown:Vc,children:[E?o.jsx("div",{className:De.menuChrome,onPointerDownCapture:go,children:o.jsx(qo,{catalog:er,layout:Po,commands:Nt,queries:Ao,disabled:D,menuVisible:!0,toolbarVisible:!1})}):null,o.jsxs("div",{className:De.body,"data-icon-dock":L?Ke:void 0,children:[L&&(Ke==="top"||Ke==="left")?o.jsx("div",{className:De.iconChrome,onPointerDownCapture:go,children:o.jsx(qo,{catalog:er,layout:Po,commands:Nt,queries:Ao,disabled:D,menuVisible:!1,toolbarVisible:!0,position:Ke})}):null,o.jsxs("div",{className:De.workspace,onDragEnter:dn.onDragEnter,onDragOver:dn.onDragOver,onDragLeave:dn.onDragLeave,onDrop:dn.onDrop,children:[B==="visual"?o.jsx(Rw,{ref:_,html:vn($).body,onChange:u=>G(u,!0),onBeforeInput:Uc,onPointerDown:Gc,onContextMenu:Wc,placeholder:b,disabled:D}):o.jsx(Mw,{ref:Ce,html:$,onChange:u=>Se(u,!0),placeholder:b,disabled:D}),dn.dragging?o.jsx(Bw,{}):null]}),L&&(Ke==="bottom"||Ke==="right")?o.jsx("div",{className:De.iconChrome,onPointerDownCapture:go,children:o.jsx(qo,{catalog:er,layout:Po,commands:Nt,queries:Ao,disabled:D,menuVisible:!1,toolbarVisible:!0,position:Ke})}):null]}),ue?o.jsx(Fw,{onClick:()=>we(!1)}):null,o.jsx(O1,{open:Xr,catalog:er,groups:tr.iconGroups,settings:Yr,loading:Fc,busy:Bc,disabled:D,onChange:u=>{Pa(u)},onReset:()=>{Pa(null)},onClose:()=>aa(!1)}),o.jsx(a1,{open:an.open,html:an.html,onClose:()=>la({open:!1,html:an.html})}),o.jsx(_y,{open:on.open,tab:on.tab,size:Yt.value,unit:Yt.unit,marks:En,fontFamily:Jt.value,fontFamilyMixed:Jt.mixed,fontColor:Qt.value,fontColorMixed:Qt.mixed,highlightColor:tn.value,highlightColorMixed:tn.mixed,fonts:at,disabled:D,onTabChange:u=>Nn({open:!0,tab:u}),onApply:u=>ae.applyFontProperties(u),onClose:()=>Nn({open:!1,tab:on.tab})}),o.jsx(Vy,{open:yt.open,tab:yt.tab,value:yt.value,disabled:D,onTabChange:u=>_n({...yt,open:!0,tab:u}),onApply:u=>ae.applyParagraphProperties(u),onClose:()=>_n({...yt,open:!1})}),o.jsx(Zy,{open:xt.open,tab:xt.tab,value:xt.value,fonts:at,disabled:D,onTabChange:u=>In({...xt,open:!0,tab:u}),onApply:u=>ae.applyPageProperties(u),onClose:()=>In({...xt,open:!1})}),o.jsx(tx,{open:be.open,mode:be.open?be.mode:"create",styleId:be.open&&be.mode==="edit"?be.style.id:void 0,name:be.open&&be.mode==="edit"?be.style.name:"",font:be.open?be.mode==="edit"?be.style.font:be.font:{size:null,unit:Ct,marks:Qe(),fontFamily:null,fontColor:null,highlightColor:null},paragraph:be.open?be.mode==="edit"?be.style.paragraph:be.paragraph:void 0,canDelete:!!W,fonts:at,busy:Hc,disabled:D,onSave:async u=>{const f=pa.current;if(f){Fn(!0);try{await f(u),ln({open:!1}),await Xn()}finally{Fn(!1)}}},onDelete:async u=>{const f=ha.current;if(f){Fn(!0);try{await f(u),ln({open:!1}),await Xn()}finally{Fn(!1)}}},onClose:()=>ln({open:!1})}),o.jsx(Nx,{open:Ae.open,tab:Ae.tab,href:Ae.href,title:Ae.title,targetBlank:Ae.targetBlank,textDecorationNone:Ae.textDecorationNone,hoverMode:Ae.hoverMode,hoverColor:Ae.hoverColor,hoverHtml:Ae.hoverHtml,bookmarks:Ae.bookmarks,selectedBookmarkId:Ae.selectedBookmarkId,disabled:D,onTabChange:u=>Bn({...Ae,open:!0,tab:u}),onApply:u=>ae.applyLink(u),onClose:()=>Bn({...Ae,open:!1})}),o.jsx(rx,{open:no.open,existingIds:no.existingIds,disabled:D,onApply:u=>ae.applyBookmark(u),onClose:()=>ro({...no,open:!1})}),o.jsx(ax,{open:zc.open,disabled:D,customImagePicker:O,onApply:u=>ae.applyImage(u),onCustomPick:()=>{Hn({open:!1}),O==null||O.onPick(Do)},onClose:()=>Hn({open:!1})}),o.jsx(Cx,{open:zn.open,tab:zn.tab,value:zn.value,aspectRatio:zn.aspectRatio,disabled:D,onTabChange:u=>On(f=>({...f,tab:u})),onApply:u=>ae.applyImageProperties(u),onClose:()=>On(u=>({...u,open:!1}))}),o.jsx(Fx,{open:oo.open,disabled:D,onApply:u=>ae.applyTable(u),onClose:()=>io({open:!1})}),o.jsx(Kx,{open:Kn.open,value:Kn.value,disabled:D,onApply:u=>ae.applyTableProperties(u),onClose:()=>ao(u=>({...u,open:!1}))}),o.jsx(Gx,{open:$n.open,value:$n.value,disabled:D,onApply:u=>ae.applyCellProperties(u),onClose:()=>lo(u=>({...u,open:!1}))}),o.jsx(Yx,{open:Un.open,value:Un.value,disabled:D,onApply:u=>ae.applyRowProperties(u),onClose:()=>so(u=>({...u,open:!1}))}),B==="visual"&&!D&&(ye!=null&&ye.isConnected)?o.jsx(Tx,{img:ye,onResize:Kc,onResizeEnd:$c}):null,o.jsx(Zu,{open:sn.open,x:sn.x,y:sn.y,kind:sn.kind,inTable:sn.inTable,commands:Nt,onClose:()=>co(u=>({...u,open:!1}))})]})})})}function Iw({toolbarBackground:e,menuColor:t,menuBackground:n,menuFontSize:r,menuFontFamily:i,border:a}){const l={};return e&&(l["--wysiwyg-toolbar-background"]=e),t&&(l["--wysiwyg-menu-color"]=t),n&&(l["--wysiwyg-menu-background"]=n),r&&(l["--wysiwyg-menu-font-size"]=r),i&&(l["--wysiwyg-menu-font-family"]=i),a==="none"?(l["--wysiwyg-border-width"]="0",l["--wysiwyg-border-radius"]="0",l["--wysiwyg-border-shadow"]="none"):a&&(a.width&&(l["--wysiwyg-border-width"]=a.width),a.color&&(l["--wysiwyg-border-color"]=a.color),a.radius&&(l["--wysiwyg-border-radius"]=a.radius),a.shadow&&(l["--wysiwyg-border-shadow"]=a.shadow)),Object.keys(l).length?l:void 0}function Fw({onClick:e}){const t=V();return o.jsx("button",{type:"button",className:De.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:o.jsx(We,{className:De.exitFullscreenIcon})})}function Bw(){const e=V();return o.jsx("div",{className:De.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}exports.Editor=_w;