commspliant-html-editor 0.0.7 → 0.0.9

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.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),c=require("react"),wl=require("react-dom");function up({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":"audio",children:[o.jsx("path",{d:"M9 18V5l12-2v13"}),o.jsx("circle",{cx:"6",cy:"18",r:"3"}),o.jsx("circle",{cx:"18",cy:"16",r:"3"})]})}function ti({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 od({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 ni({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 ri({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 dp({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 mp({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 id({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 fp({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 pp({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 _e({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 Bc({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":"comment",children:o.jsx("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"})})}function gp({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":"comments-visible",children:[o.jsx("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"}),o.jsx("path",{d:"M8 9h8M8 13h5"})]})}function hp({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 bp({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 yp({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-css",children:[o.jsx("path",{d:"M8 6h12"}),o.jsx("path",{d:"M8 12h12"}),o.jsx("path",{d:"M8 18h8"}),o.jsx("path",{d:"M4 6h.01"}),o.jsx("path",{d:"M4 12h.01"}),o.jsx("path",{d:"M4 18h.01"})]})}function xp({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 Cp({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 ad({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 wp({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 vp({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 Sp({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 kp({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":"format-brush",children:[o.jsx("path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08"}),o.jsx("path",{d:"M7.07 14.94c-1.66 0-3 1.34-3 3v2.06h2.06c1.66 0 3-1.34 3-3v-2.06Z"}),o.jsx("path",{d:"M7.07 14.94 4.01 18"})]})}function Ap({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 ld({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 Pp({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 Dp({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 sd({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 jp({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 Ep({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 Rp({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 Tp({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 Np({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 Mp({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":"merge-cells",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 12h5"}),o.jsx("path",{d:"M16 12h5"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("path",{d:"M9 9l3 3-3 3"}),o.jsx("path",{d:"M15 9l-3 3 3 3"})]})}function cd({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 _p({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 Lp({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 Ip({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":"pageBreak",children:[o.jsx("path",{d:"M4 10h16",strokeDasharray:"3 2"}),o.jsx("path",{d:"M14 10v8"}),o.jsx("path",{d:"M18 14h4v4h-4z"})]})}function ud({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 Fp({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 Bp({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 Hp({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 zp({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 Op({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 Kp({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":"read-aloud",children:[o.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),o.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}function $p({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 Up({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 Wp({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 Aa({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 Hc({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 Pa({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 Gp({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 Vp({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 Zp({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 qp({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":"unmerge-cells",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("path",{d:"M3 12h18"}),o.jsx("path",{d:"M9 9l-3 3 3 3"}),o.jsx("path",{d:"M15 9l3 3-3 3"})]})}function Yp({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"})]})}function Xp({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":"youtube",children:[o.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3"}),o.jsx("path",{d:"m10 9 6 3-6 3V9Z",fill:"currentColor",stroke:"none"})]})}const de="---";function zt(e){return e===de}function br(e){return typeof e=="object"&&e!==null&&"submenu"in e}const vl=new Set(["save","open","print","undo","redo","link","bookmark","horizontalRule","pageBreak","insertPage","visual","html","customizeToolbar","toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom","lightMode","darkMode","preview","readAloud","fullscreen","bold","italic","underline","strikethrough","clearFormatting","formatBrush","fontSize","fontFamily","paragraphStyle","fontProperties","customCss","paragraphProperties","pageProperties","imageProperties","fontColor","highlightColor","alignLeft","alignCenter","alignRight","alignJustify","indent","outdent","bulletList","numberedList","table","insertRowBelow","insertRowBefore","deleteRow","insertColumnAfter","insertColumnBefore","deleteColumn","mergeCells","unmergeCells","tableProperties","cellProperties","rowProperties"]),Jp=new Set(["file","edit","insert","table","view","format"]),dd="custom",md="custom";function fd(e){return`custom:${e}`}function Qp(e){return e==="menu"||e==="both"}function eg(e){return e==="toolbar"||e==="both"}function pd(e){return e.map(t=>br(t)?{submenu:t.submenu,items:pd(t.items)}:t)}function tg(e){return{menus:e.menus.map(t=>({id:t.id,items:pd(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function gd(e){return zt(e)?!0:br(e)?e.items.every(gd):vl.has(e)}function hd(e,t){for(const n of e)if(n===t||br(n)&&hd(n.items,t))return!0;return!1}function ng(e){const t=e.tooltip??e.label;return{id:e.id,command:fd(e.id),icon:e.icon??bp,label:e.label,ariaLabel:e.label,tooltip:t}}function rg(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Jp.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===dd&&!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 og(e,t,n){if(e.groups[n]||(n===md?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 ig(e,t,n){var a,l;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},i=tg(n);for(const u of e??[])if(!(vl.has(u.id)||zt(u.id))){if(r.items[u.id]=ng(u),Qp(u.showIn)){const m=((a=u.menu)==null?void 0:a.id)??dd;rg(r,i,m,(l=u.menu)==null?void 0:l.label);const p=i.menus.find(g=>g.id===m);if(p&&!hd(p.items,u.id)){const g=p.items[p.items.length-1];g!==void 0&&!zt(g)&&p.items.every(gd)&&p.items.push(de),p.items.push(u.id)}}if(eg(u.showIn)){const m=u.toolbarGroup??md;og(r,i,m);const p=i.iconGroups.find(g=>g.id===m);p&&!p.items.includes(u.id)&&p.items.push(u.id)}}return{catalog:r,layout:i}}function ag(e,t){const n={};for(const r of e??[])vl.has(r.id)||zt(r.id)||(n[fd(r.id)]=()=>r.onAction(t()));return n}function lg(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const sg="_chrome_boy0f_1",cg={chrome:sg},bd=c.createContext(!1);function ug({dark:e,children:t}){return o.jsx(bd.Provider,{value:e,children:t})}function dg(){return c.useContext(bd)}function Ua(e){return{className:cg.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function se({children:e}){const t=dg(),n=Ua(t);return wl.createPortal(o.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function Sl(e,t){const n=e[t];n==null||n()}const kl={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 menu",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",commandAudio:"Audio",commandAudioAria:"Insert audio",commandYoutube:"YouTube video",commandYoutubeAria:"Insert YouTube video",commandImageProperties:"Image properties…",commandImagePropertiesAria:"Image properties",commandTable:"Table",commandTableAria:"Insert table",commandHorizontalRule:"Horizontal line",commandHorizontalRuleAria:"Insert horizontal line",commandPageBreak:"Page break",commandPageBreakAria:"Insert page break",commandInsertPage:"Page",commandInsertPageAria:"Insert new page",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",commandMergeCells:"Merge cells",commandMergeCellsAria:"Merge selected cells",commandUnmergeCells:"Unmerge cells",commandUnmergeCellsAria:"Split merged cells",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",commandFormatBrush:"Format brush",commandFormatBrushAria:"Copy formatting",commandFontSize:"Font size",commandFontSizeAria:"Font size",commandFontSizeUnitAria:"Font size unit",commandFontFamily:"Font",commandFontFamilyAria:"Font family",commandFontProperties:"Font properties…",commandFontPropertiesAria:"Font properties",commandCustomCss:"Custom CSS",commandCustomCssAria:"Custom CSS",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",commandReadAloud:"Read aloud",commandReadAloudAria:"Read selection or document aloud",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.",customCssDialogTitle:"Custom CSS",customCssDialogField:"CSS",customCssDialogFieldAria:"Custom CSS declarations",customCssDialogCloseAria:"Close",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.",audioDialogTitle:"Insert audio",audioDialogSource:"Source",audioDialogFile:"File",audioDialogChooseFile:"Choose file",audioDialogUrl:"Audio URL",audioDialogTitleField:"Title",audioDialogCloseAria:"Close",audioDialogErrorEmpty:"Choose a file or enter an audio URL.",audioDialogErrorInvalid:"Enter a valid audio URL.",audioDialogErrorType:"Use an MP3, WAV, OGG, AAC, WebM, or M4A audio file.",audioDialogErrorTooLarge:"Choose an audio file smaller than 5 MB.",youtubeDialogTitle:"Insert YouTube video",youtubeDialogUrl:"YouTube URL",youtubeDialogTitleField:"Title",youtubeDialogCloseAria:"Close",youtubeDialogErrorEmpty:"Enter a YouTube URL.",youtubeDialogErrorInvalid:"Enter a valid YouTube URL.",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",cellPropertiesColSpan:"Column span",cellPropertiesRowSpan:"Row span",rowPropertiesDialogTitle:"Row properties",rowPropertiesDialogCloseAria:"Close",rowPropertiesHeight:"Height",paragraphDialogTitle:"Paragraph properties",pageDialogTitle:"Page properties",pageDialogTabBackgroundImage:"Background Image",pageDialogTabPrint:"Print",pageAtRuleSize:"Page size",pageAtRuleSizeAuto:"Auto",pageAtRuleSizeA4:"A4",pageAtRuleSizeLetter:"Letter",pageAtRuleSizeLegal:"Legal",pageAtRuleSizeCustom:"Custom",pageAtRuleWidth:"Width",pageAtRuleHeight:"Height",pageAtRuleOrientation:"Orientation",pageAtRuleOrientationNone:"Default",pageAtRuleOrientationPortrait:"Portrait",pageAtRuleOrientationLandscape:"Landscape",pageAtRuleMargins:"Page margins",pageAtRuleReset:"Reset print settings",pageAtRuleResetAria:"Remove @page print settings from this page",menuZoom:"Zoom",menuZoomAria:"Zoom submenu",pageZoomFitWidth:"Fit width",pageZoomFitWidthAria:"Fit page width to the editor",pageZoomFitPage:"Fit page",pageZoomFitPageAria:"Fit entire page to the editor",pageZoom50:"50%",pageZoom50Aria:"Zoom to 50 percent",pageZoom75:"75%",pageZoom75Aria:"Zoom to 75 percent",pageZoom100:"100%",pageZoom100Aria:"Zoom to 100 percent",pageZoom125:"125%",pageZoom125Aria:"Zoom to 125 percent",pageZoom150:"150%",pageZoom150Aria:"Zoom to 150 percent",pageZoom200:"200%",pageZoom200Aria:"Zoom to 200 percent",pageBackgroundImagePreview:"Preview",pageBackgroundImagePreviewAlt:"Page background image preview",pageBackgroundImageClear:"Remove background image",pageBackgroundImageCurrent:"Image selected",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",paragraphDialogPageBreaks:"Page breaks",paragraphDialogBreakInside:"Break inside",paragraphDialogBreakAfter:"Break after",paragraphDialogBreakBefore:"Break before",paragraphDialogBreakAuto:"Auto",paragraphDialogBreakAvoid:"Avoid",paragraphDialogBreakPage:"Page",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Formatting toolbar",toolbarGroupFile:"File",toolbarGroupPrint:"Print",toolbarGroupEdit:"Edit",toolbarGroupInsert:"Insert",toolbarGroupTable:"Table",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",commandAddComment:"Add comment",commandAddCommentAria:"Add comment on selection",commandInsertComment:"Comment",commandInsertCommentAria:"Insert comment on selection",showComments:"Show comments",hideComments:"Hide comments",toggleCommentsVisibleAria:"Toggle comment visibility",commentPanelTitle:"Comment",commentPlaceholder:"Write a comment…",commentReplyPlaceholder:"Write a reply…",commentPost:"Post",commentEmpty:"No messages yet.",commentPanelCloseAria:"Close comment panel"},mg={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:"Menú 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",commandAudio:"Audio",commandAudioAria:"Insertar audio",commandYoutube:"Vídeo de YouTube",commandYoutubeAria:"Insertar vídeo de YouTube",commandImageProperties:"Propiedades de imagen…",commandImagePropertiesAria:"Propiedades de imagen",commandTable:"Tabla",commandTableAria:"Insertar tabla",commandHorizontalRule:"Línea horizontal",commandHorizontalRuleAria:"Insertar línea horizontal",commandPageBreak:"Salto de página",commandPageBreakAria:"Insertar salto de página",commandInsertPage:"Página",commandInsertPageAria:"Insertar página nueva",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",commandMergeCells:"Combinar celdas",commandMergeCellsAria:"Combinar las celdas seleccionadas",commandUnmergeCells:"Separar celdas",commandUnmergeCellsAria:"Dividir las celdas combinadas",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",commandFormatBrush:"Copiar formato",commandFormatBrushAria:"Copiar 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",commandCustomCss:"CSS personalizado",commandCustomCssAria:"CSS personalizado",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",commandReadAloud:"Leer en voz alta",commandReadAloudAria:"Leer la selección o el documento en voz alta",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.",customCssDialogTitle:"CSS personalizado",customCssDialogField:"CSS",customCssDialogFieldAria:"Declaraciones CSS personalizadas",customCssDialogCloseAria:"Cerrar",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.",audioDialogTitle:"Insertar audio",audioDialogSource:"Origen",audioDialogFile:"Archivo",audioDialogChooseFile:"Elegir archivo",audioDialogUrl:"URL del audio",audioDialogTitleField:"Título",audioDialogCloseAria:"Cerrar",audioDialogErrorEmpty:"Elige un archivo o introduce una URL de audio.",audioDialogErrorInvalid:"Introduce una URL de audio válida.",audioDialogErrorType:"Usa un archivo de audio MP3, WAV, OGG, AAC, WebM o M4A.",audioDialogErrorTooLarge:"Elige un archivo de audio de menos de 5 MB.",youtubeDialogTitle:"Insertar vídeo de YouTube",youtubeDialogUrl:"URL de YouTube",youtubeDialogTitleField:"Título",youtubeDialogCloseAria:"Cerrar",youtubeDialogErrorEmpty:"Introduce una URL de YouTube.",youtubeDialogErrorInvalid:"Introduce una URL de YouTube válida.",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",cellPropertiesColSpan:"Columnas",cellPropertiesRowSpan:"Filas",rowPropertiesDialogTitle:"Propiedades de fila",rowPropertiesDialogCloseAria:"Cerrar",rowPropertiesHeight:"Alto",paragraphDialogTitle:"Propiedades de párrafo",pageDialogTitle:"Propiedades de página",pageDialogTabBackgroundImage:"Imagen de fondo",pageDialogTabPrint:"Impresión",pageAtRuleSize:"Tamaño de página",pageAtRuleSizeAuto:"Automático",pageAtRuleSizeA4:"A4",pageAtRuleSizeLetter:"Carta",pageAtRuleSizeLegal:"Legal",pageAtRuleSizeCustom:"Personalizado",pageAtRuleWidth:"Ancho",pageAtRuleHeight:"Alto",pageAtRuleOrientation:"Orientación",pageAtRuleOrientationNone:"Predeterminada",pageAtRuleOrientationPortrait:"Vertical",pageAtRuleOrientationLandscape:"Horizontal",pageAtRuleMargins:"Márgenes de página",pageAtRuleReset:"Restablecer impresión",pageAtRuleResetAria:"Quitar la configuración @page de impresión de esta página",menuZoom:"Zoom",menuZoomAria:"Submenú Zoom",pageZoomFitWidth:"Ajustar ancho",pageZoomFitWidthAria:"Ajustar el ancho de la página al editor",pageZoomFitPage:"Ajustar página",pageZoomFitPageAria:"Ajustar toda la página al editor",pageZoom50:"50 %",pageZoom50Aria:"Zoom al 50 por ciento",pageZoom75:"75 %",pageZoom75Aria:"Zoom al 75 por ciento",pageZoom100:"100 %",pageZoom100Aria:"Zoom al 100 por ciento",pageZoom125:"125 %",pageZoom125Aria:"Zoom al 125 por ciento",pageZoom150:"150 %",pageZoom150Aria:"Zoom al 150 por ciento",pageZoom200:"200 %",pageZoom200Aria:"Zoom al 200 por ciento",pageBackgroundImagePreview:"Vista previa",pageBackgroundImagePreviewAlt:"Vista previa de la imagen de fondo de página",pageBackgroundImageClear:"Quitar imagen de fondo",pageBackgroundImageCurrent:"Imagen seleccionada",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",paragraphDialogPageBreaks:"Saltos de página",paragraphDialogBreakInside:"Evitar corte interno",paragraphDialogBreakAfter:"Salto después",paragraphDialogBreakBefore:"Salto antes",paragraphDialogBreakAuto:"Automático",paragraphDialogBreakAvoid:"Evitar",paragraphDialogBreakPage:"Página",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Barra de herramientas",toolbarGroupFile:"Archivo",toolbarGroupPrint:"Imprimir",toolbarGroupEdit:"Editar",toolbarGroupInsert:"Insertar",toolbarGroupTable:"Tabla",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",commandAddComment:"Añadir comentario",commandAddCommentAria:"Añadir comentario en la selección",commandInsertComment:"Comentario",commandInsertCommentAria:"Insertar comentario en la selección",showComments:"Mostrar comentarios",hideComments:"Ocultar comentarios",toggleCommentsVisibleAria:"Alternar visibilidad de comentarios",commentPanelTitle:"Comentario",commentPlaceholder:"Escribe un comentario…",commentReplyPlaceholder:"Escribe una respuesta…",commentPost:"Publicar",commentEmpty:"Aún no hay mensajes.",commentPanelCloseAria:"Cerrar panel de comentarios"},fg={en:kl,es:mg},yd=c.createContext(e=>kl[e]);function pg({locale:e="en",children:t}){const n=c.useMemo(()=>{const r=fg[e]??kl;return i=>r[i]},[e]);return o.jsx(yd.Provider,{value:n,children:t})}function W(){return c.useContext(yd)}const gg="_menu_c1m45_1",hg="_item_c1m45_19",bg="_separator_c1m45_59",Da={menu:gg,item:hg,separator:bg},po=8,yg=[{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.inTable},{type:"item",command:"openCellProperties",labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"openRowProperties",labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"mergeCells",labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:(e,t)=>t.canMergeCells},{type:"item",command:"unmergeCells",labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:(e,t)=>t.canUnmergeCells}];function xg(e,t){const n=[];let r=!1;for(const i of yg){if(i.type==="separator"){n.length>0&&(r=!0);continue}i.enabled(e,t)&&(r&&(n.push({type:"separator"}),r=!1),n.push(i))}return n}function zc(){return'[role="menuitem"]:not(:disabled)'}function Cg({open:e,x:t,y:n,kind:r,inTable:i=!1,canMergeCells:a=!1,canUnmergeCells:l=!1,commands:u,onClose:m}){const p=W(),g=c.useId(),h=c.useRef(null);if(c.useLayoutEffect(()=>{var k;if(!e)return;const x=h.current;if(!x)return;const b=x.getBoundingClientRect(),S=Math.max(po,Math.min(t,window.innerWidth-b.width-po)),v=Math.max(po,Math.min(n,window.innerHeight-b.height-po));x.style.left=`${S}px`,x.style.top=`${v}px`,(k=x.querySelector(zc()))==null||k.focus()},[e,t,n,r]),c.useEffect(()=>{if(!e)return;const x=k=>{var P;(P=h.current)!=null&&P.contains(k.target)||m()},b=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),m())},S=()=>{m()},v=k=>{var P;if((P=h.current)!=null&&P.contains(k.target)){k.preventDefault();return}k.defaultPrevented||m()};return document.addEventListener("pointerdown",x),document.addEventListener("keydown",b,!0),window.addEventListener("scroll",S,!0),document.addEventListener("contextmenu",v),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",b,!0),window.removeEventListener("scroll",S,!0),document.removeEventListener("contextmenu",v)}},[e,m]),!e)return null;const C=xg(r,{inTable:i,canMergeCells:a,canUnmergeCells:l}),y=x=>{var P;if(x.key!=="ArrowDown"&&x.key!=="ArrowUp")return;const b=[...((P=h.current)==null?void 0:P.querySelectorAll(zc()))??[]];if(b.length===0)return;const S=b.indexOf(document.activeElement),v=x.key==="ArrowDown"?1:-1,k=b[(S+v+b.length)%b.length];x.preventDefault(),k==null||k.focus()};return o.jsx(se,{children:o.jsxs("div",{ref:h,className:Da.menu,role:"menu","aria-labelledby":g,style:{left:t,top:n},onMouseDown:x=>x.preventDefault(),onKeyDown:y,children:[o.jsx("span",{id:g,hidden:!0,children:p("contextMenuAria")}),C.map((x,b)=>x.type==="separator"?o.jsx("div",{role:"separator",className:Da.separator},`separator-${b}`):o.jsx("button",{type:"button",role:"menuitem",className:Da.item,"aria-label":p(x.ariaKey),onClick:()=>{m(),Sl(u,x.command)},children:p(x.labelKey)},x.command))]})})}function wg(e){return e==="touch"||e==="pen"}function vg(e,t){return e.button===2||e.ctrlKey?!0:!wg(t)}const fr="data-page",Lo="data-page-bg",Io="commspliant-background";function gt(e){return e instanceof HTMLElement&&(e.id===Io||e.hasAttribute(Lo))}function Sg(e){return e.hasAttribute(fr)&&e.parentElement?e.parentElement:e}function Al(e){const t=Sg(e),n=new Set,r=[],i=a=>{a instanceof HTMLElement&&gt(a)&&!n.has(a)&&(n.add(a),r.push(a))};i(t.querySelector(`#${Io}`));for(const a of t.querySelectorAll(`[${Lo}]`))i(a);return i(t),r}function Pl(e){return Al(e)[0]??null}function To(e){let t=!1;return e.style.width!=="100%"&&(e.style.width="100%",t=!0),e.style.height!=="100%"&&(e.style.height="100%",t=!0),t}function xd(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(fr)}function Cd(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function kg(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function yr(e){return Cd(e).find(n=>n.hasAttribute(fr))??null}function Ag(e){if(kg(e))return null;const t=Cd(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"||gt(n)?null:n}function Pg(e){const t=yr(e);if(t)return To(t),t;const n=Ag(e);if(n)return n.setAttribute(fr,""),To(n),n;const r=document.createElement("div");for(r.setAttribute(fr,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),To(r),r}function Dl(e){return yr(e)??e}const Oc=["background-color","background-image","background-size","background-position","background-repeat","opacity"];function Kc(e,t,n){const r=(t==null?void 0:t.style.getPropertyValue(n).trim())??"";r?e.style.setProperty(n,r):e.style.removeProperty(n)}function oi(e){const t=yr(e),n=t?Pl(t):null;if(Kc(e,t,"background-color"),n)for(const r of Oc)r!=="background-color"&&Kc(e,n,r);else for(const r of Oc)r!=="background-color"&&e.style.removeProperty(r)}const Fo="<!-- wysiwyg-page-separator -->",Wa="data-page-surface";function Pt(e){const t=e.trim();return t?t.includes(Fo)?e.split(Fo).map(n=>n.trim()):[e]:[""]}function mt(e){return e.length===0?"":e.length===1?e[0]??"":e.join(`
2
- ${Fo}
3
- `)}function Ga(){return"<p></p>"}function $c(e){return e.length===0?[Ga()]:e.map(t=>t.trim())}function No(e,t){const n=e.querySelector(`[${Wa}][data-page-index="${t}"]`);return n||([...e.querySelectorAll(`[${Wa}]`)][t]??null)}function jl(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 Dg(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function go(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 jg(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 Eg(e){return e?jg(e).find(Dg)??null:null}const wd={description:"HTML",accept:{"text/html":[".html",".htm"]}},Rg="document.html";function vd(){return window}function Sd(e){return e instanceof DOMException&&e.name==="AbortError"}function Tg(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 Ng(){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}jl(r).then(a=>n(a),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function Mg(e,t=Rg){const n=vd().showSaveFilePicker;if(typeof n=="function"){try{const i=await(await n({suggestedName:t,types:[wd]})).createWritable();await i.write(e),await i.close()}catch(r){if(Sd(r))return;throw r}return}Tg(e,t)}async function _g(){const e=vd().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[wd]}),n=await t.getFile();return await jl(n)}catch(t){if(Sd(t))return null;throw t}return Ng()}const Lg=new Set(["span","strong","b","em","i","u","s","strike","del"]);function ae(e,t){return t?e===t||e.contains(t):!1}function ht(e){return Lg.has(e.tagName.toLowerCase())}function Ig(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 ze(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&&Ig(e,i)&&n.push(i);return n}function pt(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 Wt(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function We(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function Gt(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 u=e.cloneNode(!1);for(const m of a)u.appendChild(m);i.insertBefore(u,e)}if(l.length>0){const u=e.cloneNode(!1);for(const m of l)u.appendChild(m);i.insertBefore(u,e.nextSibling)}}function ln(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 xr(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 ii="data-wysiwyg-font",Fg=[{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 pr(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function Cr(e,t){return e===t?!0:!e||!t?!1:pr(e)===pr(t)}function kd(e=[]){var r;const t=[],n=new Set;for(const i of[...Fg,...e]){const a=i.family.trim();if(!a)continue;const l=pr(a);if(n.has(l))continue;n.add(l);const u=(r=i.css)==null?void 0:r.trim();t.push({name:i.name.trim()||a,family:a,...u?{css:u}:{}})}return t}function Bg(e,t){return e?t.find(n=>Cr(n.family,e))??null:null}function Hg(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function zg(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function ai(e){const t=new Set,n=[];for(const r of e){const i=r.trim();!i||!Hg(i)||t.has(i)||(t.add(i),n.push(i))}return n}function Og(e){return e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&amp;/g,"&")}const Kg=new RegExp(`<link\\b[^>]*\\b${ii}\\b[^>]*>`,"gi");function jt(e){if(!e.includes(ii))return{hrefs:[],body:e};const t=[],n=e.replace(Kg,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(Og(i)),""});return{hrefs:ai(t),body:n}}function ho(e,t){const n=ai(t);return n.length===0?e:`${n.map(i=>`<link rel="stylesheet" href="${zg(i)}" ${ii}="">`).join("")}${e}`}function $g(e,t){const n=pr(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&&pr(l)===n)return!0}a=i.nextNode()}return!1}function bo(e,t,n=[]){const r=jt(t).hrefs,i=n.filter(a=>a.css&&$g(e,a.family)).map(a=>a.css??"");return ai([...r,...i])}function Ug(e,t=[]){const n=jt(e).hrefs,r=t.map(i=>i.css??"");return ai([...n,...r])}function Wg(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Ad(e){return e.style.fontFamily.trim()||null}function El(e,t){let n=Wg(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Ad(n);if(r)return r;n=n.parentElement}return null}function Va(e){return e instanceof HTMLElement&&Ad(e)!==null}function Rl(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function Gg(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!ht(r)||!Va(r)){n=r;continue}if(Gt(r,n),Va(r)&&(Rl(r),Wt(r))){We(r);continue}n=r}}function Pd(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 Dd(e){const t=Pd(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:ze(t).filter(u=>u.data.length>0),i=(n.length>0?n:[t.startContainer]).map(u=>El(e,u)),a=i[0]??null;return i.every(u=>Cr(u,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function Za(e,t){const n=Pd(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;pt(n);const i=ze(n).filter(a=>a.data.length>0);for(const a of i){const l=El(e,a);if(r===null){if(l===null)continue;Gg(e,a);continue}Cr(l,r)||xr(a,u=>{u.style.fontFamily=r})}return ln(i),!0}function Vg(e,t){if(t){if(t.value===null){Rl(e);return}e.style.fontFamily=t.value}}function Zg(e){return e!=null}function qg(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 Yg(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 qa(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!ht(r)||!Va(r)){n=r;continue}if(Gt(r,n),Rl(r),Wt(r)){We(r);continue}n=r.isConnected?r:t}return t}function Xg(e,t){qg(t);const n=Yg(t);return qa(e,n)}function Jg(e,t,n){return!!(n&&n.value===null&&El(e,t))}const Qg=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),c=require("react"),vl=require("react-dom");function fg({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":"audio",children:[o.jsx("path",{d:"M9 18V5l12-2v13"}),o.jsx("circle",{cx:"6",cy:"18",r:"3"}),o.jsx("circle",{cx:"18",cy:"16",r:"3"})]})}function ni({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 id({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 ri({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 oi({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 gg({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 pg({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 ad({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 hg({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 bg({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 Ie({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 Hc({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":"comment",children:o.jsx("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"})})}function yg({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":"comments-visible",children:[o.jsx("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"}),o.jsx("path",{d:"M8 9h8M8 13h5"})]})}function xg({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 Cg({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 wg({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-css",children:[o.jsx("path",{d:"M8 6h12"}),o.jsx("path",{d:"M8 12h12"}),o.jsx("path",{d:"M8 18h8"}),o.jsx("path",{d:"M4 6h.01"}),o.jsx("path",{d:"M4 12h.01"}),o.jsx("path",{d:"M4 18h.01"})]})}function vg({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 Sg({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 ld({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 kg({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 Ag({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 Pg({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 Dg({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":"format-brush",children:[o.jsx("path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08"}),o.jsx("path",{d:"M7.07 14.94c-1.66 0-3 1.34-3 3v2.06h2.06c1.66 0 3-1.34 3-3v-2.06Z"}),o.jsx("path",{d:"M7.07 14.94 4.01 18"})]})}function jg({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 sd({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 Eg({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 Rg({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 cd({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 Tg({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 Ng({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 Mg({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 _g({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 Lg({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 Ig({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":"merge-cells",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 12h5"}),o.jsx("path",{d:"M16 12h5"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("path",{d:"M9 9l3 3-3 3"}),o.jsx("path",{d:"M15 9l-3 3 3 3"})]})}function ud({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 Fg({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 Bg({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 Hg({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":"pageBreak",children:[o.jsx("path",{d:"M4 10h16",strokeDasharray:"3 2"}),o.jsx("path",{d:"M14 10v8"}),o.jsx("path",{d:"M18 14h4v4h-4z"})]})}function dd({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 zg({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 Og({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 Kg({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 $g({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 Ug({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 Wg({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":"read-aloud",children:[o.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),o.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}function Gg({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 Vg({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 Zg({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 Pa({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 zc({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 Da({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 qg({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 Yg({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 Xg({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 Jg({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":"unmerge-cells",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("path",{d:"M3 12h18"}),o.jsx("path",{d:"M9 9l-3 3 3 3"}),o.jsx("path",{d:"M15 9l3 3-3 3"})]})}function Qg({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"})]})}function ep({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":"youtube",children:[o.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3"}),o.jsx("path",{d:"m10 9 6 3-6 3V9Z",fill:"currentColor",stroke:"none"})]})}const de="---";function Kt(e){return e===de}function yr(e){return typeof e=="object"&&e!==null&&"submenu"in e}const Sl=new Set(["save","open","print","undo","redo","link","bookmark","horizontalRule","pageBreak","insertPage","visual","html","customizeToolbar","toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom","lightMode","darkMode","preview","readAloud","fullscreen","bold","italic","underline","strikethrough","clearFormatting","formatBrush","fontSize","fontFamily","paragraphStyle","fontProperties","customCss","paragraphProperties","pageProperties","imageProperties","fontColor","highlightColor","alignLeft","alignCenter","alignRight","alignJustify","indent","outdent","bulletList","numberedList","table","insertRowBelow","insertRowBefore","deleteRow","insertColumnAfter","insertColumnBefore","deleteColumn","mergeCells","unmergeCells","tableProperties","cellProperties","rowProperties"]),tp=new Set(["file","edit","insert","table","view","format"]),md="custom",fd="custom";function gd(e){return`custom:${e}`}function np(e){return e==="menu"||e==="both"}function rp(e){return e==="toolbar"||e==="both"}function pd(e){return e.map(t=>yr(t)?{submenu:t.submenu,items:pd(t.items)}:t)}function op(e){return{menus:e.menus.map(t=>({id:t.id,items:pd(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function hd(e){return Kt(e)?!0:yr(e)?e.items.every(hd):Sl.has(e)}function bd(e,t){for(const n of e)if(n===t||yr(n)&&bd(n.items,t))return!0;return!1}function ip(e){const t=e.tooltip??e.label;return{id:e.id,command:gd(e.id),icon:e.icon??Cg,label:e.label,ariaLabel:e.label,tooltip:t}}function ap(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!tp.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===md&&!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 lp(e,t,n){if(e.groups[n]||(n===fd?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 sp(e,t,n){var a,l;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},i=op(n);for(const u of e??[])if(!(Sl.has(u.id)||Kt(u.id))){if(r.items[u.id]=ip(u),np(u.showIn)){const m=((a=u.menu)==null?void 0:a.id)??md;ap(r,i,m,(l=u.menu)==null?void 0:l.label);const g=i.menus.find(p=>p.id===m);if(g&&!bd(g.items,u.id)){const p=g.items[g.items.length-1];p!==void 0&&!Kt(p)&&g.items.every(hd)&&g.items.push(de),g.items.push(u.id)}}if(rp(u.showIn)){const m=u.toolbarGroup??fd;lp(r,i,m);const g=i.iconGroups.find(p=>p.id===m);g&&!g.items.includes(u.id)&&g.items.push(u.id)}}return{catalog:r,layout:i}}function cp(e,t){const n={};for(const r of e??[])Sl.has(r.id)||Kt(r.id)||(n[gd(r.id)]=()=>r.onAction(t()));return n}function up(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const dp="_chrome_boy0f_1",mp={chrome:dp},yd=c.createContext(!1);function fp({dark:e,children:t}){return o.jsx(yd.Provider,{value:e,children:t})}function gp(){return c.useContext(yd)}function Wa(e){return{className:mp.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function ce({children:e}){const t=gp(),n=Wa(t);return vl.createPortal(o.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function kl(e,t){const n=e[t];n==null||n()}const Al={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 menu",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",commandAudio:"Audio",commandAudioAria:"Insert audio",commandYoutube:"YouTube video",commandYoutubeAria:"Insert YouTube video",commandImageProperties:"Image properties…",commandImagePropertiesAria:"Image properties",commandTable:"Table",commandTableAria:"Insert table",commandHorizontalRule:"Horizontal line",commandHorizontalRuleAria:"Insert horizontal line",commandPageBreak:"Page break",commandPageBreakAria:"Insert page break",commandInsertPage:"Page",commandInsertPageAria:"Insert new page",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",commandMergeCells:"Merge cells",commandMergeCellsAria:"Merge selected cells",commandUnmergeCells:"Unmerge cells",commandUnmergeCellsAria:"Split merged cells",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",commandFormatBrush:"Format brush",commandFormatBrushAria:"Copy formatting",commandFontSize:"Font size",commandFontSizeAria:"Font size",commandFontSizeUnitAria:"Font size unit",commandFontFamily:"Font",commandFontFamilyAria:"Font family",commandFontProperties:"Font properties…",commandFontPropertiesAria:"Font properties",commandCustomCss:"Custom CSS",commandCustomCssAria:"Custom CSS",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",commandReadAloud:"Read aloud",commandReadAloudAria:"Read selection or document aloud",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.",customCssDialogTitle:"Custom CSS",customCssDialogField:"CSS",customCssDialogFieldAria:"Custom CSS declarations",customCssDialogCloseAria:"Close",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.",audioDialogTitle:"Insert audio",audioDialogSource:"Source",audioDialogFile:"File",audioDialogChooseFile:"Choose file",audioDialogUrl:"Audio URL",audioDialogTitleField:"Title",audioDialogCloseAria:"Close",audioDialogErrorEmpty:"Choose a file or enter an audio URL.",audioDialogErrorInvalid:"Enter a valid audio URL.",audioDialogErrorType:"Use an MP3, WAV, OGG, AAC, WebM, or M4A audio file.",audioDialogErrorTooLarge:"Choose an audio file smaller than 5 MB.",youtubeDialogTitle:"Insert YouTube video",youtubeDialogUrl:"YouTube URL",youtubeDialogTitleField:"Title",youtubeDialogCloseAria:"Close",youtubeDialogErrorEmpty:"Enter a YouTube URL.",youtubeDialogErrorInvalid:"Enter a valid YouTube URL.",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",cellPropertiesColSpan:"Column span",cellPropertiesRowSpan:"Row span",rowPropertiesDialogTitle:"Row properties",rowPropertiesDialogCloseAria:"Close",rowPropertiesHeight:"Height",paragraphDialogTitle:"Paragraph properties",pageDialogTitle:"Page properties",pageDialogTabBackgroundImage:"Background Image",pageDialogTabPrint:"Print",pageAtRuleSize:"Page size",pageAtRuleSizeAuto:"Auto",pageAtRuleSizeA4:"A4",pageAtRuleSizeLetter:"Letter",pageAtRuleSizeLegal:"Legal",pageAtRuleSizeCustom:"Custom",pageAtRuleWidth:"Width",pageAtRuleHeight:"Height",pageAtRuleOrientation:"Orientation",pageAtRuleOrientationNone:"Default",pageAtRuleOrientationPortrait:"Portrait",pageAtRuleOrientationLandscape:"Landscape",pageAtRuleMargins:"Page margins",pageAtRuleReset:"Reset print settings",pageAtRuleResetAria:"Remove @page print settings from this page",menuZoom:"Zoom",menuZoomAria:"Zoom submenu",pageZoomFitWidth:"Fit width",pageZoomFitWidthAria:"Fit page width to the editor",pageZoomFitPage:"Fit page",pageZoomFitPageAria:"Fit entire page to the editor",pageZoom50:"50%",pageZoom50Aria:"Zoom to 50 percent",pageZoom75:"75%",pageZoom75Aria:"Zoom to 75 percent",pageZoom100:"100%",pageZoom100Aria:"Zoom to 100 percent",pageZoom125:"125%",pageZoom125Aria:"Zoom to 125 percent",pageZoom150:"150%",pageZoom150Aria:"Zoom to 150 percent",pageZoom200:"200%",pageZoom200Aria:"Zoom to 200 percent",pageBackgroundImagePreview:"Preview",pageBackgroundImagePreviewAlt:"Page background image preview",pageBackgroundImageClear:"Remove background image",pageBackgroundImageCurrent:"Image selected",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",paragraphDialogPageBreaks:"Page breaks",paragraphDialogBreakInside:"Break inside",paragraphDialogBreakAfter:"Break after",paragraphDialogBreakBefore:"Break before",paragraphDialogBreakAuto:"Auto",paragraphDialogBreakAvoid:"Avoid",paragraphDialogBreakPage:"Page",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Formatting toolbar",toolbarGroupFile:"File",toolbarGroupPrint:"Print",toolbarGroupEdit:"Edit",toolbarGroupInsert:"Insert",toolbarGroupTable:"Table",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",commandAddComment:"Add comment",commandAddCommentAria:"Add comment on selection",commandInsertComment:"Comment",commandInsertCommentAria:"Insert comment on selection",showComments:"Show comments",hideComments:"Hide comments",toggleCommentsVisibleAria:"Toggle comment visibility",commentPanelTitle:"Comment",commentPlaceholder:"Write a comment…",commentReplyPlaceholder:"Write a reply…",commentPost:"Post",commentEmpty:"No messages yet.",commentPanelCloseAria:"Close comment panel"},pp={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:"Menú 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",commandAudio:"Audio",commandAudioAria:"Insertar audio",commandYoutube:"Vídeo de YouTube",commandYoutubeAria:"Insertar vídeo de YouTube",commandImageProperties:"Propiedades de imagen…",commandImagePropertiesAria:"Propiedades de imagen",commandTable:"Tabla",commandTableAria:"Insertar tabla",commandHorizontalRule:"Línea horizontal",commandHorizontalRuleAria:"Insertar línea horizontal",commandPageBreak:"Salto de página",commandPageBreakAria:"Insertar salto de página",commandInsertPage:"Página",commandInsertPageAria:"Insertar página nueva",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",commandMergeCells:"Combinar celdas",commandMergeCellsAria:"Combinar las celdas seleccionadas",commandUnmergeCells:"Separar celdas",commandUnmergeCellsAria:"Dividir las celdas combinadas",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",commandFormatBrush:"Copiar formato",commandFormatBrushAria:"Copiar 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",commandCustomCss:"CSS personalizado",commandCustomCssAria:"CSS personalizado",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",commandReadAloud:"Leer en voz alta",commandReadAloudAria:"Leer la selección o el documento en voz alta",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.",customCssDialogTitle:"CSS personalizado",customCssDialogField:"CSS",customCssDialogFieldAria:"Declaraciones CSS personalizadas",customCssDialogCloseAria:"Cerrar",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.",audioDialogTitle:"Insertar audio",audioDialogSource:"Origen",audioDialogFile:"Archivo",audioDialogChooseFile:"Elegir archivo",audioDialogUrl:"URL del audio",audioDialogTitleField:"Título",audioDialogCloseAria:"Cerrar",audioDialogErrorEmpty:"Elige un archivo o introduce una URL de audio.",audioDialogErrorInvalid:"Introduce una URL de audio válida.",audioDialogErrorType:"Usa un archivo de audio MP3, WAV, OGG, AAC, WebM o M4A.",audioDialogErrorTooLarge:"Elige un archivo de audio de menos de 5 MB.",youtubeDialogTitle:"Insertar vídeo de YouTube",youtubeDialogUrl:"URL de YouTube",youtubeDialogTitleField:"Título",youtubeDialogCloseAria:"Cerrar",youtubeDialogErrorEmpty:"Introduce una URL de YouTube.",youtubeDialogErrorInvalid:"Introduce una URL de YouTube válida.",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",cellPropertiesColSpan:"Columnas",cellPropertiesRowSpan:"Filas",rowPropertiesDialogTitle:"Propiedades de fila",rowPropertiesDialogCloseAria:"Cerrar",rowPropertiesHeight:"Alto",paragraphDialogTitle:"Propiedades de párrafo",pageDialogTitle:"Propiedades de página",pageDialogTabBackgroundImage:"Imagen de fondo",pageDialogTabPrint:"Impresión",pageAtRuleSize:"Tamaño de página",pageAtRuleSizeAuto:"Automático",pageAtRuleSizeA4:"A4",pageAtRuleSizeLetter:"Carta",pageAtRuleSizeLegal:"Legal",pageAtRuleSizeCustom:"Personalizado",pageAtRuleWidth:"Ancho",pageAtRuleHeight:"Alto",pageAtRuleOrientation:"Orientación",pageAtRuleOrientationNone:"Predeterminada",pageAtRuleOrientationPortrait:"Vertical",pageAtRuleOrientationLandscape:"Horizontal",pageAtRuleMargins:"Márgenes de página",pageAtRuleReset:"Restablecer impresión",pageAtRuleResetAria:"Quitar la configuración @page de impresión de esta página",menuZoom:"Zoom",menuZoomAria:"Submenú Zoom",pageZoomFitWidth:"Ajustar ancho",pageZoomFitWidthAria:"Ajustar el ancho de la página al editor",pageZoomFitPage:"Ajustar página",pageZoomFitPageAria:"Ajustar toda la página al editor",pageZoom50:"50 %",pageZoom50Aria:"Zoom al 50 por ciento",pageZoom75:"75 %",pageZoom75Aria:"Zoom al 75 por ciento",pageZoom100:"100 %",pageZoom100Aria:"Zoom al 100 por ciento",pageZoom125:"125 %",pageZoom125Aria:"Zoom al 125 por ciento",pageZoom150:"150 %",pageZoom150Aria:"Zoom al 150 por ciento",pageZoom200:"200 %",pageZoom200Aria:"Zoom al 200 por ciento",pageBackgroundImagePreview:"Vista previa",pageBackgroundImagePreviewAlt:"Vista previa de la imagen de fondo de página",pageBackgroundImageClear:"Quitar imagen de fondo",pageBackgroundImageCurrent:"Imagen seleccionada",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",paragraphDialogPageBreaks:"Saltos de página",paragraphDialogBreakInside:"Evitar corte interno",paragraphDialogBreakAfter:"Salto después",paragraphDialogBreakBefore:"Salto antes",paragraphDialogBreakAuto:"Automático",paragraphDialogBreakAvoid:"Evitar",paragraphDialogBreakPage:"Página",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Barra de herramientas",toolbarGroupFile:"Archivo",toolbarGroupPrint:"Imprimir",toolbarGroupEdit:"Editar",toolbarGroupInsert:"Insertar",toolbarGroupTable:"Tabla",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",commandAddComment:"Añadir comentario",commandAddCommentAria:"Añadir comentario en la selección",commandInsertComment:"Comentario",commandInsertCommentAria:"Insertar comentario en la selección",showComments:"Mostrar comentarios",hideComments:"Ocultar comentarios",toggleCommentsVisibleAria:"Alternar visibilidad de comentarios",commentPanelTitle:"Comentario",commentPlaceholder:"Escribe un comentario…",commentReplyPlaceholder:"Escribe una respuesta…",commentPost:"Publicar",commentEmpty:"Aún no hay mensajes.",commentPanelCloseAria:"Cerrar panel de comentarios"},hp={en:Al,es:pp},xd=c.createContext(e=>Al[e]);function bp({locale:e="en",children:t}){const n=c.useMemo(()=>{const r=hp[e]??Al;return i=>r[i]},[e]);return o.jsx(xd.Provider,{value:n,children:t})}function W(){return c.useContext(xd)}const yp="_menu_c1m45_1",xp="_item_c1m45_19",Cp="_separator_c1m45_59",ja={menu:yp,item:xp,separator:Cp},po=8,wp=[{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.inTable},{type:"item",command:"openCellProperties",labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"openRowProperties",labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"mergeCells",labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:(e,t)=>t.canMergeCells},{type:"item",command:"unmergeCells",labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:(e,t)=>t.canUnmergeCells}];function vp(e,t){const n=[];let r=!1;for(const i of wp){if(i.type==="separator"){n.length>0&&(r=!0);continue}i.enabled(e,t)&&(r&&(n.push({type:"separator"}),r=!1),n.push(i))}return n}function Oc(){return'[role="menuitem"]:not(:disabled)'}function Sp({open:e,x:t,y:n,kind:r,inTable:i=!1,canMergeCells:a=!1,canUnmergeCells:l=!1,commands:u,onClose:m}){const g=W(),p=c.useId(),h=c.useRef(null);if(c.useLayoutEffect(()=>{var k;if(!e)return;const x=h.current;if(!x)return;const b=x.getBoundingClientRect(),S=Math.max(po,Math.min(t,window.innerWidth-b.width-po)),v=Math.max(po,Math.min(n,window.innerHeight-b.height-po));x.style.left=`${S}px`,x.style.top=`${v}px`,(k=x.querySelector(Oc()))==null||k.focus()},[e,t,n,r]),c.useEffect(()=>{if(!e)return;const x=k=>{var P;(P=h.current)!=null&&P.contains(k.target)||m()},b=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),m())},S=()=>{m()},v=k=>{var P;if((P=h.current)!=null&&P.contains(k.target)){k.preventDefault();return}k.defaultPrevented||m()};return document.addEventListener("pointerdown",x),document.addEventListener("keydown",b,!0),window.addEventListener("scroll",S,!0),document.addEventListener("contextmenu",v),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",b,!0),window.removeEventListener("scroll",S,!0),document.removeEventListener("contextmenu",v)}},[e,m]),!e)return null;const C=vp(r,{inTable:i,canMergeCells:a,canUnmergeCells:l}),y=x=>{var P;if(x.key!=="ArrowDown"&&x.key!=="ArrowUp")return;const b=[...((P=h.current)==null?void 0:P.querySelectorAll(Oc()))??[]];if(b.length===0)return;const S=b.indexOf(document.activeElement),v=x.key==="ArrowDown"?1:-1,k=b[(S+v+b.length)%b.length];x.preventDefault(),k==null||k.focus()};return o.jsx(ce,{children:o.jsxs("div",{ref:h,className:ja.menu,role:"menu","aria-labelledby":p,style:{left:t,top:n},onMouseDown:x=>x.preventDefault(),onKeyDown:y,children:[o.jsx("span",{id:p,hidden:!0,children:g("contextMenuAria")}),C.map((x,b)=>x.type==="separator"?o.jsx("div",{role:"separator",className:ja.separator},`separator-${b}`):o.jsx("button",{type:"button",role:"menuitem",className:ja.item,"aria-label":g(x.ariaKey),onClick:()=>{m(),kl(u,x.command)},children:g(x.labelKey)},x.command))]})})}function kp(e){return e==="touch"||e==="pen"}function Ap(e,t){return e.button===2||e.ctrlKey?!0:!kp(t)}const fr="data-page",Io="data-page-bg",Fo="commspliant-background";function yt(e){return e instanceof HTMLElement&&(e.id===Fo||e.hasAttribute(Io))}function Pp(e){return e.hasAttribute(fr)&&e.parentElement?e.parentElement:e}function Pl(e){const t=Pp(e),n=new Set,r=[],i=a=>{a instanceof HTMLElement&&yt(a)&&!n.has(a)&&(n.add(a),r.push(a))};i(t.querySelector(`#${Fo}`));for(const a of t.querySelectorAll(`[${Io}]`))i(a);return i(t),r}function Dl(e){return Pl(e)[0]??null}function No(e){let t=!1;return e.style.width!=="100%"&&(e.style.width="100%",t=!0),e.style.height!=="100%"&&(e.style.height="100%",t=!0),t}function Cd(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(fr)}function wd(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function Dp(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function xr(e){return wd(e).find(n=>n.hasAttribute(fr))??null}function jp(e){if(Dp(e))return null;const t=wd(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"||yt(n)?null:n}function Ep(e){const t=xr(e);if(t)return No(t),t;const n=jp(e);if(n)return n.setAttribute(fr,""),No(n),n;const r=document.createElement("div");for(r.setAttribute(fr,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),No(r),r}function jl(e){return xr(e)??e}const Kc=["background-color","background-image","background-size","background-position","background-repeat","opacity"];function $c(e,t,n){const r=(t==null?void 0:t.style.getPropertyValue(n).trim())??"";r?e.style.setProperty(n,r):e.style.removeProperty(n)}function ii(e){const t=xr(e),n=t?Dl(t):null;if($c(e,t,"background-color"),n)for(const r of Kc)r!=="background-color"&&$c(e,n,r);else for(const r of Kc)r!=="background-color"&&e.style.removeProperty(r)}const Bo="<!-- wysiwyg-page-separator -->",Ga="data-page-surface";function ze(e){const t=e.trim();return t?t.includes(Bo)?e.split(Bo).map(n=>n.trim()):[e]:[""]}function pt(e){return e.length===0?"":e.length===1?e[0]??"":e.join(`
2
+ ${Bo}
3
+ `)}function Va(){return"<p></p>"}function Uc(e){return e.length===0?[Va()]:e.map(t=>t.trim())}function Mo(e,t){const n=e.querySelector(`[${Ga}][data-page-index="${t}"]`);return n||([...e.querySelectorAll(`[${Ga}]`)][t]??null)}function El(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 Rp(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function ho(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 Tp(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 Np(e){return e?Tp(e).find(Rp)??null:null}const vd={description:"HTML",accept:{"text/html":[".html",".htm"]}},Mp="document.html";function Sd(){return window}function kd(e){return e instanceof DOMException&&e.name==="AbortError"}function _p(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 Lp(){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}El(r).then(a=>n(a),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function Ip(e,t=Mp){const n=Sd().showSaveFilePicker;if(typeof n=="function"){try{const i=await(await n({suggestedName:t,types:[vd]})).createWritable();await i.write(e),await i.close()}catch(r){if(kd(r))return;throw r}return}_p(e,t)}async function Fp(){const e=Sd().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[vd]}),n=await t.getFile();return await El(n)}catch(t){if(kd(t))return null;throw t}return Lp()}const Bp=new Set(["span","strong","b","em","i","u","s","strike","del"]);function le(e,t){return t?e===t||e.contains(t):!1}function xt(e){return Bp.has(e.tagName.toLowerCase())}function Hp(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 $e(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&&Hp(e,i)&&n.push(i);return n}function bt(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 Vt(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function Ze(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function Zt(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 u=e.cloneNode(!1);for(const m of a)u.appendChild(m);i.insertBefore(u,e)}if(l.length>0){const u=e.cloneNode(!1);for(const m of l)u.appendChild(m);i.insertBefore(u,e.nextSibling)}}function cn(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 Cr(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 ai="data-wysiwyg-font",zp=[{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 gr(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function wr(e,t){return e===t?!0:!e||!t?!1:gr(e)===gr(t)}function Ad(e=[]){var r;const t=[],n=new Set;for(const i of[...zp,...e]){const a=i.family.trim();if(!a)continue;const l=gr(a);if(n.has(l))continue;n.add(l);const u=(r=i.css)==null?void 0:r.trim();t.push({name:i.name.trim()||a,family:a,...u?{css:u}:{}})}return t}function Op(e,t){return e?t.find(n=>wr(n.family,e))??null:null}function Kp(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function $p(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function li(e){const t=new Set,n=[];for(const r of e){const i=r.trim();!i||!Kp(i)||t.has(i)||(t.add(i),n.push(i))}return n}function Up(e){return e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&amp;/g,"&")}const Wp=new RegExp(`<link\\b[^>]*\\b${ai}\\b[^>]*>`,"gi");function Ce(e){if(!e.includes(ai))return{hrefs:[],body:e};const t=[],n=e.replace(Wp,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(Up(i)),""});return{hrefs:li(t),body:n}}function bo(e,t){const n=li(t);return n.length===0?e:`${n.map(i=>`<link rel="stylesheet" href="${$p(i)}" ${ai}="">`).join("")}${e}`}function Gp(e,t){const n=gr(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&&gr(l)===n)return!0}a=i.nextNode()}return!1}function yo(e,t,n=[]){const r=Ce(t).hrefs,i=n.filter(a=>a.css&&Gp(e,a.family)).map(a=>a.css??"");return li([...r,...i])}function Vp(e,t=[]){const n=Ce(e).hrefs,r=t.map(i=>i.css??"");return li([...n,...r])}function Zp(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Pd(e){return e.style.fontFamily.trim()||null}function Rl(e,t){let n=Zp(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Pd(n);if(r)return r;n=n.parentElement}return null}function Za(e){return e instanceof HTMLElement&&Pd(e)!==null}function Tl(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function qp(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!xt(r)||!Za(r)){n=r;continue}if(Zt(r,n),Za(r)&&(Tl(r),Vt(r))){Ze(r);continue}n=r}}function Dd(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return le(e,n.commonAncestorContainer)?n:null}function jd(e){const t=Dd(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:$e(t).filter(u=>u.data.length>0),i=(n.length>0?n:[t.startContainer]).map(u=>Rl(e,u)),a=i[0]??null;return i.every(u=>wr(u,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function qa(e,t){const n=Dd(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;bt(n);const i=$e(n).filter(a=>a.data.length>0);for(const a of i){const l=Rl(e,a);if(r===null){if(l===null)continue;qp(e,a);continue}wr(l,r)||Cr(a,u=>{u.style.fontFamily=r})}return cn(i),!0}function Yp(e,t){if(t){if(t.value===null){Tl(e);return}e.style.fontFamily=t.value}}function Xp(e){return e!=null}function Jp(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 Qp(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 Ya(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!xt(r)||!Za(r)){n=r;continue}if(Zt(r,n),Tl(r),Vt(r)){Ze(r);continue}n=r.isConnected?r:t}return t}function eh(e,t){Jp(t);const n=Qp(t);return Ya(e,n)}function th(e,t,n){return!!(n&&n.value===null&&Rl(e,t))}const nh=`
4
4
  @page {
5
5
  margin: 0;
6
6
  }
@@ -89,8 +89,8 @@ img {
89
89
  height: auto;
90
90
  vertical-align: middle;
91
91
  }
92
- `.trim();function Ya(e,t,n="​"){const{hrefs:r,body:i}=jt(t),a=e.createElement("meta");a.setAttribute("charset","utf-8");const l=e.createElement("title");l.textContent=n;const u=e.createElement("style");u.textContent=Qg;const m=r.map(p=>{const g=e.createElement("link");return g.rel="stylesheet",g.href=p,g});e.head.replaceChildren(a,l,u,...m),e.title=n,e.body.innerHTML=i}const Tl=["pt","px","em","rem","%"],nn="pt",eh={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]},th={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},nh=new Set(Tl),rh=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function li(e){return nh.has(e)}function Ee(e){return Math.round(e*100)/100}function Q(e){const t=Ee(e);return Number.isInteger(t),String(t)}function Nl(e,t){return`${Q(e)}${t}`}function Ml(e){const t=e.trim();if(!t)return null;const n=t.match(rh);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 oh(e,t){const n=e.trim();if(!n)return null;const r=Ml(n);if(r)return li(r.unit)?rn(r.value,r.unit):null;const i=Number(n.replace(",","."));return Number.isFinite(i)?rn(i,t):null}function rn(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=th[t];return{value:Ee(Math.min(r,Math.max(n,e))),unit:t}}function jd(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return Ee(e);case"pt":return Ee(e*.75);case"em":return Ee(e/i);case"rem":return Ee(e/a);case"%":return Ee(e/i*100)}}function ih(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 Ed(e,t,n,r,i){if(t===n)return Ee(e);const a=ih(e,t,r,i);return jd(a,n,r,i)}const _l="pt",ah=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,lh=/^[+-]?0(?:\.0+)?$/;function ge(e){return`${Q(e.value)}${e.unit}`}function Te(e){const t=e.trim();if(!t)return null;if(lh.test(t))return{value:0,unit:"px"};const n=t.match(ah);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return li(i)?{value:Ee(r),unit:i}:null}function gr(e,t,n){const r=e.trim();if(!r)return null;const i=Te(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:Ee(a),unit:t}:null}function Vt(e){return e.value>=0?e:{value:0,unit:e.unit}}function Xe(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function yo(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function sh(e,t){return t?e===t||e.contains(t):!1}function Uc(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 Wc(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return Uc(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 Uc(e,t)+r}function Gc(e,t){var l,u;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:((u=a.textContent)==null?void 0:u.length)??0}:{node:e,offset:e.childNodes.length}}function Ll(e,t,n){const r=document.createRange(),i=Gc(e,t),a=Gc(e,n);return r.setStart(i.node,i.offset),r.setEnd(a.node,a.offset),r}function Rd(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Vc(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function ch(e,t){return t.mode!=="visual"?null:t.visualRange&&Rd(t.visualRange,e)?t.visualRange:Ll(e,t.start,t.end)}function dt(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(sh(t,a.commonAncestorContainer)){const l=Wc(t,a.startContainer,a.startOffset),u=Wc(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(l,u),end:Math.max(l,u),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 Zc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function uh(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),l=e.snapshot.start,u=e.snapshot.end,m=e.asHtml?e.content:Zc(e.content);e.setHtml(a.slice(0,l)+m+a.slice(u));const p=e.htmlEl;if(p){const g=l+m.length;p.focus(),p.setSelectionRange(g,g)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:Zc(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&Rd(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??Ll(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 Il=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),Td=new Set(["table","thead","tbody","tr","td","th"]),Fl=new Set([...Td,"ul","ol","li","pre","hr"]);function ce(e){return e.tagName.toLowerCase()}function wr(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Bl(e){return e instanceof HTMLElement&&(ce(e)==="ul"||ce(e)==="ol")}function Je(e){return e instanceof HTMLElement&&ce(e)==="li"}function bt(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 Hl(e){const t=e.collapsed?[]:ze(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function An(e,t,n){var m,p,g;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let C=0,y;for(;y=h.nextNode();){if(y===t)return C+n;C+=((m=y.textContent)==null?void 0:m.length)??0}return C}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,u;for(;u=a.nextNode();){if(t.contains(u)||t.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING)return l+r;l+=((g=u.textContent)==null?void 0:g.length)??0}return l+r}function zl(e,t,n){const r=Ll(e,t,n),i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function _n(e,t){const n=bt(e);if(!n)return!1;const r=An(e,n.startContainer,n.startOffset),i=An(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),u=t();return zl(e,a,l),u}function Ol(e,t){if(ce(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 it(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function dh(e,t){let n=wr(t);for(;n&&n!==e;){if(xd(n,e)||gt(n)){n=n.parentElement;continue}const r=ce(n);if(Il.has(r)&&n instanceof HTMLElement)return n;if(Td.has(r)||r==="pre")return null;n=n.parentElement}return null}function Ln(e){const t=bt(e);if(!t)return[];const n=new Set,r=[];for(const i of Hl(t)){const a=dh(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Xa(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ce(e);return Il.has(t)||Fl.has(t)?!1:ht(e)||t==="br"||t==="a"||t==="img"||t==="span"}function mh(e,t){let n=wr(t);for(;n&&n!==e;){if(Fl.has(ce(n)))return!0;n=n.parentElement}return!1}function fh(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function ph(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&Xa(n[i-1]);)i-=1;for(;a<n.length-1&&Xa(n[a+1]);)a+=1;return n.slice(i,a+1)}function Ja(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&gt(t)))return t;return null}function gh(e,t,n){if(n.startContainer===e){const r=e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild;return r instanceof HTMLElement&&gt(r)?Ja(e):r}return n.startContainer===t&&e!==t?Ja(e):fh(e,n.startContainer)}function hh(e,t){const n=Dl(e);if(mh(e,t.startContainer))return null;if(!Ja(n)){const l=document.createElement("p");return l.appendChild(document.createElement("br")),n.appendChild(l),l}const r=gh(n,e,t);if(!r||r instanceof HTMLElement&&gt(r)||r instanceof Element&&Fl.has(ce(r))||r instanceof HTMLElement&&Il.has(ce(r))||!Xa(r))return null;const i=ph(n,r),a=document.createElement("p");n.insertBefore(a,i[0]);for(const l of i)a.appendChild(l);return a}function vr(e){const t=Ln(e);if(t.length>0)return t;const n=bt(e);if(!n)return[];const r=hh(e,n);return r?[r]:[]}function Pn(e){const t=e.parentElement;return t&&Bl(t)?t:null}function Nd(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&&bh(r,i)?t[t.length-1].push(i):t.push([i])}return t}function bh(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}function yh(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function ja(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 Ea(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 Ra(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 xh={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 Ch(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function we(e){const t=e.trim();if(!t||Ch(t))return null;const n=Ra(t);if(n)return n;const r=ja(t);if(r)return r.a===0?null:Ea(r.r,r.g,r.b);const i=xh[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=Ra(t);if(m==="#010203")return m;const p=ja(t);return p&&Ea(p.r,p.g,p.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(l.startsWith("#"))return Ra(l);const u=ja(l);return!u||u.a===0?null:Ea(u.r,u.g,u.b)}function Md(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?we(n):null}function Bo(e,t,n){let r=yh(t);for(;r&&r!==e&&r instanceof HTMLElement;){const i=Md(r,n);if(i)return i;r=r.parentElement}return null}function Ho(e,t){return e instanceof HTMLElement?Md(e,t)!==null:!1}function Kl(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function _d(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function wh(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!ht(i)||!Ho(i,n)){r=i;continue}if(Gt(i,r),Ho(i,n)&&(Kl(i,n),Wt(i))){We(i);continue}r=i}}function Ld(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 zo(e,t){const n=Ld(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:ze(n).filter(m=>m.data.length>0),a=(r.length>0?r:[n.startContainer]).map(m=>Bo(e,m,t)),l=a[0]??null;return a.every(m=>m===l)?{value:l,mixed:!1}:{value:null,mixed:!0}}function cr(e,t,n){const r=Ld(e);if(!r||r.collapsed)return!1;const i=n===null?null:we(n);if(n!==null&&i===null)return!1;pt(r);const a=ze(r).filter(l=>l.data.length>0);for(const l of a){const u=Bo(e,l,t);if(i===null){if(u===null)continue;wh(e,l,t);continue}u!==i&&xr(l,m=>{_d(m,t,i)})}return ln(a),!0}function qc(e,t,n){if(n.value===null){Kl(e,t);return}const r=we(n.value);r&&_d(e,t,r)}function vh(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function Sh(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 kh(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 Id(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!ht(i)||!n.some(a=>Ho(i,a))){r=i;continue}Gt(i,r);for(const a of n)Ho(i,a)&&Kl(i,a);if(Wt(i)){We(i);continue}r=i.isConnected?i:t}return t}function Ah(e,t,n){Sh(t);const r=kh(t);return Id(e,r,n)}function Ph(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&Bo(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&Bo(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const Fd=["auto","avoid"],Qa=["auto","avoid","page"];new Set(Fd);new Set(Qa);function Bd(e){return e.trim().toLowerCase()}function Yc(e){return Bd(e)==="avoid"?"avoid":"auto"}function Oo(e){const t=Bd(e);return t==="avoid"?"avoid":t==="page"||t==="always"?"page":"auto"}function Hd(e){const t=e.style.breakInside;if(t)return Yc(t);const n=e.style.pageBreakInside;return n?Yc(n):"auto"}function zd(e){const t=e.style.breakAfter;if(t)return Oo(t);const n=e.style.pageBreakAfter;return n?Oo(n):"auto"}function Od(e){const t=e.style.breakBefore;if(t)return Oo(t);const n=e.style.pageBreakBefore;return n?Oo(n):"auto"}function Dh(e){e.style.removeProperty("break-inside"),e.style.removeProperty("page-break-inside")}function jh(e){e.style.removeProperty("break-after"),e.style.removeProperty("page-break-after")}function Eh(e){e.style.removeProperty("break-before"),e.style.removeProperty("page-break-before")}function Rh(e){return{breakInside:Hd(e),breakAfter:zd(e),breakBefore:Od(e)}}function Th(e,t){return Hd(e)===t?!1:t==="auto"?(Dh(e),!0):(e.style.breakInside="avoid",e.style.pageBreakInside="avoid",!0)}function Nh(e,t){return zd(e)===t?!1:t==="auto"?(jh(e),!0):t==="avoid"?(e.style.breakAfter="avoid",e.style.pageBreakAfter="avoid",!0):(e.style.breakAfter="page",e.style.pageBreakAfter="always",!0)}function Mh(e,t){return Od(e)===t?!1:t==="auto"?(Eh(e),!0):t==="avoid"?(e.style.breakBefore="avoid",e.style.pageBreakBefore="avoid",!0):(e.style.breakBefore="page",e.style.pageBreakBefore="always",!0)}function _h(e,t){return e===t}function Xc(e,t){return e===t}const Me=["top","right","bottom","left"],si=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],at={top:null,right:null,bottom:null,left:null},$l={style:"none",width:null,color:null},Lh=new Set(si),Jc={value:0,unit:"px"};function Ih(){return{margin:{...at},padding:{...at},lineHeight:null,border:{...$l},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null,breakInside:"auto",breakAfter:"auto",breakBefore:"auto"}}function Ul(){const e=Ih();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,breakInside:e.breakInside,breakInsideMixed:!1,breakAfter:e.breakAfter,breakAfterMixed:!1,breakBefore:e.breakBefore,breakBeforeMixed:!1}}function Rt(e,t){return Me.every(n=>Xe(e[n],t[n]))}function Kd(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 $d(e,t){return e.style===t.style&&Xe(e.width,t.width)&&e.color===t.color}function Ud(e,t){return e===t?!0:!e||!t?!1:Xe(e.offsetX,t.offsetX)&&Xe(e.offsetY,t.offsetY)&&Xe(e.blur,t.blur)&&Xe(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function Fh(e){return e.kind==="normal"?"normal":e.kind==="number"?Q(e.value):ge({value:e.value,unit:e.unit})}function Bh(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 Ee(Math.min(1,Math.max(0,e)))}function Ko(e){return Ee(Ot(e)*100)}function Wd(e){return Ot(e/100)}function Gd(e){return Q(Ot(e))}function Hh(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:Ee(r)}}const n=Te(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function zh(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 Oh(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 Kh(e){const t=[ge(e.offsetX),ge(e.offsetY),ge(e.blur),ge(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function $h(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=zh(t,",")[0];if(!n)return null;const r=Oh(n);let i=!1,a=null;const l=[];for(const u of r){if(u.toLowerCase()==="inset"){i=!0;continue}const m=Te(u);if(m){l.push(m);continue}const p=we(u);if(p){a=p;continue}return null}return l.length<2||l.length>4?null:{offsetX:l[0],offsetY:l[1],blur:l[2]??Jc,spread:l[3]??Jc,color:a,inset:i}}function yn(e,t){return Te(e.style.getPropertyValue(t))}function Uh(e,t,n,r){const i=n&&r?Vt(n):n,a=i?ge(i):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function Qc(e,t){return{top:yn(e,`${t}-top`),right:yn(e,`${t}-right`),bottom:yn(e,`${t}-bottom`),left:yn(e,`${t}-left`)}}function eu(e,t,n,r){let i=!1;for(const a of Me)Uh(e,`${t}-${a}`,n[a],r)&&(i=!0);return i}function Wh(e){const t=e.trim().toLowerCase();return Lh.has(t)?t:"none"}function Vd(e){const t=Wh(e.style.borderStyle||e.style.borderTopStyle),n=yn(e,"border-width")??yn(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,i=r?we(r):null;return{style:t,width:n,color:i}}function Gh(e,t){const n=Vd(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?Vt(t.width):null,color:t.color};return $d(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=ge(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function Zd(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return Te(n)}function Vh(e,t){const n=t?Vt(t):null,r=Zd(e);return Xe(r,n)?!1:(n?e.style.borderRadius=ge(n):e.style.removeProperty("border-radius"),!0)}function qd(e){return $h(e.style.boxShadow)}function Zh(e,t){const n=qd(e),r=t?{...t,blur:Vt(t.blur)}:null;return Ud(n,r)?!1:(r?e.style.boxShadow=Kh(r):e.style.removeProperty("box-shadow"),!0)}function Yd(e){return Hh(e.style.lineHeight)}function qh(e,t){const n=Yd(e);return Kd(n,t)?!1:(t?e.style.lineHeight=Fh(t):e.style.removeProperty("line-height"),!0)}function Xd(e){const t=e.style.backgroundColor;return t?we(t):null}function Yh(e,t){const n=t?we(t):null;return Xd(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Jd(e){return Bh(e.style.opacity)}function Xh(e,t){const n=Jd(e),r=t===null?null:Ot(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Gd(r),!0)}function In(e){const t=Rh(e);return{margin:Qc(e,"margin"),padding:Qc(e,"padding"),lineHeight:Yd(e),border:Vd(e),borderRadius:Zd(e),boxShadow:qd(e),backgroundColor:Xd(e),opacity:Jd(e),breakInside:t.breakInside,breakAfter:t.breakAfter,breakBefore:t.breakBefore}}function Fn(e,t){let n=!1;return!t.marginMixed&&eu(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&eu(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&qh(e,t.lineHeight)&&(n=!0),!t.borderMixed&&Gh(e,t.border)&&(n=!0),!t.radiusMixed&&Vh(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&Zh(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&Yh(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&Xh(e,t.opacity)&&(n=!0),!t.breakInsideMixed&&Th(e,t.breakInside)&&(n=!0),!t.breakAfterMixed&&Nh(e,t.breakAfter)&&(n=!0),!t.breakBeforeMixed&&Mh(e,t.breakBefore)&&(n=!0),n&&it(e),n}function Jh(e){const t=Ul(),n=Ln(e);if(n.length===0)return t;const r=n.map(In),i=r[0];return{margin:i.margin,marginMixed:r.some(a=>!Rt(a.margin,i.margin)),padding:i.padding,paddingMixed:r.some(a=>!Rt(a.padding,i.padding)),lineHeight:i.lineHeight,lineHeightMixed:r.some(a=>!Kd(a.lineHeight,i.lineHeight)),border:i.border,borderMixed:r.some(a=>!$d(a.border,i.border)),borderRadius:i.borderRadius,radiusMixed:r.some(a=>!Xe(a.borderRadius,i.borderRadius)),boxShadow:i.boxShadow,shadowMixed:r.some(a=>!Ud(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),breakInside:i.breakInside,breakInsideMixed:r.some(a=>!_h(a.breakInside,i.breakInside)),breakAfter:i.breakAfter,breakAfterMixed:r.some(a=>!Xc(a.breakAfter,i.breakAfter)),breakBefore:i.breakBefore,breakBeforeMixed:r.some(a=>!Xc(a.breakBefore,i.breakBefore))}}function Qh(e,t){return _n(e,()=>{const n=vr(e);if(n.length===0)return!1;let r=!1;for(const i of n)Fn(i,t)&&(r=!0);return r})}const $o="data-page-at-rule";function on(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...at},marginMixed:!1}}function Wl(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Qd(e){return e.body.innerHTML}function Dn(e){var r;const n=Wl(e).querySelector(`style[${$o}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function xo(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?Te(r[1].trim()):null}function eb(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...at};const n=t[1].trim().split(/\s+/).map(u=>Te(u)),[r,i=r,a=r,l=i]=n;return{top:r??null,right:i??null,bottom:a??null,left:l??null}}function tb(e){const t=e.match(/(?:^|[\s{;])size\s*:\s*([^;]+)/i);if(!t)return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null};const n=t[1].trim().toLowerCase();if(n==="auto")return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null};if(n==="a4")return{sizePreset:"A4",customWidth:null,customHeight:null,orientation:null};if(n==="letter")return{sizePreset:"letter",customWidth:null,customHeight:null,orientation:null};if(n==="legal")return{sizePreset:"legal",customWidth:null,customHeight:null,orientation:null};const r=n.includes("landscape"),i=n.includes("portrait"),a=r?"landscape":i?"portrait":null,u=n.replace(/\b(landscape|portrait)\b/g,"").trim().split(/\s+/).filter(Boolean);if(u.length>=2){const m=Te(u[0]),p=Te(u[1]);if(m&&p)return{sizePreset:"custom",customWidth:m,customHeight:p,orientation:a}}return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:a}}function nb(e){const t=on();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],i=tb(r),a={top:xo(r,"top"),right:xo(r,"right"),bottom:xo(r,"bottom"),left:xo(r,"left")},u=Me.some(m=>a[m]!==null)?a:eb(r);return{...i,margin:u,marginMixed:!1}}function jn(e){return nb(Dn(e))}function rb(e,t){return Dn(e)||!Dn(t)?e:Gl(e,jn(t))}function ob(e){const t=Me.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?ge(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:Me.map(r=>e[r]?`margin-${r}: ${ge(e[r])};`:null).filter(Boolean).join(" ")}function ib(e){if(e.sizePreset==="auto"&&!e.orientation)return null;const t=[];return e.sizePreset==="A4"?t.push("A4"):e.sizePreset==="letter"?t.push("letter"):e.sizePreset==="legal"?t.push("legal"):e.sizePreset==="custom"&&e.customWidth&&e.customHeight&&t.push(ge(e.customWidth),ge(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function ab(e){const t=ib(e),n=ob(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function lb(e){const t=Wl(e);for(const n of t.querySelectorAll(`style[${$o}]`))n.remove();return Qd(t)}function sb(e,t){const n=Wl(e);let r=n.querySelector(`style[${$o}]`);return r||(r=n.createElement("style"),r.setAttribute($o,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,Qd(n)}function Gl(e,t){const n=ab(t);return n?sb(e,n):em(e)}function em(e){return lb(e)}function cb(e){const t=e.map(n=>Dn(n)).filter(n=>!!n);return t.length===0?"":t.join(`
93
- `)}const ub=1e3;function tm(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.setAttribute("data-wysiwyg-print",""),e.style.position="fixed",e.style.right="0",e.style.bottom="0",e.style.width="0",e.style.height="0",e.style.border="0",document.body.append(e);const t=e.contentDocument,n=e.contentWindow;return!t||!n?(e.remove(),null):{iframe:e,doc:t,win:n}}function nm(e,t,n,r){Ya(e,r);let i=!1;const a=()=>{i||(i=!0,n.remove())};t.addEventListener("afterprint",a),t.focus(),t.print(),window.setTimeout(a,ub)}function db(e){const t=tm();t&&nm(t.doc,t.win,t.iframe,e)}function mb(e){const t=tm();if(!t)return;const n=[],r=[];for(const u of e){const m=jt(u);n.push(...m.hrefs),r.push(m.body)}const i=r.map((u,m)=>`<div style="${m<r.length-1?"page-break-after: always;":""}">${u}</div>`).join(""),a=cb(e),l=[a?`<style>${a}</style>`:"",...Array.from(new Set(n)).map(u=>`<link rel="stylesheet" href="${u}" />`),i].filter(Boolean).join("");nm(t.doc,t.win,t.iframe,l)}function fb(e){return{save:async()=>{if(e.onSave){const n=e.isMultiPagesEnabled()?e.getAllPagesHtml():e.getHtml();await e.onSave(n);return}const t=e.isMultiPagesEnabled()?e.getActivePageHtml():e.getHtml();await Mg(t)},open:async()=>{const t=e.onOpen?await e.onOpen():await _g();if(t!==null){if(Array.isArray(t)){e.setHtml(mt(t));return}if(e.isMultiPagesEnabled()){e.setHtml(mt([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){mb(e.getAllPagesHtml());return}db(e.getHtml())}}}function pb(e){return{toggleBold:()=>{e.toggleFontMark("bold")},toggleItalic:()=>{e.toggleFontMark("italic")},toggleUnderline:()=>{e.toggleFontMark("underline")},toggleStrikethrough:()=>{e.toggleFontMark("strikethrough")},clearFormatting:()=>{e.clearFormatting()},toggleFormatBrush:()=>{e.toggleFormatBrush()},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)},openCustomCss:()=>{e.openCustomCss()},applyCustomCss:t=>{e.applyCustomCss(t)}}}function gb(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(),isFormatBrushActive:()=>e.isFormatBrushActive(),customParagraphStylesEnabled:()=>e.customParagraphStylesEnabled(),getCustomParagraphStyles:()=>e.getCustomParagraphStyles(),isCustomParagraphStylesLoading:()=>e.isCustomParagraphStylesLoading()}}function hb(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function bb(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function yb(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)},openAudioDialog:()=>{e.openAudioDialog()},applyAudio:t=>{e.applyAudio(t)},openYoutubeDialog:()=>{e.openYoutubeDialog()},applyYoutube:t=>{e.applyYoutube(t)},openImageProperties:t=>{e.openImageProperties(t)},applyImageProperties:t=>{e.applyImageProperties(t)},insertHorizontalRule:()=>{e.insertHorizontalRule()},insertPageBreak:()=>{e.insertPageBreak()},insertPage:()=>{e.insertPage()}}}function xb(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),canInsertPage:()=>e.isMultiPagesEnabled()&&e.getMode()==="visual"}}function Cb(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()},mergeCells:()=>{e.mergeCells()},unmergeCells:()=>{e.unmergeCells()}}}function wb(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}const vb=[50,75,100,125,150,200],Sb=.1,kb=3;function Ta(e){return!Number.isFinite(e)||e<=0?1:Math.min(kb,Math.max(Sb,e))}function Ab(e,t,n,r,i){if(e==="fitWidth")return r<=0?1:Ta(t/r);if(e==="fitPage"){if(r<=0||i<=0)return 1;const a=t/r,l=n/i;return Ta(Math.min(a,l))}return Ta(e/100)}function It(e,t){return()=>{e.setPageZoom(t)}}function Ft(e,t){return()=>e.getPageZoom()===t}function Pb(e){return{setVisualMode:()=>{e.setMode("visual")},setHtmlMode:()=>{e.setMode("html")},toggleFullscreen:()=>{e.setFullscreen(!e.getFullscreen())},openCustomizeToolbar:()=>{e.openCustomizeToolbar()},openDocumentPreview:()=>{e.openDocumentPreview()},toggleReadAloud:()=>{e.toggleReadAloud()},setLightMode:()=>{e.setDarkMode(!1)},setDarkMode:()=>{e.setDarkMode(!0)},setPageZoomFitWidth:It(e,"fitWidth"),setPageZoomFitPage:It(e,"fitPage"),setPageZoom50:It(e,50),setPageZoom75:It(e,75),setPageZoom100:It(e,100),setPageZoom125:It(e,125),setPageZoom150:It(e,150),setPageZoom200:It(e,200),setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function Db(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isPageZoomFitWidth:Ft(e,"fitWidth"),isPageZoomFitPage:Ft(e,"fitPage"),isPageZoom50:Ft(e,50),isPageZoom75:Ft(e,75),isPageZoom100:Ft(e,100),isPageZoom125:Ft(e,125),isPageZoom150:Ft(e,150),isPageZoom200:Ft(e,200),isToolbarPositionTop:()=>e.getToolbarPosition()==="top",isToolbarPositionLeft:()=>e.getToolbarPosition()==="left",isToolbarPositionRight:()=>e.getToolbarPosition()==="right",isToolbarPositionBottom:()=>e.getToolbarPosition()==="bottom",isReadingAloud:()=>e.isReadingAloud(),canReadAloud:()=>e.canReadAloud()}}function jb(e){return{addComment:()=>e.addComment(),toggleCommentsVisible:()=>e.toggleCommentsVisible()}}function Eb(e){return{canAddComment:()=>e.canAddComment(),areCommentsVisible:()=>e.areCommentsVisible(),isCommentsEnabled:()=>e.isCommentsEnabled()}}function Rb(e){return{...fb(e),...hb(e),...lg(e),...yb(e),...Cb(e),...Pb(e),...pb(e),...jb(e)}}function Tb(e){return{...Db(e),...bb(e),...xb(e),...wb(e),...gb(e),...Eb(e)}}function Uo(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Nb(e){const t=e.style.fontSize;if(!t)return null;const n=Ml(t);return!n||!li(n.unit)?null:{value:n.value,unit:n.unit}}function rm(e,t){let n=Uo(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Nb(n);if(r)return r;n=n.parentElement}return null}function Mb(e,t){const n=Uo(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function om(e,t){var a;let n=Uo(t);for(;n&&n!==e;){if(n.style.fontSize){const u=n.parentElement??e,m=parseFloat(getComputedStyle(u).fontSize);return Number.isFinite(m)&&m>0?m:16}n=n.parentElement}const r=((a=Uo(t))==null?void 0:a.parentElement)??e,i=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(i)&&i>0?i:16}function im(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function _b(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function tu(e=nn){return{value:null,unit:e,mixed:!1}}function am(e,t=nn){const n=window.getSelection();if(!n||n.rangeCount===0)return tu(t);const r=n.getRangeAt(0);if(!ae(e,r.commonAncestorContainer))return tu(t);const i=r.collapsed?[]:ze(r).filter(p=>p.data.length>0),a=i.length>0?i:[r.startContainer],l=a.map(p=>rm(e,p)),u=l[0];if(l.every(p=>_b(p,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(l.every(p=>p===null)){const p=a.map(h=>Mb(h,e)),g=p[0];if(p.every(h=>Math.abs(h-g)<.05)){const h=om(e,a[0]),C=im(e);return{value:jd(g,t,h,C),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function Lb(e,t){return{parentPx:om(e,t),rootPx:im(e)}}function Ib(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 el(e,t,n){const r=rn(t,n);if(!r)return!1;const i=Ib(e);if(!i||i.collapsed)return!1;const a=Nl(r.value,r.unit);pt(i);const l=ze(i).filter(u=>u.data.length>0);for(const u of l){const m=rm(e,u);m&&m.value===r.value&&m.unit===r.unit||xr(u,p=>{p.style.fontSize=a})}return ln(l),!0}function Fb(e,t){e.style.fontSize=Nl(t.value,t.unit)}function Bb(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Hb(e){return e.trim().toLowerCase()}function tl(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=Hb(r.slice(0,i)),l=r.slice(i+1).trim();a&&(t[a]=l)}return t}function lm(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function zb(e,t){const n={...e};for(const[r,i]of Object.entries(t))i.trim()?n[r]=i:delete n[r];return n}function Ob(e){const t=e.trim();if(!t)return"";const n=t.split(";").map(r=>r.trim()).filter(Boolean);return n.length===0?"":n.map(r=>`${r};`).join(`
94
- `)}function ci(e){const t=tl(e);return lm(t)}function Kb(e,t){let n=Bb(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function sm(e){const t=bt(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:ze(t).filter(m=>m.data.length>0),a=(n.length>0?n:[t.startContainer]).map(m=>Kb(e,m)).map(m=>m.trim()),l=a[0]??"";return a.every(m=>m===l)?{value:l||null,mixed:!1}:{value:null,mixed:!0}}function cm(e,t){const n=tl(e.style.cssText),r=tl(t),i=zb(n,r),a=lm(i);a?e.style.cssText=a:e.removeAttribute("style")}function um(e,t){const n=ci(t);if(!n)return!1;const r=bt(e);if(!r||r.collapsed)return!1;pt(r);const i=ze(r).filter(a=>a.data.length>0);if(i.length===0)return!1;for(const a of i)xr(a,l=>{cm(l,n),Wt(l)&&We(l)});return ln(i),!0}function $b(e,t){const n=ci(t);n&&cm(e,n)}function Ub(e){return!!(e&&ci(e))}const Qe=["bold","italic","underline","strikethrough"],xn={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},Wb=new Set(["underline","line-through","overline"]);function Et(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function Gb(e,t){return Qe.every(n=>e[n]===t[n])}function Vb(e){return Qe.some(t=>e[t]!==void 0)}function dm(e,t){const n={...e};if(!t)return n;for(const r of Qe){const i=t[r];i!==void 0&&(n[r]=i)}return n}function Zb(e,t,n){const r=e[n]??t[n],i={...e,[n]:!r};return i[n]===t[n]&&delete i[n],i}function Kt(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>Wb.has(n))}function En(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 mm(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(xn.bold.has(r))return!0;const l=n.style.fontWeight;if(!l)return null;if(l==="bold"||l==="bolder")return!0;const u=Number(l);return Number.isNaN(u)?l==="normal"||l==="lighter"?!1:null:u>=700}if(t==="italic"){if(xn.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(xn.underline.has(r))return!0;const l=n.style.textDecorationLine||n.style.textDecoration;if(!l)return null;if(l==="none")return!1;const u=Kt(n);return u.includes("underline")?!0:u.length>0?!1:null}if(xn.strikethrough.has(r))return!0;const i=n.style.textDecorationLine||n.style.textDecoration;if(!i)return null;if(i==="none")return!1;const a=Kt(n);return a.includes("line-through")?!0:a.length>0?!1:null}function Wo(e,t){return mm(e,t)===!0}function Rn(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const i=mm(r,n);if(i!==null)return i;r=r.parentElement}return!1}function fm(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=Kt(e);r.includes("underline")||r.push("underline"),En(e,r);return}const n=Kt(e);n.includes("line-through")||n.push("line-through"),En(e,n)}function pm(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"){En(e,Kt(e).filter(n=>n!=="underline"));return}En(e,Kt(e).filter(n=>n!=="line-through"))}function qb(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=Kt(e).filter(i=>i!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}En(e,r);return}const n=Kt(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}En(e,n)}function Yb(e,t){xr(e,n=>fm(n,t))}function Xb(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!ht(i)||!Wo(i,n)){r=i;continue}if(Gt(i,r),Wo(i,n)){if(xn[n].has(i.tagName.toLowerCase())){We(i);continue}if(pm(i,n),Wt(i)){We(i);continue}}r=i}}function Jb(e,t,n){const r=ze(t).filter(i=>i.data.length>0);return r.length===0?Rn(e,t.startContainer,n):r.every(i=>Rn(e,i,n))}function Qb(e,t,n,r){pt(t);const i=ze(t).filter(a=>a.data.length>0);for(const a of i)r?Rn(e,a,n)||Yb(a,n):Xb(e,a,n);ln(i)}function Cn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return Et();const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return Et();if(n.collapsed)return nl(e,n);const r=ze(n).filter(a=>a.data.length>0);if(r.length===0)return nl(e,n);const i=Et();for(const a of Qe)i[a]=Rn(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const l of Qe)i[l]=i[l]&&Rn(e,r[a],l);return i}function nl(e,t){const n=Et();for(const r of Qe)n[r]=Rn(e,t.startContainer,r);return n}function rl(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=Jb(e,r,t);return Qb(e,r,t,!i),!0}function ey(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 ty(e,t,n){var a,l,u;ey(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?(u=r.parentNode)==null||u.insertBefore(m,r):t.startContainer.appendChild(m),r=m}let i=r;for(;i.parentElement&&i.parentElement!==e;){const m=i.parentElement;if(!ht(m)){i=m;continue}if(!n.some(g=>Wo(m,g))){i=m;continue}Gt(m,i);for(const g of n)if(Wo(m,g)){if(xn[g].has(m.tagName.toLowerCase())){We(m);break}if(pm(m,g),Wt(m)){We(m);break}}i=m.isConnected?m:r}return r}function ny(e,t,n){for(const r of Qe)n[r]!==t[r]&&(n[r]?fm(e,r):qb(e,r))}function ry(e,t,n,r,i,a,l){var k,P;const u=window.getSelection();if(!u||u.rangeCount===0)return;const m=u.getRangeAt(0);if(!ae(e,m.commonAncestorContainer))return;const p=nl(e,m),g=dm(p,n),h=Qe.filter(N=>p[N]&&!g[N]),C=Ph(e,m.startContainer,i),y=Jg(e,m.startContainer,a);let x=null;h.length>0?(x=ty(e,m,h),C.length>0&&Id(e,x,C),y&&qa(e,x)):C.length>0?(x=Ah(e,m,C),y&&qa(e,x)):y?x=Xg(e,m):m.deleteContents();const b=document.createElement("span");ny(b,p,g),r&&Fb(b,r),i!=null&&i.color&&qc(b,"color",i.color),i!=null&&i.backgroundColor&&qc(b,"backgroundColor",i.backgroundColor),a&&Vg(b,a),l&&$b(b,l),b.textContent=t;const S=b.style.cssText.trim()?b:document.createTextNode(t);x?((k=x.parentNode)==null||k.insertBefore(S,x),x.nodeType===Node.TEXT_NODE&&!x.data&&((P=x.parentNode)==null||P.removeChild(x))):m.insertNode(S);const v=document.createRange();v.selectNodeContents(S),v.collapse(!1),u.removeAllRanges(),u.addRange(v)}const Go=["p","h1","h2","h3","h4","h5","h6"],oy=new Set(Go),gm=new Set([...Go,"div"]),ui=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),iy=()=>({tag:null,mixed:!1});function hm(e){return oy.has(e)}function ay(e){return hm(e)?e:e==="div"?"p":null}function ly(e){return e instanceof Element&&ui.has(ce(e))}function bm(e){return e instanceof HTMLElement&&!gt(e)&&gm.has(ce(e))}function ol(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ce(e);return gm.has(t)||ui.has(t)?!1:ht(e)||t==="br"||t==="a"||t==="img"||t==="span"}function sy(e,t){let n=wr(t);for(;n&&n!==e;){if(ui.has(ce(n)))return!0;n=n.parentElement}return!1}function ym(e,t){let n=wr(t);for(;n&&n!==e;){if(xd(n,e)){n=n.parentElement;continue}if(bm(n))return n;if(ui.has(ce(n)))return null;n=n.parentElement}return null}function cy(e,t){const n=new Set,r=[];for(const i of Hl(t)){const a=ym(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function uy(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function dy(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&ol(n[i-1]);)i-=1;for(;a<n.length-1&&ol(n[a+1]);)a+=1;return n.slice(i,a+1)}function il(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&gt(t)))return t;return null}function my(e,t,n){if(n.startContainer===e){const r=e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild;return r instanceof HTMLElement&&gt(r)?il(e):r}return n.startContainer===t&&e!==t?il(e):uy(e,n.startContainer)}function fy(e,t,n){const r=Dl(e);if(sy(e,t.startContainer))return!1;if(!il(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const i=my(r,e,t);if(!i||i instanceof HTMLElement&&gt(i)||ly(i)||bm(i)||!ol(i))return!1;const a=dy(r,i),l=document.createElement(n);r.insertBefore(l,a[0]);for(const u of a)l.appendChild(u);return!0}function py(e){const t=bt(e);if(!t)return iy();const n=Hl(t).map(i=>{const a=ym(e,i);return a?ay(ce(a)):null}),r=n[0];return n.every(i=>i===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function gy(e,t){if(!hm(t))return!1;const n=bt(e);if(!n)return!1;const r=An(e,n.startContainer,n.startOffset),i=An(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),u=cy(e,n);let m=!1;if(u.length===0)m=fy(e,n,t);else for(const p of u)ce(p)!==t&&(Ol(p,t),m=!0);return zl(e,a,l),m}function Vl(e){if(!Je(e))return null;const t=Pn(e);if(!t)return null;const n=ce(t);return n==="ul"||n==="ol"?n:null}function xm(e){const t=Ln(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(Vl),r=n[0];return n.every(i=>i===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function hy(e,t,n){const r=[...e.children].filter(i=>Bl(i));for(const i of r)t.insertBefore(i,n)}function Cm(e){const t=Pn(e),n=document.createElement("p");for(const p of[...e.attributes])n.setAttribute(p.name,p.value);for(n.style.marginLeft="",it(n);e.firstChild&&!Bl(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=Je(a)?a.parentNode??a:a,u=Je(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,u),m&&l.insertBefore(m,n.nextSibling),hy(e,l,n.nextSibling),t.childElementCount===0&&t.remove(),n}function by(e){if(Je(e))return e;const t=Ol(e,"li");return t.style.marginLeft="",it(t),t}function wm(e,t){if(e.length===0)return!1;if(e.every(Je)){const a=Pn(e[0]);if(a&&e.every(l=>l.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return ce(a)===t?!1:(Ol(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=Je(a)?Pn(a):null;i.appendChild(by(a)),l&&l!==i&&l.childElementCount===0&&l.remove()}return!0}function vm(e){let t=!1;for(const n of[...e].reverse())Je(n)&&(Cm(n),t=!0);return t}function yy(e,t){return _n(e,()=>{const n=vr(e);if(n.length===0)return!1;if(n.every(a=>Vl(a)===t))return vm(n);let i=!1;for(const a of Nd(n))wm(a,t)&&(i=!0);return i})}function xy(e,t){return _n(e,()=>{const n=vr(e);if(n.length===0)return!1;if(t===null)return vm(n);if(n.every(a=>Vl(a)===t))return!1;let i=!1;for(const a of Nd(n))wm(a,t)&&(i=!0);return i})}const Sm=40;function Zl(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function km(e,t){if(t<=0){e.style.marginLeft="",it(e);return}e.style.marginLeft=`${t}px`}function Cy(e){let t=e.previousElementSibling;for(;t;){if(Je(t))return t;t=t.previousElementSibling}return null}function wy(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(ce(n)==="ul"||ce(n)==="ol"))return n}return null}function vy(e){const t=Cy(e);if(!t)return!1;const n=Pn(e);if(!n)return!1;const r=ce(n)==="ol"?"ol":"ul";let i=wy(t);return(!i||ce(i)!==r)&&(i=document.createElement(r),t.appendChild(i)),i.appendChild(e),!0}function Sy(e){const t=Pn(e);if(!t)return!1;const n=t.parentElement;if(n&&Je(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return Cm(e),!0}function ky(e){return Ln(e).some(n=>Je(n)||Zl(n)>0)}function Ay(e){return _n(e,()=>{const t=vr(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(Je(r)){vy(r)&&(n=!0);continue}km(r,Zl(r)+Sm),n=!0}return n})}function Py(e){return _n(e,()=>{const t=Ln(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(Je(r)){Sy(r)&&(n=!0);continue}const i=Zl(r);i<=0||(km(r,Math.max(0,i-Sm)),n=!0)}return n})}function di(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function an(e,t,n){const r=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(n));r<=1?e.removeAttribute("colspan"):e.colSpan=r,i<=1?e.removeAttribute("rowspan"):e.rowSpan=i}function Ge(e){const t=e.rows.length,n=Array.from({length:t},()=>[]),r=[];let i=0;for(let a=0;a<t;a+=1){const l=e.rows[a];let u=0;for(const m of Array.from(l.cells)){for(;n[a][u];)u+=1;const p=di(m),g={cell:m,originRow:a,originCol:u,rowSpan:p.rowSpan,colSpan:p.colSpan};r.push(g);for(let h=0;h<p.rowSpan;h+=1){const C=a+h;if(C>=t)break;for(let y=0;y<p.colSpan;y+=1)n[C][u+y]=g}u+=p.colSpan,i=Math.max(i,u)}i=Math.max(i,n[a].length)}return{table:e,slots:n,unique:r,rowCount:t,colCount:i}}function Vo(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function lt(e,t){return e.unique.find(n=>n.cell===t)??null}function Am(e,t){return e.originRow<t.minRow||e.originCol<t.minCol||e.originRow+e.rowSpan-1>t.maxRow||e.originCol+e.colSpan-1>t.maxCol}function Pm(e){if(e.length===0)return null;let t=1/0,n=-1/0,r=1/0,i=-1/0;for(const a of e)t=Math.min(t,a.originRow),n=Math.max(n,a.originRow+a.rowSpan-1),r=Math.min(r,a.originCol),i=Math.max(i,a.originCol+a.colSpan-1);return{minRow:t,maxRow:n,minCol:r,maxCol:i}}function Dy(e,t){const n=new Set,r=[];for(let i=t.minRow;i<=t.maxRow;i+=1)for(let a=t.minCol;a<=t.maxCol;a+=1){const l=Vo(e,i,a);!l||n.has(l.cell)||(n.add(l.cell),r.push(l.cell))}return r}function Dm(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=Vo(e,t.minRow,t.minCol);if(!n||n.originRow!==t.minRow||n.originCol!==t.minCol)return null;const r=new Set,i=[];for(let a=t.minRow;a<=t.maxRow;a+=1)for(let l=t.minCol;l<=t.maxCol;l+=1){const u=Vo(e,a,l);if(!u||Am(u,t))return null;r.has(u.cell)||(r.add(u.cell),i.push(u.cell))}return{origin:n,cells:i,colSpan:t.maxCol-t.minCol+1,rowSpan:t.maxRow-t.minRow+1}}function jy(e,t,n,r){const i={minRow:t.originRow,maxRow:t.originRow+r-1,minCol:t.originCol,maxCol:t.originCol+n-1};if(i.maxRow>=e.rowCount||i.maxCol>=e.colCount)return!1;for(let a=i.minRow;a<=i.maxRow;a+=1)for(let l=i.minCol;l<=i.maxCol;l+=1){const u=Vo(e,a,l);if(!u)return!1;if(u.cell!==t.cell&&Am(u,i))return!1}return!0}const nu=10,wn=1,vn=50,Ey="1px solid #000",Ry="0.25em",Ty=new Set(["td","th"]);function jm(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=wn&&t>=wn&&e<=vn&&t<=vn}function He(e,t){return Yl(e,t,n=>n instanceof HTMLTableElement)}function Zo(e,t){return Yl(e,t,n=>Ky(n))}function Ny(e,t){return Yl(e,t,n=>n instanceof HTMLTableRowElement)}function ql(e){return He(e,Xl(e))}function yt(e){return Zo(e,Xl(e))}function Em(e){return Ny(e,Xl(e))}function My(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function Sr(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return[];const r=Zo(e,n.startContainer),i=Zo(e,n.endContainer);if(!r)return[];if(!i||r===i)return[r];const a=He(e,r);if(!a||He(e,i)!==a)return[r];const l=Ge(a),u=lt(l,r),m=lt(l,i);if(!u||!m)return[r];const p=Pm([u,m]);if(!p)return[r];const g=Dy(l,p);return g.length>0?g:[r]}function _y(e,t){if(!jm(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 u=0;u<t.rows;u+=1){const m=document.createElement("tr");for(let p=0;p<t.cols;p+=1)m.appendChild($y("td"));a.appendChild(m)}i.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(i),Vy(e,i);const l=i.querySelector("td, th");return l instanceof HTMLTableCellElement&&Be(l),!0}function al(e,t){var h,C,y,x;const n=yt(e);if(!n)return!1;const r=He(e,n);if(!r)return!1;const i=Ge(r),a=lt(i,n);if(!a)return!1;const l=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const b of i.unique)if(b.originRow<l&&b.originRow+b.rowSpan>l){an(b.cell,b.colSpan,b.rowSpan+1);for(let S=b.originCol;S<b.originCol+b.colSpan;S+=1)u.add(S)}const m=document.createElement("tr"),p=Math.min(l,i.rowCount-1);for(let b=0;b<i.colCount;b+=1){if(u.has(b))continue;const S=((C=(h=i.slots[p])==null?void 0:h[b])==null?void 0:C.cell)??n;m.appendChild(Jl(S))}if(l>=r.rows.length)(y=r.rows[r.rows.length-1].parentNode)==null||y.appendChild(m);else{const b=r.rows[l];(x=b.parentNode)==null||x.insertBefore(m,b)}const g=Wy(m,i.colCount,u,a.originCol);return Be(g||n),!0}function ru(e,t){var p,g,h,C;const n=yt(e);if(!n)return!1;const r=He(e,n);if(!r)return!1;const i=Ge(r),a=lt(i,n);if(!a)return!1;const l=t==="before"?a.originCol:a.originCol+a.colSpan,u=new Set;for(const y of i.unique)if(y.originCol<l&&y.originCol+y.colSpan>l){an(y.cell,y.colSpan+1,y.rowSpan);for(let x=y.originRow;x<y.originRow+y.rowSpan;x+=1)u.add(x)}let m=null;for(let y=0;y<i.rowCount;y+=1){if(u.has(y))continue;const x=((g=(p=i.slots[y])==null?void 0:p[Math.min(l,Math.max(0,i.colCount-1))])==null?void 0:g.cell)??((C=(h=i.slots[y])==null?void 0:h[Math.max(0,l-1)])==null?void 0:C.cell)??n,b=Jl(x);Ql(r,y,l,b),y===a.originRow&&(m=b)}return m&&Be(m),!0}function Ly(e){var C,y;const t=yt(e);if(!t)return!1;const n=He(e,t);if(!n)return!1;const r=Ge(n),i=lt(r,t);if(!i)return!1;if(r.rowCount<=1)return ll(e,n);const a=i.originRow,l=a+1,u=[];for(const x of r.unique)x.originRow<=a&&x.originRow+x.rowSpan>a&&(x.originRow<a?an(x.cell,x.colSpan,x.rowSpan-1):x.originRow===a&&x.rowSpan>1&&u.push(x));u.sort((x,b)=>x.originCol-b.originCol);for(const x of u)an(x.cell,x.colSpan,x.rowSpan-1),Ql(n,l,x.originCol,x.cell);const m=i.originCol;n.rows[a].remove();const p=n.rows[Math.min(a,n.rows.length-1)],g=Ge(n),h=(y=(C=g.slots[Math.min(a,g.rowCount-1)])==null?void 0:C[Math.min(m,Math.max(0,g.colCount-1))])==null?void 0:y.cell;return h?Be(h):p!=null&&p.cells[0]?Be(p.cells[0]):qy(n),!0}function Iy(e){var p,g,h;const t=yt(e);if(!t)return!1;const n=He(e,t);if(!n)return!1;const r=Ge(n),i=lt(r,t);if(!i)return!1;if(r.colCount<=1)return ll(e,n);const a=i.originCol,l=i.originRow;for(const C of r.unique)a<C.originCol||a>=C.originCol+C.colSpan||(C.colSpan===1?C.cell.remove():an(C.cell,C.colSpan-1,C.rowSpan));const u=Ge(n);if(u.colCount===0||u.unique.length===0)return ll(e,n);const m=((g=(p=u.slots[Math.min(l,u.rowCount-1)])==null?void 0:p[Math.min(a,u.colCount-1)])==null?void 0:g.cell)??((h=u.unique[0])==null?void 0:h.cell);return m&&Be(m),!0}function Fy(e,t){const n=yt(e);if(!n)return!1;const r=He(e,n);if(!r)return!1;const i=My(r),a=i.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(Be(i[a-1]),{changed:!1});if(a<i.length-1)return Be(i[a+1]),{changed:!1};const l=n.parentElement;if(!al(e,"below"))return!1;const u=l instanceof HTMLTableRowElement?l.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&Be(u.cells[0]),{changed:!0}}function By(e,t){return!ae(e,t)||t===e?!1:(Be(t),!0)}function ou(e){return Rm(e)!==null}function iu(e){const t=yt(e);if(!t)return!1;const n=di(t);return n.colSpan>1||n.rowSpan>1}function Hy(e){const t=Rm(e);if(!t)return!1;const n=He(e,t.origin.cell);return n?Tm(n,t):!1}function zy(e){const t=yt(e);if(!t)return!1;const n=He(e,t);return n?Nm(n,t):!1}function Oy(e,t,n){const r=yt(e);if(!r)return!1;const i=He(e,r);if(!i)return!1;const a=Ge(i),l=lt(a,r);if(!l)return!1;const u=Math.min(a.colCount-l.originCol,Math.max(1,Math.floor(t))),m=Math.min(a.rowCount-l.originRow,Math.max(1,Math.floor(n)));if(u===l.colSpan&&m===l.rowSpan||!jy(a,l,u,m))return!1;if((l.colSpan>1||l.rowSpan>1)&&Nm(i,r),u===1&&m===1)return Be(r),!0;const p=Ge(i),g=Dm(p,{minRow:l.originRow,maxRow:l.originRow+m-1,minCol:l.originCol,maxCol:l.originCol+u-1});return g?Tm(i,g):!0}function Yl(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function Ky(e){return Ty.has(e.tagName.toLowerCase())}function Xl(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 Rm(e){const t=Sr(e);if(t.length<2)return null;const n=He(e,t[0]);if(!n)return null;const r=Ge(n),i=[];for(const u of t){const m=lt(r,u);if(!m)return null;i.push(m)}const a=Pm(i);if(!a)return null;const l=Dm(r,a);return!l||l.cells.length<2?null:l}function Tm(e,t){const n=t.origin.cell,r=Ge(e),i=t.cells.map(a=>lt(r,a)).filter(a=>a!==null).sort((a,l)=>a.originRow-l.originRow||a.originCol-l.originCol);for(const a of i)a.cell!==n&&Gy(n,a.cell);an(n,t.colSpan,t.rowSpan);for(const a of i)a.cell!==n&&a.cell.remove();return Be(n),!0}function Nm(e,t){const n=Ge(e),r=lt(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;an(t,1,1);for(let i=r.originRow;i<r.originRow+r.rowSpan;i+=1)for(let a=r.originCol;a<r.originCol+r.colSpan;a+=1)i===r.originRow&&a===r.originCol||Ql(e,i,a,Jl(t));return Be(t),!0}function $y(e){const t=document.createElement(e);return t.style.border=Ey,t.style.padding=Ry,t.appendChild(document.createElement("br")),t}function Jl(e){const t=e.cloneNode(!1);for(t.removeAttribute("colspan"),t.removeAttribute("rowspan");t.firstChild;)t.removeChild(t.firstChild);return t.appendChild(document.createElement("br")),t}function Uy(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Ql(e,t,n,r){const i=e.rows[t];if(!i)return;const a=Ge(e);let l=0;for(const u of Array.from(i.cells)){if(u===r)continue;const m=lt(a,u);if(!m||m.originCol>=n)break;l+=1}Uy(i,l,r)}function Wy(e,t,n,r){let i=0;for(let a=0;a<t;a+=1)if(!n.has(a)){if(a>=r)return e.cells[i]??null;i+=1}return e.cells[e.cells.length-1]??null}function au(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 Gy(e,t){if(!(e===t||au(t)))for(au(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function Vy(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),Zy(n)&&n.remove())}function Zy(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 ll(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 Be(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function qy(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const Mm=["left","center","right","justify"];function Yy(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function qo(e){return Yy(e.style.textAlign)}function sl(e,t){const n=t??"left";return qo(e)===n?t===null&&e.style.textAlign?(e.style.removeProperty("text-align"),!0):!1:(t===null||t==="left"?e.style.removeProperty("text-align"):e.style.textAlign=t,!0)}function lu(e){const t=e[0];return e.every(n=>n===t)?{align:t,mixed:!1}:{align:null,mixed:!0}}function _m(e){const t=Sr(e);if(t.length>0)return lu(t.map(qo));const n=Ln(e);return n.length===0?bt(e)?{align:"left",mixed:!1}:{align:null,mixed:!1}:lu(n.map(qo))}function Lm(e,t){return Mm.includes(t)?_n(e,()=>{const n=Sr(e);if(n.length>0){let a=!1;for(const l of n)sl(l,t)&&(a=!0);return a}const r=vr(e);if(r.length===0)return!1;let i=!1;for(const a of r)sl(a,t)&&(i=!0);return i}):!1}function ur(){return{...Ul(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function su(e){const t=Jh(e),n=_m(e),r=xm(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function Im(e,t){let n=!1;return!t.alignMixed&&t.align&&Lm(e,t.align)&&(n=!0),t.listMixed||xy(e,t.list)&&(n=!0),Qh(e,t)&&(n=!0),n}function Xy(e,t){return Im(e,cl(t))}function Fm(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,breakInside:e.breakInsideMixed?void 0:e.breakInside,breakAfter:e.breakAfterMixed?void 0:e.breakAfter,breakBefore:e.breakBeforeMixed?void 0:e.breakBefore}}function cl(e){const t=ur();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,breakInside:e.breakInside===void 0?t.breakInside:e.breakInside,breakInsideMixed:e.breakInside===void 0,breakAfter:e.breakAfter===void 0?t.breakAfter:e.breakAfter,breakAfterMixed:e.breakAfter===void 0,breakBefore:e.breakBefore===void 0?t.breakBefore:e.breakBefore,breakBeforeMixed:e.breakBefore===void 0}:{...t,alignMixed:!0,listMixed:!0,marginMixed:!0,paddingMixed:!0,lineHeightMixed:!0,borderMixed:!0,radiusMixed:!0,shadowMixed:!0,backgroundMixed:!0,opacityMixed:!0,breakInsideMixed:!0,breakAfterMixed:!0,breakBeforeMixed:!0}}const Bm="data-page-sized",Jy={A4:{width:"210mm",height:"297mm"},letter:{width:"8.5in",height:"11in"},legal:{width:"8.5in",height:"14in"}};function Hm(e){let t=null;if(e.sizePreset==="A4"||e.sizePreset==="letter"||e.sizePreset==="legal")t={...Jy[e.sizePreset]};else if(e.sizePreset==="custom"&&e.customWidth&&e.customHeight)t={width:ge(e.customWidth),height:ge(e.customHeight)};else return e.orientation,null;return e.orientation==="landscape"?{width:t.height,height:t.width}:t}function Qy(e){return Hm(e)!==null}function ex(e){return tx(e.margin)}function tx(e){return{top:e.top?ge(e.top):null,right:e.right?ge(e.right):null,bottom:e.bottom?ge(e.bottom):null,left:e.left?ge(e.left):null}}const nx=["width","min-height","padding-top","padding-right","padding-bottom","padding-left"];function rx(e){e.removeAttribute(Bm);for(const t of nx)e.style.removeProperty(t)}function Tn(e,t){Dn(t)&&!Dn(e.innerHTML)&&(e.innerHTML=Gl(e.innerHTML,jn(t)));const r=jn(t),i=Hm(r);if(!i){rx(e);return}e.setAttribute(Bm,""),e.style.width=i.width,e.style.minHeight=i.height;const a=ex(r);for(const l of Me){const u=`padding-${l}`,m=a[l];m?e.style.setProperty(u,m):e.style.removeProperty(u)}}const ox=2*1024*1024,ix="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",ax=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),lx=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),sx=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,cx=/^(javascript|vbscript|file|blob):/i;function ux(e={}){return{src:"",alt:"",title:"",...e}}function Bn(e){const t=e.trim();if(!t)return"empty";if(cx.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return sx.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 dx(e){return e.size>ox?"tooLarge":hx(e)?null:"type"}function mx(e){const t=dx(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(Bn(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function fx(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",px(e,t.css)}function px(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 gx(e,t){const n=ux(t);if(Bn(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 fx(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function ul(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function Na(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 hx(e){const t=e.type.trim().toLowerCase();if(t&&ax.has(t))return!0;const n=bx(e.name);return!!(!t&&n&&lx.has(n))}function bx(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const zm=["%","px","pt","pc","em","rem"],yx="%",xx={"%":[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]},Nn={"%":{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}},Cx=new Set(zm),wx=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function vx(e){return Cx.has(e)}function Sn(e){return`${Q(e.value)}${e.unit}`}function Yo(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(wx);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 vx(i)?Mn(r,i):null}function cu(e,t){const n=e.trim();if(!n)return null;const r=Yo(n);if(r)return r;const i=Number(n.replace(",","."));return Number.isFinite(i)?Mn(i,t):null}function Mn(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=Nn[t];return{value:Ee(Math.min(r,Math.max(n,e))),unit:t}}function dr(e,t,n){const r=n>0?n:1;if(e==="width"){const a=Mn(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:Mn(t.value*r,t.unit)??t,height:t}}const Mo="data-hover-css",es=["fill","contain","cover","none","scale-down"],ts=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],Sx=new Set(es),kx=new Set(ts),uu="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",Ax="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",Px=/^-?[a-z][a-z0-9-]*$/i,Dx=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,dl=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function Om(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...at},border:{...$l},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function jx(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function Ex(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=dr("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=dr("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function Rx(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||Px.test(a)&&(a==="behavior"||a.endsWith("binding")||Dx.test(l)||t.push(`${a}: ${l}`))}return t.join("; ")}function Ht(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 ul(e,n.commonAncestorContainer)}function Tx(e){const t=Ht(e);return t?Km(t):null}function Km(e){const t=In(e),n=Ix(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,i=Mx(e);return Om({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:Um(e),objectPosition:zx(e),rotateDeg:Wm(e),hoverCss:e.getAttribute(Mo)??""})}function $m(e,t){let n=!1;return _x(e,t)&&(n=!0),Fn(e,{margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:at,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),Fx(e,t.align)&&(n=!0),Bx(e,t.objectFit)&&(n=!0),Hx(e,t.objectPosition)&&(n=!0),Kx(e,t.rotateDeg)&&(n=!0),$x(e,t.hoverCss)&&(n=!0),n}function Nx(e,t){const n=Ht(e);return n?$m(n,t):!1}function Mx(e){const t=Yo(e.style.width),n=Yo(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 _x(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=Lx(t);return r.width?e.style.width=Sn(r.width):e.style.removeProperty("width"),r.height?e.style.height=Sn(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 Lx(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 Ix(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 Fx(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 Um(e){const t=e.style.objectFit.trim().toLowerCase();return Sx.has(t)?t:null}function Bx(e,t){return Um(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function Hx(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 zx(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(kx.has(t),t):null}function Wm(e){const t=dl.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?Ee(n):null}function Ox(e){const t=e.trim();return t?dl.test(t)&&t.replace(dl,"").trim()==="":!0}function Kx(e,t){const n=Wm(e),r=t===null||t===0?null:Ee(t);return n===r?!1:r===null?Ox(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${Q(r)}deg)`,!0)}function $x(e,t){const n=Rx(t),r=e.getAttribute(Mo)??"",i=e.getAttribute("onmouseover")??"";return r===n&&(n&&i===uu||!n&&!i)?!1:n?(e.setAttribute(Mo,n),e.setAttribute("onmouseover",uu),e.setAttribute("onmouseout",Ax),!0):(e.removeAttribute(Mo),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const kn={value:100,unit:"%"},Ux=new Set(es),Wx=new Set(ts),Gx=new Set(["cover","contain","scale-down","none"]),du={contain:"contain",cover:"cover",auto:"none"},mu={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function ns(){return{src:null,opacity:null,fit:null,position:null,width:{...kn},height:null}}function Gm(e){return e!=null&&Gx.has(e)}function Vm(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?Ot(n):null}function Vx(e,t){const n=Vm(e),r=t===null?null:Ot(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Gd(r),!0)}function Zm(e){const t=e.style.backgroundImage.trim();if(!t||t==="none")return null;const n=/^url\(\s*["']?(.+?)["']?\s*\)$/i.exec(t);return n&&n[1].trim()||null}function Zx(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function qx(e,t){const n=Zm(e),r=(t==null?void 0:t.trim())??"",i=r&&Bn(r)===null?r:null;return n===i?!1:(i?e.style.backgroundImage=Zx(i):e.style.removeProperty("background-image"),!0)}function qm(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Ma(e){return!e||e==="auto"?null:Yo(e)}function Yx(e){return Gm(e.fit)&&e.fit?mu[e.fit]:e.fit==="fill"?mu.fill:e.width&&e.height?`${Sn(e.width)} ${Sn(e.height)}`:e.width?Sn(e.width):e.height?`auto ${Sn(e.height)}`:null}function Xx(e){const t=qm(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...kn},height:{...kn}};if(du[t])return{fit:du[t],width:null,height:null};if(Ux.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:Ma(n[0]),height:null}:n.length===2?{fit:null,width:Ma(n[0]),height:Ma(n[1])}:{fit:null,width:null,height:null}}function Jx(e,t){const n=qm(e.style.backgroundSize),r=Yx(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function Qx(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Wx.has(t),t):null}function e1(e,t){const n=(t==null?void 0:t.trim().toLowerCase().replace(/\s+/g," "))||"";return e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ")===n?!1:(n?e.style.backgroundPosition=n:e.style.removeProperty("background-position"),!0)}function ml(e){let t=!1;return e.id!==Io&&(e.id=Io,t=!0),e.hasAttribute(Lo)||(e.setAttribute(Lo,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function Ym(e){const t=e.getAttribute("style");return e.style.position="absolute",e.style.inset="0",e.style.zIndex="-1",e.style.pointerEvents="none",e.style.userSelect="none",e.style.backgroundRepeat="no-repeat",e.getAttribute("style")!==t}function t1(e){const t=Al(e),n=t[0]??null;if(n){let i=ml(n);for(const a of t.slice(1))a.remove(),i=!0;return(n.parentNode!==e||n!==e.firstChild)&&(e.insertBefore(n,e.firstChild),i=!0),{layer:n,changed:i}}const r=document.createElement("div");return ml(r),Ym(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function n1(e){const t=Al(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function fu(e){let t=!1;return Pl(e)?(e.style.position!=="relative"&&(e.style.position="relative",t=!0),e.style.isolation!=="isolate"&&(e.style.isolation="isolate",t=!0)):(e.style.position==="relative"&&(e.style.removeProperty("position"),t=!0),e.style.isolation==="isolate"&&(e.style.removeProperty("isolation"),t=!0)),t}function r1(e){const t=Pl(e);if(!t)return ns();const n=Xx(t);return{src:Zm(t),opacity:Vm(t),fit:n.fit,position:Qx(t),width:n.width,height:n.height}}function o1(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&Bn(n)===null)){const m=n1(e),p=fu(e);return(m||p)&&it(e),m||p}const i=t1(e),a=i.layer;let l=i.changed;return ml(a)&&(l=!0),Ym(a)&&(l=!0),fu(e)&&(l=!0),qx(a,n)&&(l=!0),Jx(a,t)&&(l=!0),e1(a,t.position)&&(l=!0),Vx(a,t.opacity)&&(l=!0),l&&(it(a),it(e)),l}function i1(){return{size:null,unit:nn,marks:Et(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function fl(){return{font:i1(),box:Ul(),backgroundImage:ns(),atRule:on()}}function a1(e){const t=e.style.fontSize,n=t?Ml(t):null,r=n&&li(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)},u=e.style.color,m=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??nn,marks:l,fontFamily:m||null,fontFamilyMixed:!1,fontColor:u?we(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function l1(e,t){const n=e.style.fontSize,r=t.size===null?null:rn(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const i=Nl(r.value,r.unit);return n===i?!1:(e.style.fontSize=i,!0)}function s1(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 Cr(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function c1(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?we(t.fontColor):null;return(e.style.color?we(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function u1(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 d1(e,t){let n=!1;return l1(e,t)&&(n=!0),s1(e,t)&&(n=!0),c1(e,t)&&(n=!0),u1(e,t.marks)&&(n=!0),n&&it(e),n}function m1(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function f1(e){const t=yr(e);if(!t)return fl();const n=In(t);return{font:a1(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},backgroundImage:r1(t),atRule:jn(e.innerHTML)}}function p1(e,t){const n=bt(e),r=n?An(e,n.startContainer,n.startOffset):null,i=n?An(e,n.endContainer,n.endOffset):null,a=yr(e),l=Pg(e);To(l);const u=d1(l,t.font),m=Fn(l,m1(t)),p=o1(l,t.backgroundImage);oi(e),Tn(e,e.innerHTML);const g=jn(e.innerHTML),h=Gl(e.innerHTML,t.atRule);h!==e.innerHTML&&(e.innerHTML=h,Tn(e,e.innerHTML));const C=JSON.stringify(g)!==JSON.stringify(t.atRule);return r!==null&&i!==null&&zl(e,Math.min(r,i),Math.max(r,i)),!a||u||m||p||C}function g1(e){const t=em(e.innerHTML);return t===e.innerHTML?!1:(e.innerHTML=t,oi(e),Tn(e,e.innerHTML),!0)}const rs="data-hover-html",h1="noopener noreferrer",b1="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)",y1="this._hoverBox&&this._hoverBox.remove()",x1=/^(#(?:[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 mi(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function C1(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function hr(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&C1(n))return n;n=n.parentNode}return null}function Xm(e){return x1.test(e)}function w1(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&&Xm(r)?r:null}function Jm(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function v1(e){const t=e.getAttribute(rs)??"",n=w1(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:Jm(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function Qm(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=hr(e,n.commonAncestorContainer);return r?v1(r):null}function S1(e){return Qm(e)!==null}function k1(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(rs)}function A1(e,t){var r;if(k1(e),t.hoverMode==="html"){const i=t.hoverHtml.trim();if(!i)return;e.setAttribute(rs,i),e.setAttribute("onmouseover",b1),e.setAttribute("onmouseout",y1);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!Xm(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function os(e,t){const n=mi(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",h1)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":Jm(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),A1(e,n)}function P1(e,t){const n=new Set;for(const r of t){const i=hr(e,r);i&&!n.has(i)&&n.add(i)}for(const r of n)We(r)}function D1(e,t,n){pt(t);const r=ze(t).filter(u=>u.data.length>0);P1(e,r),r.length>0&&ln(r);const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);pt(a);const l=document.createElement("a");os(l,n);try{return a.surroundContents(l),!0}catch{const u=a.extractContents();return u.hasChildNodes()?(l.appendChild(u),a.insertNode(l),!0):!1}}function j1(e,t){const n=document.createElement("a");os(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 E1(e,t){const n=t.href.trim();if(!n)return!1;const r=mi({...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=hr(e,a.startContainer),u=hr(e,a.endContainer);return l&&l===u?(os(l,r),!0):a.collapsed?j1(a,r):D1(e,a,r)}const R1=/^[A-Za-z][A-Za-z0-9_-]*$/,ef="​";function pl(e){var r;const t=Dl(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 T1(e){return new Set(pl(e).map(t=>t.id))}function tf(e,t){const n=e.trim();return n?R1.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function pu(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ef)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function N1(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ef)),(r=e.parentNode)==null||r.insertBefore(n,e)}function M1(e,t){const n=t.trim();if(tf(n,T1(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=hr(e,i.startContainer);if(a)return N1(a,n),!0;if(i.collapsed)return pu(i,n),!0;pt(i);const l=document.createElement("span");l.id=n;try{return i.surroundContents(l),!0}catch{return pu(i,n),!0}}const Re="data-comment-thread",gu="wysiwyg-comment-anchor";function _1(){return`cmt_${crypto.randomUUID()}`}function L1(){return crypto.randomUUID()}const Xo=20;function hu(e,t){if(!e)return null;const n=e instanceof Element?e:e.parentElement;if(!n)return null;const r=n.closest(`[${Re}]`);return r instanceof HTMLElement&&ae(t,r)?r:null}function bu(e,t,n){var C;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let i=Math.max(0,t),a=Math.max(t,n),l=null,u=0,m=null,p=0,g;for(;g=r.nextNode();){const y=g,x=((C=y.textContent)==null?void 0:C.length)??0;if(!l&&i<=x&&(l=y,u=i),!m&&a<=x){m=y,p=a;break}i-=x,a-=x}if(!l||!m)return null;const h=document.createRange();return h.setStart(l,u),h.setEnd(m,p),h}function I1(e,t,n){const r=e.textContent??"",i=r.slice(Math.max(0,t-Xo),t),a=r.slice(n,n+Xo);return{prefix:i,suffix:a}}function F1(e,t){if(t.mode!=="visual")return null;const n=Ht(e);if(n)return{type:"image",elementId:n.id||void 0,src:n.getAttribute("src")??void 0};if(t.collapsed&&!t.text)return null;const{prefix:r,suffix:i}=I1(e,t.start,t.end);return{type:"text",text:t.text,start:t.start,end:t.end,prefix:r,suffix:i}}function yu(e,t){if(t.mode!=="visual")return null;const n=Ht(e);if(n!=null&&n.hasAttribute(Re))return n.getAttribute(Re)??null;if(t.visualRange){const r=hu(t.visualRange.startContainer,e);if(r)return r.getAttribute(Re)??null;const i=hu(t.visualRange.endContainer,e);if(i)return i.getAttribute(Re)??null}return null}function gl(e,t,n){if(!ae(e,n.commonAncestorContainer))return!1;pt(n);const r=document.createElement("span");r.setAttribute(Re,t);try{return n.surroundContents(r),!0}catch{const i=n.toString();if(!i)return!1;const a=document.createElement("span");return a.setAttribute(Re,t),a.textContent=i,n.deleteContents(),n.insertNode(a),!0}}function nf(e,t){e.setAttribute(Re,t)}function B1(e,t,n){const r=Ht(e);return r?(nf(r,t),!0):n.visualRange?gl(e,t,n.visualRange):!1}function H1(e,t){if(t.type!=="image")return null;for(const n of e.querySelectorAll("img"))if(t.elementId&&n.id===t.elementId||t.src&&n.getAttribute("src")===t.src)return n;return null}function z1(e,t,n){if(n.type!=="text")return!1;if(n.start!==void 0&&n.end!==void 0){const l=bu(e,n.start,n.end);if(l&&l.toString()===n.text)return gl(e,t,l)}const r=e.textContent??"",i=n.text;if(!i)return!1;let a=0;for(;a<=r.length;){const l=r.indexOf(i,a);if(l===-1)return!1;const u=l+i.length,m=r.slice(Math.max(0,l-Xo),l),p=r.slice(u,u+Xo);if(n.prefix!==void 0&&m!==n.prefix){a=l+1;continue}if(n.suffix!==void 0&&p!==n.suffix){a=l+1;continue}const g=bu(e,l,u);return g?gl(e,t,g):!1}return!1}function O1(e,t){for(const n of t)if(!e.querySelector(`[${Re}="${n.id}"]`)){if(n.anchor.type==="image"){const i=H1(e,n.anchor);i&&nf(i,n.id);continue}z1(e,n.id,n.anchor)}}function xu(e,t){for(const n of e.querySelectorAll(`[${Re}]`))n instanceof HTMLElement&&(t?n.classList.add(gu):n.classList.remove(gu))}function Cu(e,t){if(!t)return null;const n=t instanceof Element?t:t.parentElement;if(!n)return null;const r=n.closest(`[${Re}]`);return r instanceof HTMLElement&&ae(e,r)?r:null}function wu(e,t){const n=e.querySelector(`[${Re}="${t}"]`);if(!(n instanceof HTMLElement))return!1;const r=window.getSelection();if(!r)return!1;const i=document.createRange();if(n instanceof HTMLImageElement)i.selectNode(n);else{const l=document.createTreeWalker(n,NodeFilter.SHOW_TEXT).nextNode();l instanceof Text?(i.setStart(l,0),i.collapse(!0)):(i.selectNodeContents(n),i.collapse(!0))}return r.removeAllRanges(),r.addRange(i),!0}function K1(e,t=[]){return{id:_1(),anchor:e,messages:t,createdAt:new Date().toISOString(),resolvedAt:null,resolvedBy:null}}function $1(e,t){return{id:L1(),userId:e.userId,userName:e.userName,message:t.trim(),createdAt:new Date().toISOString()}}function U1(e,t,n){return e.map(r=>r.id===t?{...r,messages:[...r.messages,n]}:r)}function W1(e,t){return e.find(n=>n.id===t)}function rf(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 G1(e){const t=rf(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 of(e){const t=rf(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 V1(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 af(e){const t=G1(e);return t?V1(t):!1}async function Z1(e){return await af(e)?of(e):!1}const q1=new Set(["strong","b","em","i","u","s","strike","del"]),Y1=["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 X1(e){for(const t of Y1)e.style.removeProperty(t)}function J1(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!ht(r)){n=r;continue}if(Gt(r,n),q1.has(r.tagName.toLowerCase())){We(r);continue}if(X1(r),Wt(r)){We(r);continue}n=r.isConnected?r:t}}function Q1(e){const t=bt(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;pt(t);const r=ze(t).filter(i=>i.data.length>0);if(r.length===0)return!1;for(const i of r)J1(e,i);return ln(r),e.innerHTML!==n}function eC(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function tC(e){const t=Cn(e),n=am(e),r=Dd(e),i=zo(e,"color"),a=zo(e,"backgroundColor"),l=sm(e);return{size:n.mixed?null:n.value,unit:n.unit,marks:t,fontFamily:r.mixed?null:r.value,fontFamilyMixed:r.mixed,fontColor:i.mixed?null:i.value,fontColorMixed:i.mixed,highlightColor:a.mixed?null:a.value,highlightColorMixed:a.mixed,customCss:l.mixed?null:l.value,customCssMixed:l.mixed}}function nC(e,t){t.size!==null&&el(e,t.size,t.unit);const n=Cn(e);for(const r of Qe)t.marks[r]!==n[r]&&rl(e,r);return t.fontFamilyMixed||Za(e,t.fontFamily),t.fontColorMixed||cr(e,"color",t.fontColor),t.highlightColorMixed||cr(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&um(e,t.customCss),!0}function _o(){return typeof window<"u"&&"speechSynthesis"in window}function rC(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function vu(e,t){const n=e.text.trim();return n||rC(t)||null}function oC(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!_o())return;if(t.speaking){t.cancel(),n();return}const i=new SpeechSynthesisUtterance(r);i.onend=n,i.onerror=n,t.speak(i),n()},isSpeaking(){return _o()&&t.speaking},cancel(){_o()&&t.speaking&&(t.cancel(),n())}}}const iC=5*1024*1024,aC="audio/mpeg,audio/mp3,audio/wav,audio/x-wav,audio/ogg,audio/aac,audio/webm,audio/mp4,audio/x-m4a,.mp3,.wav,.ogg,.aac,.webm,.m4a",lC=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),sC=new Set(["mp3","wav","ogg","aac","webm","m4a"]),cC=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,uC=/^(javascript|vbscript|file|blob):/i;function dC(e={}){return{src:"",title:"",...e}}function is(e){const t=e.trim();if(!t)return"empty";if(uC.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return cC.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 mC(e){return e.size>iC?"tooLarge":bC(e)?null:"type"}function fC(e){const t=mC(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(is(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function pC(e,t){e.setAttribute("controls",""),e.setAttribute("src",t.src.trim());const n=t.title.trim();n?e.setAttribute("title",n):e.removeAttribute("title"),e.style.maxWidth="100%",gC(e,t.css)}function gC(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 hC(e,t){const n=dC(t);if(is(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("audio");return pC(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function bC(e){const t=e.type.trim().toLowerCase();if(t&&lC.has(t))return!0;const n=yC(e.name);return!!(!t&&n&&sC.has(n))}function yC(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const lf=/^(javascript|vbscript|file|blob):/i,xC=[/(?:youtube\.com\/watch\?(?:[^&]*&)*v=|youtube\.com\/watch\?v=)([\w-]{11})/i,/youtu\.be\/([\w-]{11})/i,/youtube\.com\/embed\/([\w-]{11})/i,/youtube\.com\/shorts\/([\w-]{11})/i];function CC(e={}){return{url:"",title:"",...e}}function wC(e={}){return{src:"",title:"",...e}}function fi(e){const t=e.trim();if(!t)return null;for(const n of xC){const r=t.match(n);if(r!=null&&r[1])return r[1]}return null}function sf(e){return`https://www.youtube.com/embed/${e}`}function cf(e){const t=e.trim();return t?lf.test(t)?"invalid":fi(t)?null:"invalid":"empty"}function vC(e){const t=e.trim();if(!t)return"empty";if(lf.test(t))return"invalid";if(fi(t))return null;if(t.toLowerCase().startsWith("data:"))return/^data:video\//i.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 uf(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 df(e,t,n){e.setAttribute("src",t),e.setAttribute("frameborder","0"),e.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),e.setAttribute("allowfullscreen","");const r=n.title.trim();r?e.setAttribute("title",r):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.width="560px",e.style.aspectRatio="16 / 9",e.style.border="0",uf(e,n.css)}function SC(e,t){e.setAttribute("controls",""),e.setAttribute("src",t.src.trim());const n=t.title.trim();n?e.setAttribute("title",n):e.removeAttribute("title"),e.style.maxWidth="100%",uf(e,t.css)}function kC(e,t){const n=CC(t);if(cf(n.url))return!1;const r=fi(n.url);if(!r)return!1;const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!ae(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const l=document.createElement("iframe");return df(l,sf(r),n),a.insertNode(l),a.setStartAfter(l),a.collapse(!0),i.removeAllRanges(),i.addRange(a),!0}function AC(e,t){const n=wC(t);if(vC(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=fi(n.src);if(a){const l=document.createElement("iframe");df(l,sf(a),{title:n.title,css:n.css}),i.insertNode(l),i.setStartAfter(l)}else{const l=document.createElement("video");SC(l,n),i.insertNode(l),i.setStartAfter(l)}return i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}const PC=new Set(["p","h1","h2","h3","h4","h5","h6"]),DC=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function mf(e,t){var a;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!ae(e,r.commonAncestorContainer))return!1;r.collapsed||r.deleteContents();const i=jC(e,r.startContainer);if(i){const l=EC(i,r);return(a=i.parentNode)==null||a.insertBefore(t,l),ku(t),!0}return r.insertNode(t),RC(e,t),MC(t),ku(t),!0}function jC(e,t){let n=wr(t);for(;n&&n!==e;){const r=ce(n);if(PC.has(r)&&n instanceof HTMLElement)return n;if(DC.has(r))return null;n=n.parentElement}return null}function EC(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),Su(e),Su(i),(a=e.parentNode)==null||a.insertBefore(i,e.nextSibling),i}function RC(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!TC(n))return;Gt(n,t),We(n)}}function TC(e){const t=ce(e);return ht(e)||t==="a"}function Su(e){NC(e)&&e.appendChild(document.createElement("br"))}function NC(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 MC(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 ku(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 _C="1em 0",LC="1px solid #d0d0d0";function IC(){const e=document.createElement("hr");return e.style.margin=_C,e.style.border="0",e.style.borderTop=LC,e}function FC(e){return mf(e,IC())}const BC="1.5em 0",HC="2px dashed #bbb";function zC(){const e=document.createElement("div");return e.style.breakAfter="page",e.style.pageBreakAfter="always",e.style.margin=BC,e.style.border="0",e.style.borderTop=HC,e.style.height="0",e}function OC(e){return mf(e,zC())}const Tt=16;function Au(e){return Math.min(Nn.px.max,Math.max(Tt,e))}function KC(e){return e.width>0&&e.height>0?e.width/e.height:1}function $C(e,t){const n=Math.max(Tt,Tt*t),r=Math.min(Nn.px.max,Nn.px.max*t),i=Math.min(r,Math.max(n,e));return{width:i,height:i/t}}function UC(e,t){const n=Math.max(Tt,Tt/t),r=Math.min(Nn.px.max,Nn.px.max/t),i=Math.min(r,Math.max(n,e));return{width:i*t,height:i}}function WC(e,t,n){const r=KC(t);return e==="e"?$C(t.width+n.x,r):e==="s"?UC(t.height+n.y,r):{width:Au(t.width+n.x),height:Au(t.height+n.y)}}function GC(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:Tt,height:r>0?r:Tt}}function VC(e,t,n){const r=Mn(Math.max(Tt,t),"px"),i=Mn(Math.max(Tt,n),"px");return!r||!i?!1:$m(e,{...Km(e),sizeMode:"lock",width:r,height:i})}function ZC(e={}){return{border:{...$l},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function qC(e){const t=In(e);return{border:t.border,borderCollapse:QC(e),borderSpacing:ff(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:Te(e.style.width)}}function YC(e,t){let n=Fn(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 ew(e,t.borderCollapse)&&(n=!0),tw(e,t.borderCollapse,t.borderSpacing)&&(n=!0),nw(e,t.width)&&(n=!0),n&&it(e),n}function XC(e){const t=ql(e);return t?qC(t):null}function JC(e,t){const n=ql(e);return n?YC(n,t):!1}function QC(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function ew(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function ff(e){const t=e.style.borderSpacing.trim();return t?Te(t.split(/\s+/)[0]??""):null}function tw(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?Vt(n):null,i=ff(e);return Xe(i,r)?!1:(r?e.style.borderSpacing=ge(r):e.style.removeProperty("border-spacing"),!0)}function nw(e,t){const n=t?Vt(t):null,r=Te(e.style.width);return Xe(r,n)?!1:(n?e.style.width=ge(n):e.style.removeProperty("width"),!0)}const pi=["top","middle","bottom","baseline"],rw=new Set(pi);function ow(e={}){return{backgroundColor:null,color:null,padding:{...at},textAlign:null,verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function iw(e){const t=In(e);return{backgroundColor:t.backgroundColor,color:pf(e),padding:t.padding,textAlign:uw(e),verticalAlign:gf(e),width:Te(e.style.width),...di(e)}}function aw(e,t){let n=Fn(e,{margin:{...at},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 cw(e,t.color)&&(n=!0),sl(e,t.textAlign)&&(n=!0),dw(e,t.verticalAlign)&&(n=!0),mw(e,t.width)&&(n=!0),n&&it(e),n}function lw(e){const t=yt(e);return t?iw(t):null}function sw(e,t){const n=Sr(e);if(n.length===0)return!1;let r=!1;for(const a of n)aw(a,t)&&(r=!0);const i=yt(e);if(i){const a=di(i);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&Oy(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function pf(e){const t=e.style.color;return t?we(t):null}function cw(e,t){const n=t?we(t):null;return pf(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function uw(e){const t=qo(e);return t==="left"?null:t}function gf(e){const t=e.style.verticalAlign.trim().toLowerCase();return rw.has(t)?t:null}function dw(e,t){return gf(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function mw(e,t){const n=t?Vt(t):null,r=Te(e.style.width);return Xe(r,n)?!1:(n?e.style.width=ge(n):e.style.removeProperty("width"),!0)}const fw=new Set(pi);function pw(e={}){return{backgroundColor:null,color:null,padding:{...at},height:null,verticalAlign:null,...e}}function gw(e){const t=e.cells[0],n=t?In(t).padding:{...at};return{backgroundColor:hf(e),color:bf(e),padding:n,height:Te(e.style.height),verticalAlign:yf(e)}}function hw(e,t){let n=!1;xw(e,t.backgroundColor)&&(n=!0),Cw(e,t.color)&&(n=!0),vw(e,t.height)&&(n=!0),ww(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))Fn(r,{margin:{...at},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&&it(e),n}function bw(e){const t=Em(e);return t?gw(t):null}function yw(e,t){const n=Em(e);return n?hw(n,t):!1}function hf(e){const t=e.style.backgroundColor;return t?we(t):null}function xw(e,t){const n=t?we(t):null;return hf(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function bf(e){const t=e.style.color;return t?we(t):null}function Cw(e,t){const n=t?we(t):null;return bf(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function yf(e){const t=e.style.verticalAlign.trim().toLowerCase();return fw.has(t)?t:null}function ww(e,t){return yf(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function vw(e,t){const n=t?Vt(t):null,r=Te(e.style.height);return Xe(r,n)?!1:(n?e.style.height=ge(n):e.style.removeProperty("height"),!0)}const Sw=1e3;function kw(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function Aw({onAutoSave:e,getHtml:t}){const n=c.useRef(e);n.current=e;const r=c.useRef(t);r.current=t;const i=c.useRef(null),a=e!=null;c.useEffect(()=>{if(!a){i.current=null;return}i.current=r.current();const l=window.setInterval(()=>{const u=n.current;if(!u)return;const m=r.current();m!==i.current&&(i.current=m,queueMicrotask(()=>kw(u,m)))},Sw);return()=>{window.clearInterval(l)}},[a])}function Co({value:e,defaultValue:t,onChange:n}){const[r,i]=c.useState(t),a=e!==void 0,l=a?e:r,u=c.useCallback(m=>{a||i(m),n==null||n(m)},[a,n]);return[l,u]}const Pu=8,Du=["#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"],Pw=8;let hl=[];const bl=new Set;function ju(){return hl}function Dw(e){const t=we(e);t&&(hl=[t,...hl.filter(n=>n!==t)].slice(0,Pw),bl.forEach(n=>n()))}function jw(e){return bl.add(e),()=>{bl.delete(e)}}function wo(e){const t=we(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 en(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 _a({r:e,g:t,b:n}){const r=e/255,i=t/255,a=n/255,l=Math.max(r,i,a),u=Math.min(r,i,a),m=l-u;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 La({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 u=0,m=0,p=0;return r<60?(u=i,m=a):r<120?(u=a,m=i):r<180?(m=i,p=a):r<240?(m=a,p=i):r<300?(u=a,p=i):(u=i,p=a),{r:Math.round((u+l)*255),g:Math.round((m+l)*255),b:Math.round((p+l)*255)}}function xf(){return typeof window<"u"&&"EyeDropper"in window}async function Ew(){if(!xf())return null;const e=window.EyeDropper;try{const t=await new e().open();return we(t.sRGBHex)}catch{return null}}const Rw="_picker_ag1yo_1",Tw="_none_ag1yo_12",Nw="_customToggle_ag1yo_13",Mw="_eyedrop_ag1yo_14",_w="_swatch_ag1yo_48",Lw="_field_ag1yo_49",Iw="_grid_ag1yo_54",Fw="_recents_ag1yo_55",Bw="_sectionLabel_ag1yo_84",Hw="_custom_ag1yo_13",zw="_sv_ag1yo_95",Ow="_svThumb_ag1yo_105",Kw="_hue_ag1yo_116",$w="_rgbRow_ag1yo_155",Uw="_hexRow_ag1yo_156",je={picker:Rw,none:Tw,customToggle:Nw,eyedrop:Mw,swatch:_w,field:Lw,grid:Iw,recents:Fw,sectionLabel:Bw,custom:Hw,sv:zw,svThumb:Ow,hue:Kw,rgbRow:$w,hexRow:Uw};function Ww(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 as({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:i,menu:a=!1,fallbackCustom:l="#000000",onChange:u,onCommit:m}){const p=W(),g=c.useId(),h=a?"menuitemradio":"option",C=t?null:e,y=wo(C??l)??{r:0,g:0,b:0},[x,b]=c.useState(!1),[S,v]=c.useState(()=>_a(y)),[k,P]=c.useState(()=>({r:String(y.r),g:String(y.g),b:String(y.b)})),[N,D]=c.useState(()=>en(y.r,y.g,y.b)),[A,T]=c.useState(()=>[...ju()]),I=c.useRef(null),E=c.useRef(en(y.r,y.g,y.b));c.useEffect(()=>jw(()=>T([...ju()])),[]),c.useEffect(()=>{const M=wo(C??l);if(!M)return;const V=_a(M);v(V),P({r:String(M.r),g:String(M.g),b:String(M.b)}),D(en(M.r,M.g,M.b))},[C,l]);const R=(M,V,re)=>{M&&(E.current=M),re&&M&&Dw(M),u(M),V&&(m==null||m(M))},j=(M,V,re)=>{const G=en(M.r,M.g,M.b);v(_a(M)),P({r:String(M.r),g:String(M.g),b:String(M.b)}),D(G),R(G,V,re)},F=(M,V,re)=>{const G=La(M),ye=en(G.r,G.g,G.b);v(M),P({r:String(G.r),g:String(G.g),b:String(G.b)}),D(ye),R(ye,V,re)},U=M=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(M.key))return;const re=[...M.currentTarget.querySelectorAll("button")],G=re.findIndex(xe=>xe===document.activeElement);if(G<0)return;M.preventDefault();const ye=M.key==="ArrowLeft"?-1:M.key==="ArrowRight"?1:M.key==="ArrowUp"?-Pu:Pu,Le=re[Math.max(0,Math.min(re.length-1,G+ye))];Le==null||Le.focus()},$=(M,V)=>{const re=I.current;if(!re||i)return;const G=re.getBoundingClientRect(),ye=Math.max(0,Math.min(1,(M.clientX-G.left)/G.width)),Le=Math.max(0,Math.min(1,1-(M.clientY-G.top)/G.height));F({h:S.h,s:ye,v:Le},V,V)},X=M=>{i||(M.currentTarget.setPointerCapture(M.pointerId),$(M,!1))},J=La({h:S.h,s:1,v:1}),he=en(J.r,J.g,J.b),Y=La(S),be=en(Y.r,Y.g,Y.b),te=new Set(Du),ie=A.filter(M=>!te.has(M));return o.jsxs("div",{className:je.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[o.jsx("button",{type:"button",className:je.none,role:h,"aria-checked":a?C===null&&!t:void 0,"aria-selected":a?void 0:C===null&&!t,disabled:i,onClick:()=>R(null,!0,!1),children:n}),o.jsx("div",{className:je.grid,role:a?"group":"none",onKeyDown:U,children:Du.map(M=>{const V=C===M;return o.jsx("button",{type:"button",className:je.swatch,role:h,"aria-label":M,"aria-checked":a?V:void 0,"aria-selected":a?void 0:V,disabled:i,style:{backgroundColor:M},onMouseDown:re=>re.preventDefault(),onClick:()=>R(M,!0,!1)},M)})}),ie.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:je.sectionLabel,children:p("colorRecent")}),o.jsx("div",{className:je.recents,role:a?"group":"none","aria-label":p("colorRecent"),children:ie.map(M=>o.jsx("button",{type:"button",className:je.swatch,role:h,"aria-label":M,"aria-checked":a?C===M:void 0,"aria-selected":a?void 0:C===M,disabled:i,style:{backgroundColor:M},onMouseDown:V=>V.preventDefault(),onClick:()=>R(M,!0,!1)},M))})]}):null,o.jsx("button",{type:"button",className:je.customToggle,disabled:i,"aria-expanded":x,onClick:()=>b(M=>!M),children:p("colorCustom")}),x?o.jsxs("div",{className:je.custom,children:[o.jsx("div",{ref:I,className:je.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${he})`},onPointerDown:X,onPointerMove:M=>{M.currentTarget.hasPointerCapture(M.pointerId)&&$(M,!1)},onPointerUp:M=>{$(M,!0)},children:o.jsx("span",{className:je.svThumb,style:{left:`${S.s*100}%`,top:`${(1-S.v)*100}%`}})}),o.jsx("input",{className:je.hue,type:"range",min:0,max:360,value:Math.round(S.h),disabled:i,"aria-label":p("colorCustom"),onChange:M=>F({...S,h:Number(M.target.value)},!1,!1),onPointerUp:()=>R(E.current,!0,!0)}),o.jsx("div",{className:je.rgbRow,children:["r","g","b"].map(M=>o.jsxs("div",{className:je.field,children:[o.jsx("label",{htmlFor:`${g}-${M}`,children:p(M==="r"?"colorRgbR":M==="g"?"colorRgbG":"colorRgbB")}),o.jsx("input",{id:`${g}-${M}`,inputMode:"numeric",value:k[M],disabled:i,onChange:V=>{P(re=>({...re,[M]:V.target.value}))},onBlur:()=>{const V=Ww(k[M]);if(V===null){P({r:String(Y.r),g:String(Y.g),b:String(Y.b)});return}j({...Y,[M]:V},!0,!0)},onKeyDown:V=>{V.key==="Enter"&&V.currentTarget.blur()}})]},M))}),o.jsx("div",{className:je.hexRow,children:o.jsxs("div",{className:je.field,children:[o.jsx("label",{htmlFor:`${g}-hex`,children:p("colorHex")}),o.jsx("input",{id:`${g}-hex`,value:N,disabled:i,onChange:M=>D(M.target.value),onBlur:()=>{const M=we(N);if(!M){D(be);return}const V=wo(M);V&&j(V,!0,!0)},onKeyDown:M=>{M.key==="Enter"&&M.currentTarget.blur()}})]})}),xf()?o.jsx("button",{type:"button",className:je.eyedrop,disabled:i,onClick:()=>{Ew().then(M=>{if(!M)return;const V=wo(M);V&&j(V,!0,!0)})},children:p("colorPickFromScreen")}):null]}):null]})}const Gw="_wrap_hfz5s_1",Vw="_button_hfz5s_8",Zw="_icon_hfz5s_18",qw="_bar_hfz5s_24",Yw="_barEmpty_hfz5s_33",Xw="_popover_hfz5s_43",tn={wrap:Gw,button:Vw,icon:Zw,bar:qw,barEmpty:Yw,popover:Xw},Jw="_field_1knrr_1",Qw="_label_1knrr_8",e0="_button_1knrr_12",t0="_swatch_1knrr_37",n0="_swatchEmpty_1knrr_44",ar={field:Jw,label:Qw,button:e0,swatch:t0,swatchEmpty:n0},vo=4;function et({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:i,fallbackCustom:a,onChange:l}){const u=c.useId(),m=c.useRef(null),p=c.useRef(null),g=c.useRef(null),[h,C]=c.useState(!1),[y,x]=c.useState({top:0,left:0}),b=c.useCallback(()=>{const k=p.current,P=g.current;if(!k)return;const N=k.getBoundingClientRect(),D=(P==null?void 0:P.offsetHeight)??0,A=(P==null?void 0:P.offsetWidth)??240;let T=N.bottom;T+D>window.innerHeight-vo&&(T=Math.max(vo,N.top-D));const I=Math.min(Math.max(N.left,vo),window.innerWidth-A-vo);x({top:T,left:I})},[]);c.useLayoutEffect(()=>{if(!h)return;b();const k=()=>b();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[h,b]),c.useEffect(()=>{if(!h)return;const k=N=>{var A,T;const D=N.target;(A=m.current)!=null&&A.contains(D)||(T=g.current)!=null&&T.contains(D)||C(!1)},P=N=>{var D;N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),C(!1),(D=p.current)==null||D.focus())};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",P,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",P,!0)}},[h]);const S=`${ar.swatch}${!n||r?` ${ar.swatchEmpty}`:""}`,v=n&&!r?{backgroundColor:n}:void 0;return o.jsxs("div",{className:ar.field,ref:m,children:[o.jsx("span",{className:ar.label,children:e}),o.jsx("button",{ref:p,type:"button",className:ar.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?u:void 0,disabled:i,onClick:()=>C(k=>!k),children:o.jsx("span",{className:S,style:v})}),h?o.jsx(se,{children:o.jsx("div",{ref:g,id:u,className:tn.popover,style:{top:y.top,left:y.left,zIndex:1400},children:o.jsx(as,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:i,fallbackCustom:a,onChange:l,onCommit:()=>C(!1)})})}):null]})}const Ia=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],r0="_toolbar_1aggm_1",o0="_menuBar_1aggm_35",i0="_menuBarDesktop_1aggm_43",a0="_brandMark_1aggm_49",l0="_brandMarkIcon_1aggm_56",s0="_menuBarCompact_1aggm_68",c0="_menuWrap_1aggm_91",u0="_menuButton_1aggm_97",d0="_iconButton_1aggm_98",m0="_menuItem_1aggm_99",f0="_hamburgerButton_1aggm_142",p0="_iconNav_1aggm_149",g0="_iconNavMain_1aggm_160",h0="_iconNavEnd_1aggm_169",b0="_iconGroup_1aggm_185",y0="_tooltipTrigger_1aggm_276",x0="_menu_1aggm_35",C0="_submenuWrap_1aggm_305",w0="_submenu_1aggm_305",v0="_submenuTrigger_1aggm_315",S0="_menuOverlay_1aggm_330",k0="_menuOverlayHeader_1aggm_342",A0="_menuOverlayTitle_1aggm_352",P0="_menuOverlayBody_1aggm_358",D0="_menuSeparator_1aggm_409",j0="_icon_1aggm_98",E0="_tooltip_1aggm_276",R0="_tooltipElevated_1aggm_494",q={toolbar:r0,menuBar:o0,menuBarDesktop:i0,brandMark:a0,brandMarkIcon:l0,menuBarCompact:s0,menuWrap:c0,menuButton:u0,iconButton:d0,menuItem:m0,hamburgerButton:f0,iconNav:p0,iconNavMain:g0,iconNavEnd:h0,iconGroup:b0,tooltipTrigger:y0,menu:x0,submenuWrap:C0,submenu:w0,submenuTrigger:v0,menuOverlay:S0,menuOverlayHeader:k0,menuOverlayTitle:A0,menuOverlayBody:P0,menuSeparator:D0,icon:j0,tooltip:E0,tooltipElevated:R0},T0=400,Eu=6,Fa=4;function $t({label:e,children:t,className:n,elevated:r}){const i=c.useRef(null),a=c.useRef(null),l=c.useRef(null),u=c.useRef(!1),m=c.useRef(!1),[p,g]=c.useState(!1),[h,C]=c.useState({top:0,left:0}),y=c.useCallback(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),x=c.useCallback(v=>{if(!(u.current||m.current)){y(),g(!1);return}if(v||m.current){y(),g(!0);return}y(),l.current=setTimeout(()=>{l.current=null,g(!0)},T0)},[y]),b=c.useCallback(()=>{const v=i.current,k=a.current;if(!v||!k)return;const P=v.getBoundingClientRect(),N=k.offsetWidth,D=k.offsetHeight;let A=P.bottom+Eu;A+D>window.innerHeight-Fa&&(A=P.top-Eu-D);let T=P.left+P.width/2-N/2;T=Math.min(Math.max(T,Fa),window.innerWidth-N-Fa),C({top:A,left:T})},[]);c.useEffect(()=>()=>y(),[y]),c.useEffect(()=>{const v=i.current;if(!v)return;const k=()=>{m.current=!0,x(!0)},P=()=>{m.current=!1,x(!1)};return v.addEventListener("focusin",k),v.addEventListener("focusout",P),()=>{v.removeEventListener("focusin",k),v.removeEventListener("focusout",P)}},[x]),c.useLayoutEffect(()=>{if(!p)return;b();const v=()=>b();return window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[p,e,b]);const S=n?`${q.tooltipTrigger} ${n}`:q.tooltipTrigger;return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:i,className:S,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,x(!1)},onMouseLeave:()=>{u.current=!1,x(!1)},children:t}),p?o.jsx(se,{children:o.jsx("span",{ref:a,className:r?`${q.tooltip} ${q.tooltipElevated}`:q.tooltip,"data-toolbar-tooltip":"",style:{top:h.top,left:h.left},"aria-hidden":"true",children:e})}):null]})}const N0="_wrap_1vjt0_1",M0="_wrapToolbar_1vjt0_7",_0="_field_1vjt0_12",L0="_trigger_1vjt0_20",I0="_chevron_1vjt0_50",F0="_list_1vjt0_73",B0="_listInline_1vjt0_88",H0="_option_1vjt0_96",z0="_separator_1vjt0_125",ot={wrap:N0,wrapToolbar:M0,field:_0,trigger:L0,chevron:I0,list:F0,listInline:B0,option:H0,separator:z0};function O0({value:e,mixed:t=!1,fonts:n,disabled:r,listId:i,listRef:a,inline:l,style:u,onSelect:m}){const p=W(),g=!t&&e===null;return o.jsxs("ul",{ref:a,id:i,className:l?`${ot.list} ${ot.listInline}`:ot.list,role:"listbox","aria-label":p("commandFontFamilyAria"),style:u,children:[o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ot.option,role:"option","aria-checked":g,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>m(null),children:p("fontFamilyDefault")})}),o.jsx("li",{className:ot.separator,role:"separator"}),n.map(h=>{const C=!t&&Cr(e,h.family);return o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ot.option,role:"option","aria-checked":C,disabled:r,style:{fontFamily:h.family},onMouseDown:y=>y.preventDefault(),onClick:()=>m(h.family),children:h.name})},h.family)})]})}function K0(e,t,n,r){var i;return t?"":e===null?r:((i=Bg(e,n))==null?void 0:i.name)??e}const So=4;function Cf({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:i,toolbar:a=!1,triggerId:l,onChange:u}){const m=W(),p=c.useId(),g=c.useRef(null),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState(!1),[b,S]=c.useState({top:0,left:0,width:0}),v=K0(e,t,n,m("fontFamilyDefault")),k=c.useCallback(()=>{const N=h.current,D=C.current;if(!N)return;const A=N.getBoundingClientRect(),T=(D==null?void 0:D.offsetHeight)??0,I=Math.max(A.width,(D==null?void 0:D.offsetWidth)??0);let E=A.bottom;E+T>window.innerHeight-So&&(E=Math.max(So,A.top-T));const R=Math.min(Math.max(A.left,So),window.innerWidth-I-So);S({top:E,left:R,width:I})},[]);c.useLayoutEffect(()=>{if(!y)return;k();const N=()=>k();return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[y,k,n.length]),c.useEffect(()=>{if(!y)return;const N=A=>{var I,E;const T=A.target;(I=g.current)!=null&&I.contains(T)||(E=C.current)!=null&&E.contains(T)||x(!1)},D=A=>{A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),x(!1))};return document.addEventListener("pointerdown",N),document.addEventListener("keydown",D,!0),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",D,!0)}},[y]);const P=o.jsxs("div",{className:`${ot.wrap}${a?` ${ot.wrapToolbar}`:""}`,ref:g,children:[o.jsxs("div",{className:ot.field,ref:h,children:[o.jsx("button",{type:"button",id:l,className:ot.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:()=>x(N=>!N),children:v}),o.jsx("span",{className:ot.chevron,"aria-hidden":"true"})]}),y?o.jsx(se,{children:o.jsx(O0,{listRef:C,listId:p,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:b.top,left:b.left,minWidth:b.width},onSelect:N=>{u(N),x(!1)}})}):null]});return i?o.jsx($t,{label:i,children:P}):P}function $0({commands:e,queries:t,disabled:n}){const r=W(),i=!!(n||!t.isVisualMode());return o.jsx(Cf,{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 U0="_wrap_58i0x_1",W0="_wrapToolbar_58i0x_9",G0="_field_58i0x_14",V0="_input_58i0x_22",Z0="_toggle_58i0x_41",q0="_chevron_58i0x_42",Y0="_unit_58i0x_80",X0="_list_58i0x_110",J0="_option_58i0x_125",ve={wrap:U0,wrapToolbar:W0,field:G0,input:V0,toggle:Z0,chevron:q0,unit:Y0,list:X0,option:J0},ko=4,Q0={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function wf({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:i,tooltip:a,sizeInputId:l,toolbar:u=!1}){const m=W(),p=c.useId(),g=c.useRef(null),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState(()=>e===null?"":Q(e)),[b,S]=c.useState(!1),[v,k]=c.useState(!1),[P,N]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{b||x(e===null?"":Q(e))},[e,b]);const D=c.useCallback(()=>{const R=h.current,j=C.current;if(!R)return;const F=R.getBoundingClientRect(),U=(j==null?void 0:j.offsetHeight)??0;let $=F.bottom;$+U>window.innerHeight-ko&&($=Math.max(ko,F.top-U));const X=Math.min(Math.max(F.left,ko),window.innerWidth-Math.max(F.width,72)-ko);N({top:$,left:X,width:F.width})},[]);c.useLayoutEffect(()=>{if(!v)return;D();const R=()=>D();return window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[v,D]),c.useEffect(()=>{if(!v)return;const R=F=>{var $,X;const U=F.target;($=g.current)!=null&&$.contains(U)||(X=C.current)!=null&&X.contains(U)||k(!1)},j=F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",R),document.addEventListener("keydown",j,!0),()=>{document.removeEventListener("pointerdown",R),document.removeEventListener("keydown",j,!0)}},[v]);const A=R=>{const j=oh(R,t);if(!j){x(e===null?"":Q(e));return}n(j.value,j.unit),x(Q(j.value))},T=eh[t],I=v?o.jsx(se,{children:o.jsx("ul",{ref:C,className:ve.list,role:"listbox",id:p,style:{top:P.top,left:P.left,minWidth:P.width},children:T.map(R=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ve.option,role:"option","aria-selected":e===R,onMouseDown:j=>j.preventDefault(),onClick:()=>{n(R,t),x(Q(R)),k(!1)},children:Q(R)})},R))})}):null,E=o.jsxs("div",{className:`${ve.wrap}${u?` ${ve.wrapToolbar}`:""}`,ref:g,children:[o.jsxs("div",{className:ve.field,ref:h,children:[o.jsx("input",{id:l,className:ve.input,value:y,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":v,"aria-controls":p,role:"combobox",inputMode:"decimal",onFocus:()=>S(!0),onBlur:()=>{S(!1),A(y)},onChange:R=>x(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),A(y),k(!1),R.currentTarget.blur()),R.key==="ArrowDown"&&(R.preventDefault(),k(!0))}}),o.jsx("button",{type:"button",className:ve.toggle,tabIndex:-1,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-expanded":v,"aria-controls":p,onMouseDown:R=>R.preventDefault(),onClick:()=>k(R=>!R)})]}),o.jsxs("div",{className:ve.field,children:[o.jsx("select",{className:ve.unit,value:t,disabled:i,"aria-label":m("commandFontSizeUnitAria"),onChange:R=>{r(R.target.value)},children:Tl.map(R=>o.jsx("option",{value:R,children:m(Q0[R])},R))}),o.jsx("span",{className:ve.chevron,"aria-hidden":"true"})]}),I]});return a?o.jsx($t,{label:a,children:E}):E}const ev="_backdrop_1p9zk_1",tv="_dialog_1p9zk_12",nv="_dialogWide_1p9zk_31",rv="_header_1p9zk_35",ov="_tabs_1p9zk_43",iv="_tab_1p9zk_43",av="_body_1p9zk_76",lv="_field_1p9zk_86",sv="_label_1p9zk_92",cv="_sizeRow_1p9zk_96",uv="_fileRow_1p9zk_102",dv="_fileName_1p9zk_108",mv="_previewImage_1p9zk_115",fv="_marks_1p9zk_125",pv="_mark_1p9zk_125",gv="_actions_1p9zk_140",hv="_actionsSpread_1p9zk_148",bv="_actionsEnd_1p9zk_152",yv="_headerRow_1p9zk_157",xv="_close_1p9zk_170",Cv="_nameSection_1p9zk_187",wv="_nameInput_1p9zk_192",vv="_labelRow_1p9zk_209",Sv="_help_1p9zk_215",kv="_textInput_1p9zk_233",Av="_fullSelect_1p9zk_245",Pv="_error_1p9zk_249",Dv="_emptyHint_1p9zk_254",jv="_action_1p9zk_140",Ev="_textarea_1p9zk_265",Rv="_actionDanger_1p9zk_279",Tv="_confirmBody_1p9zk_285",Nv="_nestedPanel_1p9zk_294",Mv="_spinnerWrap_1p9zk_309",_v="_spinner_1p9zk_309",Lv="_actionPrimary_1p9zk_344",Iv="_iconButton_1p9zk_358",Fv="_select_1p9zk_359",Bv="_lengthInput_1p9zk_360",Hv="_lengthUnit_1p9zk_361",zv="_group_1p9zk_369",Ov="_nestedGroup_1p9zk_379",Kv="_subLabel_1p9zk_389",$v="_iconRow_1p9zk_393",Uv="_lengthField_1p9zk_425",Wv="_sideLabel_1p9zk_431",Gv="_lengthRow_1p9zk_435",Vv="_sideGrid_1p9zk_463",Zv="_shadowGrid_1p9zk_464",d={backdrop:ev,dialog:tv,dialogWide:nv,header:rv,tabs:ov,tab:iv,body:av,field:lv,label:sv,sizeRow:cv,fileRow:uv,fileName:dv,previewImage:mv,marks:fv,mark:pv,actions:gv,actionsSpread:hv,actionsEnd:bv,headerRow:yv,close:xv,nameSection:Cv,nameInput:wv,labelRow:vv,help:Sv,textInput:kv,fullSelect:Av,error:Pv,emptyHint:Dv,action:jv,textarea:Ev,actionDanger:Rv,confirmBody:Tv,nestedPanel:Nv,spinnerWrap:Mv,spinner:_v,actionPrimary:Lv,iconButton:Iv,select:Fv,lengthInput:Bv,lengthUnit:Hv,group:zv,nestedGroup:Ov,subLabel:Kv,iconRow:$v,lengthField:Uv,sideLabel:Wv,lengthRow:Gv,sideGrid:Vv,shadowGrid:Zv},qv={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function ls({tab:e,value:t,fonts:n,disabled:r,onTabChange:i,onChange:a}){const l=W(),u=c.useId(),m=c.useId(),p=n??kd(),g=Ia.find(h=>h.id===e)??Ia[0];return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("fontDialogTitle"),children:Ia.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:g.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(Cf,{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:u,children:l("fontDialogSize")}),o.jsx("div",{className:d.sizeRow,children:o.jsx(wf,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(h,C)=>{a({...t,size:h,unit:C})},onUnitChange:h=>{const C=t.size!==null?Ed(t.size,t.unit,h,16,16):t.size;a({...t,size:C,unit:h})}})})]}),o.jsx("div",{className:d.field,children:o.jsx(et,{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(et,{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")}),Qe.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(qv[h].label)]},h))]})]}):null})]})}const Ru='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function Yv({open:e,tab:t,size:n,unit:r,marks:i,fontFamily:a=null,fontFamilyMixed:l=!1,fontColor:u,fontColorMixed:m=!1,highlightColor:p,highlightColorMixed:g=!1,fonts:h,disabled:C,onTabChange:y,onApply:x,onClose:b}){const S=W(),v=c.useId(),k=c.useRef(null),[P,N]=c.useState({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:u,highlightColor:p,fontColorMixed:m,highlightColorMixed:g});return c.useEffect(()=>{e&&N({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:u,highlightColor:p,fontColorMixed:m,highlightColorMixed:g})},[e,n,r,i,a,l,u,m,p,g]),c.useEffect(()=>{if(!e)return;const D=k.current,A=D==null?void 0:D.querySelector(Ru);A==null||A.focus();const T=I=>{if(I.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;I.preventDefault(),I.stopPropagation(),b();return}if(I.key!=="Tab"||!D)return;const E=[...D.querySelectorAll(Ru)];if(E.length===0)return;const R=E[0],j=E[E.length-1];I.shiftKey&&document.activeElement===R?(I.preventDefault(),j.focus()):!I.shiftKey&&document.activeElement===j&&(I.preventDefault(),R.focus())};return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,b]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:b,children:o.jsxs("div",{ref:k,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:D=>D.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:v,children:S("fontDialogTitle")}),o.jsx(ls,{tab:t,value:P,fonts:h,disabled:C,onTabChange:y,onChange:N}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:b,children:S("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:C,onClick:()=>x(P),children:S("fontDialogOk")})]})]})})}):null}const Xv={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function ke({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:i,inputId:a,onChange:l}){const u=W(),m=c.useId(),p=a??m,g=(t==null?void 0:t.unit)??_l,[h,C]=c.useState(()=>t?Q(t.value):""),[y,x]=c.useState(!1);c.useEffect(()=>{y||C(t?Q(t.value):"")},[t,y]);const b=S=>{const v=S.trim();if(!v){l(null),C("");return}const k=gr(v,g,r);if(!k){C(t?Q(t.value):"");return}l(k),C(Q(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:()=>x(!0),onBlur:()=>{x(!1),b(h)},onChange:S=>C(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),b(h),S.currentTarget.blur())}}),o.jsx("select",{className:d.lengthUnit,value:g,disabled:n,"aria-label":i??u("paragraphDialogLengthUnitAria"),onChange:S=>{const v=S.target.value;if(t){l({value:t.value,unit:v});return}if(h.trim()){const k=gr(h,v,r);l(k)}},children:Tl.map(S=>o.jsx("option",{value:S,children:u(Xv[S])},S))})]})]})}function ss({shadow:e,disabled:t,onChange:n}){const r=W();return o.jsxs("div",{className:d.shadowGrid,children:[o.jsx(ke,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetX:i??{value:0,unit:"px"}})}}),o.jsx(ke,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetY:i??{value:0,unit:"px"}})}}),o.jsx(ke,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:i=>{n({...e,blur:i??{value:0,unit:"px"}})}}),o.jsx(ke,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:i=>{n({...e,spread:i??{value:0,unit:"px"}})}}),o.jsx(et,{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 vf=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0}],Sf=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],Jv={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},Qv={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function kf({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const i=W(),a=c.useId(),l=c.useId();return o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:i(e)}),o.jsx(eS,{value:t.opacity,disabled:n,onChange:u=>{r({...t,opacity:u})}}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:i("imagePropertiesFit")}),o.jsxs("select",{id:a,className:d.select,value:t.fit??"",disabled:n,onChange:u=>{const m=u.target.value;r({...t,fit:m||null})},children:[o.jsx("option",{value:"",children:i("imagePropertiesFitDefault")}),es.map(u=>o.jsx("option",{value:u,children:i(Jv[u])},u))]})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:i("imagePropertiesPosition")}),o.jsxs("select",{id:l,className:d.select,value:t.position??"",disabled:n,onChange:u=>{r({...t,position:u.target.value||null})},children:[o.jsx("option",{value:"",children:i("imagePropertiesPositionDefault")}),ts.map(u=>o.jsx("option",{value:u,children:i(Qv[u])},u))]})]})]})}function eS({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=e===null?null:Ko(e),[l,u]=c.useState(()=>a===null?"":Q(a)),[m,p]=c.useState(!1);c.useEffect(()=>{m||u(a===null?"":Q(a))},[a,m]);const g=h=>{const C=h.trim();if(!C){n(null),u("");return}const y=Number(C.replace(",","."));if(!Number.isFinite(y)){u(a===null?"":Q(a));return}const x=Wd(y);n(x),u(Q(Ko(x)))};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=>u(h.target.value),onBlur:()=>{p(!1),g(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const Ao=4,tS={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function Jo({label:e,inputAria:t,value:n,disabled:r,onChange:i}){const a=W(),l=c.useId(),u=c.useId(),m=c.useRef(null),p=c.useRef(null),g=c.useRef(null),h=(n==null?void 0:n.unit)??yx,[C,y]=c.useState(()=>n?Q(n.value):""),[x,b]=c.useState(!1),[S,v]=c.useState(!1),[k,P]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{x||y(n?Q(n.value):"")},[n,x]);const N=c.useCallback(()=>{const E=p.current,R=g.current;if(!E)return;const j=E.getBoundingClientRect(),F=(R==null?void 0:R.offsetHeight)??0;let U=j.bottom;U+F>window.innerHeight-Ao&&(U=Math.max(Ao,j.top-F));const $=Math.min(Math.max(j.left,Ao),window.innerWidth-Math.max(j.width,72)-Ao);P({top:U,left:$,width:j.width})},[]);c.useLayoutEffect(()=>{if(!S)return;N();const E=()=>N();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[S,N]),c.useEffect(()=>{if(!S)return;const E=j=>{var U,$;const F=j.target;(U=m.current)!=null&&U.contains(F)||($=g.current)!=null&&$.contains(F)||v(!1)},R=j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),v(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",R,!0)}},[S]);const D=E=>{const R=E.trim();if(!R){i(null),y("");return}const j=cu(R,h);if(!j){y(n?Q(n.value):"");return}i(j),y(Q(j.value))},A=xx[h],T=(n==null?void 0:n.value)??null,I=S?o.jsx(se,{children:o.jsx("ul",{ref:g,className:ve.list,role:"listbox",id:l,style:{top:k.top,left:k.left,minWidth:k.width},children:A.map(E=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ve.option,role:"option","aria-selected":T===E,onMouseDown:R=>R.preventDefault(),onClick:()=>{i({value:E,unit:h}),y(Q(E)),v(!1)},children:Q(E)})},E))})}):null;return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:u,children:e}),o.jsxs("div",{className:`${ve.wrap} ${d.lengthRow}`,ref:m,children:[o.jsxs("div",{className:ve.field,ref:p,children:[o.jsx("input",{id:u,className:ve.input,value:C,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":S,"aria-controls":l,role:"combobox",inputMode:"decimal",onFocus:()=>b(!0),onBlur:()=>{b(!1),D(C)},onChange:E=>y(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),D(C),v(!1),E.currentTarget.blur()),E.key==="ArrowDown"&&(E.preventDefault(),v(!0))}}),o.jsx("button",{type:"button",className:ve.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":S,"aria-controls":l,onMouseDown:E=>E.preventDefault(),onClick:()=>v(E=>!E)})]}),o.jsxs("div",{className:ve.field,children:[o.jsx("select",{className:ve.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:E=>{const R=E.target.value;if(n){i({value:n.value,unit:R});return}C.trim()&&i(cu(C,R))},children:zm.map(E=>o.jsx("option",{value:E,children:a(tS[E])},E))}),o.jsx("span",{className:ve.chevron,"aria-hidden":"true"})]}),I]})]})}const nS={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},rS={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function Af({src:e,disabled:t,customImagePicker:n,onSrcChange:r,onCustomPick:i,onSourceChange:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useRef(null),[g,h]=c.useState(()=>e.startsWith("data:")?"file":e.trim()?"url":"file"),[C,y]=c.useState(()=>e.startsWith("data:")?"":e),[x,b]=c.useState(""),[S,v]=c.useState(null),[k,P]=c.useState(!1);c.useEffect(()=>{a==null||a(g)},[a,g]);const N=g==="file"&&e.startsWith("data:")?e:g==="url"?C:"",D=g==="custom"?null:Bn(N),A=g==="custom"?null:g==="file"&&S?rS[S]:D&&(g==="file"||C.trim().length>0)?nS[D]:null,T=()=>{t||!n||i==null||i()},I=E=>{var j;const R=(j=E.target.files)==null?void 0:j[0];R&&(P(!0),v(null),mx(R).then(F=>{b(R.name),h("file"),r(F),P(!1)},F=>{const U=F instanceof Error?F.message:"";b(""),h("file"),v(U==="tooLarge"||U==="type"?U:"type"),P(!1),p.current&&(p.current.value="")}))};return 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":g==="file",disabled:t,onClick:()=>h("file"),children:l("imageDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":g==="url",disabled:t,onClick:()=>h("url"),children:l("imageDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":g==="custom",disabled:t,onClick:()=>h("custom"),children:n.text}):null]}),g==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:p,type:"file",accept:ix,hidden:!0,disabled:t,"aria-label":l("imageDialogChooseFile"),onChange:I}),o.jsx("button",{type:"button",className:d.action,disabled:t||k,onClick:()=>{var E;return(E=p.current)==null?void 0:E.click()},children:l("imageDialogChooseFile")}),x?o.jsx("span",{className:d.fileName,children:x}):null,e.startsWith("data:")&&!x?o.jsx("span",{className:d.fileName,children:l("pageBackgroundImageCurrent")}):null]}):null,g==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:l("imageDialogUrl")}),o.jsx("input",{id:u,className:d.textInput,value:C,disabled:t,"aria-invalid":A!==null,"aria-describedby":A?m:void 0,onChange:E=>{const R=E.target.value;y(R),r(R.trim())}})]}):null,g==="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:T,children:n.buttonCaption})]}):null,A?o.jsx("p",{id:m,className:d.error,children:l(A)}):null]})}function oS(e){return Bn(e.trim())===null}function iS(e){return Gm(e)?{width:null,height:null}:e==="fill"?{width:{...kn},height:{...kn}}:{width:{...kn},height:null}}function aS({value:e,disabled:t,customImagePicker:n,onCustomImagePick:r,onChange:i}){const a=W(),l=e.src??"",u=(m,p)=>{i({...e,fit:null,[m]:p})};return o.jsxs(o.Fragment,{children:[l?o.jsxs("div",{className:d.field,children:[o.jsx("span",{className:d.label,children:a("pageBackgroundImagePreview")}),o.jsx("img",{className:d.previewImage,src:l,alt:a("pageBackgroundImagePreviewAlt")}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:()=>{i({...e,src:null})},children:a("pageBackgroundImageClear")})]}):null,o.jsx(Af,{src:l,disabled:t,customImagePicker:n,onCustomPick:r,onSrcChange:m=>{i({...e,src:m.trim()||null})}}),l?o.jsxs(o.Fragment,{children:[o.jsx(Jo,{label:a("imagePropertiesWidth"),inputAria:a("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:m=>u("width",m)}),o.jsx(Jo,{label:a("imagePropertiesHeight"),inputAria:a("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:m=>u("height",m)}),o.jsx(kf,{legendKey:"pageDialogTabBackgroundImage",value:{opacity:e.opacity,fit:e.fit,position:e.position},disabled:t,onChange:m=>{const p=m.fit===e.fit?{width:e.width,height:e.height}:iS(m.fit);i({...e,opacity:m.opacity,fit:m.fit,position:m.position,...p})}})]}):null]})}const lS={left:ni,center:ti,right:ri,justify:od},sS={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},cS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},uS={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},dS={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},mS={value:1,unit:"pt"},fS={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1},pS={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid"},Tu={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid",page:"paragraphDialogBreakPage"};function lr(e){return{top:e,right:e,bottom:e,left:e}}function Nu(e){for(const t of Me)if(e[t])return e[t];return null}function gS(){const e=[...vf];for(const t of Sf)e.some(n=>n.id===t.id)||e.push(t);return e}function cs({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:i="paragraphDialogTitle",backgroundImage:a,customImagePicker:l,onCustomImagePick:u,onBackgroundImageChange:m,onTabChange:p,onChange:g}){const h=W(),C=r?gS().filter(A=>r.includes(A.id)):vf,y=c.useId(),x=c.useId(),b=c.useId(),S=c.useId(),[v,k]=c.useState(()=>Rt(t.margin,lr(t.margin.top))),[P,N]=c.useState(()=>Rt(t.padding,lr(t.padding.top))),D=(A,T,I,E)=>{const R=t[A],j=T?lr(E):{...R,[I]:E};g({...t,[A]:j,[`${A}Mixed`]:!1})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":h(i),children:C.map(A=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":A.id===e,disabled:!A.implemented,onClick:()=>p(A.id),children:h(A.labelKey)},A.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:h("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":h("paragraphDialogAlignment"),children:Mm.map(A=>{const T=lS[A],I=!t.alignMixed&&t.align===A;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":I,"aria-label":h(sS[A].aria),disabled:n,onClick:()=>{g({...t,align:A,alignMixed:!1})},children:o.jsx(T,{})},A)})})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("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":h("commandBulletListAria"),disabled:n,onClick:()=>{const A=!t.listMixed&&t.list==="ul"?null:"ul";g({...t,list:A,listMixed:!1})},children:o.jsx(id,{})}),o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":h("commandNumberedListAria"),disabled:n,onClick:()=>{const A=!t.listMixed&&t.list==="ol"?null:"ol";g({...t,list:A,listMixed:!1})},children:o.jsx(cd,{})})]})]})]}):null,e==="spacing"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogSpacing")}),o.jsx(Mu,{legend:h("paragraphDialogMargin"),sides:t.margin,linked:v,disabled:n,allowNegative:!0,onLinkedChange:A=>{k(A),A&&g({...t,margin:lr(Nu(t.margin)),marginMixed:!1})},onSideChange:(A,T)=>D("margin",v,A,T)}),o.jsx(Mu,{legend:h("paragraphDialogPadding"),sides:t.padding,linked:P,disabled:n,onLinkedChange:A=>{N(A),A&&g({...t,padding:lr(Nu(t.padding)),paddingMixed:!1})},onSideChange:(A,T)=>D("padding",P,A,T)}),o.jsx(bS,{value:t.lineHeight,disabled:n,onChange:A=>{g({...t,lineHeight:A,lineHeightMixed:!1})}}),o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:h("paragraphDialogPageBreaks")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:x,children:h("paragraphDialogBreakInside")}),o.jsx("select",{id:x,className:d.select,value:t.breakInsideMixed?"auto":t.breakInside,disabled:n,onChange:A=>{g({...t,breakInside:A.target.value,breakInsideMixed:!1})},children:Fd.map(A=>o.jsx("option",{value:A,children:h(pS[A])},A))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:b,children:h("paragraphDialogBreakAfter")}),o.jsx("select",{id:b,className:d.select,value:t.breakAfterMixed?"auto":t.breakAfter,disabled:n,onChange:A=>{g({...t,breakAfter:A.target.value,breakAfterMixed:!1})},children:Qa.map(A=>o.jsx("option",{value:A,children:h(Tu[A])},A))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:S,children:h("paragraphDialogBreakBefore")}),o.jsx("select",{id:S,className:d.select,value:t.breakBeforeMixed?"auto":t.breakBefore,disabled:n,onChange:A=>{g({...t,breakBefore:A.target.value,breakBeforeMixed:!1})},children:Qa.map(A=>o.jsx("option",{value:A,children:h(Tu[A])},A))})]})]})]}):null,e==="border"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:y,children:h("paragraphDialogBorderStyle")}),o.jsx("select",{id:y,className:d.select,value:t.border.style,disabled:n,onChange:A=>{const T=A.target.value;g({...t,border:{style:T,width:T==="none"?null:t.border.width??mS,color:T==="none"?null:t.border.color},borderMixed:!1})},children:si.map(A=>o.jsx("option",{value:A,children:h(uS[A])},A))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(ke,{label:h("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:A=>{g({...t,border:{...t.border,width:A},borderMixed:!1})}}),o.jsx(et,{label:h("paragraphDialogBorderColor"),noneLabel:h("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:A=>{g({...t,border:{...t.border,color:A},borderMixed:!1})}})]}):null,o.jsx(ke,{label:h("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:A=>{g({...t,borderRadius:A,radiusMixed:!1})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{g({...t,boxShadow:t.boxShadow?null:fS,shadowMixed:!1})}}),h("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(ss,{shadow:t.boxShadow,disabled:n,onChange:A=>{g({...t,boxShadow:A,shadowMixed:!1})}}):null]}):null,e==="background"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogTabBackground")}),o.jsx(et,{label:h("paragraphDialogBackgroundColor"),noneLabel:h("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:A=>{g({...t,backgroundColor:A,backgroundMixed:!1})}}),o.jsx(hS,{value:t.opacity,disabled:n,onChange:A=>{g({...t,opacity:A,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&m?o.jsx(aS,{value:a,disabled:n,customImagePicker:l,onCustomImagePick:u,onChange:m}):null]})]})}function hS({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=e===null?null:Ko(e),[l,u]=c.useState(()=>a===null?"":Q(a)),[m,p]=c.useState(!1);c.useEffect(()=>{m||u(a===null?"":Q(a))},[a,m]);const g=h=>{const C=h.trim();if(!C){n(null),u("");return}const y=Number(C.replace(",","."));if(!Number.isFinite(y)){u(a===null?"":Q(a));return}const x=Wd(y);n(x),u(Q(Ko(x)))};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=>u(h.target.value),onBlur:()=>{p(!1),g(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function Mu({legend:e,sides:t,linked:n,disabled:r,allowNegative:i=!1,onLinkedChange:a,onSideChange:l}){const u=W(),m=n?["top"]:Me;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)}),u("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:m.map(p=>o.jsx(ke,{label:n?e:u(cS[p]),value:t[p],disabled:r,allowNegative:i,onChange:g=>l(p,g)},p))})]})}function bS({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=yS(e),l=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,m]=c.useState(()=>l===null?"":Q(l)),p=(e==null?void 0:e.kind)==="length"?e.unit:_l;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"?"":u,disabled:t||a==="normal",inputMode:"decimal",onChange:g=>m(g.target.value),onBlur:()=>{const g=u.trim();if(!g){n(null);return}if(a==="number"||a==="empty"){const C=Number(g.replace(",","."));if(!Number.isFinite(C)||C<0){m(l===null?"":Q(l));return}n({kind:"number",value:C}),m(Q(C));return}const h=gr(g,p,!1);if(!h){m(l===null?"":Q(l));return}n({kind:"length",value:h.value,unit:h.unit}),m(Q(h.value))}}),o.jsxs("select",{className:d.lengthUnit,value:a==="length"?p:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:g=>{const h=g.target.value;if(h==="empty"){n(null),m("");return}if(h==="normal"){n({kind:"normal"}),m("");return}if(h==="number"){const b=Number((u||"1.5").replace(",",".")),S=Number.isFinite(b)&&b>=0?b:1.5;n({kind:"number",value:S}),m(Q(S));return}const C=h,y=gr(u||"1",C,!1),x=(y==null?void 0:y.value)??1;n({kind:"length",value:x,unit:C}),m(Q(x))},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(g=>o.jsx("option",{value:g,children:r(dS[g])},g))]})]})]})}function yS(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}const _u='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function xS({open:e,tab:t,value:n,disabled:r,onTabChange:i,onApply:a,onClose:l}){const u=W(),m=c.useId(),p=c.useRef(null),[g,h]=c.useState(n);return c.useEffect(()=>{e&&h(n)},[e,n]),c.useEffect(()=>{if(!e)return;const C=p.current,y=C==null?void 0:C.querySelector(_u);y==null||y.focus();const x=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),l();return}if(b.key!=="Tab"||!C)return;const S=[...C.querySelectorAll(_u)];if(S.length===0)return;const v=S[0],k=S[S.length-1];b.shiftKey&&document.activeElement===v?(b.preventDefault(),k.focus()):!b.shiftKey&&document.activeElement===k&&(b.preventDefault(),v.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,l]),e?o.jsx(se,{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:C=>C.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:m,children:u("paragraphDialogTitle")}),o.jsx(cs,{tab:t,value:g,disabled:r,onTabChange:i,onChange:h}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:l,children:u("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:r,onClick:()=>a(g),children:u("fontDialogOk")})]})]})})}):null}const CS=["auto","A4","letter","legal","custom"],wS={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},vS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function Lu(e){return e===null?"":Q(e.value)}function SS({value:e,disabled:t,onChange:n,onReset:r}){const i=W(),a=c.useId(),[l,u]=c.useState(!0),m=e??on(),p=(g,h)=>{if(l){n({...m,margin:{top:h,right:h,bottom:h,left:h},marginMixed:!1});return}n({...m,margin:{...m.margin,[g]:h},marginMixed:!1})};return o.jsxs("div",{className:d.body,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:i("pageAtRuleSize")}),o.jsx("select",{id:a,className:d.select,disabled:t,value:m.sizePreset,onChange:g=>n({...m,sizePreset:g.target.value}),children:CS.map(g=>o.jsx("option",{value:g,children:i(wS[g])},g))})]}),m.sizePreset==="custom"?o.jsxs("div",{className:d.sideGrid,children:[o.jsx(Ba,{label:i("pageAtRuleWidth"),value:m.customWidth,disabled:t,onChange:g=>n({...m,customWidth:g})}),o.jsx(Ba,{label:i("pageAtRuleHeight"),value:m.customHeight,disabled:t,onChange:g=>n({...m,customHeight:g})})]}):null,o.jsxs("div",{className:d.field,children:[o.jsx("span",{className:d.label,children:i("pageAtRuleOrientation")}),o.jsx("div",{className:d.marks,children:[["none","pageAtRuleOrientationNone"],["portrait","pageAtRuleOrientationPortrait"],["landscape","pageAtRuleOrientationLandscape"]].map(([g,h])=>o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"radio",name:"page-orientation",checked:(m.orientation??"none")===g,disabled:t,onChange:()=>n({...m,orientation:g==="none"?null:g})}),i(h)]},g))})]}),o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:i("pageAtRuleMargins")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:l,disabled:t,onChange:()=>u(!l)}),i("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(l?["top"]:Me).map(g=>o.jsx(Ba,{label:i(l?"pageAtRuleMargins":vS[g]),value:m.margin[g],disabled:t,onChange:h=>p(g,h)},g))})]}),o.jsx("div",{className:d.actions,children:o.jsx("button",{type:"button",className:d.action,disabled:t,"aria-label":i("pageAtRuleResetAria"),onClick:r,children:i("pageAtRuleReset")})})]})}function Ba({label:e,value:t,disabled:n,onChange:r}){const i=W(),a=c.useId(),[l,u]=c.useState(()=>Lu(t)),m=(t==null?void 0:t.unit)??_l;return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:a,className:d.lengthInput,value:l,disabled:n,inputMode:"decimal",onChange:p=>u(p.target.value),onBlur:()=>{const p=l.trim();if(!p){r(null);return}const g=gr(p,m,!1);if(!g){u(Lu(t));return}r(g),u(Q(g.value))}}),o.jsxs("select",{className:d.lengthUnit,disabled:n,value:m,"aria-label":i("paragraphDialogLengthUnitAria"),onChange:p=>{const g=p.target.value;t&&r({...t,unit:g})},children:[o.jsx("option",{value:"pt",children:i("fontSizeUnitPt")}),o.jsx("option",{value:"px",children:i("fontSizeUnitPx")}),o.jsx("option",{value:"em",children:i("fontSizeUnitEm")}),o.jsx("option",{value:"rem",children:i("fontSizeUnitRem")}),o.jsx("option",{value:"%",children:i("fontSizeUnitPercent")})]})]})]})}const Iu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',kS=Sf.map(e=>e.id);function AS(e){return{...ur(),...e}}function PS(e){const{align:t,alignMixed:n,list:r,listMixed:i,...a}=e;return a}function DS({open:e,tab:t,value:n,fonts:r,disabled:i,customImagePicker:a,onCustomImagePick:l,onTabChange:u,onApply:m,onResetAtRule:p,onClose:g}){const h=W(),C=c.useId(),y=c.useRef(null),[x,b]=c.useState("general"),[S,v]=c.useState("spacing"),[k,P]=c.useState(n.font),[N,D]=c.useState(n.box),[A,T]=c.useState(n.backgroundImage),[I,E]=c.useState(n.atRule??on());if(c.useEffect(()=>{e&&(b("general"),v("spacing"),P(n.font),D(n.box),T(n.backgroundImage??ns()),E(n.atRule??on()))},[e,n]),c.useEffect(()=>{if(!e)return;const j=y.current,F=j==null?void 0:j.querySelector(Iu);F==null||F.focus();const U=$=>{if($.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;$.preventDefault(),$.stopPropagation(),g();return}if($.key!=="Tab"||!j)return;const X=[...j.querySelectorAll(Iu)];if(X.length===0)return;const J=X[0],he=X[X.length-1];$.shiftKey&&document.activeElement===J?($.preventDefault(),he.focus()):!$.shiftKey&&document.activeElement===he&&($.preventDefault(),J.focus())};return document.addEventListener("keydown",U,!0),()=>document.removeEventListener("keydown",U,!0)},[e,g]),!e)return null;const R=h("pageDialogTitle");return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:g,children:o.jsxs("div",{ref:y,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":C,onMouseDown:j=>j.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:C,children:R}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":R,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="font",onClick:()=>u("font"),children:h("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="paragraph",onClick:()=>u("paragraph"),children:h("customStyleDialogTabParagraph")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="print",onClick:()=>u("print"),children:h("pageDialogTabPrint")})]}),t==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(ls,{tab:x,value:k,fonts:r,disabled:i,onTabChange:b,onChange:P})}):t==="paragraph"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(cs,{tab:S,value:AS(N),disabled:i,tabs:kS,tablistLabelKey:"pageDialogTitle",backgroundImage:A,customImagePicker:a,onCustomImagePick:l,onBackgroundImageChange:T,onTabChange:j=>{j!=="general"&&v(j)},onChange:j=>D(PS(j))})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(SS,{value:I,disabled:i,onChange:E,onReset:()=>{E(on()),p==null||p()}})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:g,children:h("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>m({font:k,box:N,backgroundImage:A,atRule:I}),children:h("fontDialogOk")})]})]})})})}const Fu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function jS(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Bu(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 ES(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 RS({open:e,mode:t,styleId:n,name:r="",font:i,paragraph:a,canDelete:l=!1,busy:u,disabled:m,fonts:p,defaultOuterTab:g="font",onSave:h,onDelete:C,onClose:y}){const x=W(),b=c.useId(),S=c.useId(),v=c.useRef(null),[k,P]=c.useState(r),[N,D]=c.useState(g),[A,T]=c.useState("general"),[I,E]=c.useState("general"),[R,j]=c.useState(()=>Bu(i)),[F,U]=c.useState(()=>cl(a)),[$,X]=c.useState(!1);if(c.useEffect(()=>{e&&(P(r),D(g),T("general"),E("general"),j(Bu(i)),U(cl(a)),X(!1))},[e,r,i,a,g]),c.useEffect(()=>{if(!e)return;const te=v.current,ie=te==null?void 0:te.querySelector(Fu);ie==null||ie.focus();const M=V=>{if(V.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;if(V.preventDefault(),V.stopPropagation(),$){X(!1);return}y();return}if(V.key!=="Tab"||!te)return;const re=[...te.querySelectorAll(Fu)];if(re.length===0)return;const G=re[0],ye=re[re.length-1];V.shiftKey&&document.activeElement===G?(V.preventDefault(),ye.focus()):!V.shiftKey&&document.activeElement===ye&&(V.preventDefault(),G.focus())};return document.addEventListener("keydown",M,!0),()=>document.removeEventListener("keydown",M,!0)},[e,y,$]),!e)return null;const J=x(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),he=k.trim().length>0,Y=!!(m||u),be=()=>{const te=k.trim();te&&h({id:n??jS(),name:te,font:ES(R),paragraph:Fm(F)})};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:y,children:o.jsxs("div",{ref:v,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":b,"aria-busy":u||void 0,onMouseDown:te=>te.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:b,children:J}),o.jsx("button",{type:"button",className:d.close,"aria-label":x("customStyleDialogCloseAria"),onClick:y,children:o.jsx(_e,{})})]}),$?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.confirmBody,children:x("customStyleDialogDeleteConfirm")}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:Y,onClick:()=>X(!1),children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:Y||!n,onClick:()=>{n&&(C==null||C(n))},children:x("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:S,children:x("customStyleDialogName")}),o.jsx("input",{id:S,className:d.nameInput,value:k,disabled:Y,onChange:te=>P(te.target.value)})]})}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":J,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="font",onClick:()=>D("font"),children:x("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="paragraph",onClick:()=>D("paragraph"),children:x("customStyleDialogTabParagraph")})]}),N==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(ls,{tab:A,value:R,fonts:p,disabled:Y,onTabChange:T,onChange:j})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(cs,{tab:I,value:F,disabled:Y,onTabChange:E,onChange:U})}),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:Y,onClick:()=>X(!0),children:x("customStyleDialogDelete")}):null,o.jsxs("div",{className:d.actionsEnd,children:[o.jsx("button",{type:"button",className:d.action,onClick:y,children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:Y||!he,onClick:be,children:x("fontDialogOk")})]})]})]})]})})})}const TS='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function NS({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useId(),m=c.useRef(null),p=c.useRef(null),[g,h]=c.useState(t);if(c.useEffect(()=>{e&&h(t)},[e,t]),c.useEffect(()=>{var b;if(!e)return;(b=p.current)==null||b.focus();const y=m.current,x=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),i();return}if(S.key!=="Tab"||!y)return;const v=[...y.querySelectorAll(TS)];if(v.length===0)return;const k=v[0],P=v[v.length-1];S.shiftKey&&document.activeElement===k?(S.preventDefault(),P.focus()):!S.shiftKey&&document.activeElement===P&&(S.preventDefault(),k.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,i]),!e)return null;const C=()=>{n||r(g)};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:m,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("customCssDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("customCssDialogCloseAria"),onClick:i,children:o.jsx(_e,{})})]}),o.jsx("div",{className:d.body,children:o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:a("customCssDialogField")}),o.jsx("textarea",{ref:p,id:u,className:d.textarea,value:g,disabled:n,spellCheck:!1,"aria-label":a("customCssDialogFieldAria"),rows:8,onChange:y=>h(y.target.value)})]})}),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:C,children:a("fontDialogOk")})]})]})})})}const Hu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',MS={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function _S({open:e,existingIds:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useId(),m=c.useId(),p=c.useRef(null),[g,h]=c.useState(""),[C,y]=c.useState(!1),x=c.useMemo(()=>new Set(t),[t]),b=tf(g,x);if(c.useEffect(()=>{e&&(h(""),y(!1))},[e]),c.useEffect(()=>{if(!e)return;const P=p.current,N=P==null?void 0:P.querySelector(Hu);N==null||N.focus();const D=A=>{if(A.key==="Escape"){A.preventDefault(),A.stopPropagation(),i();return}if(A.key!=="Tab"||!P)return;const T=[...P.querySelectorAll(Hu)];if(T.length===0)return;const I=T[0],E=T[T.length-1];A.shiftKey&&document.activeElement===I?(A.preventDefault(),E.focus()):!A.shiftKey&&document.activeElement===E&&(A.preventDefault(),I.focus())};return document.addEventListener("keydown",D,!0),()=>document.removeEventListener("keydown",D,!0)},[e,i]),!e)return null;const S=C||g.trim().length>0?b:null,v=b===null&&!n,k=()=>{y(!0),!(b||n)&&r(g.trim())};return o.jsx(se,{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: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(_e,{})})]}),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:u,children:a("bookmarkDialogName")}),o.jsx($t,{label:a("bookmarkDialogHelp"),elevated:!0,children:o.jsx("button",{type:"button",className:d.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),o.jsx("input",{id:u,className:d.textInput,value:g,disabled:n,"aria-invalid":S!==null,"aria-describedby":S?m:void 0,onChange:P=>h(P.target.value)}),S?o.jsx("p",{id:m,className:d.error,children:a(MS[S])}):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:!v,onClick:k,children:a("fontDialogOk")})]})]})})})}const zu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',LS={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},IS={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function FS({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useId(),g=c.useId(),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState("file"),[b,S]=c.useState(""),[v,k]=c.useState(""),[P,N]=c.useState(""),[D,A]=c.useState(""),[T,I]=c.useState(null),[E,R]=c.useState(!1);if(c.useEffect(()=>{e&&(x("file"),S(""),k(""),N(""),A(""),I(null),R(!1),C.current&&(C.current.value=""))},[e]),c.useEffect(()=>{if(!e)return;const Y=h.current,be=Y==null?void 0:Y.querySelector(zu);be==null||be.focus();const te=ie=>{if(ie.key==="Escape"){ie.preventDefault(),ie.stopPropagation(),a();return}if(ie.key!=="Tab"||!Y)return;const M=[...Y.querySelectorAll(zu)];if(M.length===0)return;const V=M[0],re=M[M.length-1];ie.shiftKey&&document.activeElement===V?(ie.preventDefault(),re.focus()):!ie.shiftKey&&document.activeElement===re&&(ie.preventDefault(),V.focus())};return document.addEventListener("keydown",te,!0),()=>document.removeEventListener("keydown",te,!0)},[e,a]),!e)return null;const j=y==="file"?v:y==="url"?b:"",F=y==="custom"?null:is(j),U=y==="custom"?null:y==="file"&&T?IS[T]:F&&(y==="file"||b.trim().length>0)?LS[F]:null,$=y!=="custom"&&F===null&&!(y==="file"&&T)&&!t&&!E,X=()=>{t||!n||i==null||i()},J=()=>{$&&r({src:j.trim(),title:D.trim()})},he=Y=>{var te;const be=(te=Y.target.files)==null?void 0:te[0];be&&(R(!0),I(null),fC(be).then(ie=>{k(ie),N(be.name),x("file"),R(!1)},ie=>{const M=ie instanceof Error?ie.message:"";k(""),N(""),x("file"),I(M==="tooLarge"||M==="type"?M:"type"),R(!1),C.current&&(C.current.value="")}))};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:h,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:Y=>Y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("audioDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("audioDialogCloseAria"),onClick:a,children:o.jsx(_e,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="file",disabled:t,onClick:()=>x("file"),children:l("audioDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>x("url"),children:l("audioDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>x("custom"),children:n.text}):null]}),y==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:C,type:"file",accept:aC,hidden:!0,disabled:t,"aria-label":l("audioDialogChooseFile"),onChange:he}),o.jsx("button",{type:"button",className:d.action,disabled:t||E,onClick:()=>{var Y;return(Y=C.current)==null?void 0:Y.click()},children:l("audioDialogChooseFile")}),P?o.jsx("span",{className:d.fileName,children:P}):null]}):null,y==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("audioDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:b,disabled:t,"aria-invalid":U!==null,"aria-describedby":U?g:void 0,onChange:Y=>S(Y.target.value)})]}):null,y==="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:X,children:n.buttonCaption})]}):null]}),y!=="custom"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("audioDialogTitleField")}),o.jsx("input",{id:p,className:d.textInput,value:D,disabled:t,onChange:Y=>A(Y.target.value)})]}):null,U?o.jsx("p",{id:g,className:d.error,children:l(U)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),y!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!$,onClick:J,children:l("fontDialogOk")}):null]})]})})})}const Ou='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])';function BS({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useId(),g=c.useRef(null),[h,C]=c.useState(""),[y,x]=c.useState(""),[b,S]=c.useState(""),[v,k]=c.useState("file");if(c.useEffect(()=>{e&&(C(""),x(""),S(""),k("file"))},[e]),c.useEffect(()=>{if(!e)return;const D=g.current,A=D==null?void 0:D.querySelector(Ou);A==null||A.focus();const T=I=>{if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),a();return}if(I.key!=="Tab"||!D)return;const E=[...D.querySelectorAll(Ou)];if(E.length===0)return;const R=E[0],j=E[E.length-1];I.shiftKey&&document.activeElement===R?(I.preventDefault(),j.focus()):!I.shiftKey&&document.activeElement===j&&(I.preventDefault(),R.focus())};return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,a]),!e)return null;const P=oS(h)&&!t,N=()=>{P&&r({src:h.trim(),alt:y.trim(),title:b.trim()})};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:g,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:D=>D.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("imageDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("imageDialogCloseAria"),onClick:a,children:o.jsx(_e,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx(Af,{src:h,disabled:t,customImagePicker:n,onCustomPick:i,onSourceChange:k,onSrcChange:C}),v!=="custom"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("imageDialogAlt")}),o.jsx("input",{id:m,className:d.textInput,value:y,disabled:t,onChange:D=>x(D.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("imageDialogTitleField")}),o.jsx("input",{id:p,className:d.textInput,value:b,disabled:t,onChange:D=>S(D.target.value)})]})]}):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:!P,onClick:N,children:l("fontDialogOk")}):null]})]})})})}const HS=[{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}],zS={left:ni,center:ti,right:ri},OS=["left","center","right"],KS={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},$S=["width","height","lock"],US={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},WS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},GS={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},VS={value:1,unit:"pt"},ZS={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 Ha(e){return{top:e,right:e,bottom:e,left:e}}function qS(e){for(const t of Me)if(e[t])return e[t];return null}function YS({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:i,onChange:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useId(),[g,h]=c.useState(()=>Rt(t.margin,Ha(t.margin.top))),C=t.align==="center",y=(b,S)=>{if(t.sizeMode==="lock"&&S){const v=dr(b,S,n);a({...t,width:v.width,height:v.height});return}a({...t,[b]:S})},x=b=>{if(b==="width"){a({...t,sizeMode:b,height:null});return}if(b==="height"){a({...t,sizeMode:b,width:null});return}if(t.width){const S=dr("width",t.width,n);a({...t,sizeMode:b,width:S.width,height:S.height});return}if(t.height){const S=dr("height",t.height,n);a({...t,sizeMode:b,width:S.width,height:S.height});return}a({...t,sizeMode:b})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("imagePropertiesDialogTitle"),children:HS.map(b=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":b.id===e,disabled:!b.implemented,onClick:()=>i(b.id),children:l(b.labelKey)},b.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:$S.map(b=>o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":t.sizeMode===b,disabled:r,onClick:()=>x(b),children:l(US[b])},b))}),o.jsx(Jo,{label:l("imagePropertiesWidth"),inputAria:l("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:b=>y("width",b)}),o.jsx(Jo,{label:l("imagePropertiesHeight"),inputAria:l("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:b=>y("height",b)})]}):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:OS.map(b=>{const S=zS[b];return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":t.align===b,"aria-label":l(KS[b]),disabled:r,onClick:()=>{a({...t,align:t.align===b?null:b})},children:o.jsx(S,{})},b)})})]}):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:g,disabled:r||C,onChange:()=>{const b=!g;h(b),b&&a({...t,margin:Ha(qS(t.margin))})}}),l("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(g?["top"]:Me).map(b=>o.jsx(ke,{label:l(g?"paragraphDialogMargin":WS[b]),value:t.margin[b],disabled:r||C&&(b==="left"||b==="right"),allowNegative:!0,onChange:S=>{const v=g?Ha(S):{...t.margin,[b]:S};a({...t,margin:v})}},b))})]}),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:u,children:l("paragraphDialogBorderStyle")}),o.jsx("select",{id:u,className:d.select,value:t.border.style,disabled:r,onChange:b=>{const S=b.target.value;a({...t,border:{style:S,width:S==="none"?null:t.border.width??VS,color:S==="none"?null:t.border.color}})},children:si.map(b=>o.jsx("option",{value:b,children:l(GS[b])},b))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(ke,{label:l("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:b=>{a({...t,border:{...t.border,width:b}})}}),o.jsx(et,{label:l("paragraphDialogBorderColor"),noneLabel:l("colorNone"),value:t.border.color,disabled:r,onChange:b=>{a({...t,border:{...t.border,color:b}})}})]}):null,o.jsx(ke,{label:l("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:b=>{a({...t,borderRadius:b})}}),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:ZS})}}),l("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(ss,{shadow:t.boxShadow,disabled:r,onChange:b=>{a({...t,boxShadow:b})}}):null]})]}):null,e==="advanced"?o.jsxs(o.Fragment,{children:[o.jsx(kf,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:b=>{a(Ex({...t,opacity:b.opacity,objectFit:b.fit,objectPosition:b.position},n))}}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesRotation")}),o.jsx("div",{className:d.field,children:o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:m,className:d.lengthInput,value:t.rotateDeg===null?"":Q(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":l("imagePropertiesRotation"),onChange:b=>{const S=b.target.value.trim();if(!S){a({...t,rotateDeg:null});return}const v=Number(S.replace(",","."));Number.isFinite(v)&&a({...t,rotateDeg:v})}}),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:p,children:l("imagePropertiesHoverCss")}),o.jsx("textarea",{id:p,className:d.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":l("imagePropertiesHoverCssAria"),onChange:b=>{a({...t,hoverCss:b.target.value})}})]})]}):null]})]})}const Ku='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function XS({open:e,tab:t,value:n,aspectRatio:r=1,disabled:i,onTabChange:a,onApply:l,onClose:u}){const m=W(),p=c.useId(),g=c.useRef(null),[h,C]=c.useState(n);return c.useEffect(()=>{e&&C(n)},[e,n]),c.useEffect(()=>{if(!e)return;const y=g.current,x=y==null?void 0:y.querySelector(Ku);x==null||x.focus();const b=S=>{if(S.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;S.preventDefault(),S.stopPropagation(),u();return}if(S.key!=="Tab"||!y)return;const v=[...y.querySelectorAll(Ku)];if(v.length===0)return;const k=v[0],P=v[v.length-1];S.shiftKey&&document.activeElement===k?(S.preventDefault(),P.focus()):!S.shiftKey&&document.activeElement===P&&(S.preventDefault(),k.focus())};return document.addEventListener("keydown",b,!0),()=>document.removeEventListener("keydown",b,!0)},[e,u]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:u,children:o.jsxs("div",{ref:g,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:u,children:o.jsx(_e,{})})]}),o.jsx(YS,{tab:t,value:h,aspectRatio:r,disabled:i,onTabChange:a,onChange:C}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:u,children:m("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>l(h),children:m("fontDialogOk")})]})]})})}):null}const JS="_frame_bwkh8_1",QS="_handle_bwkh8_9",ek="_handleEast_bwkh8_29",tk="_handleSouth_bwkh8_37",nk="_handleSouthEast_bwkh8_45",mr={frame:JS,handle:QS,handleEast:ek,handleSouth:tk,handleSouthEast:nk};function sr(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const rk=[{handle:"e",className:mr.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:mr.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:mr.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function za(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function ok({img:e,onResize:t,onResizeEnd:n}){const r=W(),i=c.useRef(null),a=c.useRef(e),l=c.useRef(t),u=c.useRef(n),m=c.useRef(null);a.current=e,l.current=t,u.current=n;const p=v=>{const k=i.current;k&&(k.style.left=`${v.left}px`,k.style.top=`${v.top}px`,k.style.width=`${v.width}px`,k.style.height=`${v.height}px`)};c.useLayoutEffect(()=>{p(sr(e));const v=()=>{e.isConnected&&p(sr(e))};return window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[e]);const g=(v,k)=>{const P=m.current,N=a.current;if(!P||!N)return;const D=WC(P.handle,P.start,{x:v-P.originX,y:k-P.originY});l.current(D.width,D.height),N.isConnected&&p(sr(N))},h=()=>{if(!m.current)return;m.current=null;const v=a.current;u.current(),v!=null&&v.isConnected&&p(sr(v))};c.useLayoutEffect(()=>{const v=P=>{if(!m.current)return;const N=za(P);N&&g(N.x,N.y)},k=()=>{h()};return document.addEventListener("pointermove",v),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k),document.addEventListener("mousemove",v),document.addEventListener("mouseup",k),()=>{document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",k)}},[]);const C=(v,k)=>{const P=za(k);P&&(m.current={handle:v,start:GC(a.current),originX:P.x,originY:P.y})},y=v=>k=>{k.preventDefault(),k.stopPropagation(),C(v,k);try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}},x=v=>k=>{k.preventDefault(),k.stopPropagation(),C(v,k)},b=v=>{const k=za(v);k&&g(k.x,k.y)};if(!e.isConnected)return null;const S=sr(e);return wl.createPortal(o.jsx("div",{ref:i,className:mr.frame,"data-image-resize-overlay":"",style:{left:S.left,top:S.top,width:S.width,height:S.height},children:rk.map(v=>o.jsx("button",{type:"button",className:`${mr.handle} ${v.className}`,style:{cursor:v.cursor},"aria-label":r(v.ariaKey),"data-resize-handle":v.handle,onPointerDown:y(v.handle),onPointerMove:b,onPointerUp:h,onPointerCancel:h,onMouseDown:x(v.handle),onMouseMove:b,onMouseUp:h},v.handle))}),document.body)}const $u='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function ik({open:e,tab:t,href:n,title:r,targetBlank:i,textDecorationNone:a,hoverMode:l,hoverColor:u,hoverHtml:m,bookmarks:p,selectedBookmarkId:g,disabled:h,onTabChange:C,onApply:y,onClose:x}){const b=W(),S=c.useId(),v=c.useId(),k=c.useId(),P=c.useId(),N=c.useId(),D=c.useRef(null),[A,T]=c.useState(n),[I,E]=c.useState(r),[R,j]=c.useState(i),[F,U]=c.useState(a),[$,X]=c.useState(l),[J,he]=c.useState(u),[Y,be]=c.useState(m),[te,ie]=c.useState(g);if(c.useEffect(()=>{e&&(T(n),E(r),j(i),U(a),X(l),he(u),be(m),ie(g))},[e,n,r,i,a,l,u,m,g]),c.useEffect(()=>{if(!e)return;const G=D.current,ye=G==null?void 0:G.querySelector($u);ye==null||ye.focus();const Le=xe=>{if(xe.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;xe.preventDefault(),xe.stopPropagation(),x();return}if(xe.key!=="Tab"||!G)return;const Zt=[...G.querySelectorAll($u)];if(Zt.length===0)return;const kr=Zt[0],Hn=Zt[Zt.length-1];xe.shiftKey&&document.activeElement===kr?(xe.preventDefault(),Hn.focus()):!xe.shiftKey&&document.activeElement===Hn&&(xe.preventDefault(),kr.focus())};return document.addEventListener("keydown",Le,!0),()=>document.removeEventListener("keydown",Le,!0)},[e,x,t,$]),!e)return null;const M=()=>mi({title:I,targetBlank:R,textDecorationNone:F,hoverMode:$,hoverColor:J,hoverHtml:Y}),V=()=>{const G=A.trim();!G||h||y({...M(),href:G})},re=()=>{!te||h||y({...M(),href:`#${te}`})};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:x,children:o.jsxs("div",{ref:D,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":S,onMouseDown:G=>G.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:S,children:b("linkDialogTitle")}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":b("linkDialogTitle"),children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="link",onClick:()=>C("link"),children:b("linkDialogTabLink")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>C("bookmark"),children:b("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:v,children:b("linkDialogHref")}),o.jsx("input",{id:v,className:d.textInput,value:A,disabled:h,onChange:G=>T(G.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:k,children:b("linkDialogHoverTitle")}),o.jsx("input",{id:k,className:d.textInput,value:I,disabled:h,onChange:G=>E(G.target.value)})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:R,disabled:h,onChange:G=>j(G.target.checked)}),b("linkDialogTargetBlank")]})]}):p.length===0?o.jsx("p",{className:d.emptyHint,children:b("linkDialogBookmarkEmpty")}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:P,children:b("linkDialogBookmark")}),o.jsxs("select",{id:P,className:`${d.select} ${d.fullSelect}`,value:te,disabled:h,onChange:G=>ie(G.target.value),children:[o.jsx("option",{value:""}),p.map(G=>o.jsx("option",{value:G.id,children:G.id},G.id))]})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:F,disabled:h,onChange:G=>U(G.target.checked)}),b("linkDialogTextDecorationNone")]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:b("linkDialogHover")}),o.jsxs("div",{className:d.sizeRow,role:"group","aria-label":b("linkDialogHover"),children:[o.jsx("button",{type:"button",className:d.action,"aria-pressed":$==="color",disabled:h,onClick:()=>X("color"),children:b("linkDialogHoverColor")}),o.jsx("button",{type:"button",className:d.action,"aria-pressed":$==="html",disabled:h,onClick:()=>X("html"),children:b("linkDialogHoverHtml")})]}),$==="color"?o.jsx(et,{label:b("linkDialogHoverColorField"),noneLabel:b("colorNone"),value:J,disabled:h,onChange:he}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:N,children:b("linkDialogHoverHtmlAria")}),o.jsx("textarea",{id:N,className:d.textarea,value:Y,disabled:h,spellCheck:!1,onChange:G=>be(G.target.value)})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:h||!te,onClick:re,children:b("linkDialogSelect")}),o.jsx("button",{type:"button",className:d.action,onClick:x,children:b("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:h||!A.trim(),onClick:V,children:b("fontDialogOk")})]})]})})})}const Uu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',Wu={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function ak({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useId(),g=c.useId(),h=c.useRef(null),[C,y]=c.useState("url"),[x,b]=c.useState(""),[S,v]=c.useState("");if(c.useEffect(()=>{e&&(y("url"),b(""),v(""))},[e]),c.useEffect(()=>{if(!e)return;const T=h.current,I=T==null?void 0:T.querySelector(Uu);I==null||I.focus();const E=R=>{if(R.key==="Escape"){R.preventDefault(),R.stopPropagation(),a();return}if(R.key!=="Tab"||!T)return;const j=[...T.querySelectorAll(Uu)];if(j.length===0)return;const F=j[0],U=j[j.length-1];R.shiftKey&&document.activeElement===F?(R.preventDefault(),U.focus()):!R.shiftKey&&document.activeElement===U&&(R.preventDefault(),F.focus())};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[e,a]),!e)return null;const k=C==="custom"?null:cf(x),P=C==="custom"?null:k&&x.trim().length>0?Wu[k]:k==="empty"&&x.trim().length===0?null:k?Wu[k]:null,N=C!=="custom"&&k===null&&!t&&x.trim().length>0,D=()=>{t||!n||i==null||i()},A=()=>{N&&r({url:x.trim(),title:S.trim()})};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:h,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:T=>T.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("youtubeDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("youtubeDialogCloseAria"),onClick:a,children:o.jsx(_e,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":C==="url",disabled:t,onClick:()=>y("url"),children:l("youtubeDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":C==="custom",disabled:t,onClick:()=>y("custom"),children:n.text}):null]}),C==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("youtubeDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:x,disabled:t,"aria-invalid":P!==null,"aria-describedby":P?g:void 0,onChange:T=>b(T.target.value)})]}):null,C==="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:D,children:n.buttonCaption})]}):null]}),C!=="custom"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("youtubeDialogTitleField")}),o.jsx("input",{id:p,className:d.textInput,value:S,disabled:t,onChange:T=>v(T.target.value)})]}):null,P?o.jsx("p",{id:g,className:d.error,children:l(P)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),C!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!N,onClick:A,children:l("fontDialogOk")}):null]})]})})})}const lk="_grid_1bpma_1",sk="_cell_1bpma_8",ck="_sizeLabel_1bpma_27",uk="_sizeFields_1bpma_33",dk="_numberInput_1bpma_37",bn={grid:lk,cell:sk,sizeLabel:ck,sizeFields:uk,numberInput:dk},Gu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])',Bt={rows:3,cols:3};function mk({open:e,disabled:t,onApply:n,onClose:r}){const i=W(),a=c.useId(),l=c.useId(),u=c.useId(),m=c.useRef(null),[p,g]=c.useState(Bt.rows),[h,C]=c.useState(Bt.cols),[y,x]=c.useState(String(Bt.rows)),[b,S]=c.useState(String(Bt.cols)),[v,k]=c.useState(!1);if(c.useEffect(()=>{e&&(g(Bt.rows),C(Bt.cols),x(String(Bt.rows)),S(String(Bt.cols)),k(!1))},[e]),c.useEffect(()=>{if(!e)return;const E=m.current,R=E==null?void 0:E.querySelector(Gu);R==null||R.focus();const j=F=>{if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),r();return}if(F.key!=="Tab"||!E)return;const U=[...E.querySelectorAll(Gu)];if(U.length===0)return;const $=U[0],X=U[U.length-1];F.shiftKey&&document.activeElement===$?(F.preventDefault(),X.focus()):!F.shiftKey&&document.activeElement===X&&(F.preventDefault(),$.focus())};return document.addEventListener("keydown",j,!0),()=>document.removeEventListener("keydown",j,!0)},[e,r]),!e)return null;const N=jm(p,h)&&!t,D=(E,R)=>{const j=Math.min(vn,Math.max(wn,E)),F=Math.min(vn,Math.max(wn,R));g(j),C(F),x(String(j)),S(String(F))},A=(E,R)=>{const j=Number.parseInt(E,10);if(!Number.isFinite(j)){R==="rows"?x(String(p)):S(String(h));return}k(!0),R==="rows"?D(j,h):D(p,j)},T=(E,R)=>{const j=E.replace(/\D/g,"");if(R==="rows"?x(j):S(j),j==="")return;const F=Number.parseInt(j,10);Number.isFinite(F)&&(k(!0),R==="rows"?D(F,h):D(p,F))},I=E=>{(E.key==="e"||E.key==="E"||E.key==="+"||E.key==="-"||E.key===".")&&E.preventDefault()};return o.jsx(se,{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:E=>E.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(_e,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx("div",{className:bn.grid,role:"grid","aria-label":i("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:nu},(E,R)=>Array.from({length:nu},(j,F)=>{const U=R+1,$=F+1,X=U<=p&&$<=h;return o.jsx("button",{type:"button",className:bn.cell,role:"gridcell","data-active":X?"true":void 0,"aria-label":`${U} × ${$}`,"aria-pressed":X&&U===p&&$===h,disabled:t,onMouseEnter:()=>{v||D(U,$)},onClick:()=>{k(!0),D(U,$)}},`${U}-${$}`)}))}),o.jsxs("p",{className:bn.sizeLabel,children:[i("tableDialogSize"),": ",p," × ",h]}),o.jsxs("div",{className:`${d.sizeRow} ${bn.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:bn.numberInput,type:"number",inputMode:"numeric",min:wn,max:vn,step:1,value:y,disabled:t,onKeyDown:I,onChange:E=>T(E.target.value,"rows"),onBlur:()=>A(y,"rows")})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:i("tableDialogColumns")}),o.jsx("input",{id:u,className:bn.numberInput,type:"number",inputMode:"numeric",min:wn,max:vn,step:1,value:b,disabled:t,onKeyDown:I,onChange:E=>T(E.target.value,"cols"),onBlur:()=>A(b,"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 fk={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},pk={value:1,unit:"pt"},gk={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 hk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=c.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(ke,{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 u=l.target.value==="separate"?"separate":"collapse";n({...e,borderCollapse:u,borderSpacing:u==="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(ke,{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 u=l.target.value;n({...e,border:{style:u,width:u==="none"?null:e.border.width??pk,color:u==="none"?null:e.border.color}})},children:si.map(l=>o.jsx("option",{value:l,children:r(fk[l])},l))})]}),e.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(ke,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:l=>n({...e,border:{...e.border,width:l}})}),o.jsx(et,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:l=>n({...e,border:{...e.border,color:l}})})]}):null,o.jsx(ke,{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:gk})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?o.jsx(ss,{shadow:e.boxShadow,disabled:t,onChange:l=>n({...e,boxShadow:l})}):null]})]})}const Vu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function bk({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useRef(null),[m,p]=c.useState(t);return c.useEffect(()=>{e&&p(t)},[e,t]),c.useEffect(()=>{if(!e)return;const g=u.current,h=g==null?void 0:g.querySelector(Vu);h==null||h.focus();const C=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!g)return;const x=[...g.querySelectorAll(Vu)];if(x.length===0)return;const b=x[0],S=x[x.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),S.focus()):!y.shiftKey&&document.activeElement===S&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:g=>g.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(_e,{})})]}),o.jsx(hk,{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 yk=["left","center","right"],xk={left:ni,center:ti,right:ri},Ck={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},wk={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},vk={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Po(e){return{top:e,right:e,bottom:e,left:e}}function Oa(e){for(const t of Me)if(e[t])return e[t];return null}function Sk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=c.useId(),l=c.useId(),[u,m]=c.useState(()=>Rt(e.padding,Po(Oa(e.padding))));return c.useEffect(()=>{m(Rt(e.padding,Po(Oa(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(et,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:p=>n({...e,backgroundColor:p})}),o.jsx(et,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:p=>n({...e,color:p})}),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:u,disabled:t,onChange:()=>{const p=!u;m(p),p&&n({...e,padding:Po(Oa(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(u?["top"]:Me).map(p=>o.jsx(ke,{label:r(u?"paragraphDialogPadding":wk[p]),value:e.padding[p],disabled:t,onChange:g=>{const h=u?Po(g):{...e.padding,[p]:g};n({...e,padding:h})}},p))})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":r("paragraphDialogAlignment"),children:yk.map(p=>{const g=xk[p],h=(e.textAlign??"left")===p;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":h,"aria-label":r(Ck[p]),disabled:t,onClick:()=>{n({...e,textAlign:p==="left"?null:p})},children:o.jsx(g,{})},p)})})]}),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:p=>{const g=p.target.value;n({...e,verticalAlign:g||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),pi.map(p=>o.jsx("option",{value:p,children:r(vk[p])},p))]})]}),o.jsx(ke,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:p=>n({...e,width:p})}),o.jsxs("div",{className:d.sizeRow,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:r("cellPropertiesColSpan")}),o.jsx("input",{id:a,className:d.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.colSpan,disabled:t,onChange:p=>{const g=Number.parseInt(p.target.value,10);n({...e,colSpan:Number.isFinite(g)?Math.max(1,g):1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:r("cellPropertiesRowSpan")}),o.jsx("input",{id:l,className:d.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:p=>{const g=Number.parseInt(p.target.value,10);n({...e,rowSpan:Number.isFinite(g)?Math.max(1,g):1})}})]})]})]})}const Zu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function kk({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useRef(null),[m,p]=c.useState(t);return c.useEffect(()=>{e&&p(t)},[e,t]),c.useEffect(()=>{if(!e)return;const g=u.current,h=g==null?void 0:g.querySelector(Zu);h==null||h.focus();const C=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!g)return;const x=[...g.querySelectorAll(Zu)];if(x.length===0)return;const b=x[0],S=x[x.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),S.focus()):!y.shiftKey&&document.activeElement===S&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:g=>g.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(_e,{})})]}),o.jsx(Sk,{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 Ak={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Pk={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Do(e){return{top:e,right:e,bottom:e,left:e}}function Ka(e){for(const t of Me)if(e[t])return e[t];return null}function Dk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),[a,l]=c.useState(()=>Rt(e.padding,Do(Ka(e.padding))));return c.useEffect(()=>{l(Rt(e.padding,Do(Ka(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(et,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),o.jsx(et,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:u=>n({...e,color:u})}),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 u=!a;l(u),u&&n({...e,padding:Do(Ka(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(a?["top"]:Me).map(u=>o.jsx(ke,{label:r(a?"paragraphDialogPadding":Ak[u]),value:e.padding[u],disabled:t,onChange:m=>{const p=a?Do(m):{...e.padding,[u]:m};n({...e,padding:p})}},u))})]}),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:u=>{const m=u.target.value;n({...e,verticalAlign:m||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),pi.map(u=>o.jsx("option",{value:u,children:r(Pk[u])},u))]})]}),o.jsx(ke,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}const qu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function jk({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useRef(null),[m,p]=c.useState(t);return c.useEffect(()=>{e&&p(t)},[e,t]),c.useEffect(()=>{if(!e)return;const g=u.current,h=g==null?void 0:g.querySelector(qu);h==null||h.focus();const C=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!g)return;const x=[...g.querySelectorAll(qu)];if(x.length===0)return;const b=x[0],S=x[x.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),S.focus()):!y.shiftKey&&document.activeElement===S&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:g=>g.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(_e,{})})]}),o.jsx(Dk,{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 Ek="_backdrop_9d3gw_1",Rk="_dialog_9d3gw_12",Tk="_headerRow_9d3gw_29",Nk="_header_9d3gw_29",Mk="_close_9d3gw_44",_k="_body_9d3gw_66",Lk="_frame_9d3gw_75",Ik="_actions_9d3gw_83",Fk="_action_9d3gw_83",At={backdrop:Ek,dialog:Rk,headerRow:Tk,header:Nk,close:Mk,body:_k,frame:Lk,actions:Ik,action:Fk},Yu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function Bk({open:e,html:t,onClose:n}){const r=W(),i=c.useId(),a=c.useRef(null),l=c.useRef(null);return c.useEffect(()=>{if(!e)return;const u=a.current,m=u==null?void 0:u.querySelector(Yu);m==null||m.focus();const p=g=>{if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),n();return}if(g.key!=="Tab"||!u)return;const h=[...u.querySelectorAll(Yu)];if(h.length===0)return;const C=h[0],y=h[h.length-1];g.shiftKey&&document.activeElement===C?(g.preventDefault(),y.focus()):!g.shiftKey&&document.activeElement===y&&(g.preventDefault(),C.focus())};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[e,n]),c.useEffect(()=>{var m;if(!e)return;const u=(m=l.current)==null?void 0:m.contentDocument;u&&Ya(u,t,r("previewDialogTitle"))},[e,t,r]),e?o.jsx(se,{children:o.jsx("div",{className:At.backdrop,role:"presentation",onMouseDown:n,children:o.jsxs("div",{ref:a,className:At.dialog,role:"dialog","aria-modal":"true","aria-labelledby":i,onMouseDown:u=>u.stopPropagation(),children:[o.jsxs("div",{className:At.headerRow,children:[o.jsx("h2",{className:At.header,id:i,children:r("previewDialogTitle")}),o.jsx("button",{type:"button",className:At.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:o.jsx(_e,{})})]}),o.jsx("div",{className:At.body,children:o.jsx("iframe",{ref:l,className:At.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var m;const u=(m=l.current)==null?void 0:m.contentDocument;u&&Ya(u,t,r("previewDialogTitle"))}})}),o.jsx("div",{className:At.actions,children:o.jsx("button",{type:"button",className:At.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const Pf="commspliant-html-editor.darkMode";function Hk(e){return typeof e=="boolean"?e:null}function Xu(){try{const e=localStorage.getItem(Pf);return e?Hk(JSON.parse(e)):null}catch{return null}}function zk(e){try{localStorage.setItem(Pf,JSON.stringify(e))}catch{}}const Df="commspliant-html-editor.pageZoom",Ok=new Set(["fitWidth","fitPage"]);function Kk(e){return typeof e=="string"&&Ok.has(e)||typeof e=="number"&&vb.includes(e)?e:null}function $k(){try{const e=localStorage.getItem(Df);return e?Kk(JSON.parse(e)):null}catch{return null}}function Uk(e){try{localStorage.setItem(Df,JSON.stringify(e))}catch{}}const jf="commspliant-html-editor.toolbarPosition",Wk=["top","left","right","bottom"];function Ef(e){return typeof e=="string"&&Wk.includes(e)?e:null}function Ju(){try{const e=localStorage.getItem(jf);return e?Ef(JSON.parse(e)):null}catch{return null}}function Gk(e){try{localStorage.setItem(jf,JSON.stringify(e))}catch{}}const Vk="_panel_6xdnw_1",Zk="_header_6xdnw_17",qk="_title_6xdnw_26",Yk="_close_6xdnw_32",Xk="_messages_6xdnw_48",Jk="_empty_6xdnw_57",Qk="_message_6xdnw_48",eA="_messageHeader_6xdnw_69",tA="_author_6xdnw_77",nA="_time_6xdnw_81",rA="_body_6xdnw_86",oA="_reply_6xdnw_92",iA="_input_6xdnw_100",aA="_post_6xdnw_111",Fe={panel:Vk,header:Zk,title:qk,close:Yk,messages:Xk,empty:Jk,message:Qk,messageHeader:eA,author:tA,time:nA,body:rA,reply:oA,input:iA,post:aA};function lA(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function sA({thread:e,locale:t,disabled:n,commentAuthor:r,panelRef:i,onPost:a,onClose:l}){const u=W(),[m,p]=c.useState(""),g=c.useRef(null);c.useEffect(()=>{var b;(b=g.current)==null||b.focus()},[e==null?void 0:e.id]);const h=!n&&r&&m.trim().length>0,C=c.useMemo(()=>(e==null?void 0:e.messages)??[],[e==null?void 0:e.messages]),y=C.length===0?u("commentPlaceholder"):u("commentReplyPlaceholder");if(!e)return null;const x=()=>{const b=m.trim();!b||!h||(a(b),p(""))};return wl.createPortal(o.jsxs("div",{ref:i,className:Fe.panel,role:"dialog","aria-label":u("commentPanelTitle"),children:[o.jsxs("div",{className:Fe.header,children:[o.jsx("h2",{className:Fe.title,children:u("commentPanelTitle")}),o.jsx("button",{type:"button",className:Fe.close,onClick:l,"aria-label":u("commentPanelCloseAria"),children:o.jsx(_e,{})})]}),o.jsx("div",{className:Fe.messages,children:C.length===0?o.jsx("p",{className:Fe.empty,children:u("commentEmpty")}):C.map(b=>o.jsxs("article",{className:Fe.message,children:[o.jsxs("header",{className:Fe.messageHeader,children:[o.jsx("span",{className:Fe.author,children:b.userName}),o.jsx("time",{className:Fe.time,dateTime:b.createdAt,children:lA(b.createdAt,t)})]}),o.jsx("p",{className:Fe.body,children:b.message})]},b.id))}),o.jsxs("div",{className:Fe.reply,children:[o.jsx("textarea",{ref:g,className:Fe.input,value:m,onChange:b=>p(b.target.value),placeholder:y,rows:3,disabled:n||!r}),o.jsx("button",{type:"button",className:Fe.post,onClick:x,disabled:!h,children:u("commentPost")})]})]}),document.body)}function cA({enabled:e,onHtml:t}){const[n,r]=c.useState(!1),i=c.useRef(0),a=c.useRef(e),l=c.useRef(t);a.current=e,l.current=t;const u=c.useCallback(()=>{i.current=0,r(!1)},[]);c.useEffect(()=>{e||u()},[e,u]);const m=c.useCallback(C=>{!a.current||!go(C.dataTransfer)||(C.preventDefault(),i.current+=1,r(!0))},[]),p=c.useCallback(C=>{!a.current||!go(C.dataTransfer)||(C.preventDefault(),C.dataTransfer&&(C.dataTransfer.dropEffect="copy"))},[]),g=c.useCallback(C=>{if(!a.current||!go(C.dataTransfer))return;const y=C.relatedTarget;y instanceof Node&&C.currentTarget.contains(y)||(i.current=Math.max(0,i.current-1),i.current===0&&r(!1))},[]),h=c.useCallback(C=>{if(!a.current||!go(C.dataTransfer))return;C.preventDefault(),u();const y=Eg(C.dataTransfer);y&&jl(y).then(x=>{a.current&&l.current(x)},()=>{})},[u]);return{dragging:n,onDragEnter:m,onDragOver:p,onDragLeave:g,onDrop:h}}const uA={menus:{edit:{id:"edit",labelKey:"menuEdit",ariaKey:"menuEditAria"}},submenus:{page:{id:"page",labelKey:"menuPage",ariaKey:"menuPageAria"}},groups:{edit:{id:"edit",labelKey:"toolbarGroupEdit"}},items:{undo:{id:"undo",command:"undo",icon:Zp,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:$p,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:ud,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"}}},dA=400,Qu=100;function mA(e){let t=[],n=e,r=[],i=!1,a=!1,l=0;function u(){t.length<=Qu||t.splice(0,t.length-Qu)}function m(y){t.push(y),u()}function p(y,x){if(i){n=y,i=!1;return}if(y===n)return;const b=Date.now(),S=(x==null?void 0:x.coalesce)===!0;if(S&&a&&b-l<dA){n=y,l=b;return}m(n),n=y,r=[],l=b,a=S}function g(){return t.length===0?null:(a=!1,r.push(n),n=t.pop(),n)}function h(){return r.length===0?null:(a=!1,m(n),n=r.pop(),n)}function C(y){if(i){n=y,i=!1;return}y!==n&&(m(n),n=y,r=[],a=!1)}return{record:p,undo:g,redo:h,canUndo:()=>t.length>0,canRedo:()=>r.length>0,syncExternal:C,markApplying:()=>{i=!0}}}function Ut(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function Qo(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):Ut(e,t):""}const ft="fullscreen",yl="commspliant-html-editor.toolbarCustomization";function xl(e){const t=e.filter(n=>n!==ft);return e.includes(ft)?[...t,ft]:t}function us(e,t){if(!t||t.length===0)return xl(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 u=e[l];if(i.has(u))continue;let m=0;for(let p=l-1;p>=0;p--){const g=e[p],h=a.indexOf(g);if(h>=0){m=h+1;break}}a.splice(m,0,u),i.add(u)}return xl(a)}function fA(e,t){const n=new Map(e.map(l=>[l.id,l])),r=us(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 u=n.get(l);if(!u)continue;const m=u.items.filter(p=>!i.has(p));m.length!==0&&a.push({id:l,items:m})}return a}function pA(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 gA(){try{const e=localStorage.getItem(yl);return e?pA(JSON.parse(e)):null}catch{return null}}function hA(e){try{if(!e){localStorage.removeItem(yl);return}localStorage.setItem(yl,JSON.stringify(e))}catch{}}function ds(e,t){return us(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function bA(e,t,n,r){const i=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?i.delete(n):i.add(n),{groupOrder:ds(e,t),hiddenItemIds:[...i]}}function Rf(e,t,n,r){const i=ds(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===ft||r===ft)return{groupOrder:i,hiddenItemIds:a};const l=i.indexOf(n),u=i.indexOf(r);if(l<0||u<0||l===u)return{groupOrder:i,hiddenItemIds:a};const m=[...i],[p]=m.splice(l,1);return m.splice(u,0,p),{groupOrder:xl(m),hiddenItemIds:a}}function ed(e,t,n,r){const i=ds(e,t),a=i.filter(m=>m!==ft),l=a.indexOf(n),u=l+r;return l<0||u<0||u>=a.length?{groupOrder:i,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:Rf(e,t,n,a[u])}const yA="_backdrop_11w4e_1",xA="_dialog_11w4e_12",CA="_header_11w4e_31",wA="_body_11w4e_39",vA="_group_11w4e_49",SA="_groupDragging_11w4e_55",kA="_groupDropTarget_11w4e_59",AA="_groupHeader_11w4e_64",PA="_groupTitle_11w4e_72",DA="_dragHandle_11w4e_77",jA="_moveButton_11w4e_78",EA="_items_11w4e_119",RA="_item_11w4e_119",TA="_itemIcon_11w4e_135",NA="_itemTitle_11w4e_144",MA="_itemCheckbox_11w4e_151",_A="_actions_11w4e_155",LA="_action_11w4e_155",IA="_spinnerWrap_11w4e_191",FA="_spinner_11w4e_191",fe={backdrop:yA,dialog:xA,header:CA,body:wA,group:vA,groupDragging:SA,groupDropTarget:kA,groupHeader:AA,groupTitle:PA,dragHandle:DA,moveButton:jA,items:EA,item:RA,itemIcon:TA,itemTitle:NA,itemCheckbox:MA,actions:_A,action:LA,spinnerWrap:IA,spinner:FA},td='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function BA(){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 HA({open:e,catalog:t,groups:n,settings:r,loading:i=!1,busy:a=!1,disabled:l,onChange:u,onReset:m,onClose:p}){const g=W(),h=c.useId(),C=c.useRef(null),[y,x]=c.useState(null),[b,S]=c.useState(null),v=us(n.map(j=>j.id),r==null?void 0:r.groupOrder),k=new Set((r==null?void 0:r.hiddenItemIds)??[]),P=new Map(n.map(j=>[j.id,j])),N=v.map(j=>P.get(j)).filter(j=>!!j),D=l||a||i;if(c.useEffect(()=>{e||(x(null),S(null))},[e]),c.useEffect(()=>{if(!e)return;const j=C.current,F=j==null?void 0:j.querySelector(td);F==null||F.focus();const U=$=>{if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),p();return}if($.key!=="Tab"||!j)return;const X=[...j.querySelectorAll(td)];if(X.length===0)return;const J=X[0],he=X[X.length-1];$.shiftKey&&document.activeElement===J?($.preventDefault(),he.focus()):!$.shiftKey&&document.activeElement===he&&($.preventDefault(),J.focus())};return document.addEventListener("keydown",U,!0),()=>document.removeEventListener("keydown",U,!0)},[e,p]),!e)return null;const A=N.map(j=>j.id).filter(j=>j!==ft),T=(j,F)=>{if(D||F===ft){j.preventDefault();return}j.dataTransfer.setData("text/plain",F),j.dataTransfer.effectAllowed="move",x(F)},I=(j,F)=>{D||F===ft||!y||y===F||(j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move"),S(F))},E=(j,F)=>{var $;j.preventDefault();const U=(($=j.dataTransfer)==null?void 0:$.getData("text/plain"))||y;x(null),S(null),!(!U||U===F||D)&&u(Rf(r,n,U,F))},R=()=>{x(null),S(null)};return o.jsx(se,{children:o.jsx("div",{className:fe.backdrop,role:"presentation",onMouseDown:p,children:o.jsxs("div",{ref:C,className:fe.dialog,role:"dialog","aria-modal":"true","aria-labelledby":h,"aria-busy":i||a?!0:void 0,onMouseDown:j=>j.stopPropagation(),children:[o.jsx("h2",{className:fe.header,id:h,children:g("customizeToolbarDialogTitle")}),o.jsx("div",{className:fe.body,children:i?o.jsx("div",{className:fe.spinnerWrap,role:"status","aria-live":"polite","aria-label":g("customizeToolbarDialogLoading"),children:o.jsx("span",{className:fe.spinner,"aria-hidden":"true"})}):N.map(j=>{const F=t.groups[j.id],U=F?Ut(g,F):j.id,$=j.id===ft,X=A.indexOf(j.id);return o.jsxs("section",{className:[fe.group,y===j.id?fe.groupDragging:"",b===j.id?fe.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":j.id,"aria-label":U,onDragOver:J=>I(J,j.id),onDrop:J=>E(J,j.id),onDragLeave:()=>{b===j.id&&S(null)},children:[o.jsxs("div",{className:fe.groupHeader,children:[o.jsx("button",{type:"button",className:fe.dragHandle,draggable:!D&&!$,disabled:D||$,"aria-label":g("customizeToolbarDragHandle"),onDragStart:J=>T(J,j.id),onDragEnd:R,children:o.jsx(BA,{})}),o.jsx("span",{className:fe.groupTitle,children:U}),o.jsx("button",{type:"button",className:fe.moveButton,disabled:D||$||X<=0,"aria-label":g("customizeToolbarMoveUp"),onClick:()=>u(ed(r,n,j.id,-1)),children:"↑"}),o.jsx("button",{type:"button",className:fe.moveButton,disabled:D||$||X<0||X>=A.length-1,"aria-label":g("customizeToolbarMoveDown"),onClick:()=>u(ed(r,n,j.id,1)),children:"↓"})]}),o.jsx("div",{className:fe.items,children:j.items.map(J=>{const he=t.items[J];if(!he)return null;const Y=he.icon,be=Ut(g,he),te=`${h}-${j.id}-${J}`,ie=!k.has(J);return o.jsxs("label",{className:fe.item,htmlFor:te,children:[o.jsx("span",{className:fe.itemIcon,"aria-hidden":"true",children:Y?o.jsx(Y,{}):be.slice(0,2)}),o.jsx("span",{className:fe.itemTitle,children:be}),o.jsx("input",{id:te,className:fe.itemCheckbox,type:"checkbox",checked:ie,disabled:D,"aria-label":`${be}: ${g("customizeToolbarItemVisible")}`,onChange:M=>u(bA(r,n,J,M.target.checked))})]},J)})})]},j.id)})}),o.jsxs("div",{className:fe.actions,children:[o.jsx("button",{type:"button",className:fe.action,disabled:D,onClick:m,children:g("customizeToolbarDialogReset")}),o.jsx("button",{type:"button",className:fe.action,"aria-label":g("customizeToolbarDialogCloseAria"),onClick:p,children:g("customizeToolbarDialogClose")})]})]})})})}function zA(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(u=>r.includes(u))})).filter(l=>l.items.length>0);return{menus:i,iconGroups:a}}const OA={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:Wp,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:_p,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:Op,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},jo=4;function Tf({icon:e,value:t,mixed:n,noneKey:r,labelKey:i,ariaKey:a,fallbackCustom:l,disabled:u,onChange:m}){const p=W(),g=c.useId(),h=c.useRef(null),C=c.useRef(null),y=c.useRef(null),[x,b]=c.useState(!1),[S,v]=c.useState({top:0,left:0}),k=c.useCallback(()=>{const T=C.current,I=y.current;if(!T)return;const E=T.getBoundingClientRect(),R=(I==null?void 0:I.offsetHeight)??0,j=(I==null?void 0:I.offsetWidth)??200;let F=E.bottom;F+R>window.innerHeight-jo&&(F=Math.max(jo,E.top-R));const U=Math.min(Math.max(E.left,jo),window.innerWidth-j-jo);v({top:F,left:U})},[]);c.useLayoutEffect(()=>{if(!x)return;k();const T=()=>k();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[x,k]),c.useEffect(()=>{if(!x)return;const T=E=>{var j,F;const R=E.target;(j=h.current)!=null&&j.contains(R)||(F=y.current)!=null&&F.contains(R)||b(!1)},I=E=>{var R;E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),b(!1),(R=C.current)==null||R.focus())};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",I,!0)}},[x]);const P=T=>{m(T)},N=`${tn.bar}${!t||n?` ${tn.barEmpty}`:""}`,D=t&&!n?{backgroundColor:t}:void 0,A=o.jsxs("div",{className:tn.wrap,ref:h,children:[o.jsxs("button",{ref:C,type:"button",className:`${q.iconButton} ${tn.button}`,"aria-label":p(a),"aria-expanded":x,"aria-haspopup":"listbox","aria-controls":x?g:void 0,disabled:u,onMouseDown:T=>T.preventDefault(),onClick:()=>b(T=>!T),children:[o.jsx(e,{className:`${q.icon} ${tn.icon}`}),o.jsx("span",{className:N,style:D})]}),x?o.jsx(se,{children:o.jsx("div",{ref:y,id:g,className:tn.popover,style:{top:S.top,left:S.left},children:o.jsx(as,{value:t,mixed:n,noneLabel:p(r),ariaLabel:p(a),disabled:u,fallbackCustom:l,onChange:P,onCommit:()=>b(!1)})})}):null]});return o.jsx($t,{label:p(i),children:A})}function KA({commands:e,queries:t,disabled:n}){return o.jsx(Tf,{icon:ad,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}function $A({commands:e,queries:t,disabled:n}){const r=W(),i=!!(n||!t.isVisualMode());return o.jsx(wf,{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 UA({commands:e,queries:t,disabled:n}){return o.jsx(Tf,{icon:ld,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function WA({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=W(),a=!!(n||!t.isVisualMode());return o.jsx(as,{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 GA="_wrap_1gtdc_1",VA="_wrapToolbar_1gtdc_7",ZA="_field_1gtdc_12",qA="_trigger_1gtdc_20",YA="_chevron_1gtdc_46",XA="_list_1gtdc_69",JA="_option_1gtdc_84",QA="_separator_1gtdc_113",Dt={wrap:GA,wrapToolbar:VA,field:ZA,trigger:qA,chevron:YA,list:XA,option:JA,separator:QA},Cl={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},eP={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 nd(){const e=W();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 Nf({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:i,listRef:a,style:l,customStylesEnabled:u=!1,customStyles:m=[],customStylesLoading:p=!1,onSelect:g,onSelectCustom:h,onAddNew:C}){const y=W(),x=t?null:e,b=u,S=!!(r&&u&&C);return r?o.jsxs(o.Fragment,{children:[Go.map(v=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitemradio","aria-checked":x===v,disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>g(v),children:y(Cl[v])},v)),b?o.jsx("div",{role:"separator",className:q.menuSeparator}):null,b&&p?o.jsx(nd,{}):null,b&&!p?m.map(v=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitem",disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>h==null?void 0:h(v.id),children:v.name},v.id)):null,S?o.jsxs(o.Fragment,{children:[b&&(p||m.length>0)?o.jsx("div",{role:"separator",className:q.menuSeparator}):null,o.jsxs("button",{type:"button",className:q.menuItem,role:"menuitem","aria-label":y("styleAddNewAria"),disabled:n,onMouseDown:v=>v.preventDefault(),onClick:()=>C==null?void 0:C(),children:[o.jsx(zp,{className:q.icon}),y("styleAddNew")]})]}):null]}):o.jsxs("ul",{ref:a,className:Dt.list,role:"listbox",id:i,style:l,"aria-label":y("commandParagraphStyleAria"),"aria-busy":b&&p?!0:void 0,children:[Go.map(v=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Dt.option,role:"option","aria-selected":x===v,disabled:n,style:eP[v],onMouseDown:k=>k.preventDefault(),onClick:()=>g(v),children:y(Cl[v])})},v)),b&&(p||m.length>0)?o.jsx("li",{role:"separator",className:Dt.separator}):null,b&&p?o.jsx("li",{role:"presentation",children:o.jsx(nd,{})}):null,b&&!p?m.map(v=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Dt.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>h==null?void 0:h(v.id),children:v.name})},v.id)):null]})}const Eo=4;function tP({commands:e,queries:t,disabled:n}){const r=W(),i=c.useId(),a=c.useRef(null),l=c.useRef(null),u=c.useRef(null),[m,p]=c.useState(!1),[g,h]=c.useState({top:0,left:0,width:0}),C=!!(n||!t.isVisualMode()),y=t.isParagraphStyleMixed(),x=y?null:t.getParagraphStyle(),b=x?r(Cl[x]):"",S=t.customParagraphStylesEnabled(),v=S?t.getCustomParagraphStyles():[],k=S&&t.isCustomParagraphStylesLoading(),P=c.useCallback(()=>{const D=l.current,A=u.current;if(!D)return;const T=D.getBoundingClientRect(),I=(A==null?void 0:A.offsetHeight)??0,E=Math.max(T.width,(A==null?void 0:A.offsetWidth)??0);let R=T.bottom;R+I>window.innerHeight-Eo&&(R=Math.max(Eo,T.top-I));const j=Math.min(Math.max(T.left,Eo),window.innerWidth-E-Eo);h({top:R,left:j,width:E})},[]);c.useLayoutEffect(()=>{if(!m)return;P();const D=()=>P();return window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[m,P,v.length,k]),c.useEffect(()=>{if(!m)return;const D=T=>{var E,R;const I=T.target;(E=a.current)!=null&&E.contains(I)||(R=u.current)!=null&&R.contains(I)||p(!1)},A=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),p(!1))};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",A,!0)}},[m]);const N=o.jsxs("div",{className:`${Dt.wrap} ${Dt.wrapToolbar}`,ref:a,children:[o.jsxs("div",{className:Dt.field,ref:l,children:[o.jsx("button",{type:"button",className:Dt.trigger,disabled:C,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":m,"aria-controls":m?i:void 0,onMouseDown:D=>D.preventDefault(),onClick:()=>p(D=>!D),children:b}),o.jsx("span",{className:Dt.chevron,"aria-hidden":"true"})]}),m?o.jsx(se,{children:o.jsx(Nf,{listRef:u,listId:i,value:x,mixed:y,disabled:C,customStylesEnabled:S,customStyles:v,customStylesLoading:k,style:{top:g.top,left:g.left,minWidth:g.width},onSelect:D=>{e.setParagraphStyle(D),p(!1)},onSelectCustom:D=>{e.applyCustomParagraphStyle(D),p(!1)}})}):null]});return o.jsx($t,{label:r("commandParagraphStyle"),children:N})}function nP({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),l=a?null:t.getParagraphStyle(),u=t.customParagraphStylesEnabled(),m=u?t.getCustomParagraphStyles():[],p=u&&t.isCustomParagraphStylesLoading();return o.jsx(Nf,{menu:!0,value:l,mixed:a,disabled:i,customStylesEnabled:u,customStyles:m,customStylesLoading:p,onSelect:g=>{e.setParagraphStyle(g),r==null||r()},onSelectCustom:g=>{e.openCustomParagraphStyleDialog(g),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const rP={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:nP,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:WA,enabled:"isVisualMode"},paragraph:{id:"paragraph",labelKey:"menuParagraph",ariaKey:"menuParagraphAria"}},groups:{font:{id:"font",labelKey:"toolbarGroupFont"},align:{id:"align",labelKey:"toolbarGroupAlign"},paragraph:{id:"paragraph",labelKey:"toolbarGroupParagraph"}},items:{fontFamily:{id:"fontFamily",widget:$0,icon:wp,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:tP,icon:Hp,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:$A,icon:Sp,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:vp,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:yp,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:Fp,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:sd,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:KA,icon:ad,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:UA,icon:ld,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:dp,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:Ep,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:Vp,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:Gp,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:pp,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:kp,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:ni,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:ti,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:ri,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:od,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:jp,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:Lp,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:id,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:cd,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},oP={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:Tp,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:mp,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:sd,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},audio:{id:"audio",command:"openAudioDialog",icon:up,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:Xp,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:Pp,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},pageBreak:{id:"pageBreak",command:"insertPageBreak",icon:Ip,labelKey:"commandPageBreak",ariaKey:"commandPageBreakAria",enabled:"isVisualMode"},insertPage:{id:"insertPage",command:"insertPage",icon:ud,labelKey:"commandInsertPage",ariaKey:"commandInsertPageAria",enabled:"canInsertPage"}}},iP={menus:{table:{id:"table",labelKey:"menuTable",ariaKey:"menuTableAria"}},submenus:{insertRow:{id:"insertRow",labelKey:"menuInsertRow",ariaKey:"menuInsertRowAria",enabled:"isInTable"},insertColumn:{id:"insertColumn",labelKey:"menuInsertColumn",ariaKey:"menuInsertColumnAria",enabled:"isInTable"}},groups:{table:{id:"table",labelKey:"toolbarGroupTable"}},items:{table:{id:"table",command:"openTableDialog",icon:Hc,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:Pa,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:Pa,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:Pa,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:Aa,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:Aa,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:Aa,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:Mp,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:qp,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:Hc,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:fp,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:Up,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},aP={menus:{view:{id:"view",labelKey:"menuView",ariaKey:"menuViewAria"}},submenus:{toolbar:{id:"toolbar",labelKey:"menuToolbar",ariaKey:"menuToolbarAria"},toolbarPosition:{id:"toolbarPosition",labelKey:"menuToolbarPosition",ariaKey:"menuToolbarPositionAria"},zoom:{id:"zoom",labelKey:"menuZoom",ariaKey:"menuZoomAria"}},groups:{view:{id:"view",labelKey:"toolbarGroupView"},fullscreen:{id:"fullscreen",labelKey:"toolbarGroupFullscreen"}},items:{visual:{id:"visual",command:"setVisualMode",icon:Yp,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:Dp,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:xp,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:Rp,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:Cp,labelKey:"modeDark",ariaKey:"modeDarkAria",active:"isDarkMode"},pageZoomFitWidth:{id:"pageZoomFitWidth",command:"setPageZoomFitWidth",labelKey:"pageZoomFitWidth",ariaKey:"pageZoomFitWidthAria",active:"isPageZoomFitWidth"},pageZoomFitPage:{id:"pageZoomFitPage",command:"setPageZoomFitPage",labelKey:"pageZoomFitPage",ariaKey:"pageZoomFitPageAria",active:"isPageZoomFitPage"},pageZoom50:{id:"pageZoom50",command:"setPageZoom50",labelKey:"pageZoom50",ariaKey:"pageZoom50Aria",active:"isPageZoom50"},pageZoom75:{id:"pageZoom75",command:"setPageZoom75",labelKey:"pageZoom75",ariaKey:"pageZoom75Aria",active:"isPageZoom75"},pageZoom100:{id:"pageZoom100",command:"setPageZoom100",labelKey:"pageZoom100",ariaKey:"pageZoom100Aria",active:"isPageZoom100"},pageZoom125:{id:"pageZoom125",command:"setPageZoom125",labelKey:"pageZoom125",ariaKey:"pageZoom125Aria",active:"isPageZoom125"},pageZoom150:{id:"pageZoom150",command:"setPageZoom150",labelKey:"pageZoom150",ariaKey:"pageZoom150Aria",active:"isPageZoom150"},pageZoom200:{id:"pageZoom200",command:"setPageZoom200",labelKey:"pageZoom200",ariaKey:"pageZoom200Aria",active:"isPageZoom200"},preview:{id:"preview",command:"openDocumentPreview",icon:Bp,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:Kp,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:Ap,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function lP(...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 sP=lP(OA,uA,oP,iP,aP,rP),cP={menus:[{id:"file",items:["save","open",de,"print"]},{id:"edit",items:["undo","redo",de,{submenu:"page",items:["pageProperties"]}]},{id:"insert",items:["link","bookmark",de,"image","audio","youtube","table","horizontalRule","pageBreak","insertComment","insertPage"]},{id:"table",items:["table",de,{submenu:"insertRow",items:["insertRowBelow","insertRowBefore","deleteRow"]},{submenu:"insertColumn",items:["insertColumnAfter","insertColumnBefore","deleteColumn"]},de,"mergeCells","unmergeCells",de,"tableProperties","cellProperties","rowProperties"]},{id:"view",items:["visual","html",de,{submenu:"toolbar",items:["customizeToolbar",de,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},de,{submenu:"zoom",items:["pageZoomFitWidth","pageZoomFitPage",de,"pageZoom50","pageZoom75","pageZoom100","pageZoom125","pageZoom150","pageZoom200"]},de,"lightMode","darkMode",de,"toggleCommentsVisible","preview","readAloud","fullscreen"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},de,{submenu:"font",items:["fontProperties","customCss",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,"imageProperties"]}],iconGroups:[{id:"file",items:["save","open"]},{id:"print",items:["print"]},{id:"edit",items:["undo","redo"]},{id:"insert",items:["link","bookmark","image","table","horizontalRule","addComment"]},{id:"table",items:["mergeCells","unmergeCells"]},{id:"font",items:["fontFamily","paragraphStyle","fontSize","fontColor","highlightColor","customCss","formatBrush","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","readAloud","toggleCommentsVisible"]},{id:"fullscreen",items:["fullscreen"]}]},rd={items:{addComment:{id:"addComment",command:"addComment",icon:Bc,labelKey:"commandAddComment",ariaKey:"commandAddCommentAria",enabled:"canAddComment"},insertComment:{id:"insertComment",command:"addComment",icon:Bc,labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:"canAddComment"},toggleCommentsVisible:{id:"toggleCommentsVisible",command:"toggleCommentsVisible",icon:gp,labelKey:"showComments",ariaKey:"toggleCommentsVisibleAria",toggle:!0,active:"areCommentsVisible"}}},uP=["addComment","insertComment","toggleCommentsVisible"],dP=new Set(["insert","view"]);function Mf(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!uP.includes(e):!0:!1}function mP(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!dP.has(e):!0:!1}function fP(e,t){const n=t?"hideComments":"showComments",r=rd.items.toggleCommentsVisible;return{...e,items:{...e.items,...rd.items,toggleCommentsVisible:r&&{...r,labelKey:n}}}}function pP(e){return{...e,menus:e.menus.map(t=>{if(t.id==="insert"){const n=[...t.items],r=n.indexOf("insertPage"),i=r===-1?n.length:r;return n.includes("insertComment")||n.splice(i,0,"insertComment"),{...t,items:n}}if(t.id==="view"){const n=[...t.items],r=n.indexOf("preview"),i=r===-1?n.length:r;return n.includes("toggleCommentsVisible")||n.splice(i,0,"toggleCommentsVisible"),{...t,items:n}}return t}),iconGroups:e.iconGroups.map(t=>t.id==="insert"&&!t.items.includes("addComment")?{...t,items:[...t.items,"addComment"]}:t.id==="view"&&!t.items.includes("toggleCommentsVisible")?{...t,items:[...t.items,"toggleCommentsVisible"]}:t)}}const Ro="fullscreen";function gP(e){const t=[];let n=null;for(const r of e){const i=r.items.filter(a=>a!==Ro);i.length>0&&t.push({id:r.id,items:i}),r.items.includes(Ro)&&(n={id:Ro,items:[Ro]})}return{main:t,trailing:n}}function hP({groups:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a}){const l=W(),{main:u,trailing:m}=gP(e),p=g=>{const h=t.groups[g.id];return o.jsx("div",{className:q.iconGroup,role:"group","aria-label":h?Ut(l,h):void 0,"data-toolbar-group":g.id,children:g.items.map(C=>{const y=t.items[C];if(!y)return null;const x=y.enabled?!r[y.enabled]():!1;if(y.widget){const k=y.widget;return o.jsx(k,{commands:n,queries:r,disabled:i||x},C)}if(!y.icon||!y.command)return null;const b=y.icon,S=y.command,v=y.active?r[y.active]():void 0;return o.jsx($t,{label:y.tooltip??Ut(l,y),children:o.jsx("button",{type:"button",className:q.iconButton,"aria-label":Qo(l,y),"aria-pressed":v,disabled:i||(a?Mf(C,a):!1)||x,onPointerDown:k=>k.preventDefault(),onMouseDown:k=>k.preventDefault(),onClick:()=>{Sl(n,S)},children:o.jsx(b,{className:q.icon})})},C)})},g.id)};return o.jsxs("div",{className:q.iconNav,role:"toolbar","aria-label":l("toolbarAria"),children:[u.length>0?o.jsx("div",{className:q.iconNavMain,children:u.map(p)}):null,m?o.jsx("div",{className:q.iconNavEnd,children:p(m)}):null]})}const bP=["--wysiwyg-menu-color","--wysiwyg-menu-background","--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function yP(e){const t={};for(const n of bP){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 xP({menus:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,compact:l,openMenuId:u,onOpenMenuIdChange:m}){const p=W(),[g,h]=c.useState(!1),[C,y]=c.useState({}),x=c.useRef(null),b=c.useRef(null),S=c.useRef(null),v=c.useRef(null),k=c.useCallback(()=>{h(!1),m(null)},[m]);c.useLayoutEffect(()=>{!g||!x.current||y(yP(x.current))},[g]),c.useEffect(()=>{var N;g&&((N=S.current)==null||N.focus())},[g]),c.useEffect(()=>{if(!g)return;const N=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=N}},[g]),c.useEffect(()=>{if(!g)return;const N=A=>{var T;if(A.key==="Escape"){if(A.preventDefault(),A.stopPropagation(),u){m(null);return}k(),(T=b.current)==null||T.focus()}},D=A=>{var T;v.current&&!v.current.contains(A.target)&&(k(),(T=b.current)==null||T.focus())};return document.addEventListener("keydown",N,!0),document.addEventListener("pointerdown",D),()=>{document.removeEventListener("keydown",N,!0),document.removeEventListener("pointerdown",D)}},[g,u,m,k]);const P=N=>e.map(D=>{const A=t.menus[D.id];return A?o.jsx(wP,{def:A,itemIds:D.items,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:N,open:(N==="overlay"||!g)&&u===D.id,onOpenChange:T=>m(T?D.id:null),onItemRun:N==="overlay"?()=>{var T;k(),(T=b.current)==null||T.focus()}:void 0},`${N}-${D.id}`):null});return o.jsxs("div",{className:q.menuBar,ref:x,children:[o.jsx($t,{label:p("brandMarkAria"),children:o.jsx("span",{className:q.brandMark,role:"img","aria-label":p("brandMarkAria"),children:o.jsx(hp,{className:q.brandMarkIcon})})}),o.jsx("div",{className:q.menuBarCompact,hidden:l===void 0?void 0:!l,children:o.jsx($t,{label:p("menuHamburgerAria"),children:o.jsx("button",{ref:b,type:"button",className:`${q.menuButton} ${q.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":g,"aria-label":p("menuHamburgerAria"),disabled:i||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>{if(g){k();return}m(null),h(!0)},children:o.jsx(Np,{className:q.icon})})})}),o.jsx("div",{className:q.menuBarDesktop,hidden:l===void 0?void 0:l,children:P("dropdown")}),g?o.jsx(se,{children:o.jsx("div",{className:q.toolbar,"data-menu-overlay-portal":"",style:C,children:o.jsxs("div",{ref:v,className:q.menuOverlay,role:"dialog","aria-modal":"true","aria-label":p("menuOverlayAria"),children:[o.jsxs("div",{className:q.menuOverlayHeader,children:[o.jsx("span",{className:q.menuOverlayTitle,children:p("menuOverlayAria")}),o.jsx("button",{ref:S,type:"button",className:q.iconButton,"aria-label":p("menuCloseAria"),onClick:()=>{var N;k(),(N=b.current)==null||N.focus()},children:o.jsx(_e,{className:q.icon})})]}),o.jsx("div",{className:q.menuOverlayBody,children:P("overlay")})]})})}):null]})}function ei(e,t){var n,r;if(zt(e))return!1;if(br(e)){const i=(n=t.submenus)==null?void 0:n[e.submenu];return i?i.panel?!0:e.items.some(a=>ei(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function CP(e,t,n){if(!zt(e[t])||!e.slice(t+1).some(a=>ei(a,n)))return!1;let i=!1;for(let a=t-1;a>=0;a--){const l=e[a];if(zt(l)){i=!0;continue}if(ei(l,n))return!i}return!1}function wP({def:e,itemIds:t,catalog:n,commands:r,queries:i,disabled:a,chromeLock:l,variant:u,open:m,onOpenChange:p,onItemRun:g}){const h=W(),C=c.useRef(null),y=u==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[x,b]=c.useState(null);c.useEffect(()=>{m||b(null)},[m]),c.useEffect(()=>{if(!m||u==="overlay")return;const v=P=>{C.current&&!C.current.contains(P.target)&&p(!1)},k=P=>{if(P.key==="Escape"){if(P.preventDefault(),P.stopPropagation(),x){b(null);return}p(!1)}};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",k,!0),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",k,!0)}},[m,x,p,u]);const S=()=>{p(!1),g==null||g()};return o.jsxs("div",{className:q.menuWrap,ref:C,children:[o.jsx("button",{type:"button",className:q.menuButton,"aria-haspopup":"menu","aria-expanded":m,"aria-controls":y,"aria-label":Qo(h,e),disabled:a||(l?mP(e.id,l):!1),onClick:()=>p(!m),children:Ut(h,e)}),m?o.jsx("div",{className:q.menu,role:"menu",id:y,onMouseDown:v=>v.preventDefault(),children:o.jsx(_f,{entries:t,catalog:n,commands:r,queries:i,disabled:a,chromeLock:l,variant:u,onClose:S,openSubmenuId:x,onOpenSubmenuIdChange:b})}):null]})}function _f({entries:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,openSubmenuId:m,onOpenSubmenuIdChange:p}){return o.jsx(o.Fragment,{children:e.map((g,h)=>{if(zt(g))return CP(e,h,t)?o.jsx("div",{role:"separator",className:q.menuSeparator},`separator-${h}`):null;if(br(g))return o.jsx(SP,{entry:g,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,open:m===g.submenu,onOpenChange:y=>p==null?void 0:p(y?g.submenu:null)},`submenu-${g.submenu}-${h}`);const C=t.items[g];return!C||!C.command?null:o.jsx(vP,{item:C,commands:n,queries:r,disabled:i,chromeLock:a,onClose:u},g)})})}function vP({item:e,commands:t,queries:n,disabled:r,chromeLock:i,onClose:a}){const l=W();if(!e.command)return null;const u=e.icon,m=e.command,p=e.active?n[e.active]():void 0,g=e.enabled?!n[e.enabled]():!1,h=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return o.jsxs("button",{type:"button",role:h,className:q.menuItem,"aria-checked":p,disabled:r||(i?Mf(e.id,i):!1)||g,onClick:()=>{a(),Sl(t,m)},children:[u?o.jsx(u,{className:q.icon}):null,Ut(l,e)]})}function SP({entry:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,open:m,onOpenChange:p}){var A;const g=W(),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState(null),b=(A=t.submenus)==null?void 0:A[e.submenu],S=l==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,v=b==null?void 0:b.panel,k=b!=null&&b.enabled?!r[b.enabled]():!1,P=l==="overlay";if(c.useEffect(()=>{m||x(null)},[m]),!b||!v&&!e.items.some(T=>ei(T,t)))return null;const N=T=>{(T.key==="ArrowRight"||T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),p(!0),requestAnimationFrame(()=>{var E;const I=(E=C.current)==null?void 0:E.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');I==null||I.focus()}))},D=T=>{var I;T.key==="ArrowLeft"&&(T.preventDefault(),T.stopPropagation(),p(!1),(I=h.current)==null||I.focus())};return o.jsxs("div",{className:q.submenuWrap,onMouseEnter:P?void 0:()=>p(!0),onMouseLeave:P?void 0:()=>p(!1),children:[o.jsx("button",{ref:h,type:"button",role:"menuitem",className:`${q.menuItem} ${q.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":m,"aria-controls":S,"aria-label":Qo(g,b),disabled:i||k||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>p(P?!m:!0),onKeyDown:N,children:Ut(g,b)}),m?o.jsx("div",{ref:C,className:`${q.menu} ${q.submenu}`,role:"menu",id:S,"aria-label":Qo(g,b),onMouseDown:T=>T.preventDefault(),onKeyDown:D,children:v?o.jsx(v,{commands:n,queries:r,disabled:i||k,onMenuClose:u}):o.jsx(_f,{entries:e.items,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,openSubmenuId:y,onOpenSubmenuIdChange:x})}):null]})}function $a({catalog:e,layout:t,commands:n,queries:r,disabled:i,chromeLock:a,menuVisible:l=!0,toolbarVisible:u=!0,compact:m,position:p="top"}){const[g,h]=c.useState(null);return!l&&!u?null:o.jsxs("div",{className:q.toolbar,"data-compact":m?"":void 0,"data-toolbar-position":p,children:[l?o.jsx(xP,{menus:t.menus,catalog:e,commands:n,queries:r,disabled:i,chromeLock:a,compact:m,openMenuId:g,onOpenMenuIdChange:h}):null,u?o.jsx(hP,{groups:t.iconGroups,catalog:e,commands:n,queries:r,disabled:i,chromeLock:a}):null]})}const kP="_root_3hjd3_1",AP="_fullscreen_3hjd3_36",PP="_exitFullscreen_3hjd3_48",DP="_exitFullscreenIcon_3hjd3_79",jP="_menuChrome_3hjd3_94",EP="_body_3hjd3_105",RP="_iconChrome_3hjd3_135",TP="_workspace_3hjd3_179",NP="_workspacePageSized_3hjd3_191",MP="_pageCanvasViewport_3hjd3_195",_P="_htmlFileDropOverlay_3hjd3_205",LP="_surface_3hjd3_219",IP="_visual_3hjd3_226",FP="_multiPageContainer_3hjd3_258",BP="_pageBlock_3hjd3_266",HP="_pageGap_3hjd3_273",zP="_pageSurface_3hjd3_279",OP="_html_3hjd3_205",pe={root:kP,fullscreen:AP,exitFullscreen:PP,exitFullscreenIcon:DP,menuChrome:jP,body:EP,iconChrome:RP,workspace:TP,workspacePageSized:NP,pageCanvasViewport:MP,htmlFileDropOverlay:_P,surface:LP,visual:IP,multiPageContainer:FP,pageBlock:BP,pageGap:HP,pageSurface:zP,html:OP},KP=c.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i},a){const l=W();return o.jsx("textarea",{ref:a,className:`${pe.surface} ${pe.html}`,value:t,onChange:u=>n(u.target.value),placeholder:r,disabled:i,"aria-label":l("htmlEditorAria"),spellCheck:!1})}),$P=c.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i,onBeforeInput:a,onPointerDown:l,onMouseUp:u,onContextMenu:m},p){const g=W(),h=c.useRef(null),C=c.useRef(a);C.current=a;const y=x=>{h.current=x,typeof p=="function"?p(x):p&&(p.current=x)};return c.useLayoutEffect(()=>{const x=h.current;x&&(x.innerHTML!==t&&(x.innerHTML=t),oi(x),Tn(x,t))},[t]),c.useLayoutEffect(()=>{const x=h.current;if(!x)return;const b=S=>{var v;(v=C.current)==null||v.call(C,S)};return x.addEventListener("beforeinput",b),()=>x.removeEventListener("beforeinput",b)},[]),o.jsx("div",{ref:y,className:`${pe.surface} ${pe.visual}`,contentEditable:!i,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":g("visualEditorAria"),"aria-disabled":i||void 0,"data-placeholder":r,onPointerDown:l,onMouseUp:u,onContextMenu:m,onInput:x=>{n(x.currentTarget.innerHTML)}})}),UP=c.forwardRef(function({pages:t,activePageIndex:n,onActivePageIndexChange:r,onPageChange:i,placeholder:a,disabled:l,onBeforeInput:u,onPointerDown:m,onMouseUp:p,onContextMenu:g},h){const C=W(),y=c.useRef(null),x=c.useRef(n);x.current=n;const b=c.useRef(u);b.current=u;const S=c.useRef(t);S.current=t,c.useImperativeHandle(h,()=>({getContainer:()=>y.current,getActivePageRoot:()=>{const P=y.current;return P?No(P,x.current):null},getActivePageIndex:()=>x.current,flushPageHtml:P=>{var D;const N=y.current;return N?((D=No(N,P))==null?void 0:D.innerHTML)??null:null}}));const v=c.useCallback((P,N)=>{const D=jt(N).body;P.innerHTML!==D&&(P.innerHTML=D),oi(P),Tn(P,N)},[]);c.useLayoutEffect(()=>{const P=y.current;if(P)for(let N=0;N<t.length;N+=1){const D=No(P,N);D&&v(D,t[N]??"")}},[t,v]),c.useLayoutEffect(()=>{const P=y.current;if(!P)return;const N=D=>{var A;(A=b.current)==null||A.call(b,D)};return P.addEventListener("beforeinput",N),()=>P.removeEventListener("beforeinput",N)},[]);const k=P=>{P!==n&&r(P)};return o.jsx("div",{ref:y,className:pe.multiPageContainer,children:t.map((P,N)=>o.jsxs("div",{className:pe.pageBlock,children:[N>0?o.jsx("div",{className:pe.pageGap,"aria-hidden":"true"}):null,o.jsx("div",{className:`${pe.surface} ${pe.visual} ${pe.pageSurface}`,[Wa]:"","data-page-index":N,contentEditable:!l,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":C("visualEditorAria"),"aria-disabled":l||void 0,"data-placeholder":N===0?a:void 0,onFocus:()=>k(N),onPointerDown:m,onMouseUp:p,onContextMenu:g,onInput:D=>{i(N,D.currentTarget.innerHTML)}})]},N))})});function WP({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:i,onOpen:a,mode:l,defaultMode:u="visual",onModeChange:m,fullscreen:p,defaultFullscreen:g=!1,onFullscreenChange:h,placeholder:C,disabled:y,readOnly:x=!1,className:b,locale:S="en",toolbarBackground:v,menuColor:k,menuBackground:P,menuFontSize:N,menuFontFamily:D,border:A,menuVisible:T=!0,toolbarVisible:I=!0,allowedChrome:E,customActions:R,customFonts:j,transformHtml:F,loadCustomParagraphStyles:U,onSaveCustomParagraphStyle:$,onDeleteCustomParagraphStyle:X,customImagePicker:J,disableBuiltinImageInsert:he,customAudioPicker:Y,disableBuiltinAudioInsert:be,customVideoPicker:te,disableBuiltinVideoInsert:ie,disableHtmlFileDrop:M=!1,toolbarCustomization:V,darkMode:re=!1,darkModePersistence:G,toolbarPosition:ye="top",toolbarPositionPersistence:Le,enableMultiPages:xe=!1,pages:Zt,defaultPages:kr,onPagesChange:Hn,enableComments:Ie=!1,defaultCommentsVisible:Lf=!0,commentAuthor:Ar,comments:If,defaultComments:Ff=[],onCommentsChange:Bf}){const ne=!!(y||x),zn=!!y,Hf=$c(kr??(t.trim()?[t]:[Ga()])),zf=xe?mt(Hf):t,Of=xe&&Zt!==void 0?mt($c(Zt)):e,[Ae,ms]=Co({value:Of,defaultValue:zf,onChange:xe?void 0:n}),[ue,fs]=Co({value:l,defaultValue:u,onChange:m}),[xt,On]=Co({value:p,defaultValue:g,onChange:h}),[st,Kf]=c.useState(Lf),[ct,Ct]=c.useState(null),[sn,Kn]=Co({value:If,defaultValue:Ff,onChange:Bf}),L=c.useRef(null),gi=c.useRef(null),ps=c.useRef(null),Pr=c.useRef(null),Oe=c.useRef(null),Ve=c.useRef(xe);Ve.current=xe;const qt=c.useRef(Ie);qt.current=Ie;const gs=c.useRef(x);gs.current=x;const hs=c.useRef(ne);hs.current=ne;const Dr=c.useRef(st);Dr.current=st;const jr=c.useRef(sn);jr.current=sn;const Er=c.useRef(Hn);Er.current=Hn;const[Yt,bs]=c.useState(0),$n=c.useRef(Yt);$n.current=Yt;const hi=c.useRef(null);hi.current===null&&(hi.current=mA(Ae));const Ze=hi.current,Ce=c.useRef(Ae);Ce.current=Ae;const Rr=c.useRef(!0),bi=c.useRef(""),cn=c.useRef(null),H=c.useRef(ue);H.current=ue;const ys=c.useRef(xt);ys.current=xt;const Se=c.useRef(null),[,$f]=c.useState(0),Un=c.useRef(null);Un.current===null&&(Un.current=oC(()=>{$f(s=>s+1)}));const Tr=c.useRef(F);Tr.current=F;const qe=c.useRef({}),Ke=c.useRef(null),Ye=c.useRef(null),tt=c.useRef(null),nt=c.useRef(null),Nt=c.useRef(null),$e=c.useRef(null),[Nr,yi]=c.useState(Et),xi=c.useRef(Nr);xi.current=Nr;const wt=c.useRef(nn),[Wn,Mr]=c.useState({value:null,unit:nn,mixed:!1}),Mt=c.useRef(Wn);Mt.current=Wn;const[Gn,Ci]=c.useState({value:null,mixed:!1}),Vn=c.useRef(Gn);Vn.current=Gn;const[Zn,wi]=c.useState({value:null,mixed:!1}),qn=c.useRef(Zn);qn.current=Zn;const[Yn,vi]=c.useState({value:null,mixed:!1}),Xn=c.useRef(Yn);Xn.current=Yn;const[Si,ki]=c.useState({tag:null,mixed:!1}),Ai=c.useRef(Si);Ai.current=Si;const[xs,Pi]=c.useState({align:"left",mixed:!1}),Di=c.useRef(xs);Di.current=xs;const[Cs,ji]=c.useState({type:null,mixed:!1}),Jn=c.useRef(Cs);Jn.current=Cs;const[ws,Ei]=c.useState(!1),vs=c.useRef(ws);vs.current=ws;const[Ri,Ti]=c.useState(!1),Ni=c.useRef(Ri);Ni.current=Ri;const[Mi,Ss]=c.useState(!1),_r=c.useRef(Mi);_r.current=Mi;const Lr=c.useRef(null),Ir=c.useRef(null),[ks,As]=c.useState(!1),Ps=c.useRef(ks);Ps.current=ks;const[Qn,Fr]=c.useState({open:!1,tab:"general"}),[_i,Ds]=c.useState(!1),[er,js]=c.useState({open:!1,html:""}),[Li,Br]=c.useState(null),[Uf,Ii]=c.useState(!1),[Wf,Fi]=c.useState(!1),[un,Hr]=c.useState(()=>G?re:Xu()??re),[rt,zr]=c.useState(()=>Le?ye:Ju()??ye),[Or,Gf]=c.useState(()=>$k()??"fitWidth"),[Bi,Vf]=c.useState(1),[Xt,Kr]=c.useState({open:!1,tab:"general",value:ur()}),[$r,Hi]=c.useState({open:!1,value:""}),[Jt,dn]=c.useState({open:!1,tab:"font",value:fl()}),[zi,Es]=c.useState([]),[Oi,Ki]=c.useState(!1),[Zf,Ur]=c.useState(!1),[Pe,tr]=c.useState({open:!1}),[Ue,Wr]=c.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[$i,Ui]=c.useState({open:!1,existingIds:[]}),[qf,Gr]=c.useState({open:!1}),[Yf,Vr]=c.useState({open:!1}),[Xf,nr]=c.useState({open:!1}),[Zr,qr]=c.useState({open:!1,tab:"general",value:Om(),aspectRatio:1}),[Wi,Gi]=c.useState({open:!1}),[Yr,Vi]=c.useState({open:!1,value:ZC()}),[Xr,Zi]=c.useState({open:!1,value:ow()}),[Jr,qi]=c.useState({open:!1,value:pw()}),[Qt,Yi]=c.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1}),[De,mn]=c.useState(null),Xi=c.useRef(De);Xi.current=De;const[Ji,Rs]=c.useState(!1),Ts=c.useRef(Ji);Ts.current=Ji;const[Qi,Ns]=c.useState(!1),Ms=c.useRef(Qi);Ms.current=Qi;const[ea,_s]=c.useState(!1),Ls=c.useRef(ea);Ls.current=ea;const Is=c.useRef(void 0),Qr=c.useRef(zi);Qr.current=zi;const Fs=c.useRef(Oi);Fs.current=Oi;const ta=!!(U&&$),na=c.useRef(ta);na.current=ta;const Bs=c.useRef(U);Bs.current=U;const Hs=c.useRef($);Hs.current=$;const zs=c.useRef(X);zs.current=X;const Os=c.useRef(i);Os.current=i;const Ks=c.useRef(a);Ks.current=a;const $s=c.useRef(J);$s.current=J;const Us=c.useRef(Y);Us.current=Y;const Ws=c.useRef(te);Ws.current=te;const Gs=c.useRef(V);Gs.current=V;const Vs=c.useRef(G);Vs.current=G;const Zs=c.useRef(Le);Zs.current=Le;const qs=c.useRef(un);qs.current=un;const Ys=c.useRef(rt);Ys.current=rt;const ra=c.useRef(Or);ra.current=Or;const Xs=c.useRef(he);Xs.current=he;const Js=c.useRef(be);Js.current=be;const Qs=c.useRef(ie);Qs.current=ie;const oa=c.useRef(0),rr=c.useRef(0),ec=c.useRef(0),eo=c.useRef(0),tc=c.useRef(0),to=c.useRef(0),nc=c.useRef(0),_t=c.useMemo(()=>kd(j),[j]),fn=c.useRef(_t);fn.current=_t;const ia=c.useMemo(()=>Ug(Ae,_t).join(`
95
- `),[Ae,_t]),no=c.useMemo(()=>Pt(Ae).map(s=>jt(s).body),[Ae]),ro=c.useMemo(()=>xe?no[Yt]??"":jt(Ae).body,[xe,no,Yt,Ae]),rc=c.useMemo(()=>Qy(jn(ro)),[ro]);c.useEffect(()=>{const f=(ia?ia.split(`
96
- `):[]).map(w=>{const _=document.createElement("link");return _.rel="stylesheet",_.href=w,_.setAttribute(ii,""),document.head.append(_),_});return()=>{for(const w of f)w.remove()}},[ia]);const oo=c.useCallback(async()=>{const s=Bs.current;if(!s)return;const f=++oa.current;Ki(!0);try{const w=await s();if(f!==oa.current)return;Es(w)}catch{}finally{f===oa.current&&Ki(!1)}},[]);c.useEffect(()=>{if(!U||!$){Es([]),Ki(!1);return}oo()},[U,$,oo]);const oc=c.useCallback(async s=>{Br(s);const f=Gs.current;if(f!=null&&f.load&&f.save){const w=++ec.current;Fi(!0);try{await f.save(s)}catch{}finally{w===ec.current&&Fi(!1)}return}hA(s)},[]);c.useEffect(()=>{const s=V;if(!(s!=null&&s.load)||!s.save){Br(gA()),Ii(!1),Fi(!1);return}const f=++rr.current;return Ii(!0),(async()=>{try{const w=await s.load();if(f!==rr.current)return;Br(w)}catch{if(f!==rr.current)return;Br(null)}finally{f===rr.current&&Ii(!1)}})(),()=>{rr.current+=1}},[V]);const ic=c.useCallback(async s=>{Hr(s);const f=Vs.current;if(f!=null&&f.load&&f.save){const w=++tc.current;try{await f.save(s)}catch{}finally{if(w!==tc.current)return}return}zk(s)},[]),ac=c.useCallback(s=>{Gf(s),Uk(s)},[]);c.useEffect(()=>{const s=G;if(!(s!=null&&s.load)||!s.save){Hr(Xu()??re);return}const f=++eo.current;return(async()=>{try{const w=await s.load();if(f!==eo.current)return;Hr(typeof w=="boolean"?w:re)}catch{if(f!==eo.current)return;Hr(re)}})(),()=>{eo.current+=1}},[G,re]),c.useLayoutEffect(()=>{if(ue!=="visual")return;const s=L.current;s&&Tn(s,ro)},[ue,ro,Yt,xe]),c.useLayoutEffect(()=>{if(ue!=="visual")return;const s=ps.current;if(!s)return;const f=()=>{const O=L.current,Z=getComputedStyle(s),Ne=parseFloat(Z.paddingLeft)+parseFloat(Z.paddingRight),ir=parseFloat(Z.paddingTop)+parseFloat(Z.paddingBottom),Ic=Math.max(0,s.clientWidth-Ne),Fc=Math.max(0,s.clientHeight-ir),sp=(O==null?void 0:O.offsetWidth)??Ic,cp=(O==null?void 0:O.offsetHeight)??Fc;Vf(Ab(ra.current,Ic,Fc,sp,cp))};if(f(),typeof ResizeObserver>"u")return;const w=new ResizeObserver(f);w.observe(s);const _=L.current;return _&&w.observe(_),f(),()=>w.disconnect()},[ue,Ae,Yt,no,Or,rc]);const lc=c.useCallback(async s=>{zr(s);const f=Zs.current;if(f!=null&&f.load&&f.save){const w=++nc.current;try{await f.save(s)}catch{}finally{if(w!==nc.current)return}return}Gk(s)},[]);c.useEffect(()=>{const s=Le;if(!(s!=null&&s.load)||!s.save){zr(Ju()??ye);return}const f=++to.current;return(async()=>{try{const w=await s.load();if(f!==to.current)return;zr(Ef(w)??ye)}catch{if(f!==to.current)return;zr(ye)}})(),()=>{to.current+=1}},[Le,ye]);const pn=c.useCallback(s=>{var w,_;const f=((w=Tr.current)==null?void 0:w.call(Tr,s))??s;return f!==Ce.current&&(Rr.current=!0),ms(f),Ve.current&&((_=Er.current)==null||_.call(Er,Pt(f),$n.current)),f},[ms]),me=c.useCallback((s,f)=>{const w=pn(s);return Ze.record(w,{coalesce:f}),w},[pn,Ze]),Jf=c.useCallback(s=>{if(Ve.current){const f=Pt(Ce.current),w=$n.current,_=[...f];_[w]=s,me(mt(_),!1);return}me(s,!1)},[me]),or=cA({enabled:!ne&&!M,onHtml:Jf}),oe=c.useCallback((s,f)=>{const w=rb(s,Ce.current);return me(ho(w,bo(w,Ce.current,fn.current)),f)},[me]),io=c.useCallback((s,f)=>ho(s,bo(s,f,fn.current)),[]),vt=c.useCallback(()=>{const s=Pr.current;return(s==null?void 0:s.getContainer())?Pt(Ce.current).map((_,O)=>{const Z=s==null?void 0:s.flushPageHtml(O);return Z===null?_:io(Z,_)}):Pt(Ce.current)},[io]),aa=c.useCallback((s,f,w)=>{const _=Pt(Ce.current),O=[..._];O[s]=io(f,_[s]??""),me(mt(O),w)},[me,io]),ee=c.useCallback((s,f)=>{var _;if(!Ve.current){oe(s.innerHTML,f);return}const w=(_=Pr.current)==null?void 0:_.getContainer();if(!w){oe(s.innerHTML,f);return}for(let O=0;O<Pt(Ce.current).length;O+=1)if(No(w,O)===s){aa(O,s.innerHTML,f);return}oe(s.innerHTML,f)},[aa,oe]),sc=c.useCallback((s,f)=>{gs.current||ee(s,f)},[ee]),cc=c.useCallback(()=>{const s=Ve.current?vt():Pt(Ce.current);return s[$n.current]??s[0]??""},[vt]),ao=c.useCallback(()=>Ve.current?vt():[Ce.current],[vt]),uc=c.useCallback(()=>{if(!Ve.current||H.current!=="visual")return;const s=vt(),f=$n.current+1,w=[...s];w.splice(f,0,Ga()),me(mt(w),!1),bs(f)},[vt,me]),lo=c.useCallback(()=>{const s=Ze.undo();s!==null&&(Ze.markApplying(),pn(s))},[pn,Ze]),so=c.useCallback(()=>{const s=Ze.redo();s!==null&&(Ze.markApplying(),pn(s))},[pn,Ze]);c.useEffect(()=>{Ze.syncExternal(Ae)},[Ae,Ze]);const B=c.useCallback(()=>{Se.current=dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current})},[]),ut=c.useCallback(s=>{if(!s||H.current!=="visual"){Rs(!1),Ns(!1),_s(!1);return}Rs(ql(s)!==null),Ns(ou(s)),_s(iu(s))},[]),la=c.useCallback(()=>{const s=dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current}),f=Se.current;Vc(f,s)||(Se.current=s)},[]),sa=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){Mr({value:null,unit:wt.current,mixed:!1});return}const f=am(s,wt.current);Ke.current&&(f.value=Ke.current.value,f.unit=Ke.current.unit,f.mixed=!1),wt.current=f.unit,Mr(w=>w.value===f.value&&w.unit===f.unit&&w.mixed===f.mixed?w:f)},[]),ca=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){Ci({value:null,mixed:!1});return}const f=Dd(s);Ye.current&&(f.value=Ye.current.value,f.mixed=!1),Ci(w=>w.value===f.value&&w.mixed===f.mixed?w:f)},[]),ua=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){wi({value:null,mixed:!1}),vi({value:null,mixed:!1});return}const f=zo(s,"color");tt.current&&(f.value=tt.current.value,f.mixed=!1);const w=zo(s,"backgroundColor");nt.current&&(w.value=nt.current.value,w.mixed=!1),wi(_=>_.value===f.value&&_.mixed===f.mixed?_:f),vi(_=>_.value===w.value&&_.mixed===w.mixed?_:w)},[]),da=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){ki({tag:null,mixed:!1});return}const f=py(s);ki(w=>w.tag===f.tag&&w.mixed===f.mixed?w:f)},[]),ma=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){Pi({align:null,mixed:!1}),ji({type:null,mixed:!1}),Ei(!1),As(!1);return}const f=_m(s);Pi(Z=>Z.align===f.align&&Z.mixed===f.mixed?Z:f);const w=xm(s);ji(Z=>Z.type===w.type&&Z.mixed===w.mixed?Z:w);const _=ky(s);Ei(Z=>Z===_?Z:_);const O=S1(s);As(Z=>Z===O?Z:O)},[]),z=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){yi(Et()),Ti(!1),sa(),ca(),ua(),da(),ma();return}const f=Se.current,w=!!(f&&!f.collapsed);Ti(O=>O===w?O:w);const _=dm(Cn(s),qe.current);yi(O=>Gb(O,_)?O:_),sa(),ca(),ua(),da(),ma()},[sa,ca,ua,da,ma]),dc=c.useCallback(()=>{const s=Se.current,f=$e.current;!f||!s||s.collapsed&&s.start===f.start&&s.end===f.end||(qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,Nt.current=null,$e.current=null)},[]);c.useEffect(()=>{Rr.current=!0},[Ae]),c.useEffect(()=>{if(ue==="visual"){z();return}qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,Nt.current=null,$e.current=null,yi(Et()),Mr({value:null,unit:wt.current,mixed:!1}),Ci({value:null,mixed:!1}),wi({value:null,mixed:!1}),vi({value:null,mixed:!1}),ki({tag:null,mixed:!1}),Pi({align:null,mixed:!1}),ji({type:null,mixed:!1}),Ei(!1),Ti(!1)},[ue,z]);const gn=c.useCallback((s,f,w)=>{uh({snapshot:s,visualEl:L.current,htmlEl:Oe.current,getHtml:()=>H.current==="visual"&&L.current?L.current.innerHTML:Ce.current,setHtml:_=>{if(H.current==="visual"){oe(jt(_).body,!1);return}me(_,!1)},content:f,asHtml:w})},[me,oe]),mc=c.useCallback(s=>{if(H.current==="visual"&&s==="html"){if(Ve.current){const f=mt(vt());f!==Ce.current&&me(f,!0)}else if(L.current){const f=L.current.innerHTML,w=ho(f,bo(f,Ce.current,fn.current));w!==Ce.current&&me(w,!0)}}fs(s)},[me,fs,vt]);c.useEffect(()=>{if(!xt)return;const s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}},[xt]),c.useEffect(()=>{if(!xt)return;const s=f=>{f.key==="Escape"&&(f.defaultPrevented||Qn.open||$r.open||Xt.open||Jt.open||Wi.open||Yr.open||Xr.open||Jr.open||_i||er.open||(f.preventDefault(),On(!1)))};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[xt,On,Qn.open,$r.open,Xt.open,Jt.open,Wi.open,Yr.open,Xr.open,Jr.open,_i,er.open]),c.useEffect(()=>{const s=()=>{if(H.current!=="visual"||!L.current)return;const f=window.getSelection();if(!f||f.rangeCount===0)return;const w=f.anchorNode;!w||!L.current.contains(w)&&L.current!==w||cn.current===null&&(cn.current=window.requestAnimationFrame(()=>{var O;cn.current=null;const _=L.current;if(!(!_||H.current!=="visual")&&(B(),dc(),z(),mn(Ht(_)),ut(_),qt.current&&Dr.current&&!((O=gi.current)!=null&&O.contains(document.activeElement)))){const Z=Se.current;Z&&Ct(yu(_,Z))}}))};return document.addEventListener("selectionchange",s),()=>{document.removeEventListener("selectionchange",s),cn.current!==null&&(window.cancelAnimationFrame(cn.current),cn.current=null)}},[B,dc,z,ut]),c.useEffect(()=>{(!Ie||ue!=="visual"||!st)&&Ct(null)},[Ie,ue,st]),c.useEffect(()=>{if(!ct)return;const s=f=>{var O;const w=f.target;if((O=gi.current)!=null&&O.contains(w))return;const _=L.current;_&&Cu(_,w)||Ct(null)};return document.addEventListener("pointerdown",s),()=>document.removeEventListener("pointerdown",s)},[ct]),c.useEffect(()=>{if(ue!=="html")return;const s=Oe.current;if(!s)return;const f=()=>B();return s.addEventListener("select",f),s.addEventListener("keyup",f),s.addEventListener("mouseup",f),()=>{s.removeEventListener("select",f),s.removeEventListener("keyup",f),s.removeEventListener("mouseup",f)}},[ue,B]),c.useLayoutEffect(()=>{if(ue!=="visual"||ne){mn(null);return}const s=L.current;if(!s)return;const f=Ht(s);mn(w=>f||(w&&w.isConnected&&s.contains(w)?w:null))},[Ae,ue,ne]);const K=c.useCallback(s=>{const f=dt({mode:"visual",visualEl:s,htmlEl:Oe.current}),w=Se.current,_=Vc(w,f)?w:f.visualRange?f:w??f;Se.current=_,s.focus();const O=ch(s,_);if(O){const Z=window.getSelection();try{Z==null||Z.removeAllRanges(),Z==null||Z.addRange(O),Se.current={..._,visualRange:O}}catch{}}return Se.current??_},[]),St=c.useCallback(()=>{Lr.current=null,Ir.current=null,Ss(!1)},[]),fc=c.useCallback(()=>{if(!_r.current||!Lr.current||!Ir.current||H.current!=="visual")return;const s=L.current;if(!s)return;B();const f=Se.current;!f||f.collapsed||eC(f,Ir.current)||(K(s),nC(s,Lr.current),ee(s,!1),B(),z(),St())},[B,K,oe,z,St]),pc=c.useCallback(()=>{if(H.current!=="visual"){St();return}if(_r.current){St();return}const s=L.current;if(!s){St();return}const f=K(s);if(f.collapsed){St();return}Lr.current=tC(s),Ir.current={...f},Ss(!0),B()},[St,K,B]),gc=c.useCallback(()=>{fc()},[fc]);c.useEffect(()=>{(ue!=="visual"||ne)&&St()},[ue,ne,St]);const fa=c.useCallback((s,f)=>{if(H.current!=="visual")return;const w=L.current;if(!w)return;const _=f??wt.current,O=rn(s,_);if(!O)return;wt.current=O.unit;const Z=K(w);if(Z.collapsed){Ke.current=O,$e.current={start:Z.start,end:Z.end},z();return}Ke.current=null,el(w,O.value,O.unit)&&(ee(w,!1),B(),z())},[K,oe,B,z]),hc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(w.collapsed){Ye.current={value:s},$e.current={start:w.start,end:w.end},z();return}Ye.current=null,Za(f,s)&&(ee(f,!1),B(),z())},[K,oe,B,z]),pa=c.useCallback((s,f)=>{if(H.current!=="visual")return;const w=L.current;if(!w)return;const _=K(w),O=s==="color"?tt:nt;if(_.collapsed){O.current={value:f},$e.current={start:_.start,end:_.end},z();return}O.current=null,cr(w,s,f)&&(ee(w,!1),B(),z())},[K,oe,B,z]),ga=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(Fr({open:!1,tab:"general"}),w.collapsed){if(s.size!==null){const Ne=rn(s.size,s.unit);Ne&&(Ke.current=Ne,wt.current=Ne.unit)}const O=Cn(f),Z={};for(const Ne of Qe)s.marks[Ne]!==O[Ne]&&(Z[Ne]=s.marks[Ne]);qe.current=Z,s.fontColorMixed||(tt.current={value:s.fontColor}),s.highlightColorMixed||(nt.current={value:s.highlightColor}),s.fontFamilyMixed||(Ye.current={value:s.fontFamily}),$e.current={start:w.start,end:w.end},z();return}if(qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,$e.current=null,s.size!==null){const O=rn(s.size,s.unit);O&&(wt.current=O.unit,el(f,O.value,O.unit))}const _=Cn(f);for(const O of Qe)s.marks[O]!==_[O]&&rl(f,O);s.fontFamilyMixed||Za(f,s.fontFamily),s.fontColorMixed||cr(f,"color",s.fontColor),s.highlightColorMixed||cr(f,"backgroundColor",s.highlightColor),ee(f,!1),B(),z()},[K,oe,B,z]),bc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Kr(w=>({...w,open:!1})),!Im(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),yc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(Hi(_=>({..._,open:!1})),!ci(s)){B(),z();return}if(w.collapsed){Nt.current=s,$e.current={start:w.start,end:w.end},z();return}if(Nt.current=null,!um(f,s)){B(),z();return}ee(f,!1),B(),z()},[K,oe,B,z]),xc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),dn(w=>({...w,open:!1})),!p1(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Cc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Wr(w=>({...w,open:!1})),!E1(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),wc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Ui(w=>({...w,open:!1})),!M1(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),co=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Gr({open:!1}),!gx(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),uo=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Vr({open:!1}),!hC(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),vc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),nr({open:!1}),!kC(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Sc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Gi({open:!1}),!_y(f,s)){B(),z();return}ee(f,!1),B(),z(),ut(f)}},[K,oe,B,z,ut]),kc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Vi(w=>({...w,open:!1})),!JC(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Ac=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Zi(w=>({...w,open:!1})),!sw(f,s)){B(),z();return}ee(f,!1),B(),z(),ut(f)}},[K,oe,B,z,ut]),Pc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),qi(w=>({...w,open:!1})),!yw(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),kt=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),!s(f)){B(),z();return}ee(f,!1),B(),z(),ut(f)}},[K,oe,B,z,ut]),ha=c.useCallback(s=>{co({src:s.src,alt:s.alt??"",title:s.title??"",css:s.css})},[co]),ba=c.useCallback(s=>{uo({src:s.src,title:s.title??"",css:s.css})},[uo]),ya=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),nr({open:!1}),!AC(f,{src:s.src,title:s.title??"",css:s.css})){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Dc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),qr(w=>({...w,open:!1})),!Nx(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Qf=c.useCallback((s,f)=>{De!=null&&De.isConnected&&VC(De,s,f)},[De]),ep=c.useCallback(()=>{const s=L.current;!s||!(De!=null&&De.isConnected)||(ee(s,!1),Na(s,De),B(),z())},[De,oe,B,z]),Lt=c.useCallback(()=>{if(Ve.current){if(H.current==="visual"){const s=vt(),f=mt(s);if(f!==Ce.current)return me(f,!0)}return Ce.current}if(H.current==="visual"&&L.current){const s=L.current.innerHTML,f=ho(s,bo(s,Ce.current,fn.current));if(f!==Ce.current)return me(f,!0)}return Ce.current},[me]),xa=c.useCallback(()=>{if(!Rr.current&&bi.current)return bi.current;const s=JSON.stringify(ao());return bi.current=s,Rr.current=!1,s},[ao]),tp=c.useCallback(()=>Ve.current?xa():Lt(),[Lt,xa]);Aw({onAutoSave:r?()=>{const s=Ve.current?JSON.parse(xa()):Lt();return r(s)}:void 0,getHtml:tp}),c.useEffect(()=>()=>{var s;(s=Un.current)==null||s.cancel()},[]);const le=c.useMemo(()=>({getHtml:Lt,setHtml:s=>{me(s,!1)},getMode:()=>H.current,setMode:mc,getFullscreen:()=>ys.current,setFullscreen:On,getDarkMode:()=>qs.current,setDarkMode:s=>{ic(s)},getPageZoom:()=>ra.current,setPageZoom:ac,getToolbarPosition:()=>Ys.current,setToolbarPosition:s=>{lc(s)},openCustomizeToolbar:()=>{Ds(!0)},openDocumentPreview:()=>{js({open:!0,html:Lt()})},toggleReadAloud:()=>{const s=Un.current;if(!s)return;const f=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current}),w=vu(yo(f),Lt());w&&s.toggle(w)},isReadingAloud:()=>{var s;return((s=Un.current)==null?void 0:s.isSpeaking())??!1},canReadAloud:()=>{if(!_o())return!1;const s=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current});return vu(yo(s),Lt())!==null},undo:lo,redo:so,canUndo:()=>Ze.canUndo(),canRedo:()=>Ze.canRedo(),getSelection:()=>{const s=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current});return yo(s)},insertText:s=>{const f=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current});gn(f,s,!1)},insertHtml:(s,f)=>{const w=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current}),_=f===void 0;gn(w,_?s:f,_)},toggleFontMark:s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(w.collapsed){const _=Cn(f);qe.current=Zb(qe.current,_,s),$e.current={start:w.start,end:w.end},z();return}qe.current={},$e.current=null,rl(f,s)&&(ee(f,!1),B(),z())},clearFormatting:()=>{if(H.current!=="visual")return;const s=L.current;!s||K(s).collapsed||(qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,Nt.current=null,$e.current=null,Q1(s)&&(ee(s,!1),B(),z()))},toggleFormatBrush:pc,isFormatBrushActive:()=>_r.current,isFontMarkActive:s=>xi.current[s],hasTextSelection:()=>H.current==="visual"&&Ni.current,setFontSize:(s,f)=>{fa(s,f)},setFontSizeUnit:s=>{var Ne;const f=L.current,w=Mt.current;if(H.current!=="visual"||!f||w.value===null||w.mixed){wt.current=s,Mr(ir=>({...ir,unit:s}));return}const _=K(f),O=Lb(f,((Ne=_.visualRange)==null?void 0:Ne.startContainer)??f),Z=Ed(w.value,w.unit,s,O.parentPx,O.rootPx);fa(Z,s)},getFontSize:()=>Mt.current.value,getFontSizeUnit:()=>Mt.current.unit,isFontSizeMixed:()=>Mt.current.mixed,setFontFamily:s=>{hc(s)},getFontFamily:()=>Vn.current.value,isFontFamilyMixed:()=>Vn.current.mixed,getFontFaces:()=>fn.current,setFontColor:s=>{pa("color",s)},setHighlightColor:s=>{pa("backgroundColor",s)},getFontColor:()=>qn.current.value,isFontColorMixed:()=>qn.current.mixed,getHighlightColor:()=>Xn.current.value,isHighlightColorMixed:()=>Xn.current.mixed,setParagraphStyle:s=>{if(H.current!=="visual")return;const f=L.current;f&&(K(f),gy(f,s)&&(ee(f,!1),B(),z()))},getParagraphStyle:()=>Ai.current.tag,isParagraphStyleMixed:()=>Ai.current.mixed,setTextAlign:s=>{if(H.current!=="visual")return;const f=L.current;f&&(K(f),Lm(f,s)&&(ee(f,!1),B(),z()))},getTextAlign:()=>Di.current.align,isTextAlignMixed:()=>Di.current.mixed,indent:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),Ay(s)&&(ee(s,!1),B(),z()))},outdent:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),Py(s)&&(ee(s,!1),B(),z()))},canOutdent:()=>H.current==="visual"&&vs.current,toggleList:s=>{if(H.current!=="visual")return;const f=L.current;f&&(K(f),yy(f,s)&&(ee(f,!1),B(),z()))},isBulletList:()=>Jn.current.type==="ul"&&!Jn.current.mixed,isNumberedList:()=>Jn.current.type==="ol"&&!Jn.current.mixed,openFontProperties:s=>{H.current==="visual"&&Fr({open:!0,tab:s??"general"})},applyFontProperties:s=>{ga(s)},openCustomCss:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=s?sm(s):{value:null,mixed:!1},w=f.mixed||!f.value?"":Ob(f.value);Hi({open:!0,value:w})},applyCustomCss:s=>{yc(s)},openParagraphProperties:s=>{if(H.current!=="visual")return;const f=L.current;f&&K(f),Kr({open:!0,tab:s??"general",value:f?su(f):ur()})},applyParagraphProperties:s=>{bc(s)},openPageProperties:s=>{if(H.current!=="visual")return;const f=L.current;f&&K(f),dn({open:!0,tab:s??"font",value:f?f1(f):fl()})},applyPageProperties:s=>{xc(s)},openCustomParagraphStyleDialog:s=>{if(H.current!=="visual"||!na.current)return;if(s){const w=Qr.current.find(_=>_.id===s);if(!w)return;tr({open:!0,mode:"edit",style:w});return}const f=L.current;f&&K(f),tr({open:!0,mode:"create",font:{size:Mt.current.mixed?null:Mt.current.value,unit:Mt.current.unit,marks:{...xi.current},fontFamily:Vn.current.mixed?null:Vn.current.value,fontColor:qn.current.mixed?null:qn.current.value,highlightColor:Xn.current.mixed?null:Xn.current.value},paragraph:Fm(f?su(f):ur())})},applyCustomParagraphStyle:s=>{const f=Qr.current.find(_=>_.id===s);if(!f||(ga({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 w=L.current;!w||H.current!=="visual"||(K(w),Xy(w,f.paragraph)&&(ee(w,!1),B(),z()))},customParagraphStylesEnabled:()=>na.current,getCustomParagraphStyles:()=>Qr.current,isCustomParagraphStylesLoading:()=>Fs.current,openLinkDialog:s=>{if(H.current!=="visual")return;const f=L.current;f&&K(f);const w=f?Qm(f):mi(),_=f?pl(f):[],O=(w==null?void 0:w.href)??"",Z=O.startsWith("#")?O.slice(1):"",Ne=_.some(ir=>ir.id===Z)?Z:"";Wr({open:!0,tab:s??"link",href:O,title:(w==null?void 0:w.title)??"",targetBlank:(w==null?void 0:w.targetBlank)??!1,textDecorationNone:(w==null?void 0:w.textDecorationNone)??!1,hoverMode:(w==null?void 0:w.hoverMode)??"color",hoverColor:(w==null?void 0:w.hoverColor)??null,hoverHtml:(w==null?void 0:w.hoverHtml)??"",bookmarks:_,selectedBookmarkId:Ne})},applyLink:s=>{Cc(s)},openBookmarkDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s),Ui({open:!0,existingIds:s?pl(s).map(f=>f.id):[]})},applyBookmark:s=>{wc(s)},openImageDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=$s.current;if(Xs.current&&f){f.onPick(ha);return}Gr({open:!0})},applyImage:s=>{co(s)},openAudioDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=Us.current;if(Js.current&&f){f.onPick(ba);return}Vr({open:!0})},applyAudio:s=>{uo(s)},openYoutubeDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=Ws.current;if(Qs.current&&f){f.onPick(ya);return}nr({open:!0})},applyYoutube:s=>{vc(s)},openImageProperties:s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;K(f);const w=Ht(f),_=Tx(f);!w||!_||qr({open:!0,tab:s??"general",value:_,aspectRatio:jx(w)})},applyImageProperties:s=>{Dc(s)},insertHorizontalRule:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),FC(s)&&(ee(s,!1),B(),z()))},insertPageBreak:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),OC(s)&&(ee(s,!1),B(),z()))},insertPage:()=>{uc()},isMultiPagesEnabled:()=>Ve.current,getActivePageHtml:()=>cc(),getAllPagesHtml:()=>ao(),openTableDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s),Gi({open:!0})},applyTable:s=>{Sc(s)},openTableProperties:()=>{if(H.current!=="visual")return;const s=L.current;if(!s)return;K(s);const f=XC(s);f&&Vi({open:!0,value:f})},applyTableProperties:s=>{kc(s)},openCellProperties:()=>{if(H.current!=="visual")return;const s=L.current;if(!s)return;K(s);const f=lw(s);f&&Zi({open:!0,value:f})},applyCellProperties:s=>{Ac(s)},openRowProperties:()=>{if(H.current!=="visual")return;const s=L.current;if(!s)return;K(s);const f=bw(s);f&&qi({open:!0,value:f})},applyRowProperties:s=>{Pc(s)},insertRowBelow:()=>{kt(s=>al(s,"below"))},insertRowBefore:()=>{kt(s=>al(s,"before"))},deleteRow:()=>{kt(s=>Ly(s))},insertColumnAfter:()=>{kt(s=>ru(s,"after"))},insertColumnBefore:()=>{kt(s=>ru(s,"before"))},deleteColumn:()=>{kt(s=>Iy(s))},mergeCells:()=>{kt(s=>Hy(s))},unmergeCells:()=>{kt(s=>zy(s))},cut:async()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),await Z1(s)&&(ee(s,!1),B(),z()))},copy:async()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),await af(s))},deleteSelection:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),of(s)&&(ee(s,!1),B(),z()))},addComment:()=>{if(!qt.current||y||H.current!=="visual")return;const s=L.current;if(!s)return;const f=K(s),w=yu(s,f);if(w){Ct(w);return}const _=F1(s,f);if(!_)return;const O=K1(_);B1(s,O.id,f)&&(wu(s,O.id),B(),sc(s,!1),Kn([...jr.current,O]),Ct(O.id))},toggleCommentsVisible:()=>{Kf(s=>{const f=!s,w=L.current;return w&&xu(w,f),f})},areCommentsVisible:()=>Dr.current,canAddComment:()=>!qt.current||y||H.current!=="visual"?!1:Ni.current||Xi.current!==null,isCommentsEnabled:()=>qt.current,getCommentThreads:()=>jr.current,setCommentThreads:s=>Kn(s),openCommentThread:s=>{const f=L.current;!f||H.current!=="visual"||wu(f,s)&&(B(),Ct(s))},isContentLocked:()=>hs.current,isLink:()=>Ps.current,isImageSelected:()=>H.current==="visual"&&Xi.current!==null,isInTable:()=>H.current==="visual"&&Ts.current,canMergeCells:()=>H.current==="visual"&&Ms.current,canUnmergeCells:()=>H.current==="visual"&&Ls.current,...i!=null?{onSave:s=>Os.current(s)}:{},...a!=null?{onOpen:()=>Ks.current()}:{}}),[me,oe,ee,sc,mc,On,ic,ac,lc,gn,lo,so,B,z,K,fa,hc,pa,ga,yc,bc,xc,Cc,wc,co,uo,vc,Dc,Sc,kc,Ac,Pc,kt,ha,ba,ya,Lt,cc,ao,uc,pc,i,a,y,Kn]),jc=c.useCallback(()=>{const s=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current});return{mode:s.mode,selection:yo(s),getHtml:le.getHtml,setHtml:f=>{me(f,!1)},insertText:f=>gn(s,f,!1),insertHtml:(f,w)=>{const _=w===void 0;gn(s,_?f:w,_)}}},[gn,le.getHtml,me]),{catalog:mo,layout:Ec}=c.useMemo(()=>ig(R,sP,cP),[R]),fo=c.useMemo(()=>zA(Ec,E),[Ec,E]),Ca=c.useMemo(()=>({...fo,iconGroups:fA(fo.iconGroups,Li)}),[fo,Li]),wa=c.useMemo(()=>Ie?fP(mo,st):mo,[mo,Ie,st]),va=c.useMemo(()=>Ie?pP(Ca):Ca,[Ca,Ie]),Sa=c.useMemo(()=>({disabled:zn,readOnly:x,enableComments:Ie}),[zn,x,Ie]),Rc=c.useMemo(()=>ct?W1(sn,ct):null,[ct,sn]),np=c.useCallback(s=>{if(!ct||!Ar||y)return;const f=$1(Ar,s);Kn(U1(jr.current,ct,f))},[ct,Ar,y,Kn]),hn=c.useMemo(()=>({...Rb(le),...ag(R,jc)}),[le,R,jc]),ka=c.useMemo(()=>Tb(le),[le,Nr,Wn,Gn,Zn,Yn,Si,zi,Oi,ta,_t,De,Ji,Qi,ea,Ri,Mi,un,rt,Or]),Tc=c.useCallback(s=>{if(ne||s.inputType!=="insertText"&&s.inputType!=="insertReplacementText"||!s.data||!Vb(qe.current)&&!Ke.current&&!Zg(Ye.current)&&!vh({color:tt.current,backgroundColor:nt.current})&&!Ub(Nt.current))return;const f=L.current;f&&(s.preventDefault(),ry(f,s.data,qe.current,Ke.current,{color:tt.current,backgroundColor:nt.current},Ye.current,Nt.current),qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,Nt.current=null,$e.current=null,ee(f,!0),B(),z())},[ne,oe,B,z]),Nc=c.useCallback(s=>{if(ne||!vg(s,Is.current))return;s.preventDefault(),s.stopPropagation();const f=L.current;if(!f)return;K(f);const w=ul(f,s.target),_=Zo(f,s.target);_&&!Sr(f).includes(_)&&By(f,_);const O={inTable:He(f,s.target)!==null,canMergeCells:ou(f),canUnmergeCells:iu(f)};if(w){Na(f,w),B(),mn(w),Yi({open:!0,x:s.clientX,y:s.clientY,kind:"image",...O,inTable:He(f,w)!==null});return}const Z=dt({mode:"visual",visualEl:f,htmlEl:Oe.current});Se.current=Z,Yi({open:!0,x:s.clientX,y:s.clientY,kind:Z.collapsed?"caret":"text",...O})},[ne,B,K]),Mc=c.useCallback(s=>{if(Is.current=s.pointerType,y)return;const f=L.current;if(!f)return;if(qt.current&&Dr.current){const _=Cu(f,s.target);if(_){const O=_.getAttribute("data-comment-thread");O&&Ct(O);return}}if(ne&&!qt.current)return;const w=ul(f,s.target);if(!w){mn(null);return}s.preventDefault(),Na(f,w),B(),mn(w)},[y,ne,B]);c.useEffect(()=>{if(!Ie||ue!=="visual")return;const s=L.current;s&&(O1(s,sn),xu(s,st))},[Ie,ue,sn,st,Ae]);const _c=c.useCallback(s=>{if(ne)return;if(s.key==="Tab"&&!s.ctrlKey&&!s.metaKey&&!s.altKey){if(H.current!=="visual")return;const w=L.current;if(!w)return;const _=s.target;if(!(_ instanceof Node)||!w.contains(_))return;K(w);const O=Fy(w,s.shiftKey);if(!O)return;s.preventDefault(),typeof O=="object"&&O.changed&&ee(w,!1),B(),z(),ut(w);return}if(!(s.ctrlKey||s.metaKey))return;if(s.key==="Enter"&&!s.shiftKey){s.preventDefault(),le.insertPageBreak();return}const f=s.key.toLowerCase();if(f==="z"&&!s.shiftKey){s.preventDefault(),lo();return}if(f==="z"&&s.shiftKey||f==="y"){s.preventDefault(),so();return}if(f==="b"&&!s.shiftKey){s.preventDefault(),le.toggleFontMark("bold");return}if(f==="i"&&!s.shiftKey){s.preventDefault(),le.toggleFontMark("italic");return}if(f==="u"&&!s.shiftKey){s.preventDefault(),le.toggleFontMark("underline");return}if(f==="x"&&s.shiftKey){s.preventDefault(),le.toggleFontMark("strikethrough");return}f==="p"&&!s.shiftKey&&(s.preventDefault(),hn.print())},[ne,lo,so,le,hn,K,oe,B,z,ut]),rp=c.useCallback(s=>{if(s.key==="Escape"&&ct){s.preventDefault(),Ct(null);return}_c(s)},[ct,_c]),op=[pe.root,Ua(un).className,xt?pe.fullscreen:"",b].filter(Boolean).join(" "),ip=GP({toolbarBackground:v,menuColor:k,menuBackground:P,menuFontSize:N,menuFontFamily:D,border:A}),ap=Ua(un)["data-wysiwyg-theme"],lp=c.useMemo(()=>{if(!(ue!=="visual"||Bi===1))return{transform:`scale(${Bi})`}},[ue,Bi]),Lc=ue==="visual"?xe?o.jsx(UP,{ref:Pr,pages:no,activePageIndex:Yt,onActivePageIndexChange:s=>{var w;bs(s);const f=(w=Pr.current)==null?void 0:w.getActivePageRoot();f instanceof HTMLDivElement&&(L.current=f)},onPageChange:(s,f)=>aa(s,f,!0),onBeforeInput:Tc,onPointerDown:s=>{s.currentTarget instanceof HTMLDivElement&&(L.current=s.currentTarget),Mc(s)},onMouseUp:gc,onContextMenu:Nc,placeholder:C,disabled:ne}):o.jsx($P,{ref:L,html:jt(Ae).body,onChange:s=>oe(s,!0),onBeforeInput:Tc,onPointerDown:Mc,onMouseUp:gc,onContextMenu:Nc,placeholder:C,disabled:ne}):o.jsx(KP,{ref:Oe,html:Ae,onChange:s=>me(s,!0),placeholder:C,disabled:ne});return o.jsx(pg,{locale:S,children:o.jsx(ug,{dark:un,children:o.jsxs("div",{className:op,style:ip,"data-fullscreen":xt?"":void 0,"data-wysiwyg-theme":ap,"data-toolbar-position":rt,"data-comments-visible":Ie&&st?"":void 0,onKeyDown:rp,children:[T?o.jsx("div",{className:pe.menuChrome,onPointerDownCapture:la,children:o.jsx($a,{catalog:wa,layout:va,commands:hn,queries:ka,disabled:zn,chromeLock:Sa,menuVisible:!0,toolbarVisible:!1})}):null,o.jsxs("div",{className:pe.body,"data-icon-dock":I?rt:void 0,children:[I&&(rt==="top"||rt==="left")?o.jsx("div",{className:pe.iconChrome,onPointerDownCapture:la,children:o.jsx($a,{catalog:wa,layout:va,commands:hn,queries:ka,disabled:zn,chromeLock:Sa,menuVisible:!1,toolbarVisible:!0,position:rt})}):null,o.jsxs("div",{ref:ps,className:`${pe.workspace} ${rc?pe.workspacePageSized:""}`,onDragEnter:or.onDragEnter,onDragOver:or.onDragOver,onDragLeave:or.onDragLeave,onDrop:or.onDrop,children:[ue==="visual"?o.jsx("div",{className:pe.pageCanvasViewport,style:lp,children:Lc}):Lc,or.dragging?o.jsx(ZP,{}):null]}),I&&(rt==="bottom"||rt==="right")?o.jsx("div",{className:pe.iconChrome,onPointerDownCapture:la,children:o.jsx($a,{catalog:wa,layout:va,commands:hn,queries:ka,disabled:zn,chromeLock:Sa,menuVisible:!1,toolbarVisible:!0,position:rt})}):null]}),xt?o.jsx(VP,{onClick:()=>On(!1)}):null,o.jsx(HA,{open:_i,catalog:mo,groups:fo.iconGroups,settings:Li,loading:Uf,busy:Wf,disabled:ne,onChange:s=>{oc(s)},onReset:()=>{oc(null)},onClose:()=>Ds(!1)}),o.jsx(Bk,{open:er.open,html:er.html,onClose:()=>js({open:!1,html:er.html})}),o.jsx(Yv,{open:Qn.open,tab:Qn.tab,size:Wn.value,unit:Wn.unit,marks:Nr,fontFamily:Gn.value,fontFamilyMixed:Gn.mixed,fontColor:Zn.value,fontColorMixed:Zn.mixed,highlightColor:Yn.value,highlightColorMixed:Yn.mixed,fonts:_t,disabled:ne,onTabChange:s=>Fr({open:!0,tab:s}),onApply:s=>le.applyFontProperties(s),onClose:()=>Fr({open:!1,tab:Qn.tab})}),o.jsx(xS,{open:Xt.open,tab:Xt.tab,value:Xt.value,disabled:ne,onTabChange:s=>Kr({...Xt,open:!0,tab:s}),onApply:s=>le.applyParagraphProperties(s),onClose:()=>Kr({...Xt,open:!1})}),o.jsx(NS,{open:$r.open,value:$r.value,disabled:ne,onApply:s=>le.applyCustomCss(s),onClose:()=>Hi(s=>({...s,open:!1}))}),o.jsx(DS,{open:Jt.open,tab:Jt.tab,value:Jt.value,fonts:_t,disabled:ne,customImagePicker:J,onCustomImagePick:()=>{J==null||J.onPick(s=>{dn(f=>({...f,tab:"paragraph",value:{...f.value,backgroundImage:{...f.value.backgroundImage,src:s.src}}}))})},onTabChange:s=>dn({...Jt,open:!0,tab:s}),onApply:s=>le.applyPageProperties(s),onResetAtRule:()=>{const s=L.current;!s||H.current!=="visual"||g1(s)&&(ee(s,!1),dn(f=>({...f,value:{...f.value,atRule:on()}})))},onClose:()=>dn({...Jt,open:!1})}),o.jsx(RS,{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:nn,marks:Et(),fontFamily:null,fontColor:null,highlightColor:null},paragraph:Pe.open?Pe.mode==="edit"?Pe.style.paragraph:Pe.paragraph:void 0,canDelete:!!X,fonts:_t,busy:Zf,disabled:ne,onSave:async s=>{const f=Hs.current;if(f){Ur(!0);try{await f(s),tr({open:!1}),await oo()}finally{Ur(!1)}}},onDelete:async s=>{const f=zs.current;if(f){Ur(!0);try{await f(s),tr({open:!1}),await oo()}finally{Ur(!1)}}},onClose:()=>tr({open:!1})}),o.jsx(ik,{open:Ue.open,tab:Ue.tab,href:Ue.href,title:Ue.title,targetBlank:Ue.targetBlank,textDecorationNone:Ue.textDecorationNone,hoverMode:Ue.hoverMode,hoverColor:Ue.hoverColor,hoverHtml:Ue.hoverHtml,bookmarks:Ue.bookmarks,selectedBookmarkId:Ue.selectedBookmarkId,disabled:ne,onTabChange:s=>Wr({...Ue,open:!0,tab:s}),onApply:s=>le.applyLink(s),onClose:()=>Wr({...Ue,open:!1})}),o.jsx(_S,{open:$i.open,existingIds:$i.existingIds,disabled:ne,onApply:s=>le.applyBookmark(s),onClose:()=>Ui({...$i,open:!1})}),o.jsx(BS,{open:qf.open,disabled:ne,customImagePicker:J,onApply:s=>le.applyImage(s),onCustomPick:()=>{Gr({open:!1}),J==null||J.onPick(ha)},onClose:()=>Gr({open:!1})}),o.jsx(FS,{open:Yf.open,disabled:ne,customAudioPicker:Y,onApply:s=>le.applyAudio(s),onCustomPick:()=>{Vr({open:!1}),Y==null||Y.onPick(ba)},onClose:()=>Vr({open:!1})}),o.jsx(ak,{open:Xf.open,disabled:ne,customVideoPicker:te,onApply:s=>le.applyYoutube(s),onCustomPick:()=>{nr({open:!1}),te==null||te.onPick(ya)},onClose:()=>nr({open:!1})}),o.jsx(XS,{open:Zr.open,tab:Zr.tab,value:Zr.value,aspectRatio:Zr.aspectRatio,disabled:ne,onTabChange:s=>qr(f=>({...f,tab:s})),onApply:s=>le.applyImageProperties(s),onClose:()=>qr(s=>({...s,open:!1}))}),o.jsx(mk,{open:Wi.open,disabled:ne,onApply:s=>le.applyTable(s),onClose:()=>Gi({open:!1})}),o.jsx(bk,{open:Yr.open,value:Yr.value,disabled:ne,onApply:s=>le.applyTableProperties(s),onClose:()=>Vi(s=>({...s,open:!1}))}),o.jsx(kk,{open:Xr.open,value:Xr.value,disabled:ne,onApply:s=>le.applyCellProperties(s),onClose:()=>Zi(s=>({...s,open:!1}))}),o.jsx(jk,{open:Jr.open,value:Jr.value,disabled:ne,onApply:s=>le.applyRowProperties(s),onClose:()=>qi(s=>({...s,open:!1}))}),ue==="visual"&&!ne&&(De!=null&&De.isConnected)?o.jsx(ok,{img:De,onResize:Qf,onResizeEnd:ep}):null,Ie&&st&&Rc?o.jsx(sA,{panelRef:gi,thread:Rc,locale:S,disabled:y,commentAuthor:Ar,onPost:np,onClose:()=>Ct(null)}):null,o.jsx(Cg,{open:Qt.open,x:Qt.x,y:Qt.y,kind:Qt.kind,inTable:Qt.inTable,canMergeCells:Qt.canMergeCells,canUnmergeCells:Qt.canUnmergeCells,commands:hn,onClose:()=>Yi(s=>({...s,open:!1}))})]})})})}function GP({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 VP({onClick:e}){const t=W();return o.jsx("button",{type:"button",className:pe.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:o.jsx(_e,{className:pe.exitFullscreenIcon})})}function ZP(){const e=W();return o.jsx("div",{className:pe.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}function qP(e){var n;if(e.tagName.toLowerCase()!=="span")return!1;const t=[...e.attributes];return t.length===0||t.length===1&&((n=t[0])==null?void 0:n.name)===Re?!0:t.length===2&&t.some(r=>r.name===Re)&&t.some(r=>r.name==="class"&&r.value.includes("wysiwyg-comment-anchor"))?!e.hasAttribute("style"):!1}function YP(e){for(const t of[...e.querySelectorAll(`[${Re}]`)])t.removeAttribute(Re),t instanceof HTMLElement&&t.classList.remove("wysiwyg-comment-anchor");for(const t of[...e.querySelectorAll("span")]){if(!qP(t))continue;const n=t.parentNode;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}}function XP(e){const t=e.trim();if(!t)return e;const n=new DOMParser().parseFromString(t,"text/html");return YP(n.body),n.body.innerHTML}exports.Editor=WP;exports.PAGE_SEPARATOR=Fo;exports.joinPagesToHtml=mt;exports.splitPagesFromHtml=Pt;exports.stripCommentAnchors=XP;
92
+ `.trim();function Xa(e,t,n="​"){const{hrefs:r,body:i}=Ce(t),a=e.createElement("meta");a.setAttribute("charset","utf-8");const l=e.createElement("title");l.textContent=n;const u=e.createElement("style");u.textContent=nh;const m=r.map(g=>{const p=e.createElement("link");return p.rel="stylesheet",p.href=g,p});e.head.replaceChildren(a,l,u,...m),e.title=n,e.body.innerHTML=i}const Nl=["pt","px","em","rem","%"],rn="pt",rh={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]},oh={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},ih=new Set(Nl),ah=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function si(e){return ih.has(e)}function Te(e){return Math.round(e*100)/100}function Q(e){const t=Te(e);return Number.isInteger(t),String(t)}function Ml(e,t){return`${Q(e)}${t}`}function _l(e){const t=e.trim();if(!t)return null;const n=t.match(ah);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 lh(e,t){const n=e.trim();if(!n)return null;const r=_l(n);if(r)return si(r.unit)?on(r.value,r.unit):null;const i=Number(n.replace(",","."));return Number.isFinite(i)?on(i,t):null}function on(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=oh[t];return{value:Te(Math.min(r,Math.max(n,e))),unit:t}}function Ed(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return Te(e);case"pt":return Te(e*.75);case"em":return Te(e/i);case"rem":return Te(e/a);case"%":return Te(e/i*100)}}function sh(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 Rd(e,t,n,r,i){if(t===n)return Te(e);const a=sh(e,t,r,i);return Ed(a,n,r,i)}const Ll="pt",ch=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,uh=/^[+-]?0(?:\.0+)?$/;function pe(e){return`${Q(e.value)}${e.unit}`}function Me(e){const t=e.trim();if(!t)return null;if(uh.test(t))return{value:0,unit:"px"};const n=t.match(ch);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return si(i)?{value:Te(r),unit:i}:null}function pr(e,t,n){const r=e.trim();if(!r)return null;const i=Me(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:Te(a),unit:t}:null}function qt(e){return e.value>=0?e:{value:0,unit:e.unit}}function Qe(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function xo(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function dh(e,t){return t?e===t||e.contains(t):!1}function Wc(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 Gc(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return Wc(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 Wc(e,t)+r}function Vc(e,t){var l,u;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:((u=a.textContent)==null?void 0:u.length)??0}:{node:e,offset:e.childNodes.length}}function Il(e,t,n){const r=document.createRange(),i=Vc(e,t),a=Vc(e,n);return r.setStart(i.node,i.offset),r.setEnd(a.node,a.offset),r}function Td(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Zc(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function mh(e,t){return t.mode!=="visual"?null:t.visualRange&&Td(t.visualRange,e)?t.visualRange:Il(e,t.start,t.end)}function ft(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(dh(t,a.commonAncestorContainer)){const l=Gc(t,a.startContainer,a.startOffset),u=Gc(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(l,u),end:Math.max(l,u),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 qc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fh(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),l=e.snapshot.start,u=e.snapshot.end,m=e.asHtml?e.content:qc(e.content);e.setHtml(a.slice(0,l)+m+a.slice(u));const g=e.htmlEl;if(g){const p=l+m.length;g.focus(),g.setSelectionRange(p,p)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:qc(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&Td(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??Il(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 Fl=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),Nd=new Set(["table","thead","tbody","tr","td","th"]),Bl=new Set([...Nd,"ul","ol","li","pre","hr"]);function ue(e){return e.tagName.toLowerCase()}function vr(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Hl(e){return e instanceof HTMLElement&&(ue(e)==="ul"||ue(e)==="ol")}function et(e){return e instanceof HTMLElement&&ue(e)==="li"}function Ct(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return le(e,n.commonAncestorContainer)?n:null}function zl(e){const t=e.collapsed?[]:$e(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function jn(e,t,n){var m,g,p;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let C=0,y;for(;y=h.nextNode();){if(y===t)return C+n;C+=((m=y.textContent)==null?void 0:m.length)??0}return C}let r=0;const i=t.childNodes;for(let h=0;h<n&&h<i.length;h+=1)r+=((g=i[h].textContent)==null?void 0:g.length)??0;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let l=0,u;for(;u=a.nextNode();){if(t.contains(u)||t.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING)return l+r;l+=((p=u.textContent)==null?void 0:p.length)??0}return l+r}function Ol(e,t,n){const r=Il(e,t,n),i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function Ln(e,t){const n=Ct(e);if(!n)return!1;const r=jn(e,n.startContainer,n.startOffset),i=jn(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),u=t();return Ol(e,a,l),u}function Kl(e,t){if(ue(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 lt(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function gh(e,t){let n=vr(t);for(;n&&n!==e;){if(Cd(n,e)||yt(n)){n=n.parentElement;continue}const r=ue(n);if(Fl.has(r)&&n instanceof HTMLElement)return n;if(Nd.has(r)||r==="pre")return null;n=n.parentElement}return null}function In(e){const t=Ct(e);if(!t)return[];const n=new Set,r=[];for(const i of zl(t)){const a=gh(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Ja(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ue(e);return Fl.has(t)||Bl.has(t)?!1:xt(e)||t==="br"||t==="a"||t==="img"||t==="span"}function ph(e,t){let n=vr(t);for(;n&&n!==e;){if(Bl.has(ue(n)))return!0;n=n.parentElement}return!1}function hh(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function bh(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&Ja(n[i-1]);)i-=1;for(;a<n.length-1&&Ja(n[a+1]);)a+=1;return n.slice(i,a+1)}function Qa(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&yt(t)))return t;return null}function yh(e,t,n){if(n.startContainer===e){const r=e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild;return r instanceof HTMLElement&&yt(r)?Qa(e):r}return n.startContainer===t&&e!==t?Qa(e):hh(e,n.startContainer)}function xh(e,t){const n=jl(e);if(ph(e,t.startContainer))return null;if(!Qa(n)){const l=document.createElement("p");return l.appendChild(document.createElement("br")),n.appendChild(l),l}const r=yh(n,e,t);if(!r||r instanceof HTMLElement&&yt(r)||r instanceof Element&&Bl.has(ue(r))||r instanceof HTMLElement&&Fl.has(ue(r))||!Ja(r))return null;const i=bh(n,r),a=document.createElement("p");n.insertBefore(a,i[0]);for(const l of i)a.appendChild(l);return a}function Sr(e){const t=In(e);if(t.length>0)return t;const n=Ct(e);if(!n)return[];const r=xh(e,n);return r?[r]:[]}function En(e){const t=e.parentElement;return t&&Hl(t)?t:null}function Md(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&&Ch(r,i)?t[t.length-1].push(i):t.push([i])}return t}function Ch(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}function wh(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Ea(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 Ra(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 Ta(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 vh={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 Sh(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function we(e){const t=e.trim();if(!t||Sh(t))return null;const n=Ta(t);if(n)return n;const r=Ea(t);if(r)return r.a===0?null:Ra(r.r,r.g,r.b);const i=vh[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=Ta(t);if(m==="#010203")return m;const g=Ea(t);return g&&Ra(g.r,g.g,g.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(l.startsWith("#"))return Ta(l);const u=Ea(l);return!u||u.a===0?null:Ra(u.r,u.g,u.b)}function _d(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?we(n):null}function Ho(e,t,n){let r=wh(t);for(;r&&r!==e&&r instanceof HTMLElement;){const i=_d(r,n);if(i)return i;r=r.parentElement}return null}function zo(e,t){return e instanceof HTMLElement?_d(e,t)!==null:!1}function $l(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function Ld(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function kh(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!xt(i)||!zo(i,n)){r=i;continue}if(Zt(i,r),zo(i,n)&&($l(i,n),Vt(i))){Ze(i);continue}r=i}}function Id(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return le(e,n.commonAncestorContainer)?n:null}function Oo(e,t){const n=Id(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:$e(n).filter(m=>m.data.length>0),a=(r.length>0?r:[n.startContainer]).map(m=>Ho(e,m,t)),l=a[0]??null;return a.every(m=>m===l)?{value:l,mixed:!1}:{value:null,mixed:!0}}function cr(e,t,n){const r=Id(e);if(!r||r.collapsed)return!1;const i=n===null?null:we(n);if(n!==null&&i===null)return!1;bt(r);const a=$e(r).filter(l=>l.data.length>0);for(const l of a){const u=Ho(e,l,t);if(i===null){if(u===null)continue;kh(e,l,t);continue}u!==i&&Cr(l,m=>{Ld(m,t,i)})}return cn(a),!0}function Yc(e,t,n){if(n.value===null){$l(e,t);return}const r=we(n.value);r&&Ld(e,t,r)}function Ah(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function Ph(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 Dh(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 Fd(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!xt(i)||!n.some(a=>zo(i,a))){r=i;continue}Zt(i,r);for(const a of n)zo(i,a)&&$l(i,a);if(Vt(i)){Ze(i);continue}r=i.isConnected?i:t}return t}function jh(e,t,n){Ph(t);const r=Dh(t);return Fd(e,r,n)}function Eh(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&Ho(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&Ho(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const Bd=["auto","avoid"],el=["auto","avoid","page"];new Set(Bd);new Set(el);function Hd(e){return e.trim().toLowerCase()}function Xc(e){return Hd(e)==="avoid"?"avoid":"auto"}function Ko(e){const t=Hd(e);return t==="avoid"?"avoid":t==="page"||t==="always"?"page":"auto"}function zd(e){const t=e.style.breakInside;if(t)return Xc(t);const n=e.style.pageBreakInside;return n?Xc(n):"auto"}function Od(e){const t=e.style.breakAfter;if(t)return Ko(t);const n=e.style.pageBreakAfter;return n?Ko(n):"auto"}function Kd(e){const t=e.style.breakBefore;if(t)return Ko(t);const n=e.style.pageBreakBefore;return n?Ko(n):"auto"}function Rh(e){e.style.removeProperty("break-inside"),e.style.removeProperty("page-break-inside")}function Th(e){e.style.removeProperty("break-after"),e.style.removeProperty("page-break-after")}function Nh(e){e.style.removeProperty("break-before"),e.style.removeProperty("page-break-before")}function Mh(e){return{breakInside:zd(e),breakAfter:Od(e),breakBefore:Kd(e)}}function _h(e,t){return zd(e)===t?!1:t==="auto"?(Rh(e),!0):(e.style.breakInside="avoid",e.style.pageBreakInside="avoid",!0)}function Lh(e,t){return Od(e)===t?!1:t==="auto"?(Th(e),!0):t==="avoid"?(e.style.breakAfter="avoid",e.style.pageBreakAfter="avoid",!0):(e.style.breakAfter="page",e.style.pageBreakAfter="always",!0)}function Ih(e,t){return Kd(e)===t?!1:t==="auto"?(Nh(e),!0):t==="avoid"?(e.style.breakBefore="avoid",e.style.pageBreakBefore="avoid",!0):(e.style.breakBefore="page",e.style.pageBreakBefore="always",!0)}function Fh(e,t){return e===t}function Jc(e,t){return e===t}const Le=["top","right","bottom","left"],ci=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],st={top:null,right:null,bottom:null,left:null},Ul={style:"none",width:null,color:null},Bh=new Set(ci),Qc={value:0,unit:"px"};function Hh(){return{margin:{...st},padding:{...st},lineHeight:null,border:{...Ul},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null,breakInside:"auto",breakAfter:"auto",breakBefore:"auto"}}function Wl(){const e=Hh();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,breakInside:e.breakInside,breakInsideMixed:!1,breakAfter:e.breakAfter,breakAfterMixed:!1,breakBefore:e.breakBefore,breakBeforeMixed:!1}}function Tt(e,t){return Le.every(n=>Qe(e[n],t[n]))}function $d(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 Ud(e,t){return e.style===t.style&&Qe(e.width,t.width)&&e.color===t.color}function Wd(e,t){return e===t?!0:!e||!t?!1:Qe(e.offsetX,t.offsetX)&&Qe(e.offsetY,t.offsetY)&&Qe(e.blur,t.blur)&&Qe(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function zh(e){return e.kind==="normal"?"normal":e.kind==="number"?Q(e.value):pe({value:e.value,unit:e.unit})}function Oh(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)?$t(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?$t(n):null}function $t(e){return Te(Math.min(1,Math.max(0,e)))}function $o(e){return Te($t(e)*100)}function Gd(e){return $t(e/100)}function Vd(e){return Q($t(e))}function Kh(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:Te(r)}}const n=Me(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function $h(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 Uh(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 Wh(e){const t=[pe(e.offsetX),pe(e.offsetY),pe(e.blur),pe(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function Gh(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=$h(t,",")[0];if(!n)return null;const r=Uh(n);let i=!1,a=null;const l=[];for(const u of r){if(u.toLowerCase()==="inset"){i=!0;continue}const m=Me(u);if(m){l.push(m);continue}const g=we(u);if(g){a=g;continue}return null}return l.length<2||l.length>4?null:{offsetX:l[0],offsetY:l[1],blur:l[2]??Qc,spread:l[3]??Qc,color:a,inset:i}}function wn(e,t){return Me(e.style.getPropertyValue(t))}function Vh(e,t,n,r){const i=n&&r?qt(n):n,a=i?pe(i):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function eu(e,t){return{top:wn(e,`${t}-top`),right:wn(e,`${t}-right`),bottom:wn(e,`${t}-bottom`),left:wn(e,`${t}-left`)}}function tu(e,t,n,r){let i=!1;for(const a of Le)Vh(e,`${t}-${a}`,n[a],r)&&(i=!0);return i}function Zh(e){const t=e.trim().toLowerCase();return Bh.has(t)?t:"none"}function Zd(e){const t=Zh(e.style.borderStyle||e.style.borderTopStyle),n=wn(e,"border-width")??wn(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,i=r?we(r):null;return{style:t,width:n,color:i}}function qh(e,t){const n=Zd(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?qt(t.width):null,color:t.color};return Ud(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=pe(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function qd(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return Me(n)}function Yh(e,t){const n=t?qt(t):null,r=qd(e);return Qe(r,n)?!1:(n?e.style.borderRadius=pe(n):e.style.removeProperty("border-radius"),!0)}function Yd(e){return Gh(e.style.boxShadow)}function Xh(e,t){const n=Yd(e),r=t?{...t,blur:qt(t.blur)}:null;return Wd(n,r)?!1:(r?e.style.boxShadow=Wh(r):e.style.removeProperty("box-shadow"),!0)}function Xd(e){return Kh(e.style.lineHeight)}function Jh(e,t){const n=Xd(e);return $d(n,t)?!1:(t?e.style.lineHeight=zh(t):e.style.removeProperty("line-height"),!0)}function Jd(e){const t=e.style.backgroundColor;return t?we(t):null}function Qh(e,t){const n=t?we(t):null;return Jd(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Qd(e){return Oh(e.style.opacity)}function eb(e,t){const n=Qd(e),r=t===null?null:$t(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Vd(r),!0)}function Fn(e){const t=Mh(e);return{margin:eu(e,"margin"),padding:eu(e,"padding"),lineHeight:Xd(e),border:Zd(e),borderRadius:qd(e),boxShadow:Yd(e),backgroundColor:Jd(e),opacity:Qd(e),breakInside:t.breakInside,breakAfter:t.breakAfter,breakBefore:t.breakBefore}}function Bn(e,t){let n=!1;return!t.marginMixed&&tu(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&tu(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&Jh(e,t.lineHeight)&&(n=!0),!t.borderMixed&&qh(e,t.border)&&(n=!0),!t.radiusMixed&&Yh(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&Xh(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&Qh(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&eb(e,t.opacity)&&(n=!0),!t.breakInsideMixed&&_h(e,t.breakInside)&&(n=!0),!t.breakAfterMixed&&Lh(e,t.breakAfter)&&(n=!0),!t.breakBeforeMixed&&Ih(e,t.breakBefore)&&(n=!0),n&&lt(e),n}function tb(e){const t=Wl(),n=In(e);if(n.length===0)return t;const r=n.map(Fn),i=r[0];return{margin:i.margin,marginMixed:r.some(a=>!Tt(a.margin,i.margin)),padding:i.padding,paddingMixed:r.some(a=>!Tt(a.padding,i.padding)),lineHeight:i.lineHeight,lineHeightMixed:r.some(a=>!$d(a.lineHeight,i.lineHeight)),border:i.border,borderMixed:r.some(a=>!Ud(a.border,i.border)),borderRadius:i.borderRadius,radiusMixed:r.some(a=>!Qe(a.borderRadius,i.borderRadius)),boxShadow:i.boxShadow,shadowMixed:r.some(a=>!Wd(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),breakInside:i.breakInside,breakInsideMixed:r.some(a=>!Fh(a.breakInside,i.breakInside)),breakAfter:i.breakAfter,breakAfterMixed:r.some(a=>!Jc(a.breakAfter,i.breakAfter)),breakBefore:i.breakBefore,breakBeforeMixed:r.some(a=>!Jc(a.breakBefore,i.breakBefore))}}function nb(e,t){return Ln(e,()=>{const n=Sr(e);if(n.length===0)return!1;let r=!1;for(const i of n)Bn(i,t)&&(r=!0);return r})}const Uo="data-page-at-rule";function an(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...st},marginMixed:!1}}function Gl(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function em(e){return e.body.innerHTML}function hr(e){var r;const n=Gl(e).querySelector(`style[${Uo}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function Co(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?Me(r[1].trim()):null}function rb(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...st};const n=t[1].trim().split(/\s+/).map(u=>Me(u)),[r,i=r,a=r,l=i]=n;return{top:r??null,right:i??null,bottom:a??null,left:l??null}}function ob(e){const t={sizePreset:"auto",customWidth:null,customHeight:null,orientation:null},n=e.match(/(?:^|[\s{;])size\s*:\s*([^;]+)/i);if(!n)return t;const r=n[1].trim().toLowerCase();if(r==="auto")return t;const i=r.includes("landscape"),a=r.includes("portrait"),l=i?"landscape":a?"portrait":null,u=r.replace(/\b(landscape|portrait)\b/g,"").trim(),m=u.split(/\s+/).filter(Boolean);if(m.length===1){if(m[0]==="a4")return{sizePreset:"A4",customWidth:null,customHeight:null,orientation:l};if(m[0]==="letter")return{sizePreset:"letter",customWidth:null,customHeight:null,orientation:l};if(m[0]==="legal")return{sizePreset:"legal",customWidth:null,customHeight:null,orientation:l}}if(m.length>=2){const g=Me(m[0]),p=Me(m[1]);if(g&&p)return{sizePreset:"custom",customWidth:g,customHeight:p,orientation:l}}return!u&&l?{sizePreset:"auto",customWidth:null,customHeight:null,orientation:l}:t}function ib(e){const t=an();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],i=ob(r),a={top:Co(r,"top"),right:Co(r,"right"),bottom:Co(r,"bottom"),left:Co(r,"left")},u=Le.some(m=>a[m]!==null)?a:rb(r);return{...i,margin:u,marginMixed:!1}}function ln(e){return ib(hr(e))}function gt(e,t){return hr(e)||!hr(t)?e:tm(e,ln(t))}function ab(e){const t=Le.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?pe(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:Le.map(r=>e[r]?`margin-${r}: ${pe(e[r])};`:null).filter(Boolean).join(" ")}function lb(e){if(e.sizePreset==="auto"&&!e.orientation)return null;const t=[];return e.sizePreset==="A4"?t.push("A4"):e.sizePreset==="letter"?t.push("letter"):e.sizePreset==="legal"?t.push("legal"):e.sizePreset==="custom"&&e.customWidth&&e.customHeight&&t.push(pe(e.customWidth),pe(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function sb(e){const t=lb(e),n=ab(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function Rn(e){const t=Gl(e);for(const n of t.querySelectorAll(`style[${Uo}]`))n.remove();return em(t)}function cb(e,t){const n=Gl(e);let r=n.querySelector(`style[${Uo}]`);return r||(r=n.createElement("style"),r.setAttribute(Uo,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,em(n)}function tm(e,t){const n=sb(t);return n?cb(e,n):nm(e)}function nm(e){return Rn(e)}function ub(e){const t=e.map(n=>hr(n)).filter(n=>!!n);return t.length===0?"":t.join(`
93
+ `)}const db=1e3;function rm(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.setAttribute("data-wysiwyg-print",""),e.style.position="fixed",e.style.right="0",e.style.bottom="0",e.style.width="0",e.style.height="0",e.style.border="0",document.body.append(e);const t=e.contentDocument,n=e.contentWindow;return!t||!n?(e.remove(),null):{iframe:e,doc:t,win:n}}function om(e,t,n,r){Xa(e,r);let i=!1;const a=()=>{i||(i=!0,n.remove())};t.addEventListener("afterprint",a),t.focus(),t.print(),window.setTimeout(a,db)}function mb(e){const t=rm();t&&om(t.doc,t.win,t.iframe,e)}function fb(e){const t=rm();if(!t)return;const n=[],r=[];for(const u of e){const m=Ce(u);n.push(...m.hrefs),r.push(m.body)}const i=r.map((u,m)=>`<div style="${m<r.length-1?"page-break-after: always;":""}">${u}</div>`).join(""),a=ub(e),l=[a?`<style>${a}</style>`:"",...Array.from(new Set(n)).map(u=>`<link rel="stylesheet" href="${u}" />`),i].filter(Boolean).join("");om(t.doc,t.win,t.iframe,l)}function gb(e){return{save:async()=>{if(e.onSave){const n=e.isMultiPagesEnabled()?e.getAllPagesHtml():e.getHtml();await e.onSave(n);return}const t=e.isMultiPagesEnabled()?e.getActivePageHtml():e.getHtml();await Ip(t)},open:async()=>{const t=e.onOpen?await e.onOpen():await Fp();if(t!==null){if(Array.isArray(t)){e.setHtml(pt(t));return}if(e.isMultiPagesEnabled()){e.setHtml(pt([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){fb(e.getAllPagesHtml());return}mb(e.getHtml())}}}function pb(e){return{toggleBold:()=>{e.toggleFontMark("bold")},toggleItalic:()=>{e.toggleFontMark("italic")},toggleUnderline:()=>{e.toggleFontMark("underline")},toggleStrikethrough:()=>{e.toggleFontMark("strikethrough")},clearFormatting:()=>{e.clearFormatting()},toggleFormatBrush:()=>{e.toggleFormatBrush()},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)},openCustomCss:()=>{e.openCustomCss()},applyCustomCss:t=>{e.applyCustomCss(t)}}}function hb(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(),isFormatBrushActive:()=>e.isFormatBrushActive(),customParagraphStylesEnabled:()=>e.customParagraphStylesEnabled(),getCustomParagraphStyles:()=>e.getCustomParagraphStyles(),isCustomParagraphStylesLoading:()=>e.isCustomParagraphStylesLoading()}}function bb(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function yb(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function xb(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)},openAudioDialog:()=>{e.openAudioDialog()},applyAudio:t=>{e.applyAudio(t)},openYoutubeDialog:()=>{e.openYoutubeDialog()},applyYoutube:t=>{e.applyYoutube(t)},openImageProperties:t=>{e.openImageProperties(t)},applyImageProperties:t=>{e.applyImageProperties(t)},insertHorizontalRule:()=>{e.insertHorizontalRule()},insertPageBreak:()=>{e.insertPageBreak()},insertPage:()=>{e.insertPage()}}}function Cb(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),canInsertPage:()=>e.isMultiPagesEnabled()&&e.getMode()==="visual"}}function wb(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()},mergeCells:()=>{e.mergeCells()},unmergeCells:()=>{e.unmergeCells()}}}function vb(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}const Sb=[50,75,100,125,150,200],kb=.1,Ab=3;function Na(e){return!Number.isFinite(e)||e<=0?1:Math.min(Ab,Math.max(kb,e))}function Pb(e,t,n,r,i){if(e==="fitWidth")return r<=0?1:Na(t/r);if(e==="fitPage"){if(r<=0||i<=0)return 1;const a=t/r,l=n/i;return Na(Math.min(a,l))}return Na(e/100)}function Bt(e,t){return()=>{e.setPageZoom(t)}}function Ht(e,t){return()=>e.getPageZoom()===t}function Db(e){return{setVisualMode:()=>{e.setMode("visual")},setHtmlMode:()=>{e.setMode("html")},toggleFullscreen:()=>{e.setFullscreen(!e.getFullscreen())},openCustomizeToolbar:()=>{e.openCustomizeToolbar()},openDocumentPreview:()=>{e.openDocumentPreview()},toggleReadAloud:()=>{e.toggleReadAloud()},setLightMode:()=>{e.setDarkMode(!1)},setDarkMode:()=>{e.setDarkMode(!0)},setPageZoomFitWidth:Bt(e,"fitWidth"),setPageZoomFitPage:Bt(e,"fitPage"),setPageZoom50:Bt(e,50),setPageZoom75:Bt(e,75),setPageZoom100:Bt(e,100),setPageZoom125:Bt(e,125),setPageZoom150:Bt(e,150),setPageZoom200:Bt(e,200),setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function jb(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isPageZoomFitWidth:Ht(e,"fitWidth"),isPageZoomFitPage:Ht(e,"fitPage"),isPageZoom50:Ht(e,50),isPageZoom75:Ht(e,75),isPageZoom100:Ht(e,100),isPageZoom125:Ht(e,125),isPageZoom150:Ht(e,150),isPageZoom200:Ht(e,200),isToolbarPositionTop:()=>e.getToolbarPosition()==="top",isToolbarPositionLeft:()=>e.getToolbarPosition()==="left",isToolbarPositionRight:()=>e.getToolbarPosition()==="right",isToolbarPositionBottom:()=>e.getToolbarPosition()==="bottom",isReadingAloud:()=>e.isReadingAloud(),canReadAloud:()=>e.canReadAloud()}}function Eb(e){return{addComment:()=>e.addComment(),toggleCommentsVisible:()=>e.toggleCommentsVisible()}}function Rb(e){return{canAddComment:()=>e.canAddComment(),areCommentsVisible:()=>e.areCommentsVisible(),isCommentsEnabled:()=>e.isCommentsEnabled()}}function Tb(e){return{...gb(e),...bb(e),...up(e),...xb(e),...wb(e),...Db(e),...pb(e),...Eb(e)}}function Nb(e){return{...jb(e),...yb(e),...Cb(e),...vb(e),...hb(e),...Rb(e)}}function Wo(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Mb(e){const t=e.style.fontSize;if(!t)return null;const n=_l(t);return!n||!si(n.unit)?null:{value:n.value,unit:n.unit}}function im(e,t){let n=Wo(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Mb(n);if(r)return r;n=n.parentElement}return null}function _b(e,t){const n=Wo(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function am(e,t){var a;let n=Wo(t);for(;n&&n!==e;){if(n.style.fontSize){const u=n.parentElement??e,m=parseFloat(getComputedStyle(u).fontSize);return Number.isFinite(m)&&m>0?m:16}n=n.parentElement}const r=((a=Wo(t))==null?void 0:a.parentElement)??e,i=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(i)&&i>0?i:16}function lm(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function Lb(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function nu(e=rn){return{value:null,unit:e,mixed:!1}}function sm(e,t=rn){const n=window.getSelection();if(!n||n.rangeCount===0)return nu(t);const r=n.getRangeAt(0);if(!le(e,r.commonAncestorContainer))return nu(t);const i=r.collapsed?[]:$e(r).filter(g=>g.data.length>0),a=i.length>0?i:[r.startContainer],l=a.map(g=>im(e,g)),u=l[0];if(l.every(g=>Lb(g,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(l.every(g=>g===null)){const g=a.map(h=>_b(h,e)),p=g[0];if(g.every(h=>Math.abs(h-p)<.05)){const h=am(e,a[0]),C=lm(e);return{value:Ed(p,t,h,C),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function Ib(e,t){return{parentPx:am(e,t),rootPx:lm(e)}}function Fb(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return le(e,n.commonAncestorContainer)?n:null}function tl(e,t,n){const r=on(t,n);if(!r)return!1;const i=Fb(e);if(!i||i.collapsed)return!1;const a=Ml(r.value,r.unit);bt(i);const l=$e(i).filter(u=>u.data.length>0);for(const u of l){const m=im(e,u);m&&m.value===r.value&&m.unit===r.unit||Cr(u,g=>{g.style.fontSize=a})}return cn(l),!0}function Bb(e,t){e.style.fontSize=Ml(t.value,t.unit)}function Hb(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function zb(e){return e.trim().toLowerCase()}function nl(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=zb(r.slice(0,i)),l=r.slice(i+1).trim();a&&(t[a]=l)}return t}function cm(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function Ob(e,t){const n={...e};for(const[r,i]of Object.entries(t))i.trim()?n[r]=i:delete n[r];return n}function Kb(e){const t=e.trim();if(!t)return"";const n=t.split(";").map(r=>r.trim()).filter(Boolean);return n.length===0?"":n.map(r=>`${r};`).join(`
94
+ `)}function ui(e){const t=nl(e);return cm(t)}function $b(e,t){let n=Hb(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function um(e){const t=Ct(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:$e(t).filter(m=>m.data.length>0),a=(n.length>0?n:[t.startContainer]).map(m=>$b(e,m)).map(m=>m.trim()),l=a[0]??"";return a.every(m=>m===l)?{value:l||null,mixed:!1}:{value:null,mixed:!0}}function dm(e,t){const n=nl(e.style.cssText),r=nl(t),i=Ob(n,r),a=cm(i);a?e.style.cssText=a:e.removeAttribute("style")}function mm(e,t){const n=ui(t);if(!n)return!1;const r=Ct(e);if(!r||r.collapsed)return!1;bt(r);const i=$e(r).filter(a=>a.data.length>0);if(i.length===0)return!1;for(const a of i)Cr(a,l=>{dm(l,n),Vt(l)&&Ze(l)});return cn(i),!0}function Ub(e,t){const n=ui(t);n&&dm(e,n)}function Wb(e){return!!(e&&ui(e))}const tt=["bold","italic","underline","strikethrough"],vn={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},Gb=new Set(["underline","line-through","overline"]);function Rt(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function Vb(e,t){return tt.every(n=>e[n]===t[n])}function Zb(e){return tt.some(t=>e[t]!==void 0)}function fm(e,t){const n={...e};if(!t)return n;for(const r of tt){const i=t[r];i!==void 0&&(n[r]=i)}return n}function qb(e,t,n){const r=e[n]??t[n],i={...e,[n]:!r};return i[n]===t[n]&&delete i[n],i}function Ut(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>Gb.has(n))}function Tn(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 gm(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(vn.bold.has(r))return!0;const l=n.style.fontWeight;if(!l)return null;if(l==="bold"||l==="bolder")return!0;const u=Number(l);return Number.isNaN(u)?l==="normal"||l==="lighter"?!1:null:u>=700}if(t==="italic"){if(vn.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(vn.underline.has(r))return!0;const l=n.style.textDecorationLine||n.style.textDecoration;if(!l)return null;if(l==="none")return!1;const u=Ut(n);return u.includes("underline")?!0:u.length>0?!1:null}if(vn.strikethrough.has(r))return!0;const i=n.style.textDecorationLine||n.style.textDecoration;if(!i)return null;if(i==="none")return!1;const a=Ut(n);return a.includes("line-through")?!0:a.length>0?!1:null}function Go(e,t){return gm(e,t)===!0}function Nn(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const i=gm(r,n);if(i!==null)return i;r=r.parentElement}return!1}function pm(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=Ut(e);r.includes("underline")||r.push("underline"),Tn(e,r);return}const n=Ut(e);n.includes("line-through")||n.push("line-through"),Tn(e,n)}function hm(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"){Tn(e,Ut(e).filter(n=>n!=="underline"));return}Tn(e,Ut(e).filter(n=>n!=="line-through"))}function Yb(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=Ut(e).filter(i=>i!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}Tn(e,r);return}const n=Ut(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}Tn(e,n)}function Xb(e,t){Cr(e,n=>pm(n,t))}function Jb(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!xt(i)||!Go(i,n)){r=i;continue}if(Zt(i,r),Go(i,n)){if(vn[n].has(i.tagName.toLowerCase())){Ze(i);continue}if(hm(i,n),Vt(i)){Ze(i);continue}}r=i}}function Qb(e,t,n){const r=$e(t).filter(i=>i.data.length>0);return r.length===0?Nn(e,t.startContainer,n):r.every(i=>Nn(e,i,n))}function ey(e,t,n,r){bt(t);const i=$e(t).filter(a=>a.data.length>0);for(const a of i)r?Nn(e,a,n)||Xb(a,n):Jb(e,a,n);cn(i)}function Sn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return Rt();const n=t.getRangeAt(0);if(!le(e,n.commonAncestorContainer))return Rt();if(n.collapsed)return rl(e,n);const r=$e(n).filter(a=>a.data.length>0);if(r.length===0)return rl(e,n);const i=Rt();for(const a of tt)i[a]=Nn(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const l of tt)i[l]=i[l]&&Nn(e,r[a],l);return i}function rl(e,t){const n=Rt();for(const r of tt)n[r]=Nn(e,t.startContainer,r);return n}function ol(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!le(e,r.commonAncestorContainer)||r.collapsed)return!1;const i=Qb(e,r,t);return ey(e,r,t,!i),!0}function ty(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 ny(e,t,n){var a,l,u;ty(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?(u=r.parentNode)==null||u.insertBefore(m,r):t.startContainer.appendChild(m),r=m}let i=r;for(;i.parentElement&&i.parentElement!==e;){const m=i.parentElement;if(!xt(m)){i=m;continue}if(!n.some(p=>Go(m,p))){i=m;continue}Zt(m,i);for(const p of n)if(Go(m,p)){if(vn[p].has(m.tagName.toLowerCase())){Ze(m);break}if(hm(m,p),Vt(m)){Ze(m);break}}i=m.isConnected?m:r}return r}function ry(e,t,n){for(const r of tt)n[r]!==t[r]&&(n[r]?pm(e,r):Yb(e,r))}function oy(e,t,n,r,i,a,l){var k,P;const u=window.getSelection();if(!u||u.rangeCount===0)return;const m=u.getRangeAt(0);if(!le(e,m.commonAncestorContainer))return;const g=rl(e,m),p=fm(g,n),h=tt.filter(N=>g[N]&&!p[N]),C=Eh(e,m.startContainer,i),y=th(e,m.startContainer,a);let x=null;h.length>0?(x=ny(e,m,h),C.length>0&&Fd(e,x,C),y&&Ya(e,x)):C.length>0?(x=jh(e,m,C),y&&Ya(e,x)):y?x=eh(e,m):m.deleteContents();const b=document.createElement("span");ry(b,g,p),r&&Bb(b,r),i!=null&&i.color&&Yc(b,"color",i.color),i!=null&&i.backgroundColor&&Yc(b,"backgroundColor",i.backgroundColor),a&&Yp(b,a),l&&Ub(b,l),b.textContent=t;const S=b.style.cssText.trim()?b:document.createTextNode(t);x?((k=x.parentNode)==null||k.insertBefore(S,x),x.nodeType===Node.TEXT_NODE&&!x.data&&((P=x.parentNode)==null||P.removeChild(x))):m.insertNode(S);const v=document.createRange();v.selectNodeContents(S),v.collapse(!1),u.removeAllRanges(),u.addRange(v)}const Vo=["p","h1","h2","h3","h4","h5","h6"],iy=new Set(Vo),bm=new Set([...Vo,"div"]),di=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),ay=()=>({tag:null,mixed:!1});function ym(e){return iy.has(e)}function ly(e){return ym(e)?e:e==="div"?"p":null}function sy(e){return e instanceof Element&&di.has(ue(e))}function xm(e){return e instanceof HTMLElement&&!yt(e)&&bm.has(ue(e))}function il(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ue(e);return bm.has(t)||di.has(t)?!1:xt(e)||t==="br"||t==="a"||t==="img"||t==="span"}function cy(e,t){let n=vr(t);for(;n&&n!==e;){if(di.has(ue(n)))return!0;n=n.parentElement}return!1}function Cm(e,t){let n=vr(t);for(;n&&n!==e;){if(Cd(n,e)){n=n.parentElement;continue}if(xm(n))return n;if(di.has(ue(n)))return null;n=n.parentElement}return null}function uy(e,t){const n=new Set,r=[];for(const i of zl(t)){const a=Cm(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function dy(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function my(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&il(n[i-1]);)i-=1;for(;a<n.length-1&&il(n[a+1]);)a+=1;return n.slice(i,a+1)}function al(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&yt(t)))return t;return null}function fy(e,t,n){if(n.startContainer===e){const r=e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild;return r instanceof HTMLElement&&yt(r)?al(e):r}return n.startContainer===t&&e!==t?al(e):dy(e,n.startContainer)}function gy(e,t,n){const r=jl(e);if(cy(e,t.startContainer))return!1;if(!al(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const i=fy(r,e,t);if(!i||i instanceof HTMLElement&&yt(i)||sy(i)||xm(i)||!il(i))return!1;const a=my(r,i),l=document.createElement(n);r.insertBefore(l,a[0]);for(const u of a)l.appendChild(u);return!0}function py(e){const t=Ct(e);if(!t)return ay();const n=zl(t).map(i=>{const a=Cm(e,i);return a?ly(ue(a)):null}),r=n[0];return n.every(i=>i===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function hy(e,t){if(!ym(t))return!1;const n=Ct(e);if(!n)return!1;const r=jn(e,n.startContainer,n.startOffset),i=jn(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),u=uy(e,n);let m=!1;if(u.length===0)m=gy(e,n,t);else for(const g of u)ue(g)!==t&&(Kl(g,t),m=!0);return Ol(e,a,l),m}function Vl(e){if(!et(e))return null;const t=En(e);if(!t)return null;const n=ue(t);return n==="ul"||n==="ol"?n:null}function wm(e){const t=In(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(Vl),r=n[0];return n.every(i=>i===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function by(e,t,n){const r=[...e.children].filter(i=>Hl(i));for(const i of r)t.insertBefore(i,n)}function vm(e){const t=En(e),n=document.createElement("p");for(const g of[...e.attributes])n.setAttribute(g.name,g.value);for(n.style.marginLeft="",lt(n);e.firstChild&&!Hl(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=et(a)?a.parentNode??a:a,u=et(a)?a.nextSibling:t.nextSibling;e.remove();let m=null;if(r.length>0){m=document.createElement(t.tagName);for(const g of r)m.appendChild(g)}return l.insertBefore(n,u),m&&l.insertBefore(m,n.nextSibling),by(e,l,n.nextSibling),t.childElementCount===0&&t.remove(),n}function yy(e){if(et(e))return e;const t=Kl(e,"li");return t.style.marginLeft="",lt(t),t}function Sm(e,t){if(e.length===0)return!1;if(e.every(et)){const a=En(e[0]);if(a&&e.every(l=>l.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return ue(a)===t?!1:(Kl(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=et(a)?En(a):null;i.appendChild(yy(a)),l&&l!==i&&l.childElementCount===0&&l.remove()}return!0}function km(e){let t=!1;for(const n of[...e].reverse())et(n)&&(vm(n),t=!0);return t}function xy(e,t){return Ln(e,()=>{const n=Sr(e);if(n.length===0)return!1;if(n.every(a=>Vl(a)===t))return km(n);let i=!1;for(const a of Md(n))Sm(a,t)&&(i=!0);return i})}function Cy(e,t){return Ln(e,()=>{const n=Sr(e);if(n.length===0)return!1;if(t===null)return km(n);if(n.every(a=>Vl(a)===t))return!1;let i=!1;for(const a of Md(n))Sm(a,t)&&(i=!0);return i})}const Am=40;function Zl(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function Pm(e,t){if(t<=0){e.style.marginLeft="",lt(e);return}e.style.marginLeft=`${t}px`}function wy(e){let t=e.previousElementSibling;for(;t;){if(et(t))return t;t=t.previousElementSibling}return null}function vy(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(ue(n)==="ul"||ue(n)==="ol"))return n}return null}function Sy(e){const t=wy(e);if(!t)return!1;const n=En(e);if(!n)return!1;const r=ue(n)==="ol"?"ol":"ul";let i=vy(t);return(!i||ue(i)!==r)&&(i=document.createElement(r),t.appendChild(i)),i.appendChild(e),!0}function ky(e){const t=En(e);if(!t)return!1;const n=t.parentElement;if(n&&et(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return vm(e),!0}function Ay(e){return In(e).some(n=>et(n)||Zl(n)>0)}function Py(e){return Ln(e,()=>{const t=Sr(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(et(r)){Sy(r)&&(n=!0);continue}Pm(r,Zl(r)+Am),n=!0}return n})}function Dy(e){return Ln(e,()=>{const t=In(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(et(r)){ky(r)&&(n=!0);continue}const i=Zl(r);i<=0||(Pm(r,Math.max(0,i-Am)),n=!0)}return n})}function mi(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function sn(e,t,n){const r=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(n));r<=1?e.removeAttribute("colspan"):e.colSpan=r,i<=1?e.removeAttribute("rowspan"):e.rowSpan=i}function qe(e){const t=e.rows.length,n=Array.from({length:t},()=>[]),r=[];let i=0;for(let a=0;a<t;a+=1){const l=e.rows[a];let u=0;for(const m of Array.from(l.cells)){for(;n[a][u];)u+=1;const g=mi(m),p={cell:m,originRow:a,originCol:u,rowSpan:g.rowSpan,colSpan:g.colSpan};r.push(p);for(let h=0;h<g.rowSpan;h+=1){const C=a+h;if(C>=t)break;for(let y=0;y<g.colSpan;y+=1)n[C][u+y]=p}u+=g.colSpan,i=Math.max(i,u)}i=Math.max(i,n[a].length)}return{table:e,slots:n,unique:r,rowCount:t,colCount:i}}function Zo(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function ct(e,t){return e.unique.find(n=>n.cell===t)??null}function Dm(e,t){return e.originRow<t.minRow||e.originCol<t.minCol||e.originRow+e.rowSpan-1>t.maxRow||e.originCol+e.colSpan-1>t.maxCol}function jm(e){if(e.length===0)return null;let t=1/0,n=-1/0,r=1/0,i=-1/0;for(const a of e)t=Math.min(t,a.originRow),n=Math.max(n,a.originRow+a.rowSpan-1),r=Math.min(r,a.originCol),i=Math.max(i,a.originCol+a.colSpan-1);return{minRow:t,maxRow:n,minCol:r,maxCol:i}}function jy(e,t){const n=new Set,r=[];for(let i=t.minRow;i<=t.maxRow;i+=1)for(let a=t.minCol;a<=t.maxCol;a+=1){const l=Zo(e,i,a);!l||n.has(l.cell)||(n.add(l.cell),r.push(l.cell))}return r}function Em(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=Zo(e,t.minRow,t.minCol);if(!n||n.originRow!==t.minRow||n.originCol!==t.minCol)return null;const r=new Set,i=[];for(let a=t.minRow;a<=t.maxRow;a+=1)for(let l=t.minCol;l<=t.maxCol;l+=1){const u=Zo(e,a,l);if(!u||Dm(u,t))return null;r.has(u.cell)||(r.add(u.cell),i.push(u.cell))}return{origin:n,cells:i,colSpan:t.maxCol-t.minCol+1,rowSpan:t.maxRow-t.minRow+1}}function Ey(e,t,n,r){const i={minRow:t.originRow,maxRow:t.originRow+r-1,minCol:t.originCol,maxCol:t.originCol+n-1};if(i.maxRow>=e.rowCount||i.maxCol>=e.colCount)return!1;for(let a=i.minRow;a<=i.maxRow;a+=1)for(let l=i.minCol;l<=i.maxCol;l+=1){const u=Zo(e,a,l);if(!u)return!1;if(u.cell!==t.cell&&Dm(u,i))return!1}return!0}const ru=10,kn=1,An=50,Ry="1px solid #000",Ty="0.25em",Ny=new Set(["td","th"]);function Rm(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=kn&&t>=kn&&e<=An&&t<=An}function Ke(e,t){return Yl(e,t,n=>n instanceof HTMLTableElement)}function qo(e,t){return Yl(e,t,n=>$y(n))}function My(e,t){return Yl(e,t,n=>n instanceof HTMLTableRowElement)}function ql(e){return Ke(e,Xl(e))}function wt(e){return qo(e,Xl(e))}function Tm(e){return My(e,Xl(e))}function _y(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function kr(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!le(e,n.commonAncestorContainer))return[];const r=qo(e,n.startContainer),i=qo(e,n.endContainer);if(!r)return[];if(!i||r===i)return[r];const a=Ke(e,r);if(!a||Ke(e,i)!==a)return[r];const l=qe(a),u=ct(l,r),m=ct(l,i);if(!u||!m)return[r];const g=jm([u,m]);if(!g)return[r];const p=jy(l,g);return p.length>0?p:[r]}function Ly(e,t){if(!Rm(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!le(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 u=0;u<t.rows;u+=1){const m=document.createElement("tr");for(let g=0;g<t.cols;g+=1)m.appendChild(Uy("td"));a.appendChild(m)}i.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(i),Zy(e,i);const l=i.querySelector("td, th");return l instanceof HTMLTableCellElement&&Oe(l),!0}function ll(e,t){var h,C,y,x;const n=wt(e);if(!n)return!1;const r=Ke(e,n);if(!r)return!1;const i=qe(r),a=ct(i,n);if(!a)return!1;const l=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const b of i.unique)if(b.originRow<l&&b.originRow+b.rowSpan>l){sn(b.cell,b.colSpan,b.rowSpan+1);for(let S=b.originCol;S<b.originCol+b.colSpan;S+=1)u.add(S)}const m=document.createElement("tr"),g=Math.min(l,i.rowCount-1);for(let b=0;b<i.colCount;b+=1){if(u.has(b))continue;const S=((C=(h=i.slots[g])==null?void 0:h[b])==null?void 0:C.cell)??n;m.appendChild(Jl(S))}if(l>=r.rows.length)(y=r.rows[r.rows.length-1].parentNode)==null||y.appendChild(m);else{const b=r.rows[l];(x=b.parentNode)==null||x.insertBefore(m,b)}const p=Gy(m,i.colCount,u,a.originCol);return Oe(p||n),!0}function ou(e,t){var g,p,h,C;const n=wt(e);if(!n)return!1;const r=Ke(e,n);if(!r)return!1;const i=qe(r),a=ct(i,n);if(!a)return!1;const l=t==="before"?a.originCol:a.originCol+a.colSpan,u=new Set;for(const y of i.unique)if(y.originCol<l&&y.originCol+y.colSpan>l){sn(y.cell,y.colSpan+1,y.rowSpan);for(let x=y.originRow;x<y.originRow+y.rowSpan;x+=1)u.add(x)}let m=null;for(let y=0;y<i.rowCount;y+=1){if(u.has(y))continue;const x=((p=(g=i.slots[y])==null?void 0:g[Math.min(l,Math.max(0,i.colCount-1))])==null?void 0:p.cell)??((C=(h=i.slots[y])==null?void 0:h[Math.max(0,l-1)])==null?void 0:C.cell)??n,b=Jl(x);Ql(r,y,l,b),y===a.originRow&&(m=b)}return m&&Oe(m),!0}function Iy(e){var C,y;const t=wt(e);if(!t)return!1;const n=Ke(e,t);if(!n)return!1;const r=qe(n),i=ct(r,t);if(!i)return!1;if(r.rowCount<=1)return sl(e,n);const a=i.originRow,l=a+1,u=[];for(const x of r.unique)x.originRow<=a&&x.originRow+x.rowSpan>a&&(x.originRow<a?sn(x.cell,x.colSpan,x.rowSpan-1):x.originRow===a&&x.rowSpan>1&&u.push(x));u.sort((x,b)=>x.originCol-b.originCol);for(const x of u)sn(x.cell,x.colSpan,x.rowSpan-1),Ql(n,l,x.originCol,x.cell);const m=i.originCol;n.rows[a].remove();const g=n.rows[Math.min(a,n.rows.length-1)],p=qe(n),h=(y=(C=p.slots[Math.min(a,p.rowCount-1)])==null?void 0:C[Math.min(m,Math.max(0,p.colCount-1))])==null?void 0:y.cell;return h?Oe(h):g!=null&&g.cells[0]?Oe(g.cells[0]):Yy(n),!0}function Fy(e){var g,p,h;const t=wt(e);if(!t)return!1;const n=Ke(e,t);if(!n)return!1;const r=qe(n),i=ct(r,t);if(!i)return!1;if(r.colCount<=1)return sl(e,n);const a=i.originCol,l=i.originRow;for(const C of r.unique)a<C.originCol||a>=C.originCol+C.colSpan||(C.colSpan===1?C.cell.remove():sn(C.cell,C.colSpan-1,C.rowSpan));const u=qe(n);if(u.colCount===0||u.unique.length===0)return sl(e,n);const m=((p=(g=u.slots[Math.min(l,u.rowCount-1)])==null?void 0:g[Math.min(a,u.colCount-1)])==null?void 0:p.cell)??((h=u.unique[0])==null?void 0:h.cell);return m&&Oe(m),!0}function By(e,t){const n=wt(e);if(!n)return!1;const r=Ke(e,n);if(!r)return!1;const i=_y(r),a=i.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(Oe(i[a-1]),{changed:!1});if(a<i.length-1)return Oe(i[a+1]),{changed:!1};const l=n.parentElement;if(!ll(e,"below"))return!1;const u=l instanceof HTMLTableRowElement?l.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&Oe(u.cells[0]),{changed:!0}}function Hy(e,t){return!le(e,t)||t===e?!1:(Oe(t),!0)}function iu(e){return Nm(e)!==null}function au(e){const t=wt(e);if(!t)return!1;const n=mi(t);return n.colSpan>1||n.rowSpan>1}function zy(e){const t=Nm(e);if(!t)return!1;const n=Ke(e,t.origin.cell);return n?Mm(n,t):!1}function Oy(e){const t=wt(e);if(!t)return!1;const n=Ke(e,t);return n?_m(n,t):!1}function Ky(e,t,n){const r=wt(e);if(!r)return!1;const i=Ke(e,r);if(!i)return!1;const a=qe(i),l=ct(a,r);if(!l)return!1;const u=Math.min(a.colCount-l.originCol,Math.max(1,Math.floor(t))),m=Math.min(a.rowCount-l.originRow,Math.max(1,Math.floor(n)));if(u===l.colSpan&&m===l.rowSpan||!Ey(a,l,u,m))return!1;if((l.colSpan>1||l.rowSpan>1)&&_m(i,r),u===1&&m===1)return Oe(r),!0;const g=qe(i),p=Em(g,{minRow:l.originRow,maxRow:l.originRow+m-1,minCol:l.originCol,maxCol:l.originCol+u-1});return p?Mm(i,p):!0}function Yl(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function $y(e){return Ny.has(e.tagName.toLowerCase())}function Xl(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return le(e,n.commonAncestorContainer)?n.startContainer:null}function Nm(e){const t=kr(e);if(t.length<2)return null;const n=Ke(e,t[0]);if(!n)return null;const r=qe(n),i=[];for(const u of t){const m=ct(r,u);if(!m)return null;i.push(m)}const a=jm(i);if(!a)return null;const l=Em(r,a);return!l||l.cells.length<2?null:l}function Mm(e,t){const n=t.origin.cell,r=qe(e),i=t.cells.map(a=>ct(r,a)).filter(a=>a!==null).sort((a,l)=>a.originRow-l.originRow||a.originCol-l.originCol);for(const a of i)a.cell!==n&&Vy(n,a.cell);sn(n,t.colSpan,t.rowSpan);for(const a of i)a.cell!==n&&a.cell.remove();return Oe(n),!0}function _m(e,t){const n=qe(e),r=ct(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;sn(t,1,1);for(let i=r.originRow;i<r.originRow+r.rowSpan;i+=1)for(let a=r.originCol;a<r.originCol+r.colSpan;a+=1)i===r.originRow&&a===r.originCol||Ql(e,i,a,Jl(t));return Oe(t),!0}function Uy(e){const t=document.createElement(e);return t.style.border=Ry,t.style.padding=Ty,t.appendChild(document.createElement("br")),t}function Jl(e){const t=e.cloneNode(!1);for(t.removeAttribute("colspan"),t.removeAttribute("rowspan");t.firstChild;)t.removeChild(t.firstChild);return t.appendChild(document.createElement("br")),t}function Wy(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Ql(e,t,n,r){const i=e.rows[t];if(!i)return;const a=qe(e);let l=0;for(const u of Array.from(i.cells)){if(u===r)continue;const m=ct(a,u);if(!m||m.originCol>=n)break;l+=1}Wy(i,l,r)}function Gy(e,t,n,r){let i=0;for(let a=0;a<t;a+=1)if(!n.has(a)){if(a>=r)return e.cells[i]??null;i+=1}return e.cells[e.cells.length-1]??null}function lu(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 Vy(e,t){if(!(e===t||lu(t)))for(lu(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function Zy(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),qy(n)&&n.remove())}function qy(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 sl(e,t){if(!t.parentNode||!le(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 Oe(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function Yy(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const Lm=["left","center","right","justify"];function Xy(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function Yo(e){return Xy(e.style.textAlign)}function cl(e,t){const n=t??"left";return Yo(e)===n?t===null&&e.style.textAlign?(e.style.removeProperty("text-align"),!0):!1:(t===null||t==="left"?e.style.removeProperty("text-align"):e.style.textAlign=t,!0)}function su(e){const t=e[0];return e.every(n=>n===t)?{align:t,mixed:!1}:{align:null,mixed:!0}}function Im(e){const t=kr(e);if(t.length>0)return su(t.map(Yo));const n=In(e);return n.length===0?Ct(e)?{align:"left",mixed:!1}:{align:null,mixed:!1}:su(n.map(Yo))}function Fm(e,t){return Lm.includes(t)?Ln(e,()=>{const n=kr(e);if(n.length>0){let a=!1;for(const l of n)cl(l,t)&&(a=!0);return a}const r=Sr(e);if(r.length===0)return!1;let i=!1;for(const a of r)cl(a,t)&&(i=!0);return i}):!1}function ur(){return{...Wl(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function cu(e){const t=tb(e),n=Im(e),r=wm(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function Bm(e,t){let n=!1;return!t.alignMixed&&t.align&&Fm(e,t.align)&&(n=!0),t.listMixed||Cy(e,t.list)&&(n=!0),nb(e,t)&&(n=!0),n}function Jy(e,t){return Bm(e,ul(t))}function Hm(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,breakInside:e.breakInsideMixed?void 0:e.breakInside,breakAfter:e.breakAfterMixed?void 0:e.breakAfter,breakBefore:e.breakBeforeMixed?void 0:e.breakBefore}}function ul(e){const t=ur();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,breakInside:e.breakInside===void 0?t.breakInside:e.breakInside,breakInsideMixed:e.breakInside===void 0,breakAfter:e.breakAfter===void 0?t.breakAfter:e.breakAfter,breakAfterMixed:e.breakAfter===void 0,breakBefore:e.breakBefore===void 0?t.breakBefore:e.breakBefore,breakBeforeMixed:e.breakBefore===void 0}:{...t,alignMixed:!0,listMixed:!0,marginMixed:!0,paddingMixed:!0,lineHeightMixed:!0,borderMixed:!0,radiusMixed:!0,shadowMixed:!0,backgroundMixed:!0,opacityMixed:!0,breakInsideMixed:!0,breakAfterMixed:!0,breakBeforeMixed:!0}}const zm="data-page-sized",Qy={A4:{width:"210mm",height:"297mm"},letter:{width:"8.5in",height:"11in"},legal:{width:"8.5in",height:"14in"}};function Om(e){let t=null;if(e.sizePreset==="A4"||e.sizePreset==="letter"||e.sizePreset==="legal")t={...Qy[e.sizePreset]};else if(e.sizePreset==="custom"&&e.customWidth&&e.customHeight)t={width:pe(e.customWidth),height:pe(e.customHeight)};else return e.orientation,null;return e.orientation==="landscape"?{width:t.height,height:t.width}:t}function ex(e){return Om(e)!==null}function tx(e){return nx(e.margin)}function nx(e){return{top:e.top?pe(e.top):null,right:e.right?pe(e.right):null,bottom:e.bottom?pe(e.bottom):null,left:e.left?pe(e.left):null}}const rx=["width","min-height","padding-top","padding-right","padding-bottom","padding-left"];function ox(e){e.removeAttribute(zm);for(const t of rx)e.style.removeProperty(t)}function Ar(e,t){const n=ln(t),r=Om(n);if(!r){ox(e);return}e.setAttribute(zm,""),e.style.width=r.width,e.style.minHeight=r.height;const i=tx(n);for(const a of Le){const l=`padding-${a}`,u=i[a];u?e.style.setProperty(l,u):e.style.removeProperty(l)}}const ix=2*1024*1024,ax="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",lx=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),sx=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),cx=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,ux=/^(javascript|vbscript|file|blob):/i;function dx(e={}){return{src:"",alt:"",title:"",...e}}function Hn(e){const t=e.trim();if(!t)return"empty";if(ux.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return cx.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 mx(e){return e.size>ix?"tooLarge":bx(e)?null:"type"}function fx(e){const t=mx(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(Hn(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function gx(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",px(e,t.css)}function px(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 hx(e,t){const n=dx(t);if(Hn(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!le(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("img");return gx(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function dl(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function Ma(e,t){if(!le(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 bx(e){const t=e.type.trim().toLowerCase();if(t&&lx.has(t))return!0;const n=yx(e.name);return!!(!t&&n&&sx.has(n))}function yx(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Km=["%","px","pt","pc","em","rem"],xx="%",Cx={"%":[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]},Mn={"%":{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}},wx=new Set(Km),vx=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function Sx(e){return wx.has(e)}function Pn(e){return`${Q(e.value)}${e.unit}`}function Xo(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(vx);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 Sx(i)?_n(r,i):null}function uu(e,t){const n=e.trim();if(!n)return null;const r=Xo(n);if(r)return r;const i=Number(n.replace(",","."));return Number.isFinite(i)?_n(i,t):null}function _n(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=Mn[t];return{value:Te(Math.min(r,Math.max(n,e))),unit:t}}function dr(e,t,n){const r=n>0?n:1;if(e==="width"){const a=_n(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:_n(t.value*r,t.unit)??t,height:t}}const _o="data-hover-css",es=["fill","contain","cover","none","scale-down"],ts=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],kx=new Set(es),Ax=new Set(ts),du="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",Px="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",Dx=/^-?[a-z][a-z0-9-]*$/i,jx=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,ml=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function $m(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...st},border:{...Ul},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function Ex(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function Rx(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=dr("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=dr("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function Tx(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||Dx.test(a)&&(a==="behavior"||a.endsWith("binding")||jx.test(l)||t.push(`${a}: ${l}`))}return t.join("; ")}function Ot(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!le(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&&le(e,r))return r}return dl(e,n.commonAncestorContainer)}function Nx(e){const t=Ot(e);return t?Um(t):null}function Um(e){const t=Fn(e),n=Fx(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,i=_x(e);return $m({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:Gm(e),objectPosition:Ox(e),rotateDeg:Vm(e),hoverCss:e.getAttribute(_o)??""})}function Wm(e,t){let n=!1;return Lx(e,t)&&(n=!0),Bn(e,{margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:st,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),Bx(e,t.align)&&(n=!0),Hx(e,t.objectFit)&&(n=!0),zx(e,t.objectPosition)&&(n=!0),$x(e,t.rotateDeg)&&(n=!0),Ux(e,t.hoverCss)&&(n=!0),n}function Mx(e,t){const n=Ot(e);return n?Wm(n,t):!1}function _x(e){const t=Xo(e.style.width),n=Xo(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 Lx(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=Ix(t);return r.width?e.style.width=Pn(r.width):e.style.removeProperty("width"),r.height?e.style.height=Pn(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 Ix(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 Fx(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 Bx(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 Gm(e){const t=e.style.objectFit.trim().toLowerCase();return kx.has(t)?t:null}function Hx(e,t){return Gm(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function zx(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 Ox(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Ax.has(t),t):null}function Vm(e){const t=ml.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?Te(n):null}function Kx(e){const t=e.trim();return t?ml.test(t)&&t.replace(ml,"").trim()==="":!0}function $x(e,t){const n=Vm(e),r=t===null||t===0?null:Te(t);return n===r?!1:r===null?Kx(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${Q(r)}deg)`,!0)}function Ux(e,t){const n=Tx(t),r=e.getAttribute(_o)??"",i=e.getAttribute("onmouseover")??"";return r===n&&(n&&i===du||!n&&!i)?!1:n?(e.setAttribute(_o,n),e.setAttribute("onmouseover",du),e.setAttribute("onmouseout",Px),!0):(e.removeAttribute(_o),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const Dn={value:100,unit:"%"},Wx=new Set(es),Gx=new Set(ts),Vx=new Set(["cover","contain","scale-down","none"]),mu={contain:"contain",cover:"cover",auto:"none"},fu={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function ns(){return{src:null,opacity:null,fit:null,position:null,width:{...Dn},height:null}}function Zm(e){return e!=null&&Vx.has(e)}function qm(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?$t(n):null}function Zx(e,t){const n=qm(e),r=t===null?null:$t(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Vd(r),!0)}function Ym(e){const t=e.style.backgroundImage.trim();if(!t||t==="none")return null;const n=/^url\(\s*["']?(.+?)["']?\s*\)$/i.exec(t);return n&&n[1].trim()||null}function qx(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function Yx(e,t){const n=Ym(e),r=(t==null?void 0:t.trim())??"",i=r&&Hn(r)===null?r:null;return n===i?!1:(i?e.style.backgroundImage=qx(i):e.style.removeProperty("background-image"),!0)}function Xm(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function _a(e){return!e||e==="auto"?null:Xo(e)}function Xx(e){return Zm(e.fit)&&e.fit?fu[e.fit]:e.fit==="fill"?fu.fill:e.width&&e.height?`${Pn(e.width)} ${Pn(e.height)}`:e.width?Pn(e.width):e.height?`auto ${Pn(e.height)}`:null}function Jx(e){const t=Xm(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...Dn},height:{...Dn}};if(mu[t])return{fit:mu[t],width:null,height:null};if(Wx.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:_a(n[0]),height:null}:n.length===2?{fit:null,width:_a(n[0]),height:_a(n[1])}:{fit:null,width:null,height:null}}function Qx(e,t){const n=Xm(e.style.backgroundSize),r=Xx(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function e1(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Gx.has(t),t):null}function t1(e,t){const n=(t==null?void 0:t.trim().toLowerCase().replace(/\s+/g," "))||"";return e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ")===n?!1:(n?e.style.backgroundPosition=n:e.style.removeProperty("background-position"),!0)}function fl(e){let t=!1;return e.id!==Fo&&(e.id=Fo,t=!0),e.hasAttribute(Io)||(e.setAttribute(Io,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function Jm(e){const t=e.getAttribute("style");return e.style.position="absolute",e.style.inset="0",e.style.zIndex="-1",e.style.pointerEvents="none",e.style.userSelect="none",e.style.backgroundRepeat="no-repeat",e.getAttribute("style")!==t}function n1(e){const t=Pl(e),n=t[0]??null;if(n){let i=fl(n);for(const a of t.slice(1))a.remove(),i=!0;return(n.parentNode!==e||n!==e.firstChild)&&(e.insertBefore(n,e.firstChild),i=!0),{layer:n,changed:i}}const r=document.createElement("div");return fl(r),Jm(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function r1(e){const t=Pl(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function gu(e){let t=!1;return Dl(e)?(e.style.position!=="relative"&&(e.style.position="relative",t=!0),e.style.isolation!=="isolate"&&(e.style.isolation="isolate",t=!0)):(e.style.position==="relative"&&(e.style.removeProperty("position"),t=!0),e.style.isolation==="isolate"&&(e.style.removeProperty("isolation"),t=!0)),t}function o1(e){const t=Dl(e);if(!t)return ns();const n=Jx(t);return{src:Ym(t),opacity:qm(t),fit:n.fit,position:e1(t),width:n.width,height:n.height}}function i1(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&Hn(n)===null)){const m=r1(e),g=gu(e);return(m||g)&&lt(e),m||g}const i=n1(e),a=i.layer;let l=i.changed;return fl(a)&&(l=!0),Jm(a)&&(l=!0),gu(e)&&(l=!0),Yx(a,n)&&(l=!0),Qx(a,t)&&(l=!0),t1(a,t.position)&&(l=!0),Zx(a,t.opacity)&&(l=!0),l&&(lt(a),lt(e)),l}function a1(){return{size:null,unit:rn,marks:Rt(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function gl(){return{font:a1(),box:Wl(),backgroundImage:ns(),atRule:an()}}function l1(e){const t=e.style.fontSize,n=t?_l(t):null,r=n&&si(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)},u=e.style.color,m=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??rn,marks:l,fontFamily:m||null,fontFamilyMixed:!1,fontColor:u?we(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function s1(e,t){const n=e.style.fontSize,r=t.size===null?null:on(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const i=Ml(r.value,r.unit);return n===i?!1:(e.style.fontSize=i,!0)}function c1(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 wr(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function u1(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?we(t.fontColor):null;return(e.style.color?we(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function d1(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 m1(e,t){let n=!1;return s1(e,t)&&(n=!0),c1(e,t)&&(n=!0),u1(e,t)&&(n=!0),d1(e,t.marks)&&(n=!0),n&&lt(e),n}function f1(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function g1(e){const t=xr(e);if(!t)return gl();const n=Fn(t);return{font:l1(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},backgroundImage:o1(t),atRule:ln(e.innerHTML)}}function p1(e,t){const n=Ct(e),r=n?jn(e,n.startContainer,n.startOffset):null,i=n?jn(e,n.endContainer,n.endOffset):null,a=xr(e),l=Ep(e);No(l);const u=m1(l,t.font),m=Bn(l,f1(t)),g=i1(l,t.backgroundImage);ii(e);const p=ln(e.innerHTML),h=tm(e.innerHTML,t.atRule),C=Rn(h);C!==Rn(e.innerHTML)&&(e.innerHTML=C),Ar(e,h);const y=JSON.stringify(p)!==JSON.stringify(t.atRule);return r!==null&&i!==null&&Ol(e,Math.min(r,i),Math.max(r,i)),{changed:!a||u||m||g||y,pageHtml:h}}function h1(e,t){const n=t??e.innerHTML,r=nm(n);return hr(n)?(e.innerHTML=Rn(r),ii(e),Ar(e,r),{changed:!0,pageHtml:r}):{changed:!1,pageHtml:r}}const rs="data-hover-html",b1="noopener noreferrer",y1="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)",x1="this._hoverBox&&this._hoverBox.remove()",C1=/^(#(?:[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 fi(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function w1(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function br(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&w1(n))return n;n=n.parentNode}return null}function Qm(e){return C1.test(e)}function v1(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&&Qm(r)?r:null}function ef(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function S1(e){const t=e.getAttribute(rs)??"",n=v1(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:ef(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function tf(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!le(e,n.commonAncestorContainer))return null;const r=br(e,n.commonAncestorContainer);return r?S1(r):null}function k1(e){return tf(e)!==null}function A1(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(rs)}function P1(e,t){var r;if(A1(e),t.hoverMode==="html"){const i=t.hoverHtml.trim();if(!i)return;e.setAttribute(rs,i),e.setAttribute("onmouseover",y1),e.setAttribute("onmouseout",x1);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!Qm(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function os(e,t){const n=fi(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",b1)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":ef(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),P1(e,n)}function D1(e,t){const n=new Set;for(const r of t){const i=br(e,r);i&&!n.has(i)&&n.add(i)}for(const r of n)Ze(r)}function j1(e,t,n){bt(t);const r=$e(t).filter(u=>u.data.length>0);D1(e,r),r.length>0&&cn(r);const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);bt(a);const l=document.createElement("a");os(l,n);try{return a.surroundContents(l),!0}catch{const u=a.extractContents();return u.hasChildNodes()?(l.appendChild(u),a.insertNode(l),!0):!1}}function E1(e,t){const n=document.createElement("a");os(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 R1(e,t){const n=t.href.trim();if(!n)return!1;const r=fi({...t,href:n}),i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!le(e,a.commonAncestorContainer))return!1;const l=br(e,a.startContainer),u=br(e,a.endContainer);return l&&l===u?(os(l,r),!0):a.collapsed?E1(a,r):j1(e,a,r)}const T1=/^[A-Za-z][A-Za-z0-9_-]*$/,nf="​";function pl(e){var r;const t=jl(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 N1(e){return new Set(pl(e).map(t=>t.id))}function rf(e,t){const n=e.trim();return n?T1.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function pu(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(nf)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function M1(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(nf)),(r=e.parentNode)==null||r.insertBefore(n,e)}function _1(e,t){const n=t.trim();if(rf(n,N1(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!le(e,i.commonAncestorContainer))return!1;const a=br(e,i.startContainer);if(a)return M1(a,n),!0;if(i.collapsed)return pu(i,n),!0;bt(i);const l=document.createElement("span");l.id=n;try{return i.surroundContents(l),!0}catch{return pu(i,n),!0}}const Ne="data-comment-thread",hu="wysiwyg-comment-anchor";function L1(){return`cmt_${crypto.randomUUID()}`}function I1(){return crypto.randomUUID()}const Jo=20;function bu(e,t){if(!e)return null;const n=e instanceof Element?e:e.parentElement;if(!n)return null;const r=n.closest(`[${Ne}]`);return r instanceof HTMLElement&&le(t,r)?r:null}function yu(e,t,n){var C;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let i=Math.max(0,t),a=Math.max(t,n),l=null,u=0,m=null,g=0,p;for(;p=r.nextNode();){const y=p,x=((C=y.textContent)==null?void 0:C.length)??0;if(!l&&i<=x&&(l=y,u=i),!m&&a<=x){m=y,g=a;break}i-=x,a-=x}if(!l||!m)return null;const h=document.createRange();return h.setStart(l,u),h.setEnd(m,g),h}function F1(e,t,n){const r=e.textContent??"",i=r.slice(Math.max(0,t-Jo),t),a=r.slice(n,n+Jo);return{prefix:i,suffix:a}}function B1(e,t){if(t.mode!=="visual")return null;const n=Ot(e);if(n)return{type:"image",elementId:n.id||void 0,src:n.getAttribute("src")??void 0};if(t.collapsed&&!t.text)return null;const{prefix:r,suffix:i}=F1(e,t.start,t.end);return{type:"text",text:t.text,start:t.start,end:t.end,prefix:r,suffix:i}}function xu(e,t){if(t.mode!=="visual")return null;const n=Ot(e);if(n!=null&&n.hasAttribute(Ne))return n.getAttribute(Ne)??null;if(t.visualRange){const r=bu(t.visualRange.startContainer,e);if(r)return r.getAttribute(Ne)??null;const i=bu(t.visualRange.endContainer,e);if(i)return i.getAttribute(Ne)??null}return null}function hl(e,t,n){if(!le(e,n.commonAncestorContainer))return!1;bt(n);const r=document.createElement("span");r.setAttribute(Ne,t);try{return n.surroundContents(r),!0}catch{const i=n.toString();if(!i)return!1;const a=document.createElement("span");return a.setAttribute(Ne,t),a.textContent=i,n.deleteContents(),n.insertNode(a),!0}}function of(e,t){e.setAttribute(Ne,t)}function H1(e,t,n){const r=Ot(e);return r?(of(r,t),!0):n.visualRange?hl(e,t,n.visualRange):!1}function z1(e,t){if(t.type!=="image")return null;for(const n of e.querySelectorAll("img"))if(t.elementId&&n.id===t.elementId||t.src&&n.getAttribute("src")===t.src)return n;return null}function O1(e,t,n){if(n.type!=="text")return!1;if(n.start!==void 0&&n.end!==void 0){const l=yu(e,n.start,n.end);if(l&&l.toString()===n.text)return hl(e,t,l)}const r=e.textContent??"",i=n.text;if(!i)return!1;let a=0;for(;a<=r.length;){const l=r.indexOf(i,a);if(l===-1)return!1;const u=l+i.length,m=r.slice(Math.max(0,l-Jo),l),g=r.slice(u,u+Jo);if(n.prefix!==void 0&&m!==n.prefix){a=l+1;continue}if(n.suffix!==void 0&&g!==n.suffix){a=l+1;continue}const p=yu(e,l,u);return p?hl(e,t,p):!1}return!1}function K1(e,t){for(const n of t)if(!e.querySelector(`[${Ne}="${n.id}"]`)){if(n.anchor.type==="image"){const i=z1(e,n.anchor);i&&of(i,n.id);continue}O1(e,n.id,n.anchor)}}function Cu(e,t){for(const n of e.querySelectorAll(`[${Ne}]`))n instanceof HTMLElement&&(t?n.classList.add(hu):n.classList.remove(hu))}function wu(e,t){if(!t)return null;const n=t instanceof Element?t:t.parentElement;if(!n)return null;const r=n.closest(`[${Ne}]`);return r instanceof HTMLElement&&le(e,r)?r:null}function vu(e,t){const n=e.querySelector(`[${Ne}="${t}"]`);if(!(n instanceof HTMLElement))return!1;const r=window.getSelection();if(!r)return!1;const i=document.createRange();if(n instanceof HTMLImageElement)i.selectNode(n);else{const l=document.createTreeWalker(n,NodeFilter.SHOW_TEXT).nextNode();l instanceof Text?(i.setStart(l,0),i.collapse(!0)):(i.selectNodeContents(n),i.collapse(!0))}return r.removeAllRanges(),r.addRange(i),!0}function $1(e,t=[]){return{id:L1(),anchor:e,messages:t,createdAt:new Date().toISOString(),resolvedAt:null,resolvedBy:null}}function U1(e,t){return{id:I1(),userId:e.userId,userName:e.userName,message:t.trim(),createdAt:new Date().toISOString()}}function W1(e,t,n){return e.map(r=>r.id===t?{...r,messages:[...r.messages,n]}:r)}function G1(e,t){return e.find(n=>n.id===t)}function af(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return le(e,n.commonAncestorContainer)?n:null}function V1(e){const t=af(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 lf(e){const t=af(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 Z1(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 sf(e){const t=V1(e);return t?Z1(t):!1}async function q1(e){return await sf(e)?lf(e):!1}const Y1=new Set(["strong","b","em","i","u","s","strike","del"]),X1=["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 J1(e){for(const t of X1)e.style.removeProperty(t)}function Q1(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!xt(r)){n=r;continue}if(Zt(r,n),Y1.has(r.tagName.toLowerCase())){Ze(r);continue}if(J1(r),Vt(r)){Ze(r);continue}n=r.isConnected?r:t}}function eC(e){const t=Ct(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;bt(t);const r=$e(t).filter(i=>i.data.length>0);if(r.length===0)return!1;for(const i of r)Q1(e,i);return cn(r),e.innerHTML!==n}function tC(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function nC(e){const t=Sn(e),n=sm(e),r=jd(e),i=Oo(e,"color"),a=Oo(e,"backgroundColor"),l=um(e);return{size:n.mixed?null:n.value,unit:n.unit,marks:t,fontFamily:r.mixed?null:r.value,fontFamilyMixed:r.mixed,fontColor:i.mixed?null:i.value,fontColorMixed:i.mixed,highlightColor:a.mixed?null:a.value,highlightColorMixed:a.mixed,customCss:l.mixed?null:l.value,customCssMixed:l.mixed}}function rC(e,t){t.size!==null&&tl(e,t.size,t.unit);const n=Sn(e);for(const r of tt)t.marks[r]!==n[r]&&ol(e,r);return t.fontFamilyMixed||qa(e,t.fontFamily),t.fontColorMixed||cr(e,"color",t.fontColor),t.highlightColorMixed||cr(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&mm(e,t.customCss),!0}function Lo(){return typeof window<"u"&&"speechSynthesis"in window}function oC(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function Su(e,t){const n=e.text.trim();return n||oC(t)||null}function iC(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!Lo())return;if(t.speaking){t.cancel(),n();return}const i=new SpeechSynthesisUtterance(r);i.onend=n,i.onerror=n,t.speak(i),n()},isSpeaking(){return Lo()&&t.speaking},cancel(){Lo()&&t.speaking&&(t.cancel(),n())}}}const aC=5*1024*1024,lC="audio/mpeg,audio/mp3,audio/wav,audio/x-wav,audio/ogg,audio/aac,audio/webm,audio/mp4,audio/x-m4a,.mp3,.wav,.ogg,.aac,.webm,.m4a",sC=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),cC=new Set(["mp3","wav","ogg","aac","webm","m4a"]),uC=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,dC=/^(javascript|vbscript|file|blob):/i;function mC(e={}){return{src:"",title:"",...e}}function is(e){const t=e.trim();if(!t)return"empty";if(dC.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return uC.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 fC(e){return e.size>aC?"tooLarge":yC(e)?null:"type"}function gC(e){const t=fC(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(is(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function pC(e,t){e.setAttribute("controls",""),e.setAttribute("src",t.src.trim());const n=t.title.trim();n?e.setAttribute("title",n):e.removeAttribute("title"),e.style.maxWidth="100%",hC(e,t.css)}function hC(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 bC(e,t){const n=mC(t);if(is(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!le(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("audio");return pC(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function yC(e){const t=e.type.trim().toLowerCase();if(t&&sC.has(t))return!0;const n=xC(e.name);return!!(!t&&n&&cC.has(n))}function xC(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const cf=/^(javascript|vbscript|file|blob):/i,CC=[/(?:youtube\.com\/watch\?(?:[^&]*&)*v=|youtube\.com\/watch\?v=)([\w-]{11})/i,/youtu\.be\/([\w-]{11})/i,/youtube\.com\/embed\/([\w-]{11})/i,/youtube\.com\/shorts\/([\w-]{11})/i];function wC(e={}){return{url:"",title:"",...e}}function vC(e={}){return{src:"",title:"",...e}}function gi(e){const t=e.trim();if(!t)return null;for(const n of CC){const r=t.match(n);if(r!=null&&r[1])return r[1]}return null}function uf(e){return`https://www.youtube.com/embed/${e}`}function df(e){const t=e.trim();return t?cf.test(t)?"invalid":gi(t)?null:"invalid":"empty"}function SC(e){const t=e.trim();if(!t)return"empty";if(cf.test(t))return"invalid";if(gi(t))return null;if(t.toLowerCase().startsWith("data:"))return/^data:video\//i.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 mf(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 ff(e,t,n){e.setAttribute("src",t),e.setAttribute("frameborder","0"),e.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),e.setAttribute("allowfullscreen","");const r=n.title.trim();r?e.setAttribute("title",r):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.width="560px",e.style.aspectRatio="16 / 9",e.style.border="0",mf(e,n.css)}function kC(e,t){e.setAttribute("controls",""),e.setAttribute("src",t.src.trim());const n=t.title.trim();n?e.setAttribute("title",n):e.removeAttribute("title"),e.style.maxWidth="100%",mf(e,t.css)}function AC(e,t){const n=wC(t);if(df(n.url))return!1;const r=gi(n.url);if(!r)return!1;const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!le(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const l=document.createElement("iframe");return ff(l,uf(r),n),a.insertNode(l),a.setStartAfter(l),a.collapse(!0),i.removeAllRanges(),i.addRange(a),!0}function PC(e,t){const n=vC(t);if(SC(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!le(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=gi(n.src);if(a){const l=document.createElement("iframe");ff(l,uf(a),{title:n.title,css:n.css}),i.insertNode(l),i.setStartAfter(l)}else{const l=document.createElement("video");kC(l,n),i.insertNode(l),i.setStartAfter(l)}return i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}const DC=new Set(["p","h1","h2","h3","h4","h5","h6"]),jC=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function gf(e,t){var a;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!le(e,r.commonAncestorContainer))return!1;r.collapsed||r.deleteContents();const i=EC(e,r.startContainer);if(i){const l=RC(i,r);return(a=i.parentNode)==null||a.insertBefore(t,l),Au(t),!0}return r.insertNode(t),TC(e,t),_C(t),Au(t),!0}function EC(e,t){let n=vr(t);for(;n&&n!==e;){const r=ue(n);if(DC.has(r)&&n instanceof HTMLElement)return n;if(jC.has(r))return null;n=n.parentElement}return null}function RC(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),ku(e),ku(i),(a=e.parentNode)==null||a.insertBefore(i,e.nextSibling),i}function TC(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!NC(n))return;Zt(n,t),Ze(n)}}function NC(e){const t=ue(e);return xt(e)||t==="a"}function ku(e){MC(e)&&e.appendChild(document.createElement("br"))}function MC(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 _C(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 Au(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 LC="1em 0",IC="1px solid #d0d0d0";function FC(){const e=document.createElement("hr");return e.style.margin=LC,e.style.border="0",e.style.borderTop=IC,e}function BC(e){return gf(e,FC())}const HC="1.5em 0",zC="2px dashed #bbb";function OC(){const e=document.createElement("div");return e.style.breakAfter="page",e.style.pageBreakAfter="always",e.style.margin=HC,e.style.border="0",e.style.borderTop=zC,e.style.height="0",e}function KC(e){return gf(e,OC())}const Nt=16;function Pu(e){return Math.min(Mn.px.max,Math.max(Nt,e))}function $C(e){return e.width>0&&e.height>0?e.width/e.height:1}function UC(e,t){const n=Math.max(Nt,Nt*t),r=Math.min(Mn.px.max,Mn.px.max*t),i=Math.min(r,Math.max(n,e));return{width:i,height:i/t}}function WC(e,t){const n=Math.max(Nt,Nt/t),r=Math.min(Mn.px.max,Mn.px.max/t),i=Math.min(r,Math.max(n,e));return{width:i*t,height:i}}function GC(e,t,n){const r=$C(t);return e==="e"?UC(t.width+n.x,r):e==="s"?WC(t.height+n.y,r):{width:Pu(t.width+n.x),height:Pu(t.height+n.y)}}function VC(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:Nt,height:r>0?r:Nt}}function ZC(e,t,n){const r=_n(Math.max(Nt,t),"px"),i=_n(Math.max(Nt,n),"px");return!r||!i?!1:Wm(e,{...Um(e),sizeMode:"lock",width:r,height:i})}function qC(e={}){return{border:{...Ul},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function YC(e){const t=Fn(e);return{border:t.border,borderCollapse:ew(e),borderSpacing:pf(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:Me(e.style.width)}}function XC(e,t){let n=Bn(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 tw(e,t.borderCollapse)&&(n=!0),nw(e,t.borderCollapse,t.borderSpacing)&&(n=!0),rw(e,t.width)&&(n=!0),n&&lt(e),n}function JC(e){const t=ql(e);return t?YC(t):null}function QC(e,t){const n=ql(e);return n?XC(n,t):!1}function ew(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function tw(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function pf(e){const t=e.style.borderSpacing.trim();return t?Me(t.split(/\s+/)[0]??""):null}function nw(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?qt(n):null,i=pf(e);return Qe(i,r)?!1:(r?e.style.borderSpacing=pe(r):e.style.removeProperty("border-spacing"),!0)}function rw(e,t){const n=t?qt(t):null,r=Me(e.style.width);return Qe(r,n)?!1:(n?e.style.width=pe(n):e.style.removeProperty("width"),!0)}const pi=["top","middle","bottom","baseline"],ow=new Set(pi);function iw(e={}){return{backgroundColor:null,color:null,padding:{...st},textAlign:null,verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function aw(e){const t=Fn(e);return{backgroundColor:t.backgroundColor,color:hf(e),padding:t.padding,textAlign:dw(e),verticalAlign:bf(e),width:Me(e.style.width),...mi(e)}}function lw(e,t){let n=Bn(e,{margin:{...st},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 uw(e,t.color)&&(n=!0),cl(e,t.textAlign)&&(n=!0),mw(e,t.verticalAlign)&&(n=!0),fw(e,t.width)&&(n=!0),n&&lt(e),n}function sw(e){const t=wt(e);return t?aw(t):null}function cw(e,t){const n=kr(e);if(n.length===0)return!1;let r=!1;for(const a of n)lw(a,t)&&(r=!0);const i=wt(e);if(i){const a=mi(i);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&Ky(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function hf(e){const t=e.style.color;return t?we(t):null}function uw(e,t){const n=t?we(t):null;return hf(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function dw(e){const t=Yo(e);return t==="left"?null:t}function bf(e){const t=e.style.verticalAlign.trim().toLowerCase();return ow.has(t)?t:null}function mw(e,t){return bf(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function fw(e,t){const n=t?qt(t):null,r=Me(e.style.width);return Qe(r,n)?!1:(n?e.style.width=pe(n):e.style.removeProperty("width"),!0)}const gw=new Set(pi);function pw(e={}){return{backgroundColor:null,color:null,padding:{...st},height:null,verticalAlign:null,...e}}function hw(e){const t=e.cells[0],n=t?Fn(t).padding:{...st};return{backgroundColor:yf(e),color:xf(e),padding:n,height:Me(e.style.height),verticalAlign:Cf(e)}}function bw(e,t){let n=!1;Cw(e,t.backgroundColor)&&(n=!0),ww(e,t.color)&&(n=!0),Sw(e,t.height)&&(n=!0),vw(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))Bn(r,{margin:{...st},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&&lt(e),n}function yw(e){const t=Tm(e);return t?hw(t):null}function xw(e,t){const n=Tm(e);return n?bw(n,t):!1}function yf(e){const t=e.style.backgroundColor;return t?we(t):null}function Cw(e,t){const n=t?we(t):null;return yf(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function xf(e){const t=e.style.color;return t?we(t):null}function ww(e,t){const n=t?we(t):null;return xf(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function Cf(e){const t=e.style.verticalAlign.trim().toLowerCase();return gw.has(t)?t:null}function vw(e,t){return Cf(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function Sw(e,t){const n=t?qt(t):null,r=Me(e.style.height);return Qe(r,n)?!1:(n?e.style.height=pe(n):e.style.removeProperty("height"),!0)}const kw=1e3;function Aw(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function Pw({onAutoSave:e,getHtml:t}){const n=c.useRef(e);n.current=e;const r=c.useRef(t);r.current=t;const i=c.useRef(null),a=e!=null;c.useEffect(()=>{if(!a){i.current=null;return}i.current=r.current();const l=window.setInterval(()=>{const u=n.current;if(!u)return;const m=r.current();m!==i.current&&(i.current=m,queueMicrotask(()=>Aw(u,m)))},kw);return()=>{window.clearInterval(l)}},[a])}function wo({value:e,defaultValue:t,onChange:n}){const[r,i]=c.useState(t),a=e!==void 0,l=a?e:r,u=c.useCallback(m=>{a||i(m),n==null||n(m)},[a,n]);return[l,u]}const Du=8,ju=["#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"],Dw=8;let bl=[];const yl=new Set;function Eu(){return bl}function jw(e){const t=we(e);t&&(bl=[t,...bl.filter(n=>n!==t)].slice(0,Dw),yl.forEach(n=>n()))}function Ew(e){return yl.add(e),()=>{yl.delete(e)}}function vo(e){const t=we(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 tn(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 La({r:e,g:t,b:n}){const r=e/255,i=t/255,a=n/255,l=Math.max(r,i,a),u=Math.min(r,i,a),m=l-u;let g=0;return m!==0&&(l===r?g=(i-a)/m%6:l===i?g=(a-r)/m+2:g=(r-i)/m+4,g*=60,g<0&&(g+=360)),{h:g,s:l===0?0:m/l,v:l}}function Ia({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 u=0,m=0,g=0;return r<60?(u=i,m=a):r<120?(u=a,m=i):r<180?(m=i,g=a):r<240?(m=a,g=i):r<300?(u=a,g=i):(u=i,g=a),{r:Math.round((u+l)*255),g:Math.round((m+l)*255),b:Math.round((g+l)*255)}}function wf(){return typeof window<"u"&&"EyeDropper"in window}async function Rw(){if(!wf())return null;const e=window.EyeDropper;try{const t=await new e().open();return we(t.sRGBHex)}catch{return null}}const Tw="_picker_ag1yo_1",Nw="_none_ag1yo_12",Mw="_customToggle_ag1yo_13",_w="_eyedrop_ag1yo_14",Lw="_swatch_ag1yo_48",Iw="_field_ag1yo_49",Fw="_grid_ag1yo_54",Bw="_recents_ag1yo_55",Hw="_sectionLabel_ag1yo_84",zw="_custom_ag1yo_13",Ow="_sv_ag1yo_95",Kw="_svThumb_ag1yo_105",$w="_hue_ag1yo_116",Uw="_rgbRow_ag1yo_155",Ww="_hexRow_ag1yo_156",Re={picker:Tw,none:Nw,customToggle:Mw,eyedrop:_w,swatch:Lw,field:Iw,grid:Fw,recents:Bw,sectionLabel:Hw,custom:zw,sv:Ow,svThumb:Kw,hue:$w,rgbRow:Uw,hexRow:Ww};function Gw(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 as({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:i,menu:a=!1,fallbackCustom:l="#000000",onChange:u,onCommit:m}){const g=W(),p=c.useId(),h=a?"menuitemradio":"option",C=t?null:e,y=vo(C??l)??{r:0,g:0,b:0},[x,b]=c.useState(!1),[S,v]=c.useState(()=>La(y)),[k,P]=c.useState(()=>({r:String(y.r),g:String(y.g),b:String(y.b)})),[N,D]=c.useState(()=>tn(y.r,y.g,y.b)),[A,T]=c.useState(()=>[...Eu()]),I=c.useRef(null),E=c.useRef(tn(y.r,y.g,y.b));c.useEffect(()=>Ew(()=>T([...Eu()])),[]),c.useEffect(()=>{const M=vo(C??l);if(!M)return;const Z=La(M);v(Z),P({r:String(M.r),g:String(M.g),b:String(M.b)}),D(tn(M.r,M.g,M.b))},[C,l]);const R=(M,Z,ie)=>{M&&(E.current=M),ie&&M&&jw(M),u(M),Z&&(m==null||m(M))},j=(M,Z,ie)=>{const G=tn(M.r,M.g,M.b);v(La(M)),P({r:String(M.r),g:String(M.g),b:String(M.b)}),D(G),R(G,Z,ie)},F=(M,Z,ie)=>{const G=Ia(M),xe=tn(G.r,G.g,G.b);v(M),P({r:String(G.r),g:String(G.g),b:String(G.b)}),D(xe),R(xe,Z,ie)},U=M=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(M.key))return;const ie=[...M.currentTarget.querySelectorAll("button")],G=ie.findIndex(ve=>ve===document.activeElement);if(G<0)return;M.preventDefault();const xe=M.key==="ArrowLeft"?-1:M.key==="ArrowRight"?1:M.key==="ArrowUp"?-Du:Du,Fe=ie[Math.max(0,Math.min(ie.length-1,G+xe))];Fe==null||Fe.focus()},$=(M,Z)=>{const ie=I.current;if(!ie||i)return;const G=ie.getBoundingClientRect(),xe=Math.max(0,Math.min(1,(M.clientX-G.left)/G.width)),Fe=Math.max(0,Math.min(1,1-(M.clientY-G.top)/G.height));F({h:S.h,s:xe,v:Fe},Z,Z)},X=M=>{i||(M.currentTarget.setPointerCapture(M.pointerId),$(M,!1))},J=Ia({h:S.h,s:1,v:1}),he=tn(J.r,J.g,J.b),Y=Ia(S),be=tn(Y.r,Y.g,Y.b),te=new Set(ju),ae=A.filter(M=>!te.has(M));return o.jsxs("div",{className:Re.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[o.jsx("button",{type:"button",className:Re.none,role:h,"aria-checked":a?C===null&&!t:void 0,"aria-selected":a?void 0:C===null&&!t,disabled:i,onClick:()=>R(null,!0,!1),children:n}),o.jsx("div",{className:Re.grid,role:a?"group":"none",onKeyDown:U,children:ju.map(M=>{const Z=C===M;return o.jsx("button",{type:"button",className:Re.swatch,role:h,"aria-label":M,"aria-checked":a?Z:void 0,"aria-selected":a?void 0:Z,disabled:i,style:{backgroundColor:M},onMouseDown:ie=>ie.preventDefault(),onClick:()=>R(M,!0,!1)},M)})}),ae.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:Re.sectionLabel,children:g("colorRecent")}),o.jsx("div",{className:Re.recents,role:a?"group":"none","aria-label":g("colorRecent"),children:ae.map(M=>o.jsx("button",{type:"button",className:Re.swatch,role:h,"aria-label":M,"aria-checked":a?C===M:void 0,"aria-selected":a?void 0:C===M,disabled:i,style:{backgroundColor:M},onMouseDown:Z=>Z.preventDefault(),onClick:()=>R(M,!0,!1)},M))})]}):null,o.jsx("button",{type:"button",className:Re.customToggle,disabled:i,"aria-expanded":x,onClick:()=>b(M=>!M),children:g("colorCustom")}),x?o.jsxs("div",{className:Re.custom,children:[o.jsx("div",{ref:I,className:Re.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${he})`},onPointerDown:X,onPointerMove:M=>{M.currentTarget.hasPointerCapture(M.pointerId)&&$(M,!1)},onPointerUp:M=>{$(M,!0)},children:o.jsx("span",{className:Re.svThumb,style:{left:`${S.s*100}%`,top:`${(1-S.v)*100}%`}})}),o.jsx("input",{className:Re.hue,type:"range",min:0,max:360,value:Math.round(S.h),disabled:i,"aria-label":g("colorCustom"),onChange:M=>F({...S,h:Number(M.target.value)},!1,!1),onPointerUp:()=>R(E.current,!0,!0)}),o.jsx("div",{className:Re.rgbRow,children:["r","g","b"].map(M=>o.jsxs("div",{className:Re.field,children:[o.jsx("label",{htmlFor:`${p}-${M}`,children:g(M==="r"?"colorRgbR":M==="g"?"colorRgbG":"colorRgbB")}),o.jsx("input",{id:`${p}-${M}`,inputMode:"numeric",value:k[M],disabled:i,onChange:Z=>{P(ie=>({...ie,[M]:Z.target.value}))},onBlur:()=>{const Z=Gw(k[M]);if(Z===null){P({r:String(Y.r),g:String(Y.g),b:String(Y.b)});return}j({...Y,[M]:Z},!0,!0)},onKeyDown:Z=>{Z.key==="Enter"&&Z.currentTarget.blur()}})]},M))}),o.jsx("div",{className:Re.hexRow,children:o.jsxs("div",{className:Re.field,children:[o.jsx("label",{htmlFor:`${p}-hex`,children:g("colorHex")}),o.jsx("input",{id:`${p}-hex`,value:N,disabled:i,onChange:M=>D(M.target.value),onBlur:()=>{const M=we(N);if(!M){D(be);return}const Z=vo(M);Z&&j(Z,!0,!0)},onKeyDown:M=>{M.key==="Enter"&&M.currentTarget.blur()}})]})}),wf()?o.jsx("button",{type:"button",className:Re.eyedrop,disabled:i,onClick:()=>{Rw().then(M=>{if(!M)return;const Z=vo(M);Z&&j(Z,!0,!0)})},children:g("colorPickFromScreen")}):null]}):null]})}const Vw="_wrap_hfz5s_1",Zw="_button_hfz5s_8",qw="_icon_hfz5s_18",Yw="_bar_hfz5s_24",Xw="_barEmpty_hfz5s_33",Jw="_popover_hfz5s_43",nn={wrap:Vw,button:Zw,icon:qw,bar:Yw,barEmpty:Xw,popover:Jw},Qw="_field_1knrr_1",e0="_label_1knrr_8",t0="_button_1knrr_12",n0="_swatch_1knrr_37",r0="_swatchEmpty_1knrr_44",ar={field:Qw,label:e0,button:t0,swatch:n0,swatchEmpty:r0},So=4;function nt({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:i,fallbackCustom:a,onChange:l}){const u=c.useId(),m=c.useRef(null),g=c.useRef(null),p=c.useRef(null),[h,C]=c.useState(!1),[y,x]=c.useState({top:0,left:0}),b=c.useCallback(()=>{const k=g.current,P=p.current;if(!k)return;const N=k.getBoundingClientRect(),D=(P==null?void 0:P.offsetHeight)??0,A=(P==null?void 0:P.offsetWidth)??240;let T=N.bottom;T+D>window.innerHeight-So&&(T=Math.max(So,N.top-D));const I=Math.min(Math.max(N.left,So),window.innerWidth-A-So);x({top:T,left:I})},[]);c.useLayoutEffect(()=>{if(!h)return;b();const k=()=>b();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[h,b]),c.useEffect(()=>{if(!h)return;const k=N=>{var A,T;const D=N.target;(A=m.current)!=null&&A.contains(D)||(T=p.current)!=null&&T.contains(D)||C(!1)},P=N=>{var D;N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),C(!1),(D=g.current)==null||D.focus())};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",P,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",P,!0)}},[h]);const S=`${ar.swatch}${!n||r?` ${ar.swatchEmpty}`:""}`,v=n&&!r?{backgroundColor:n}:void 0;return o.jsxs("div",{className:ar.field,ref:m,children:[o.jsx("span",{className:ar.label,children:e}),o.jsx("button",{ref:g,type:"button",className:ar.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?u:void 0,disabled:i,onClick:()=>C(k=>!k),children:o.jsx("span",{className:S,style:v})}),h?o.jsx(ce,{children:o.jsx("div",{ref:p,id:u,className:nn.popover,style:{top:y.top,left:y.left,zIndex:1400},children:o.jsx(as,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:i,fallbackCustom:a,onChange:l,onCommit:()=>C(!1)})})}):null]})}const Fa=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],o0="_toolbar_1aggm_1",i0="_menuBar_1aggm_35",a0="_menuBarDesktop_1aggm_43",l0="_brandMark_1aggm_49",s0="_brandMarkIcon_1aggm_56",c0="_menuBarCompact_1aggm_68",u0="_menuWrap_1aggm_91",d0="_menuButton_1aggm_97",m0="_iconButton_1aggm_98",f0="_menuItem_1aggm_99",g0="_hamburgerButton_1aggm_142",p0="_iconNav_1aggm_149",h0="_iconNavMain_1aggm_160",b0="_iconNavEnd_1aggm_169",y0="_iconGroup_1aggm_185",x0="_tooltipTrigger_1aggm_276",C0="_menu_1aggm_35",w0="_submenuWrap_1aggm_305",v0="_submenu_1aggm_305",S0="_submenuTrigger_1aggm_315",k0="_menuOverlay_1aggm_330",A0="_menuOverlayHeader_1aggm_342",P0="_menuOverlayTitle_1aggm_352",D0="_menuOverlayBody_1aggm_358",j0="_menuSeparator_1aggm_409",E0="_icon_1aggm_98",R0="_tooltip_1aggm_276",T0="_tooltipElevated_1aggm_494",q={toolbar:o0,menuBar:i0,menuBarDesktop:a0,brandMark:l0,brandMarkIcon:s0,menuBarCompact:c0,menuWrap:u0,menuButton:d0,iconButton:m0,menuItem:f0,hamburgerButton:g0,iconNav:p0,iconNavMain:h0,iconNavEnd:b0,iconGroup:y0,tooltipTrigger:x0,menu:C0,submenuWrap:w0,submenu:v0,submenuTrigger:S0,menuOverlay:k0,menuOverlayHeader:A0,menuOverlayTitle:P0,menuOverlayBody:D0,menuSeparator:j0,icon:E0,tooltip:R0,tooltipElevated:T0},N0=400,Ru=6,Ba=4;function Wt({label:e,children:t,className:n,elevated:r}){const i=c.useRef(null),a=c.useRef(null),l=c.useRef(null),u=c.useRef(!1),m=c.useRef(!1),[g,p]=c.useState(!1),[h,C]=c.useState({top:0,left:0}),y=c.useCallback(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),x=c.useCallback(v=>{if(!(u.current||m.current)){y(),p(!1);return}if(v||m.current){y(),p(!0);return}y(),l.current=setTimeout(()=>{l.current=null,p(!0)},N0)},[y]),b=c.useCallback(()=>{const v=i.current,k=a.current;if(!v||!k)return;const P=v.getBoundingClientRect(),N=k.offsetWidth,D=k.offsetHeight;let A=P.bottom+Ru;A+D>window.innerHeight-Ba&&(A=P.top-Ru-D);let T=P.left+P.width/2-N/2;T=Math.min(Math.max(T,Ba),window.innerWidth-N-Ba),C({top:A,left:T})},[]);c.useEffect(()=>()=>y(),[y]),c.useEffect(()=>{const v=i.current;if(!v)return;const k=()=>{m.current=!0,x(!0)},P=()=>{m.current=!1,x(!1)};return v.addEventListener("focusin",k),v.addEventListener("focusout",P),()=>{v.removeEventListener("focusin",k),v.removeEventListener("focusout",P)}},[x]),c.useLayoutEffect(()=>{if(!g)return;b();const v=()=>b();return window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[g,e,b]);const S=n?`${q.tooltipTrigger} ${n}`:q.tooltipTrigger;return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:i,className:S,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,x(!1)},onMouseLeave:()=>{u.current=!1,x(!1)},children:t}),g?o.jsx(ce,{children:o.jsx("span",{ref:a,className:r?`${q.tooltip} ${q.tooltipElevated}`:q.tooltip,"data-toolbar-tooltip":"",style:{top:h.top,left:h.left},"aria-hidden":"true",children:e})}):null]})}const M0="_wrap_1vjt0_1",_0="_wrapToolbar_1vjt0_7",L0="_field_1vjt0_12",I0="_trigger_1vjt0_20",F0="_chevron_1vjt0_50",B0="_list_1vjt0_73",H0="_listInline_1vjt0_88",z0="_option_1vjt0_96",O0="_separator_1vjt0_125",at={wrap:M0,wrapToolbar:_0,field:L0,trigger:I0,chevron:F0,list:B0,listInline:H0,option:z0,separator:O0};function K0({value:e,mixed:t=!1,fonts:n,disabled:r,listId:i,listRef:a,inline:l,style:u,onSelect:m}){const g=W(),p=!t&&e===null;return o.jsxs("ul",{ref:a,id:i,className:l?`${at.list} ${at.listInline}`:at.list,role:"listbox","aria-label":g("commandFontFamilyAria"),style:u,children:[o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:at.option,role:"option","aria-checked":p,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>m(null),children:g("fontFamilyDefault")})}),o.jsx("li",{className:at.separator,role:"separator"}),n.map(h=>{const C=!t&&wr(e,h.family);return o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:at.option,role:"option","aria-checked":C,disabled:r,style:{fontFamily:h.family},onMouseDown:y=>y.preventDefault(),onClick:()=>m(h.family),children:h.name})},h.family)})]})}function $0(e,t,n,r){var i;return t?"":e===null?r:((i=Op(e,n))==null?void 0:i.name)??e}const ko=4;function vf({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:i,toolbar:a=!1,triggerId:l,onChange:u}){const m=W(),g=c.useId(),p=c.useRef(null),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState(!1),[b,S]=c.useState({top:0,left:0,width:0}),v=$0(e,t,n,m("fontFamilyDefault")),k=c.useCallback(()=>{const N=h.current,D=C.current;if(!N)return;const A=N.getBoundingClientRect(),T=(D==null?void 0:D.offsetHeight)??0,I=Math.max(A.width,(D==null?void 0:D.offsetWidth)??0);let E=A.bottom;E+T>window.innerHeight-ko&&(E=Math.max(ko,A.top-T));const R=Math.min(Math.max(A.left,ko),window.innerWidth-I-ko);S({top:E,left:R,width:I})},[]);c.useLayoutEffect(()=>{if(!y)return;k();const N=()=>k();return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[y,k,n.length]),c.useEffect(()=>{if(!y)return;const N=A=>{var I,E;const T=A.target;(I=p.current)!=null&&I.contains(T)||(E=C.current)!=null&&E.contains(T)||x(!1)},D=A=>{A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),x(!1))};return document.addEventListener("pointerdown",N),document.addEventListener("keydown",D,!0),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",D,!0)}},[y]);const P=o.jsxs("div",{className:`${at.wrap}${a?` ${at.wrapToolbar}`:""}`,ref:p,children:[o.jsxs("div",{className:at.field,ref:h,children:[o.jsx("button",{type:"button",id:l,className:at.trigger,disabled:r,"aria-label":a?m("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":y,"aria-controls":y?g:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:N=>N.preventDefault(),onClick:()=>x(N=>!N),children:v}),o.jsx("span",{className:at.chevron,"aria-hidden":"true"})]}),y?o.jsx(ce,{children:o.jsx(K0,{listRef:C,listId:g,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:b.top,left:b.left,minWidth:b.width},onSelect:N=>{u(N),x(!1)}})}):null]});return i?o.jsx(Wt,{label:i,children:P}):P}function U0({commands:e,queries:t,disabled:n}){const r=W(),i=!!(n||!t.isVisualMode());return o.jsx(vf,{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 W0="_wrap_58i0x_1",G0="_wrapToolbar_58i0x_9",V0="_field_58i0x_14",Z0="_input_58i0x_22",q0="_toggle_58i0x_41",Y0="_chevron_58i0x_42",X0="_unit_58i0x_80",J0="_list_58i0x_110",Q0="_option_58i0x_125",Se={wrap:W0,wrapToolbar:G0,field:V0,input:Z0,toggle:q0,chevron:Y0,unit:X0,list:J0,option:Q0},Ao=4,ev={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Sf({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:i,tooltip:a,sizeInputId:l,toolbar:u=!1}){const m=W(),g=c.useId(),p=c.useRef(null),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState(()=>e===null?"":Q(e)),[b,S]=c.useState(!1),[v,k]=c.useState(!1),[P,N]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{b||x(e===null?"":Q(e))},[e,b]);const D=c.useCallback(()=>{const R=h.current,j=C.current;if(!R)return;const F=R.getBoundingClientRect(),U=(j==null?void 0:j.offsetHeight)??0;let $=F.bottom;$+U>window.innerHeight-Ao&&($=Math.max(Ao,F.top-U));const X=Math.min(Math.max(F.left,Ao),window.innerWidth-Math.max(F.width,72)-Ao);N({top:$,left:X,width:F.width})},[]);c.useLayoutEffect(()=>{if(!v)return;D();const R=()=>D();return window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[v,D]),c.useEffect(()=>{if(!v)return;const R=F=>{var $,X;const U=F.target;($=p.current)!=null&&$.contains(U)||(X=C.current)!=null&&X.contains(U)||k(!1)},j=F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",R),document.addEventListener("keydown",j,!0),()=>{document.removeEventListener("pointerdown",R),document.removeEventListener("keydown",j,!0)}},[v]);const A=R=>{const j=lh(R,t);if(!j){x(e===null?"":Q(e));return}n(j.value,j.unit),x(Q(j.value))},T=rh[t],I=v?o.jsx(ce,{children:o.jsx("ul",{ref:C,className:Se.list,role:"listbox",id:g,style:{top:P.top,left:P.left,minWidth:P.width},children:T.map(R=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Se.option,role:"option","aria-selected":e===R,onMouseDown:j=>j.preventDefault(),onClick:()=>{n(R,t),x(Q(R)),k(!1)},children:Q(R)})},R))})}):null,E=o.jsxs("div",{className:`${Se.wrap}${u?` ${Se.wrapToolbar}`:""}`,ref:p,children:[o.jsxs("div",{className:Se.field,ref:h,children:[o.jsx("input",{id:l,className:Se.input,value:y,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":v,"aria-controls":g,role:"combobox",inputMode:"decimal",onFocus:()=>S(!0),onBlur:()=>{S(!1),A(y)},onChange:R=>x(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),A(y),k(!1),R.currentTarget.blur()),R.key==="ArrowDown"&&(R.preventDefault(),k(!0))}}),o.jsx("button",{type:"button",className:Se.toggle,tabIndex:-1,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-expanded":v,"aria-controls":g,onMouseDown:R=>R.preventDefault(),onClick:()=>k(R=>!R)})]}),o.jsxs("div",{className:Se.field,children:[o.jsx("select",{className:Se.unit,value:t,disabled:i,"aria-label":m("commandFontSizeUnitAria"),onChange:R=>{r(R.target.value)},children:Nl.map(R=>o.jsx("option",{value:R,children:m(ev[R])},R))}),o.jsx("span",{className:Se.chevron,"aria-hidden":"true"})]}),I]});return a?o.jsx(Wt,{label:a,children:E}):E}const tv="_backdrop_1p9zk_1",nv="_dialog_1p9zk_12",rv="_dialogWide_1p9zk_31",ov="_header_1p9zk_35",iv="_tabs_1p9zk_43",av="_tab_1p9zk_43",lv="_body_1p9zk_76",sv="_field_1p9zk_86",cv="_label_1p9zk_92",uv="_sizeRow_1p9zk_96",dv="_fileRow_1p9zk_102",mv="_fileName_1p9zk_108",fv="_previewImage_1p9zk_115",gv="_marks_1p9zk_125",pv="_mark_1p9zk_125",hv="_actions_1p9zk_140",bv="_actionsSpread_1p9zk_148",yv="_actionsEnd_1p9zk_152",xv="_headerRow_1p9zk_157",Cv="_close_1p9zk_170",wv="_nameSection_1p9zk_187",vv="_nameInput_1p9zk_192",Sv="_labelRow_1p9zk_209",kv="_help_1p9zk_215",Av="_textInput_1p9zk_233",Pv="_fullSelect_1p9zk_245",Dv="_error_1p9zk_249",jv="_emptyHint_1p9zk_254",Ev="_action_1p9zk_140",Rv="_textarea_1p9zk_265",Tv="_actionDanger_1p9zk_279",Nv="_confirmBody_1p9zk_285",Mv="_nestedPanel_1p9zk_294",_v="_spinnerWrap_1p9zk_309",Lv="_spinner_1p9zk_309",Iv="_actionPrimary_1p9zk_344",Fv="_iconButton_1p9zk_358",Bv="_select_1p9zk_359",Hv="_lengthInput_1p9zk_360",zv="_lengthUnit_1p9zk_361",Ov="_group_1p9zk_369",Kv="_nestedGroup_1p9zk_379",$v="_subLabel_1p9zk_389",Uv="_iconRow_1p9zk_393",Wv="_lengthField_1p9zk_425",Gv="_sideLabel_1p9zk_431",Vv="_lengthRow_1p9zk_435",Zv="_sideGrid_1p9zk_463",qv="_shadowGrid_1p9zk_464",d={backdrop:tv,dialog:nv,dialogWide:rv,header:ov,tabs:iv,tab:av,body:lv,field:sv,label:cv,sizeRow:uv,fileRow:dv,fileName:mv,previewImage:fv,marks:gv,mark:pv,actions:hv,actionsSpread:bv,actionsEnd:yv,headerRow:xv,close:Cv,nameSection:wv,nameInput:vv,labelRow:Sv,help:kv,textInput:Av,fullSelect:Pv,error:Dv,emptyHint:jv,action:Ev,textarea:Rv,actionDanger:Tv,confirmBody:Nv,nestedPanel:Mv,spinnerWrap:_v,spinner:Lv,actionPrimary:Iv,iconButton:Fv,select:Bv,lengthInput:Hv,lengthUnit:zv,group:Ov,nestedGroup:Kv,subLabel:$v,iconRow:Uv,lengthField:Wv,sideLabel:Gv,lengthRow:Vv,sideGrid:Zv,shadowGrid:qv},Yv={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function ls({tab:e,value:t,fonts:n,disabled:r,onTabChange:i,onChange:a}){const l=W(),u=c.useId(),m=c.useId(),g=n??Ad(),p=Fa.find(h=>h.id===e)??Fa[0];return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("fontDialogTitle"),children:Fa.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:p.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(vf,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:g,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:u,children:l("fontDialogSize")}),o.jsx("div",{className:d.sizeRow,children:o.jsx(Sf,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(h,C)=>{a({...t,size:h,unit:C})},onUnitChange:h=>{const C=t.size!==null?Rd(t.size,t.unit,h,16,16):t.size;a({...t,size:C,unit:h})}})})]}),o.jsx("div",{className:d.field,children:o.jsx(nt,{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(nt,{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")}),tt.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(Yv[h].label)]},h))]})]}):null})]})}const Tu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function Xv({open:e,tab:t,size:n,unit:r,marks:i,fontFamily:a=null,fontFamilyMixed:l=!1,fontColor:u,fontColorMixed:m=!1,highlightColor:g,highlightColorMixed:p=!1,fonts:h,disabled:C,onTabChange:y,onApply:x,onClose:b}){const S=W(),v=c.useId(),k=c.useRef(null),[P,N]=c.useState({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:u,highlightColor:g,fontColorMixed:m,highlightColorMixed:p});return c.useEffect(()=>{e&&N({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:u,highlightColor:g,fontColorMixed:m,highlightColorMixed:p})},[e,n,r,i,a,l,u,m,g,p]),c.useEffect(()=>{if(!e)return;const D=k.current,A=D==null?void 0:D.querySelector(Tu);A==null||A.focus();const T=I=>{if(I.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;I.preventDefault(),I.stopPropagation(),b();return}if(I.key!=="Tab"||!D)return;const E=[...D.querySelectorAll(Tu)];if(E.length===0)return;const R=E[0],j=E[E.length-1];I.shiftKey&&document.activeElement===R?(I.preventDefault(),j.focus()):!I.shiftKey&&document.activeElement===j&&(I.preventDefault(),R.focus())};return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,b]),e?o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:b,children:o.jsxs("div",{ref:k,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:D=>D.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:v,children:S("fontDialogTitle")}),o.jsx(ls,{tab:t,value:P,fonts:h,disabled:C,onTabChange:y,onChange:N}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:b,children:S("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:C,onClick:()=>x(P),children:S("fontDialogOk")})]})]})})}):null}const Jv={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Ae({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:i,inputId:a,onChange:l}){const u=W(),m=c.useId(),g=a??m,p=(t==null?void 0:t.unit)??Ll,[h,C]=c.useState(()=>t?Q(t.value):""),[y,x]=c.useState(!1);c.useEffect(()=>{y||C(t?Q(t.value):"")},[t,y]);const b=S=>{const v=S.trim();if(!v){l(null),C("");return}const k=pr(v,p,r);if(!k){C(t?Q(t.value):"");return}l(k),C(Q(k.value))};return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:g,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:g,className:d.lengthInput,value:h,disabled:n,inputMode:"decimal",onFocus:()=>x(!0),onBlur:()=>{x(!1),b(h)},onChange:S=>C(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),b(h),S.currentTarget.blur())}}),o.jsx("select",{className:d.lengthUnit,value:p,disabled:n,"aria-label":i??u("paragraphDialogLengthUnitAria"),onChange:S=>{const v=S.target.value;if(t){l({value:t.value,unit:v});return}if(h.trim()){const k=pr(h,v,r);l(k)}},children:Nl.map(S=>o.jsx("option",{value:S,children:u(Jv[S])},S))})]})]})}function ss({shadow:e,disabled:t,onChange:n}){const r=W();return o.jsxs("div",{className:d.shadowGrid,children:[o.jsx(Ae,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetX:i??{value:0,unit:"px"}})}}),o.jsx(Ae,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetY:i??{value:0,unit:"px"}})}}),o.jsx(Ae,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:i=>{n({...e,blur:i??{value:0,unit:"px"}})}}),o.jsx(Ae,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:i=>{n({...e,spread:i??{value:0,unit:"px"}})}}),o.jsx(nt,{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 kf=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0}],Af=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],Qv={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},eS={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function Pf({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const i=W(),a=c.useId(),l=c.useId();return o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:i(e)}),o.jsx(tS,{value:t.opacity,disabled:n,onChange:u=>{r({...t,opacity:u})}}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:i("imagePropertiesFit")}),o.jsxs("select",{id:a,className:d.select,value:t.fit??"",disabled:n,onChange:u=>{const m=u.target.value;r({...t,fit:m||null})},children:[o.jsx("option",{value:"",children:i("imagePropertiesFitDefault")}),es.map(u=>o.jsx("option",{value:u,children:i(Qv[u])},u))]})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:i("imagePropertiesPosition")}),o.jsxs("select",{id:l,className:d.select,value:t.position??"",disabled:n,onChange:u=>{r({...t,position:u.target.value||null})},children:[o.jsx("option",{value:"",children:i("imagePropertiesPositionDefault")}),ts.map(u=>o.jsx("option",{value:u,children:i(eS[u])},u))]})]})]})}function tS({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=e===null?null:$o(e),[l,u]=c.useState(()=>a===null?"":Q(a)),[m,g]=c.useState(!1);c.useEffect(()=>{m||u(a===null?"":Q(a))},[a,m]);const p=h=>{const C=h.trim();if(!C){n(null),u("");return}const y=Number(C.replace(",","."));if(!Number.isFinite(y)){u(a===null?"":Q(a));return}const x=Gd(y);n(x),u(Q($o(x)))};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:()=>g(!0),onChange:h=>u(h.target.value),onBlur:()=>{g(!1),p(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const Po=4,nS={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function Qo({label:e,inputAria:t,value:n,disabled:r,onChange:i}){const a=W(),l=c.useId(),u=c.useId(),m=c.useRef(null),g=c.useRef(null),p=c.useRef(null),h=(n==null?void 0:n.unit)??xx,[C,y]=c.useState(()=>n?Q(n.value):""),[x,b]=c.useState(!1),[S,v]=c.useState(!1),[k,P]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{x||y(n?Q(n.value):"")},[n,x]);const N=c.useCallback(()=>{const E=g.current,R=p.current;if(!E)return;const j=E.getBoundingClientRect(),F=(R==null?void 0:R.offsetHeight)??0;let U=j.bottom;U+F>window.innerHeight-Po&&(U=Math.max(Po,j.top-F));const $=Math.min(Math.max(j.left,Po),window.innerWidth-Math.max(j.width,72)-Po);P({top:U,left:$,width:j.width})},[]);c.useLayoutEffect(()=>{if(!S)return;N();const E=()=>N();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[S,N]),c.useEffect(()=>{if(!S)return;const E=j=>{var U,$;const F=j.target;(U=m.current)!=null&&U.contains(F)||($=p.current)!=null&&$.contains(F)||v(!1)},R=j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),v(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",R,!0)}},[S]);const D=E=>{const R=E.trim();if(!R){i(null),y("");return}const j=uu(R,h);if(!j){y(n?Q(n.value):"");return}i(j),y(Q(j.value))},A=Cx[h],T=(n==null?void 0:n.value)??null,I=S?o.jsx(ce,{children:o.jsx("ul",{ref:p,className:Se.list,role:"listbox",id:l,style:{top:k.top,left:k.left,minWidth:k.width},children:A.map(E=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Se.option,role:"option","aria-selected":T===E,onMouseDown:R=>R.preventDefault(),onClick:()=>{i({value:E,unit:h}),y(Q(E)),v(!1)},children:Q(E)})},E))})}):null;return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:u,children:e}),o.jsxs("div",{className:`${Se.wrap} ${d.lengthRow}`,ref:m,children:[o.jsxs("div",{className:Se.field,ref:g,children:[o.jsx("input",{id:u,className:Se.input,value:C,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":S,"aria-controls":l,role:"combobox",inputMode:"decimal",onFocus:()=>b(!0),onBlur:()=>{b(!1),D(C)},onChange:E=>y(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),D(C),v(!1),E.currentTarget.blur()),E.key==="ArrowDown"&&(E.preventDefault(),v(!0))}}),o.jsx("button",{type:"button",className:Se.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":S,"aria-controls":l,onMouseDown:E=>E.preventDefault(),onClick:()=>v(E=>!E)})]}),o.jsxs("div",{className:Se.field,children:[o.jsx("select",{className:Se.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:E=>{const R=E.target.value;if(n){i({value:n.value,unit:R});return}C.trim()&&i(uu(C,R))},children:Km.map(E=>o.jsx("option",{value:E,children:a(nS[E])},E))}),o.jsx("span",{className:Se.chevron,"aria-hidden":"true"})]}),I]})]})}const rS={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},oS={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function Df({src:e,disabled:t,customImagePicker:n,onSrcChange:r,onCustomPick:i,onSourceChange:a}){const l=W(),u=c.useId(),m=c.useId(),g=c.useRef(null),[p,h]=c.useState(()=>e.startsWith("data:")?"file":e.trim()?"url":"file"),[C,y]=c.useState(()=>e.startsWith("data:")?"":e),[x,b]=c.useState(""),[S,v]=c.useState(null),[k,P]=c.useState(!1);c.useEffect(()=>{a==null||a(p)},[a,p]);const N=p==="file"&&e.startsWith("data:")?e:p==="url"?C:"",D=p==="custom"?null:Hn(N),A=p==="custom"?null:p==="file"&&S?oS[S]:D&&(p==="file"||C.trim().length>0)?rS[D]:null,T=()=>{t||!n||i==null||i()},I=E=>{var j;const R=(j=E.target.files)==null?void 0:j[0];R&&(P(!0),v(null),fx(R).then(F=>{b(R.name),h("file"),r(F),P(!1)},F=>{const U=F instanceof Error?F.message:"";b(""),h("file"),v(U==="tooLarge"||U==="type"?U:"type"),P(!1),g.current&&(g.current.value="")}))};return 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":p==="file",disabled:t,onClick:()=>h("file"),children:l("imageDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":p==="url",disabled:t,onClick:()=>h("url"),children:l("imageDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":p==="custom",disabled:t,onClick:()=>h("custom"),children:n.text}):null]}),p==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:g,type:"file",accept:ax,hidden:!0,disabled:t,"aria-label":l("imageDialogChooseFile"),onChange:I}),o.jsx("button",{type:"button",className:d.action,disabled:t||k,onClick:()=>{var E;return(E=g.current)==null?void 0:E.click()},children:l("imageDialogChooseFile")}),x?o.jsx("span",{className:d.fileName,children:x}):null,e.startsWith("data:")&&!x?o.jsx("span",{className:d.fileName,children:l("pageBackgroundImageCurrent")}):null]}):null,p==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:l("imageDialogUrl")}),o.jsx("input",{id:u,className:d.textInput,value:C,disabled:t,"aria-invalid":A!==null,"aria-describedby":A?m:void 0,onChange:E=>{const R=E.target.value;y(R),r(R.trim())}})]}):null,p==="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:T,children:n.buttonCaption})]}):null,A?o.jsx("p",{id:m,className:d.error,children:l(A)}):null]})}function iS(e){return Hn(e.trim())===null}function aS(e){return Zm(e)?{width:null,height:null}:e==="fill"?{width:{...Dn},height:{...Dn}}:{width:{...Dn},height:null}}function lS({value:e,disabled:t,customImagePicker:n,onCustomImagePick:r,onChange:i}){const a=W(),l=e.src??"",u=(m,g)=>{i({...e,fit:null,[m]:g})};return o.jsxs(o.Fragment,{children:[l?o.jsxs("div",{className:d.field,children:[o.jsx("span",{className:d.label,children:a("pageBackgroundImagePreview")}),o.jsx("img",{className:d.previewImage,src:l,alt:a("pageBackgroundImagePreviewAlt")}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:()=>{i({...e,src:null})},children:a("pageBackgroundImageClear")})]}):null,o.jsx(Df,{src:l,disabled:t,customImagePicker:n,onCustomPick:r,onSrcChange:m=>{i({...e,src:m.trim()||null})}}),l?o.jsxs(o.Fragment,{children:[o.jsx(Qo,{label:a("imagePropertiesWidth"),inputAria:a("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:m=>u("width",m)}),o.jsx(Qo,{label:a("imagePropertiesHeight"),inputAria:a("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:m=>u("height",m)}),o.jsx(Pf,{legendKey:"pageDialogTabBackgroundImage",value:{opacity:e.opacity,fit:e.fit,position:e.position},disabled:t,onChange:m=>{const g=m.fit===e.fit?{width:e.width,height:e.height}:aS(m.fit);i({...e,opacity:m.opacity,fit:m.fit,position:m.position,...g})}})]}):null]})}const sS={left:ri,center:ni,right:oi,justify:id},cS={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},uS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},dS={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},mS={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},fS={value:1,unit:"pt"},gS={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1},pS={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid"},Nu={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid",page:"paragraphDialogBreakPage"};function lr(e){return{top:e,right:e,bottom:e,left:e}}function Mu(e){for(const t of Le)if(e[t])return e[t];return null}function hS(){const e=[...kf];for(const t of Af)e.some(n=>n.id===t.id)||e.push(t);return e}function cs({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:i="paragraphDialogTitle",backgroundImage:a,customImagePicker:l,onCustomImagePick:u,onBackgroundImageChange:m,onTabChange:g,onChange:p}){const h=W(),C=r?hS().filter(A=>r.includes(A.id)):kf,y=c.useId(),x=c.useId(),b=c.useId(),S=c.useId(),[v,k]=c.useState(()=>Tt(t.margin,lr(t.margin.top))),[P,N]=c.useState(()=>Tt(t.padding,lr(t.padding.top))),D=(A,T,I,E)=>{const R=t[A],j=T?lr(E):{...R,[I]:E};p({...t,[A]:j,[`${A}Mixed`]:!1})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":h(i),children:C.map(A=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":A.id===e,disabled:!A.implemented,onClick:()=>g(A.id),children:h(A.labelKey)},A.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:h("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":h("paragraphDialogAlignment"),children:Lm.map(A=>{const T=sS[A],I=!t.alignMixed&&t.align===A;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":I,"aria-label":h(cS[A].aria),disabled:n,onClick:()=>{p({...t,align:A,alignMixed:!1})},children:o.jsx(T,{})},A)})})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("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":h("commandBulletListAria"),disabled:n,onClick:()=>{const A=!t.listMixed&&t.list==="ul"?null:"ul";p({...t,list:A,listMixed:!1})},children:o.jsx(ad,{})}),o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":h("commandNumberedListAria"),disabled:n,onClick:()=>{const A=!t.listMixed&&t.list==="ol"?null:"ol";p({...t,list:A,listMixed:!1})},children:o.jsx(ud,{})})]})]})]}):null,e==="spacing"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogSpacing")}),o.jsx(_u,{legend:h("paragraphDialogMargin"),sides:t.margin,linked:v,disabled:n,allowNegative:!0,onLinkedChange:A=>{k(A),A&&p({...t,margin:lr(Mu(t.margin)),marginMixed:!1})},onSideChange:(A,T)=>D("margin",v,A,T)}),o.jsx(_u,{legend:h("paragraphDialogPadding"),sides:t.padding,linked:P,disabled:n,onLinkedChange:A=>{N(A),A&&p({...t,padding:lr(Mu(t.padding)),paddingMixed:!1})},onSideChange:(A,T)=>D("padding",P,A,T)}),o.jsx(yS,{value:t.lineHeight,disabled:n,onChange:A=>{p({...t,lineHeight:A,lineHeightMixed:!1})}}),o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:h("paragraphDialogPageBreaks")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:x,children:h("paragraphDialogBreakInside")}),o.jsx("select",{id:x,className:d.select,value:t.breakInsideMixed?"auto":t.breakInside,disabled:n,onChange:A=>{p({...t,breakInside:A.target.value,breakInsideMixed:!1})},children:Bd.map(A=>o.jsx("option",{value:A,children:h(pS[A])},A))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:b,children:h("paragraphDialogBreakAfter")}),o.jsx("select",{id:b,className:d.select,value:t.breakAfterMixed?"auto":t.breakAfter,disabled:n,onChange:A=>{p({...t,breakAfter:A.target.value,breakAfterMixed:!1})},children:el.map(A=>o.jsx("option",{value:A,children:h(Nu[A])},A))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:S,children:h("paragraphDialogBreakBefore")}),o.jsx("select",{id:S,className:d.select,value:t.breakBeforeMixed?"auto":t.breakBefore,disabled:n,onChange:A=>{p({...t,breakBefore:A.target.value,breakBeforeMixed:!1})},children:el.map(A=>o.jsx("option",{value:A,children:h(Nu[A])},A))})]})]})]}):null,e==="border"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:y,children:h("paragraphDialogBorderStyle")}),o.jsx("select",{id:y,className:d.select,value:t.border.style,disabled:n,onChange:A=>{const T=A.target.value;p({...t,border:{style:T,width:T==="none"?null:t.border.width??fS,color:T==="none"?null:t.border.color},borderMixed:!1})},children:ci.map(A=>o.jsx("option",{value:A,children:h(dS[A])},A))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{label:h("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:A=>{p({...t,border:{...t.border,width:A},borderMixed:!1})}}),o.jsx(nt,{label:h("paragraphDialogBorderColor"),noneLabel:h("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:A=>{p({...t,border:{...t.border,color:A},borderMixed:!1})}})]}):null,o.jsx(Ae,{label:h("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:A=>{p({...t,borderRadius:A,radiusMixed:!1})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{p({...t,boxShadow:t.boxShadow?null:gS,shadowMixed:!1})}}),h("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(ss,{shadow:t.boxShadow,disabled:n,onChange:A=>{p({...t,boxShadow:A,shadowMixed:!1})}}):null]}):null,e==="background"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogTabBackground")}),o.jsx(nt,{label:h("paragraphDialogBackgroundColor"),noneLabel:h("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:A=>{p({...t,backgroundColor:A,backgroundMixed:!1})}}),o.jsx(bS,{value:t.opacity,disabled:n,onChange:A=>{p({...t,opacity:A,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&m?o.jsx(lS,{value:a,disabled:n,customImagePicker:l,onCustomImagePick:u,onChange:m}):null]})]})}function bS({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=e===null?null:$o(e),[l,u]=c.useState(()=>a===null?"":Q(a)),[m,g]=c.useState(!1);c.useEffect(()=>{m||u(a===null?"":Q(a))},[a,m]);const p=h=>{const C=h.trim();if(!C){n(null),u("");return}const y=Number(C.replace(",","."));if(!Number.isFinite(y)){u(a===null?"":Q(a));return}const x=Gd(y);n(x),u(Q($o(x)))};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:()=>g(!0),onChange:h=>u(h.target.value),onBlur:()=>{g(!1),p(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function _u({legend:e,sides:t,linked:n,disabled:r,allowNegative:i=!1,onLinkedChange:a,onSideChange:l}){const u=W(),m=n?["top"]:Le;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)}),u("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:m.map(g=>o.jsx(Ae,{label:n?e:u(uS[g]),value:t[g],disabled:r,allowNegative:i,onChange:p=>l(g,p)},g))})]})}function yS({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=xS(e),l=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,m]=c.useState(()=>l===null?"":Q(l)),g=(e==null?void 0:e.kind)==="length"?e.unit:Ll;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"?"":u,disabled:t||a==="normal",inputMode:"decimal",onChange:p=>m(p.target.value),onBlur:()=>{const p=u.trim();if(!p){n(null);return}if(a==="number"||a==="empty"){const C=Number(p.replace(",","."));if(!Number.isFinite(C)||C<0){m(l===null?"":Q(l));return}n({kind:"number",value:C}),m(Q(C));return}const h=pr(p,g,!1);if(!h){m(l===null?"":Q(l));return}n({kind:"length",value:h.value,unit:h.unit}),m(Q(h.value))}}),o.jsxs("select",{className:d.lengthUnit,value:a==="length"?g:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:p=>{const h=p.target.value;if(h==="empty"){n(null),m("");return}if(h==="normal"){n({kind:"normal"}),m("");return}if(h==="number"){const b=Number((u||"1.5").replace(",",".")),S=Number.isFinite(b)&&b>=0?b:1.5;n({kind:"number",value:S}),m(Q(S));return}const C=h,y=pr(u||"1",C,!1),x=(y==null?void 0:y.value)??1;n({kind:"length",value:x,unit:C}),m(Q(x))},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(p=>o.jsx("option",{value:p,children:r(mS[p])},p))]})]})]})}function xS(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}const Lu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function CS({open:e,tab:t,value:n,disabled:r,onTabChange:i,onApply:a,onClose:l}){const u=W(),m=c.useId(),g=c.useRef(null),[p,h]=c.useState(n);return c.useEffect(()=>{e&&h(n)},[e,n]),c.useEffect(()=>{if(!e)return;const C=g.current,y=C==null?void 0:C.querySelector(Lu);y==null||y.focus();const x=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),l();return}if(b.key!=="Tab"||!C)return;const S=[...C.querySelectorAll(Lu)];if(S.length===0)return;const v=S[0],k=S[S.length-1];b.shiftKey&&document.activeElement===v?(b.preventDefault(),k.focus()):!b.shiftKey&&document.activeElement===k&&(b.preventDefault(),v.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,l]),e?o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:l,children:o.jsxs("div",{ref:g,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":m,onMouseDown:C=>C.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:m,children:u("paragraphDialogTitle")}),o.jsx(cs,{tab:t,value:p,disabled:r,onTabChange:i,onChange:h}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:l,children:u("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:r,onClick:()=>a(p),children:u("fontDialogOk")})]})]})})}):null}const wS=["auto","A4","letter","legal","custom"],vS={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},SS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function Iu(e){return e===null?"":Q(e.value)}function kS({value:e,disabled:t,onChange:n,onReset:r}){const i=W(),a=c.useId(),[l,u]=c.useState(!0),m=e??an(),g=(p,h)=>{if(l){n({...m,margin:{top:h,right:h,bottom:h,left:h},marginMixed:!1});return}n({...m,margin:{...m.margin,[p]:h},marginMixed:!1})};return o.jsxs("div",{className:d.body,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:i("pageAtRuleSize")}),o.jsx("select",{id:a,className:d.select,disabled:t,value:m.sizePreset,onChange:p=>n({...m,sizePreset:p.target.value}),children:wS.map(p=>o.jsx("option",{value:p,children:i(vS[p])},p))})]}),m.sizePreset==="custom"?o.jsxs("div",{className:d.sideGrid,children:[o.jsx(Ha,{label:i("pageAtRuleWidth"),value:m.customWidth,disabled:t,onChange:p=>n({...m,customWidth:p})}),o.jsx(Ha,{label:i("pageAtRuleHeight"),value:m.customHeight,disabled:t,onChange:p=>n({...m,customHeight:p})})]}):null,o.jsxs("div",{className:d.field,children:[o.jsx("span",{className:d.label,children:i("pageAtRuleOrientation")}),o.jsx("div",{className:d.marks,children:[["none","pageAtRuleOrientationNone"],["portrait","pageAtRuleOrientationPortrait"],["landscape","pageAtRuleOrientationLandscape"]].map(([p,h])=>o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"radio",name:"page-orientation",checked:(m.orientation??"none")===p,disabled:t,onChange:()=>n({...m,orientation:p==="none"?null:p})}),i(h)]},p))})]}),o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:i("pageAtRuleMargins")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:l,disabled:t,onChange:()=>u(!l)}),i("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(l?["top"]:Le).map(p=>o.jsx(Ha,{label:i(l?"pageAtRuleMargins":SS[p]),value:m.margin[p],disabled:t,onChange:h=>g(p,h)},p))})]}),o.jsx("div",{className:d.actions,children:o.jsx("button",{type:"button",className:d.action,disabled:t,"aria-label":i("pageAtRuleResetAria"),onClick:r,children:i("pageAtRuleReset")})})]})}function Ha({label:e,value:t,disabled:n,onChange:r}){const i=W(),a=c.useId(),[l,u]=c.useState(()=>Iu(t)),m=(t==null?void 0:t.unit)??Ll;return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:a,className:d.lengthInput,value:l,disabled:n,inputMode:"decimal",onChange:g=>u(g.target.value),onBlur:()=>{const g=l.trim();if(!g){r(null);return}const p=pr(g,m,!1);if(!p){u(Iu(t));return}r(p),u(Q(p.value))}}),o.jsxs("select",{className:d.lengthUnit,disabled:n,value:m,"aria-label":i("paragraphDialogLengthUnitAria"),onChange:g=>{const p=g.target.value;t&&r({...t,unit:p})},children:[o.jsx("option",{value:"pt",children:i("fontSizeUnitPt")}),o.jsx("option",{value:"px",children:i("fontSizeUnitPx")}),o.jsx("option",{value:"em",children:i("fontSizeUnitEm")}),o.jsx("option",{value:"rem",children:i("fontSizeUnitRem")}),o.jsx("option",{value:"%",children:i("fontSizeUnitPercent")})]})]})]})}const Fu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',AS=Af.map(e=>e.id);function PS(e){return{...ur(),...e}}function DS(e){const{align:t,alignMixed:n,list:r,listMixed:i,...a}=e;return a}function jS({open:e,tab:t,value:n,fonts:r,disabled:i,customImagePicker:a,onCustomImagePick:l,onTabChange:u,onApply:m,onResetAtRule:g,onClose:p}){const h=W(),C=c.useId(),y=c.useRef(null),[x,b]=c.useState("general"),[S,v]=c.useState("spacing"),[k,P]=c.useState(n.font),[N,D]=c.useState(n.box),[A,T]=c.useState(n.backgroundImage),[I,E]=c.useState(n.atRule??an());if(c.useEffect(()=>{e&&(b("general"),v("spacing"),P(n.font),D(n.box),T(n.backgroundImage??ns()),E(n.atRule??an()))},[e,n]),c.useEffect(()=>{if(!e)return;const j=y.current,F=j==null?void 0:j.querySelector(Fu);F==null||F.focus();const U=$=>{if($.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;$.preventDefault(),$.stopPropagation(),p();return}if($.key!=="Tab"||!j)return;const X=[...j.querySelectorAll(Fu)];if(X.length===0)return;const J=X[0],he=X[X.length-1];$.shiftKey&&document.activeElement===J?($.preventDefault(),he.focus()):!$.shiftKey&&document.activeElement===he&&($.preventDefault(),J.focus())};return document.addEventListener("keydown",U,!0),()=>document.removeEventListener("keydown",U,!0)},[e,p]),!e)return null;const R=h("pageDialogTitle");return o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:p,children:o.jsxs("div",{ref:y,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":C,onMouseDown:j=>j.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:C,children:R}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":R,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="font",onClick:()=>u("font"),children:h("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="paragraph",onClick:()=>u("paragraph"),children:h("customStyleDialogTabParagraph")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="print",onClick:()=>u("print"),children:h("pageDialogTabPrint")})]}),t==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(ls,{tab:x,value:k,fonts:r,disabled:i,onTabChange:b,onChange:P})}):t==="paragraph"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(cs,{tab:S,value:PS(N),disabled:i,tabs:AS,tablistLabelKey:"pageDialogTitle",backgroundImage:A,customImagePicker:a,onCustomImagePick:l,onBackgroundImageChange:T,onTabChange:j=>{j!=="general"&&v(j)},onChange:j=>D(DS(j))})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(kS,{value:I,disabled:i,onChange:E,onReset:()=>{E(an()),g==null||g()}})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:p,children:h("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>m({font:k,box:N,backgroundImage:A,atRule:I}),children:h("fontDialogOk")})]})]})})})}const Bu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function ES(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Hu(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 RS(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 TS({open:e,mode:t,styleId:n,name:r="",font:i,paragraph:a,canDelete:l=!1,busy:u,disabled:m,fonts:g,defaultOuterTab:p="font",onSave:h,onDelete:C,onClose:y}){const x=W(),b=c.useId(),S=c.useId(),v=c.useRef(null),[k,P]=c.useState(r),[N,D]=c.useState(p),[A,T]=c.useState("general"),[I,E]=c.useState("general"),[R,j]=c.useState(()=>Hu(i)),[F,U]=c.useState(()=>ul(a)),[$,X]=c.useState(!1);if(c.useEffect(()=>{e&&(P(r),D(p),T("general"),E("general"),j(Hu(i)),U(ul(a)),X(!1))},[e,r,i,a,p]),c.useEffect(()=>{if(!e)return;const te=v.current,ae=te==null?void 0:te.querySelector(Bu);ae==null||ae.focus();const M=Z=>{if(Z.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;if(Z.preventDefault(),Z.stopPropagation(),$){X(!1);return}y();return}if(Z.key!=="Tab"||!te)return;const ie=[...te.querySelectorAll(Bu)];if(ie.length===0)return;const G=ie[0],xe=ie[ie.length-1];Z.shiftKey&&document.activeElement===G?(Z.preventDefault(),xe.focus()):!Z.shiftKey&&document.activeElement===xe&&(Z.preventDefault(),G.focus())};return document.addEventListener("keydown",M,!0),()=>document.removeEventListener("keydown",M,!0)},[e,y,$]),!e)return null;const J=x(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),he=k.trim().length>0,Y=!!(m||u),be=()=>{const te=k.trim();te&&h({id:n??ES(),name:te,font:RS(R),paragraph:Hm(F)})};return o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:y,children:o.jsxs("div",{ref:v,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":b,"aria-busy":u||void 0,onMouseDown:te=>te.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:b,children:J}),o.jsx("button",{type:"button",className:d.close,"aria-label":x("customStyleDialogCloseAria"),onClick:y,children:o.jsx(Ie,{})})]}),$?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.confirmBody,children:x("customStyleDialogDeleteConfirm")}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:Y,onClick:()=>X(!1),children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:Y||!n,onClick:()=>{n&&(C==null||C(n))},children:x("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:S,children:x("customStyleDialogName")}),o.jsx("input",{id:S,className:d.nameInput,value:k,disabled:Y,onChange:te=>P(te.target.value)})]})}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":J,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="font",onClick:()=>D("font"),children:x("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="paragraph",onClick:()=>D("paragraph"),children:x("customStyleDialogTabParagraph")})]}),N==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(ls,{tab:A,value:R,fonts:g,disabled:Y,onTabChange:T,onChange:j})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(cs,{tab:I,value:F,disabled:Y,onTabChange:E,onChange:U})}),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:Y,onClick:()=>X(!0),children:x("customStyleDialogDelete")}):null,o.jsxs("div",{className:d.actionsEnd,children:[o.jsx("button",{type:"button",className:d.action,onClick:y,children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:Y||!he,onClick:be,children:x("fontDialogOk")})]})]})]})]})})})}const NS='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function MS({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useId(),m=c.useRef(null),g=c.useRef(null),[p,h]=c.useState(t);if(c.useEffect(()=>{e&&h(t)},[e,t]),c.useEffect(()=>{var b;if(!e)return;(b=g.current)==null||b.focus();const y=m.current,x=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),i();return}if(S.key!=="Tab"||!y)return;const v=[...y.querySelectorAll(NS)];if(v.length===0)return;const k=v[0],P=v[v.length-1];S.shiftKey&&document.activeElement===k?(S.preventDefault(),P.focus()):!S.shiftKey&&document.activeElement===P&&(S.preventDefault(),k.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,i]),!e)return null;const C=()=>{n||r(p)};return o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:m,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("customCssDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("customCssDialogCloseAria"),onClick:i,children:o.jsx(Ie,{})})]}),o.jsx("div",{className:d.body,children:o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:a("customCssDialogField")}),o.jsx("textarea",{ref:g,id:u,className:d.textarea,value:p,disabled:n,spellCheck:!1,"aria-label":a("customCssDialogFieldAria"),rows:8,onChange:y=>h(y.target.value)})]})}),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:C,children:a("fontDialogOk")})]})]})})})}const zu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',_S={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function LS({open:e,existingIds:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useId(),m=c.useId(),g=c.useRef(null),[p,h]=c.useState(""),[C,y]=c.useState(!1),x=c.useMemo(()=>new Set(t),[t]),b=rf(p,x);if(c.useEffect(()=>{e&&(h(""),y(!1))},[e]),c.useEffect(()=>{if(!e)return;const P=g.current,N=P==null?void 0:P.querySelector(zu);N==null||N.focus();const D=A=>{if(A.key==="Escape"){A.preventDefault(),A.stopPropagation(),i();return}if(A.key!=="Tab"||!P)return;const T=[...P.querySelectorAll(zu)];if(T.length===0)return;const I=T[0],E=T[T.length-1];A.shiftKey&&document.activeElement===I?(A.preventDefault(),E.focus()):!A.shiftKey&&document.activeElement===E&&(A.preventDefault(),I.focus())};return document.addEventListener("keydown",D,!0),()=>document.removeEventListener("keydown",D,!0)},[e,i]),!e)return null;const S=C||p.trim().length>0?b:null,v=b===null&&!n,k=()=>{y(!0),!(b||n)&&r(p.trim())};return o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:g,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(Ie,{})})]}),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:u,children:a("bookmarkDialogName")}),o.jsx(Wt,{label:a("bookmarkDialogHelp"),elevated:!0,children:o.jsx("button",{type:"button",className:d.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),o.jsx("input",{id:u,className:d.textInput,value:p,disabled:n,"aria-invalid":S!==null,"aria-describedby":S?m:void 0,onChange:P=>h(P.target.value)}),S?o.jsx("p",{id:m,className:d.error,children:a(_S[S])}):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:!v,onClick:k,children:a("fontDialogOk")})]})]})})})}const Ou='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',IS={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},FS={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function BS({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=W(),u=c.useId(),m=c.useId(),g=c.useId(),p=c.useId(),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState("file"),[b,S]=c.useState(""),[v,k]=c.useState(""),[P,N]=c.useState(""),[D,A]=c.useState(""),[T,I]=c.useState(null),[E,R]=c.useState(!1);if(c.useEffect(()=>{e&&(x("file"),S(""),k(""),N(""),A(""),I(null),R(!1),C.current&&(C.current.value=""))},[e]),c.useEffect(()=>{if(!e)return;const Y=h.current,be=Y==null?void 0:Y.querySelector(Ou);be==null||be.focus();const te=ae=>{if(ae.key==="Escape"){ae.preventDefault(),ae.stopPropagation(),a();return}if(ae.key!=="Tab"||!Y)return;const M=[...Y.querySelectorAll(Ou)];if(M.length===0)return;const Z=M[0],ie=M[M.length-1];ae.shiftKey&&document.activeElement===Z?(ae.preventDefault(),ie.focus()):!ae.shiftKey&&document.activeElement===ie&&(ae.preventDefault(),Z.focus())};return document.addEventListener("keydown",te,!0),()=>document.removeEventListener("keydown",te,!0)},[e,a]),!e)return null;const j=y==="file"?v:y==="url"?b:"",F=y==="custom"?null:is(j),U=y==="custom"?null:y==="file"&&T?FS[T]:F&&(y==="file"||b.trim().length>0)?IS[F]:null,$=y!=="custom"&&F===null&&!(y==="file"&&T)&&!t&&!E,X=()=>{t||!n||i==null||i()},J=()=>{$&&r({src:j.trim(),title:D.trim()})},he=Y=>{var te;const be=(te=Y.target.files)==null?void 0:te[0];be&&(R(!0),I(null),gC(be).then(ae=>{k(ae),N(be.name),x("file"),R(!1)},ae=>{const M=ae instanceof Error?ae.message:"";k(""),N(""),x("file"),I(M==="tooLarge"||M==="type"?M:"type"),R(!1),C.current&&(C.current.value="")}))};return o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:h,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:Y=>Y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("audioDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("audioDialogCloseAria"),onClick:a,children:o.jsx(Ie,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="file",disabled:t,onClick:()=>x("file"),children:l("audioDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>x("url"),children:l("audioDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>x("custom"),children:n.text}):null]}),y==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:C,type:"file",accept:lC,hidden:!0,disabled:t,"aria-label":l("audioDialogChooseFile"),onChange:he}),o.jsx("button",{type:"button",className:d.action,disabled:t||E,onClick:()=>{var Y;return(Y=C.current)==null?void 0:Y.click()},children:l("audioDialogChooseFile")}),P?o.jsx("span",{className:d.fileName,children:P}):null]}):null,y==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("audioDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:b,disabled:t,"aria-invalid":U!==null,"aria-describedby":U?p:void 0,onChange:Y=>S(Y.target.value)})]}):null,y==="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:X,children:n.buttonCaption})]}):null]}),y!=="custom"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:g,children:l("audioDialogTitleField")}),o.jsx("input",{id:g,className:d.textInput,value:D,disabled:t,onChange:Y=>A(Y.target.value)})]}):null,U?o.jsx("p",{id:p,className:d.error,children:l(U)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),y!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!$,onClick:J,children:l("fontDialogOk")}):null]})]})})})}const Ku='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])';function HS({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=W(),u=c.useId(),m=c.useId(),g=c.useId(),p=c.useRef(null),[h,C]=c.useState(""),[y,x]=c.useState(""),[b,S]=c.useState(""),[v,k]=c.useState("file");if(c.useEffect(()=>{e&&(C(""),x(""),S(""),k("file"))},[e]),c.useEffect(()=>{if(!e)return;const D=p.current,A=D==null?void 0:D.querySelector(Ku);A==null||A.focus();const T=I=>{if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),a();return}if(I.key!=="Tab"||!D)return;const E=[...D.querySelectorAll(Ku)];if(E.length===0)return;const R=E[0],j=E[E.length-1];I.shiftKey&&document.activeElement===R?(I.preventDefault(),j.focus()):!I.shiftKey&&document.activeElement===j&&(I.preventDefault(),R.focus())};return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,a]),!e)return null;const P=iS(h)&&!t,N=()=>{P&&r({src:h.trim(),alt:y.trim(),title:b.trim()})};return o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:p,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:D=>D.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("imageDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("imageDialogCloseAria"),onClick:a,children:o.jsx(Ie,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx(Df,{src:h,disabled:t,customImagePicker:n,onCustomPick:i,onSourceChange:k,onSrcChange:C}),v!=="custom"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("imageDialogAlt")}),o.jsx("input",{id:m,className:d.textInput,value:y,disabled:t,onChange:D=>x(D.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:g,children:l("imageDialogTitleField")}),o.jsx("input",{id:g,className:d.textInput,value:b,disabled:t,onChange:D=>S(D.target.value)})]})]}):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:!P,onClick:N,children:l("fontDialogOk")}):null]})]})})})}const zS=[{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}],OS={left:ri,center:ni,right:oi},KS=["left","center","right"],$S={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},US=["width","height","lock"],WS={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},GS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},VS={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},ZS={value:1,unit:"pt"},qS={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 za(e){return{top:e,right:e,bottom:e,left:e}}function YS(e){for(const t of Le)if(e[t])return e[t];return null}function XS({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:i,onChange:a}){const l=W(),u=c.useId(),m=c.useId(),g=c.useId(),[p,h]=c.useState(()=>Tt(t.margin,za(t.margin.top))),C=t.align==="center",y=(b,S)=>{if(t.sizeMode==="lock"&&S){const v=dr(b,S,n);a({...t,width:v.width,height:v.height});return}a({...t,[b]:S})},x=b=>{if(b==="width"){a({...t,sizeMode:b,height:null});return}if(b==="height"){a({...t,sizeMode:b,width:null});return}if(t.width){const S=dr("width",t.width,n);a({...t,sizeMode:b,width:S.width,height:S.height});return}if(t.height){const S=dr("height",t.height,n);a({...t,sizeMode:b,width:S.width,height:S.height});return}a({...t,sizeMode:b})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("imagePropertiesDialogTitle"),children:zS.map(b=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":b.id===e,disabled:!b.implemented,onClick:()=>i(b.id),children:l(b.labelKey)},b.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:US.map(b=>o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":t.sizeMode===b,disabled:r,onClick:()=>x(b),children:l(WS[b])},b))}),o.jsx(Qo,{label:l("imagePropertiesWidth"),inputAria:l("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:b=>y("width",b)}),o.jsx(Qo,{label:l("imagePropertiesHeight"),inputAria:l("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:b=>y("height",b)})]}):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:KS.map(b=>{const S=OS[b];return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":t.align===b,"aria-label":l($S[b]),disabled:r,onClick:()=>{a({...t,align:t.align===b?null:b})},children:o.jsx(S,{})},b)})})]}):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:p,disabled:r||C,onChange:()=>{const b=!p;h(b),b&&a({...t,margin:za(YS(t.margin))})}}),l("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(p?["top"]:Le).map(b=>o.jsx(Ae,{label:l(p?"paragraphDialogMargin":GS[b]),value:t.margin[b],disabled:r||C&&(b==="left"||b==="right"),allowNegative:!0,onChange:S=>{const v=p?za(S):{...t.margin,[b]:S};a({...t,margin:v})}},b))})]}),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:u,children:l("paragraphDialogBorderStyle")}),o.jsx("select",{id:u,className:d.select,value:t.border.style,disabled:r,onChange:b=>{const S=b.target.value;a({...t,border:{style:S,width:S==="none"?null:t.border.width??ZS,color:S==="none"?null:t.border.color}})},children:ci.map(b=>o.jsx("option",{value:b,children:l(VS[b])},b))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{label:l("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:b=>{a({...t,border:{...t.border,width:b}})}}),o.jsx(nt,{label:l("paragraphDialogBorderColor"),noneLabel:l("colorNone"),value:t.border.color,disabled:r,onChange:b=>{a({...t,border:{...t.border,color:b}})}})]}):null,o.jsx(Ae,{label:l("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:b=>{a({...t,borderRadius:b})}}),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:qS})}}),l("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(ss,{shadow:t.boxShadow,disabled:r,onChange:b=>{a({...t,boxShadow:b})}}):null]})]}):null,e==="advanced"?o.jsxs(o.Fragment,{children:[o.jsx(Pf,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:b=>{a(Rx({...t,opacity:b.opacity,objectFit:b.fit,objectPosition:b.position},n))}}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesRotation")}),o.jsx("div",{className:d.field,children:o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:m,className:d.lengthInput,value:t.rotateDeg===null?"":Q(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":l("imagePropertiesRotation"),onChange:b=>{const S=b.target.value.trim();if(!S){a({...t,rotateDeg:null});return}const v=Number(S.replace(",","."));Number.isFinite(v)&&a({...t,rotateDeg:v})}}),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:g,children:l("imagePropertiesHoverCss")}),o.jsx("textarea",{id:g,className:d.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":l("imagePropertiesHoverCssAria"),onChange:b=>{a({...t,hoverCss:b.target.value})}})]})]}):null]})]})}const $u='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function JS({open:e,tab:t,value:n,aspectRatio:r=1,disabled:i,onTabChange:a,onApply:l,onClose:u}){const m=W(),g=c.useId(),p=c.useRef(null),[h,C]=c.useState(n);return c.useEffect(()=>{e&&C(n)},[e,n]),c.useEffect(()=>{if(!e)return;const y=p.current,x=y==null?void 0:y.querySelector($u);x==null||x.focus();const b=S=>{if(S.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;S.preventDefault(),S.stopPropagation(),u();return}if(S.key!=="Tab"||!y)return;const v=[...y.querySelectorAll($u)];if(v.length===0)return;const k=v[0],P=v[v.length-1];S.shiftKey&&document.activeElement===k?(S.preventDefault(),P.focus()):!S.shiftKey&&document.activeElement===P&&(S.preventDefault(),k.focus())};return document.addEventListener("keydown",b,!0),()=>document.removeEventListener("keydown",b,!0)},[e,u]),e?o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:u,children:o.jsxs("div",{ref:p,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":g,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:g,children:m("imagePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":m("imagePropertiesDialogCloseAria"),onClick:u,children:o.jsx(Ie,{})})]}),o.jsx(XS,{tab:t,value:h,aspectRatio:r,disabled:i,onTabChange:a,onChange:C}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:u,children:m("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>l(h),children:m("fontDialogOk")})]})]})})}):null}const QS="_frame_bwkh8_1",ek="_handle_bwkh8_9",tk="_handleEast_bwkh8_29",nk="_handleSouth_bwkh8_37",rk="_handleSouthEast_bwkh8_45",mr={frame:QS,handle:ek,handleEast:tk,handleSouth:nk,handleSouthEast:rk};function sr(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const ok=[{handle:"e",className:mr.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:mr.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:mr.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function Oa(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function ik({img:e,onResize:t,onResizeEnd:n}){const r=W(),i=c.useRef(null),a=c.useRef(e),l=c.useRef(t),u=c.useRef(n),m=c.useRef(null);a.current=e,l.current=t,u.current=n;const g=v=>{const k=i.current;k&&(k.style.left=`${v.left}px`,k.style.top=`${v.top}px`,k.style.width=`${v.width}px`,k.style.height=`${v.height}px`)};c.useLayoutEffect(()=>{g(sr(e));const v=()=>{e.isConnected&&g(sr(e))};return window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[e]);const p=(v,k)=>{const P=m.current,N=a.current;if(!P||!N)return;const D=GC(P.handle,P.start,{x:v-P.originX,y:k-P.originY});l.current(D.width,D.height),N.isConnected&&g(sr(N))},h=()=>{if(!m.current)return;m.current=null;const v=a.current;u.current(),v!=null&&v.isConnected&&g(sr(v))};c.useLayoutEffect(()=>{const v=P=>{if(!m.current)return;const N=Oa(P);N&&p(N.x,N.y)},k=()=>{h()};return document.addEventListener("pointermove",v),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k),document.addEventListener("mousemove",v),document.addEventListener("mouseup",k),()=>{document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",k)}},[]);const C=(v,k)=>{const P=Oa(k);P&&(m.current={handle:v,start:VC(a.current),originX:P.x,originY:P.y})},y=v=>k=>{k.preventDefault(),k.stopPropagation(),C(v,k);try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}},x=v=>k=>{k.preventDefault(),k.stopPropagation(),C(v,k)},b=v=>{const k=Oa(v);k&&p(k.x,k.y)};if(!e.isConnected)return null;const S=sr(e);return vl.createPortal(o.jsx("div",{ref:i,className:mr.frame,"data-image-resize-overlay":"",style:{left:S.left,top:S.top,width:S.width,height:S.height},children:ok.map(v=>o.jsx("button",{type:"button",className:`${mr.handle} ${v.className}`,style:{cursor:v.cursor},"aria-label":r(v.ariaKey),"data-resize-handle":v.handle,onPointerDown:y(v.handle),onPointerMove:b,onPointerUp:h,onPointerCancel:h,onMouseDown:x(v.handle),onMouseMove:b,onMouseUp:h},v.handle))}),document.body)}const Uu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function ak({open:e,tab:t,href:n,title:r,targetBlank:i,textDecorationNone:a,hoverMode:l,hoverColor:u,hoverHtml:m,bookmarks:g,selectedBookmarkId:p,disabled:h,onTabChange:C,onApply:y,onClose:x}){const b=W(),S=c.useId(),v=c.useId(),k=c.useId(),P=c.useId(),N=c.useId(),D=c.useRef(null),[A,T]=c.useState(n),[I,E]=c.useState(r),[R,j]=c.useState(i),[F,U]=c.useState(a),[$,X]=c.useState(l),[J,he]=c.useState(u),[Y,be]=c.useState(m),[te,ae]=c.useState(p);if(c.useEffect(()=>{e&&(T(n),E(r),j(i),U(a),X(l),he(u),be(m),ae(p))},[e,n,r,i,a,l,u,m,p]),c.useEffect(()=>{if(!e)return;const G=D.current,xe=G==null?void 0:G.querySelector(Uu);xe==null||xe.focus();const Fe=ve=>{if(ve.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;ve.preventDefault(),ve.stopPropagation(),x();return}if(ve.key!=="Tab"||!G)return;const Yt=[...G.querySelectorAll(Uu)];if(Yt.length===0)return;const Pr=Yt[0],zn=Yt[Yt.length-1];ve.shiftKey&&document.activeElement===Pr?(ve.preventDefault(),zn.focus()):!ve.shiftKey&&document.activeElement===zn&&(ve.preventDefault(),Pr.focus())};return document.addEventListener("keydown",Fe,!0),()=>document.removeEventListener("keydown",Fe,!0)},[e,x,t,$]),!e)return null;const M=()=>fi({title:I,targetBlank:R,textDecorationNone:F,hoverMode:$,hoverColor:J,hoverHtml:Y}),Z=()=>{const G=A.trim();!G||h||y({...M(),href:G})},ie=()=>{!te||h||y({...M(),href:`#${te}`})};return o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:x,children:o.jsxs("div",{ref:D,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":S,onMouseDown:G=>G.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:S,children:b("linkDialogTitle")}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":b("linkDialogTitle"),children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="link",onClick:()=>C("link"),children:b("linkDialogTabLink")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>C("bookmark"),children:b("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:v,children:b("linkDialogHref")}),o.jsx("input",{id:v,className:d.textInput,value:A,disabled:h,onChange:G=>T(G.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:k,children:b("linkDialogHoverTitle")}),o.jsx("input",{id:k,className:d.textInput,value:I,disabled:h,onChange:G=>E(G.target.value)})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:R,disabled:h,onChange:G=>j(G.target.checked)}),b("linkDialogTargetBlank")]})]}):g.length===0?o.jsx("p",{className:d.emptyHint,children:b("linkDialogBookmarkEmpty")}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:P,children:b("linkDialogBookmark")}),o.jsxs("select",{id:P,className:`${d.select} ${d.fullSelect}`,value:te,disabled:h,onChange:G=>ae(G.target.value),children:[o.jsx("option",{value:""}),g.map(G=>o.jsx("option",{value:G.id,children:G.id},G.id))]})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:F,disabled:h,onChange:G=>U(G.target.checked)}),b("linkDialogTextDecorationNone")]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:b("linkDialogHover")}),o.jsxs("div",{className:d.sizeRow,role:"group","aria-label":b("linkDialogHover"),children:[o.jsx("button",{type:"button",className:d.action,"aria-pressed":$==="color",disabled:h,onClick:()=>X("color"),children:b("linkDialogHoverColor")}),o.jsx("button",{type:"button",className:d.action,"aria-pressed":$==="html",disabled:h,onClick:()=>X("html"),children:b("linkDialogHoverHtml")})]}),$==="color"?o.jsx(nt,{label:b("linkDialogHoverColorField"),noneLabel:b("colorNone"),value:J,disabled:h,onChange:he}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:N,children:b("linkDialogHoverHtmlAria")}),o.jsx("textarea",{id:N,className:d.textarea,value:Y,disabled:h,spellCheck:!1,onChange:G=>be(G.target.value)})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:h||!te,onClick:ie,children:b("linkDialogSelect")}),o.jsx("button",{type:"button",className:d.action,onClick:x,children:b("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:h||!A.trim(),onClick:Z,children:b("fontDialogOk")})]})]})})})}const Wu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',Gu={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function lk({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=W(),u=c.useId(),m=c.useId(),g=c.useId(),p=c.useId(),h=c.useRef(null),[C,y]=c.useState("url"),[x,b]=c.useState(""),[S,v]=c.useState("");if(c.useEffect(()=>{e&&(y("url"),b(""),v(""))},[e]),c.useEffect(()=>{if(!e)return;const T=h.current,I=T==null?void 0:T.querySelector(Wu);I==null||I.focus();const E=R=>{if(R.key==="Escape"){R.preventDefault(),R.stopPropagation(),a();return}if(R.key!=="Tab"||!T)return;const j=[...T.querySelectorAll(Wu)];if(j.length===0)return;const F=j[0],U=j[j.length-1];R.shiftKey&&document.activeElement===F?(R.preventDefault(),U.focus()):!R.shiftKey&&document.activeElement===U&&(R.preventDefault(),F.focus())};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[e,a]),!e)return null;const k=C==="custom"?null:df(x),P=C==="custom"?null:k&&x.trim().length>0?Gu[k]:k==="empty"&&x.trim().length===0?null:k?Gu[k]:null,N=C!=="custom"&&k===null&&!t&&x.trim().length>0,D=()=>{t||!n||i==null||i()},A=()=>{N&&r({url:x.trim(),title:S.trim()})};return o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:h,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:T=>T.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("youtubeDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("youtubeDialogCloseAria"),onClick:a,children:o.jsx(Ie,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":C==="url",disabled:t,onClick:()=>y("url"),children:l("youtubeDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":C==="custom",disabled:t,onClick:()=>y("custom"),children:n.text}):null]}),C==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("youtubeDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:x,disabled:t,"aria-invalid":P!==null,"aria-describedby":P?p:void 0,onChange:T=>b(T.target.value)})]}):null,C==="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:D,children:n.buttonCaption})]}):null]}),C!=="custom"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:g,children:l("youtubeDialogTitleField")}),o.jsx("input",{id:g,className:d.textInput,value:S,disabled:t,onChange:T=>v(T.target.value)})]}):null,P?o.jsx("p",{id:p,className:d.error,children:l(P)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),C!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!N,onClick:A,children:l("fontDialogOk")}):null]})]})})})}const sk="_grid_1bpma_1",ck="_cell_1bpma_8",uk="_sizeLabel_1bpma_27",dk="_sizeFields_1bpma_33",mk="_numberInput_1bpma_37",Cn={grid:sk,cell:ck,sizeLabel:uk,sizeFields:dk,numberInput:mk},Vu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])',zt={rows:3,cols:3};function fk({open:e,disabled:t,onApply:n,onClose:r}){const i=W(),a=c.useId(),l=c.useId(),u=c.useId(),m=c.useRef(null),[g,p]=c.useState(zt.rows),[h,C]=c.useState(zt.cols),[y,x]=c.useState(String(zt.rows)),[b,S]=c.useState(String(zt.cols)),[v,k]=c.useState(!1);if(c.useEffect(()=>{e&&(p(zt.rows),C(zt.cols),x(String(zt.rows)),S(String(zt.cols)),k(!1))},[e]),c.useEffect(()=>{if(!e)return;const E=m.current,R=E==null?void 0:E.querySelector(Vu);R==null||R.focus();const j=F=>{if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),r();return}if(F.key!=="Tab"||!E)return;const U=[...E.querySelectorAll(Vu)];if(U.length===0)return;const $=U[0],X=U[U.length-1];F.shiftKey&&document.activeElement===$?(F.preventDefault(),X.focus()):!F.shiftKey&&document.activeElement===X&&(F.preventDefault(),$.focus())};return document.addEventListener("keydown",j,!0),()=>document.removeEventListener("keydown",j,!0)},[e,r]),!e)return null;const N=Rm(g,h)&&!t,D=(E,R)=>{const j=Math.min(An,Math.max(kn,E)),F=Math.min(An,Math.max(kn,R));p(j),C(F),x(String(j)),S(String(F))},A=(E,R)=>{const j=Number.parseInt(E,10);if(!Number.isFinite(j)){R==="rows"?x(String(g)):S(String(h));return}k(!0),R==="rows"?D(j,h):D(g,j)},T=(E,R)=>{const j=E.replace(/\D/g,"");if(R==="rows"?x(j):S(j),j==="")return;const F=Number.parseInt(j,10);Number.isFinite(F)&&(k(!0),R==="rows"?D(F,h):D(g,F))},I=E=>{(E.key==="e"||E.key==="E"||E.key==="+"||E.key==="-"||E.key===".")&&E.preventDefault()};return o.jsx(ce,{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:E=>E.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(Ie,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx("div",{className:Cn.grid,role:"grid","aria-label":i("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:ru},(E,R)=>Array.from({length:ru},(j,F)=>{const U=R+1,$=F+1,X=U<=g&&$<=h;return o.jsx("button",{type:"button",className:Cn.cell,role:"gridcell","data-active":X?"true":void 0,"aria-label":`${U} × ${$}`,"aria-pressed":X&&U===g&&$===h,disabled:t,onMouseEnter:()=>{v||D(U,$)},onClick:()=>{k(!0),D(U,$)}},`${U}-${$}`)}))}),o.jsxs("p",{className:Cn.sizeLabel,children:[i("tableDialogSize"),": ",g," × ",h]}),o.jsxs("div",{className:`${d.sizeRow} ${Cn.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:Cn.numberInput,type:"number",inputMode:"numeric",min:kn,max:An,step:1,value:y,disabled:t,onKeyDown:I,onChange:E=>T(E.target.value,"rows"),onBlur:()=>A(y,"rows")})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:i("tableDialogColumns")}),o.jsx("input",{id:u,className:Cn.numberInput,type:"number",inputMode:"numeric",min:kn,max:An,step:1,value:b,disabled:t,onKeyDown:I,onChange:E=>T(E.target.value,"cols"),onBlur:()=>A(b,"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:g,cols:h})},children:i("tableDialogInsert")})]})]})})})}const gk={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},pk={value:1,unit:"pt"},hk={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 bk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=c.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(Ae,{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 u=l.target.value==="separate"?"separate":"collapse";n({...e,borderCollapse:u,borderSpacing:u==="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(Ae,{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 u=l.target.value;n({...e,border:{style:u,width:u==="none"?null:e.border.width??pk,color:u==="none"?null:e.border.color}})},children:ci.map(l=>o.jsx("option",{value:l,children:r(gk[l])},l))})]}),e.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:l=>n({...e,border:{...e.border,width:l}})}),o.jsx(nt,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:l=>n({...e,border:{...e.border,color:l}})})]}):null,o.jsx(Ae,{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:hk})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?o.jsx(ss,{shadow:e.boxShadow,disabled:t,onChange:l=>n({...e,boxShadow:l})}):null]})]})}const Zu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function yk({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useRef(null),[m,g]=c.useState(t);return c.useEffect(()=>{e&&g(t)},[e,t]),c.useEffect(()=>{if(!e)return;const p=u.current,h=p==null?void 0:p.querySelector(Zu);h==null||h.focus();const C=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!p)return;const x=[...p.querySelectorAll(Zu)];if(x.length===0)return;const b=x[0],S=x[x.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),S.focus()):!y.shiftKey&&document.activeElement===S&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),e?o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,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("tablePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:i,children:o.jsx(Ie,{})})]}),o.jsx(bk,{value:m,disabled:n,onChange:g}),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 xk=["left","center","right"],Ck={left:ri,center:ni,right:oi},wk={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},vk={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Sk={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Do(e){return{top:e,right:e,bottom:e,left:e}}function Ka(e){for(const t of Le)if(e[t])return e[t];return null}function kk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=c.useId(),l=c.useId(),[u,m]=c.useState(()=>Tt(e.padding,Do(Ka(e.padding))));return c.useEffect(()=>{m(Tt(e.padding,Do(Ka(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(nt,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:g=>n({...e,backgroundColor:g})}),o.jsx(nt,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:g=>n({...e,color:g})}),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:u,disabled:t,onChange:()=>{const g=!u;m(g),g&&n({...e,padding:Do(Ka(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(u?["top"]:Le).map(g=>o.jsx(Ae,{label:r(u?"paragraphDialogPadding":vk[g]),value:e.padding[g],disabled:t,onChange:p=>{const h=u?Do(p):{...e.padding,[g]:p};n({...e,padding:h})}},g))})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":r("paragraphDialogAlignment"),children:xk.map(g=>{const p=Ck[g],h=(e.textAlign??"left")===g;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":h,"aria-label":r(wk[g]),disabled:t,onClick:()=>{n({...e,textAlign:g==="left"?null:g})},children:o.jsx(p,{})},g)})})]}),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:g=>{const p=g.target.value;n({...e,verticalAlign:p||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),pi.map(g=>o.jsx("option",{value:g,children:r(Sk[g])},g))]})]}),o.jsx(Ae,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:g=>n({...e,width:g})}),o.jsxs("div",{className:d.sizeRow,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:r("cellPropertiesColSpan")}),o.jsx("input",{id:a,className:d.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.colSpan,disabled:t,onChange:g=>{const p=Number.parseInt(g.target.value,10);n({...e,colSpan:Number.isFinite(p)?Math.max(1,p):1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:r("cellPropertiesRowSpan")}),o.jsx("input",{id:l,className:d.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:g=>{const p=Number.parseInt(g.target.value,10);n({...e,rowSpan:Number.isFinite(p)?Math.max(1,p):1})}})]})]})]})}const qu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Ak({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useRef(null),[m,g]=c.useState(t);return c.useEffect(()=>{e&&g(t)},[e,t]),c.useEffect(()=>{if(!e)return;const p=u.current,h=p==null?void 0:p.querySelector(qu);h==null||h.focus();const C=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!p)return;const x=[...p.querySelectorAll(qu)];if(x.length===0)return;const b=x[0],S=x[x.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),S.focus()):!y.shiftKey&&document.activeElement===S&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),e?o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,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("cellPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:i,children:o.jsx(Ie,{})})]}),o.jsx(kk,{value:m,disabled:n,onChange:g}),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 Pk={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Dk={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function jo(e){return{top:e,right:e,bottom:e,left:e}}function $a(e){for(const t of Le)if(e[t])return e[t];return null}function jk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),[a,l]=c.useState(()=>Tt(e.padding,jo($a(e.padding))));return c.useEffect(()=>{l(Tt(e.padding,jo($a(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(nt,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),o.jsx(nt,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:u=>n({...e,color:u})}),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 u=!a;l(u),u&&n({...e,padding:jo($a(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(a?["top"]:Le).map(u=>o.jsx(Ae,{label:r(a?"paragraphDialogPadding":Pk[u]),value:e.padding[u],disabled:t,onChange:m=>{const g=a?jo(m):{...e.padding,[u]:m};n({...e,padding:g})}},u))})]}),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:u=>{const m=u.target.value;n({...e,verticalAlign:m||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),pi.map(u=>o.jsx("option",{value:u,children:r(Dk[u])},u))]})]}),o.jsx(Ae,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}const Yu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Ek({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useRef(null),[m,g]=c.useState(t);return c.useEffect(()=>{e&&g(t)},[e,t]),c.useEffect(()=>{if(!e)return;const p=u.current,h=p==null?void 0:p.querySelector(Yu);h==null||h.focus();const C=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!p)return;const x=[...p.querySelectorAll(Yu)];if(x.length===0)return;const b=x[0],S=x[x.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),S.focus()):!y.shiftKey&&document.activeElement===S&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),e?o.jsx(ce,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,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("rowPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:i,children:o.jsx(Ie,{})})]}),o.jsx(jk,{value:m,disabled:n,onChange:g}),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 Rk="_backdrop_9d3gw_1",Tk="_dialog_9d3gw_12",Nk="_headerRow_9d3gw_29",Mk="_header_9d3gw_29",_k="_close_9d3gw_44",Lk="_body_9d3gw_66",Ik="_frame_9d3gw_75",Fk="_actions_9d3gw_83",Bk="_action_9d3gw_83",jt={backdrop:Rk,dialog:Tk,headerRow:Nk,header:Mk,close:_k,body:Lk,frame:Ik,actions:Fk,action:Bk},Xu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function Hk({open:e,html:t,onClose:n}){const r=W(),i=c.useId(),a=c.useRef(null),l=c.useRef(null);return c.useEffect(()=>{if(!e)return;const u=a.current,m=u==null?void 0:u.querySelector(Xu);m==null||m.focus();const g=p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),n();return}if(p.key!=="Tab"||!u)return;const h=[...u.querySelectorAll(Xu)];if(h.length===0)return;const C=h[0],y=h[h.length-1];p.shiftKey&&document.activeElement===C?(p.preventDefault(),y.focus()):!p.shiftKey&&document.activeElement===y&&(p.preventDefault(),C.focus())};return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[e,n]),c.useEffect(()=>{var m;if(!e)return;const u=(m=l.current)==null?void 0:m.contentDocument;u&&Xa(u,t,r("previewDialogTitle"))},[e,t,r]),e?o.jsx(ce,{children:o.jsx("div",{className:jt.backdrop,role:"presentation",onMouseDown:n,children:o.jsxs("div",{ref:a,className:jt.dialog,role:"dialog","aria-modal":"true","aria-labelledby":i,onMouseDown:u=>u.stopPropagation(),children:[o.jsxs("div",{className:jt.headerRow,children:[o.jsx("h2",{className:jt.header,id:i,children:r("previewDialogTitle")}),o.jsx("button",{type:"button",className:jt.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:o.jsx(Ie,{})})]}),o.jsx("div",{className:jt.body,children:o.jsx("iframe",{ref:l,className:jt.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var m;const u=(m=l.current)==null?void 0:m.contentDocument;u&&Xa(u,t,r("previewDialogTitle"))}})}),o.jsx("div",{className:jt.actions,children:o.jsx("button",{type:"button",className:jt.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const jf="commspliant-html-editor.darkMode";function zk(e){return typeof e=="boolean"?e:null}function Ju(){try{const e=localStorage.getItem(jf);return e?zk(JSON.parse(e)):null}catch{return null}}function Ok(e){try{localStorage.setItem(jf,JSON.stringify(e))}catch{}}const Ef="commspliant-html-editor.pageZoom",Kk=new Set(["fitWidth","fitPage"]);function $k(e){return typeof e=="string"&&Kk.has(e)||typeof e=="number"&&Sb.includes(e)?e:null}function Uk(){try{const e=localStorage.getItem(Ef);return e?$k(JSON.parse(e)):null}catch{return null}}function Wk(e){try{localStorage.setItem(Ef,JSON.stringify(e))}catch{}}const Rf="commspliant-html-editor.toolbarPosition",Gk=["top","left","right","bottom"];function Tf(e){return typeof e=="string"&&Gk.includes(e)?e:null}function Qu(){try{const e=localStorage.getItem(Rf);return e?Tf(JSON.parse(e)):null}catch{return null}}function Vk(e){try{localStorage.setItem(Rf,JSON.stringify(e))}catch{}}const Zk="_panel_6xdnw_1",qk="_header_6xdnw_17",Yk="_title_6xdnw_26",Xk="_close_6xdnw_32",Jk="_messages_6xdnw_48",Qk="_empty_6xdnw_57",eA="_message_6xdnw_48",tA="_messageHeader_6xdnw_69",nA="_author_6xdnw_77",rA="_time_6xdnw_81",oA="_body_6xdnw_86",iA="_reply_6xdnw_92",aA="_input_6xdnw_100",lA="_post_6xdnw_111",He={panel:Zk,header:qk,title:Yk,close:Xk,messages:Jk,empty:Qk,message:eA,messageHeader:tA,author:nA,time:rA,body:oA,reply:iA,input:aA,post:lA};function sA(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function cA({thread:e,locale:t,disabled:n,commentAuthor:r,panelRef:i,onPost:a,onClose:l}){const u=W(),[m,g]=c.useState(""),p=c.useRef(null);c.useEffect(()=>{var b;(b=p.current)==null||b.focus()},[e==null?void 0:e.id]);const h=!n&&r&&m.trim().length>0,C=c.useMemo(()=>(e==null?void 0:e.messages)??[],[e==null?void 0:e.messages]),y=C.length===0?u("commentPlaceholder"):u("commentReplyPlaceholder");if(!e)return null;const x=()=>{const b=m.trim();!b||!h||(a(b),g(""))};return vl.createPortal(o.jsxs("div",{ref:i,className:He.panel,role:"dialog","aria-label":u("commentPanelTitle"),children:[o.jsxs("div",{className:He.header,children:[o.jsx("h2",{className:He.title,children:u("commentPanelTitle")}),o.jsx("button",{type:"button",className:He.close,onClick:l,"aria-label":u("commentPanelCloseAria"),children:o.jsx(Ie,{})})]}),o.jsx("div",{className:He.messages,children:C.length===0?o.jsx("p",{className:He.empty,children:u("commentEmpty")}):C.map(b=>o.jsxs("article",{className:He.message,children:[o.jsxs("header",{className:He.messageHeader,children:[o.jsx("span",{className:He.author,children:b.userName}),o.jsx("time",{className:He.time,dateTime:b.createdAt,children:sA(b.createdAt,t)})]}),o.jsx("p",{className:He.body,children:b.message})]},b.id))}),o.jsxs("div",{className:He.reply,children:[o.jsx("textarea",{ref:p,className:He.input,value:m,onChange:b=>g(b.target.value),placeholder:y,rows:3,disabled:n||!r}),o.jsx("button",{type:"button",className:He.post,onClick:x,disabled:!h,children:u("commentPost")})]})]}),document.body)}function uA({enabled:e,onHtml:t}){const[n,r]=c.useState(!1),i=c.useRef(0),a=c.useRef(e),l=c.useRef(t);a.current=e,l.current=t;const u=c.useCallback(()=>{i.current=0,r(!1)},[]);c.useEffect(()=>{e||u()},[e,u]);const m=c.useCallback(C=>{!a.current||!ho(C.dataTransfer)||(C.preventDefault(),i.current+=1,r(!0))},[]),g=c.useCallback(C=>{!a.current||!ho(C.dataTransfer)||(C.preventDefault(),C.dataTransfer&&(C.dataTransfer.dropEffect="copy"))},[]),p=c.useCallback(C=>{if(!a.current||!ho(C.dataTransfer))return;const y=C.relatedTarget;y instanceof Node&&C.currentTarget.contains(y)||(i.current=Math.max(0,i.current-1),i.current===0&&r(!1))},[]),h=c.useCallback(C=>{if(!a.current||!ho(C.dataTransfer))return;C.preventDefault(),u();const y=Np(C.dataTransfer);y&&El(y).then(x=>{a.current&&l.current(x)},()=>{})},[u]);return{dragging:n,onDragEnter:m,onDragOver:g,onDragLeave:p,onDrop:h}}const dA={menus:{edit:{id:"edit",labelKey:"menuEdit",ariaKey:"menuEditAria"}},submenus:{page:{id:"page",labelKey:"menuPage",ariaKey:"menuPageAria"}},groups:{edit:{id:"edit",labelKey:"toolbarGroupEdit"}},items:{undo:{id:"undo",command:"undo",icon:Xg,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:Gg,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:dd,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"}}},mA=400,ed=100;function fA(e){let t=[],n=e,r=[],i=!1,a=!1,l=0;function u(){t.length<=ed||t.splice(0,t.length-ed)}function m(y){t.push(y),u()}function g(y,x){if(i){n=y,i=!1;return}if(y===n)return;const b=Date.now(),S=(x==null?void 0:x.coalesce)===!0;if(S&&a&&b-l<mA){n=y,l=b;return}m(n),n=y,r=[],l=b,a=S}function p(){return t.length===0?null:(a=!1,r.push(n),n=t.pop(),n)}function h(){return r.length===0?null:(a=!1,m(n),n=r.pop(),n)}function C(y){if(i){n=y,i=!1;return}y!==n&&(m(n),n=y,r=[],a=!1)}return{record:g,undo:p,redo:h,canUndo:()=>t.length>0,canRedo:()=>r.length>0,syncExternal:C,markApplying:()=>{i=!0}}}function Gt(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function ei(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):Gt(e,t):""}const ht="fullscreen",xl="commspliant-html-editor.toolbarCustomization";function Cl(e){const t=e.filter(n=>n!==ht);return e.includes(ht)?[...t,ht]:t}function us(e,t){if(!t||t.length===0)return Cl(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 u=e[l];if(i.has(u))continue;let m=0;for(let g=l-1;g>=0;g--){const p=e[g],h=a.indexOf(p);if(h>=0){m=h+1;break}}a.splice(m,0,u),i.add(u)}return Cl(a)}function gA(e,t){const n=new Map(e.map(l=>[l.id,l])),r=us(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 u=n.get(l);if(!u)continue;const m=u.items.filter(g=>!i.has(g));m.length!==0&&a.push({id:l,items:m})}return a}function pA(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 hA(){try{const e=localStorage.getItem(xl);return e?pA(JSON.parse(e)):null}catch{return null}}function bA(e){try{if(!e){localStorage.removeItem(xl);return}localStorage.setItem(xl,JSON.stringify(e))}catch{}}function ds(e,t){return us(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function yA(e,t,n,r){const i=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?i.delete(n):i.add(n),{groupOrder:ds(e,t),hiddenItemIds:[...i]}}function Nf(e,t,n,r){const i=ds(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===ht||r===ht)return{groupOrder:i,hiddenItemIds:a};const l=i.indexOf(n),u=i.indexOf(r);if(l<0||u<0||l===u)return{groupOrder:i,hiddenItemIds:a};const m=[...i],[g]=m.splice(l,1);return m.splice(u,0,g),{groupOrder:Cl(m),hiddenItemIds:a}}function td(e,t,n,r){const i=ds(e,t),a=i.filter(m=>m!==ht),l=a.indexOf(n),u=l+r;return l<0||u<0||u>=a.length?{groupOrder:i,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:Nf(e,t,n,a[u])}const xA="_backdrop_11w4e_1",CA="_dialog_11w4e_12",wA="_header_11w4e_31",vA="_body_11w4e_39",SA="_group_11w4e_49",kA="_groupDragging_11w4e_55",AA="_groupDropTarget_11w4e_59",PA="_groupHeader_11w4e_64",DA="_groupTitle_11w4e_72",jA="_dragHandle_11w4e_77",EA="_moveButton_11w4e_78",RA="_items_11w4e_119",TA="_item_11w4e_119",NA="_itemIcon_11w4e_135",MA="_itemTitle_11w4e_144",_A="_itemCheckbox_11w4e_151",LA="_actions_11w4e_155",IA="_action_11w4e_155",FA="_spinnerWrap_11w4e_191",BA="_spinner_11w4e_191",fe={backdrop:xA,dialog:CA,header:wA,body:vA,group:SA,groupDragging:kA,groupDropTarget:AA,groupHeader:PA,groupTitle:DA,dragHandle:jA,moveButton:EA,items:RA,item:TA,itemIcon:NA,itemTitle:MA,itemCheckbox:_A,actions:LA,action:IA,spinnerWrap:FA,spinner:BA},nd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function HA(){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 zA({open:e,catalog:t,groups:n,settings:r,loading:i=!1,busy:a=!1,disabled:l,onChange:u,onReset:m,onClose:g}){const p=W(),h=c.useId(),C=c.useRef(null),[y,x]=c.useState(null),[b,S]=c.useState(null),v=us(n.map(j=>j.id),r==null?void 0:r.groupOrder),k=new Set((r==null?void 0:r.hiddenItemIds)??[]),P=new Map(n.map(j=>[j.id,j])),N=v.map(j=>P.get(j)).filter(j=>!!j),D=l||a||i;if(c.useEffect(()=>{e||(x(null),S(null))},[e]),c.useEffect(()=>{if(!e)return;const j=C.current,F=j==null?void 0:j.querySelector(nd);F==null||F.focus();const U=$=>{if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),g();return}if($.key!=="Tab"||!j)return;const X=[...j.querySelectorAll(nd)];if(X.length===0)return;const J=X[0],he=X[X.length-1];$.shiftKey&&document.activeElement===J?($.preventDefault(),he.focus()):!$.shiftKey&&document.activeElement===he&&($.preventDefault(),J.focus())};return document.addEventListener("keydown",U,!0),()=>document.removeEventListener("keydown",U,!0)},[e,g]),!e)return null;const A=N.map(j=>j.id).filter(j=>j!==ht),T=(j,F)=>{if(D||F===ht){j.preventDefault();return}j.dataTransfer.setData("text/plain",F),j.dataTransfer.effectAllowed="move",x(F)},I=(j,F)=>{D||F===ht||!y||y===F||(j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move"),S(F))},E=(j,F)=>{var $;j.preventDefault();const U=(($=j.dataTransfer)==null?void 0:$.getData("text/plain"))||y;x(null),S(null),!(!U||U===F||D)&&u(Nf(r,n,U,F))},R=()=>{x(null),S(null)};return o.jsx(ce,{children:o.jsx("div",{className:fe.backdrop,role:"presentation",onMouseDown:g,children:o.jsxs("div",{ref:C,className:fe.dialog,role:"dialog","aria-modal":"true","aria-labelledby":h,"aria-busy":i||a?!0:void 0,onMouseDown:j=>j.stopPropagation(),children:[o.jsx("h2",{className:fe.header,id:h,children:p("customizeToolbarDialogTitle")}),o.jsx("div",{className:fe.body,children:i?o.jsx("div",{className:fe.spinnerWrap,role:"status","aria-live":"polite","aria-label":p("customizeToolbarDialogLoading"),children:o.jsx("span",{className:fe.spinner,"aria-hidden":"true"})}):N.map(j=>{const F=t.groups[j.id],U=F?Gt(p,F):j.id,$=j.id===ht,X=A.indexOf(j.id);return o.jsxs("section",{className:[fe.group,y===j.id?fe.groupDragging:"",b===j.id?fe.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":j.id,"aria-label":U,onDragOver:J=>I(J,j.id),onDrop:J=>E(J,j.id),onDragLeave:()=>{b===j.id&&S(null)},children:[o.jsxs("div",{className:fe.groupHeader,children:[o.jsx("button",{type:"button",className:fe.dragHandle,draggable:!D&&!$,disabled:D||$,"aria-label":p("customizeToolbarDragHandle"),onDragStart:J=>T(J,j.id),onDragEnd:R,children:o.jsx(HA,{})}),o.jsx("span",{className:fe.groupTitle,children:U}),o.jsx("button",{type:"button",className:fe.moveButton,disabled:D||$||X<=0,"aria-label":p("customizeToolbarMoveUp"),onClick:()=>u(td(r,n,j.id,-1)),children:"↑"}),o.jsx("button",{type:"button",className:fe.moveButton,disabled:D||$||X<0||X>=A.length-1,"aria-label":p("customizeToolbarMoveDown"),onClick:()=>u(td(r,n,j.id,1)),children:"↓"})]}),o.jsx("div",{className:fe.items,children:j.items.map(J=>{const he=t.items[J];if(!he)return null;const Y=he.icon,be=Gt(p,he),te=`${h}-${j.id}-${J}`,ae=!k.has(J);return o.jsxs("label",{className:fe.item,htmlFor:te,children:[o.jsx("span",{className:fe.itemIcon,"aria-hidden":"true",children:Y?o.jsx(Y,{}):be.slice(0,2)}),o.jsx("span",{className:fe.itemTitle,children:be}),o.jsx("input",{id:te,className:fe.itemCheckbox,type:"checkbox",checked:ae,disabled:D,"aria-label":`${be}: ${p("customizeToolbarItemVisible")}`,onChange:M=>u(yA(r,n,J,M.target.checked))})]},J)})})]},j.id)})}),o.jsxs("div",{className:fe.actions,children:[o.jsx("button",{type:"button",className:fe.action,disabled:D,onClick:m,children:p("customizeToolbarDialogReset")}),o.jsx("button",{type:"button",className:fe.action,"aria-label":p("customizeToolbarDialogCloseAria"),onClick:g,children:p("customizeToolbarDialogClose")})]})]})})})}function OA(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(u=>r.includes(u))})).filter(l=>l.items.length>0);return{menus:i,iconGroups:a}}const KA={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:Zg,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:Fg,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:Ug,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},Eo=4;function Mf({icon:e,value:t,mixed:n,noneKey:r,labelKey:i,ariaKey:a,fallbackCustom:l,disabled:u,onChange:m}){const g=W(),p=c.useId(),h=c.useRef(null),C=c.useRef(null),y=c.useRef(null),[x,b]=c.useState(!1),[S,v]=c.useState({top:0,left:0}),k=c.useCallback(()=>{const T=C.current,I=y.current;if(!T)return;const E=T.getBoundingClientRect(),R=(I==null?void 0:I.offsetHeight)??0,j=(I==null?void 0:I.offsetWidth)??200;let F=E.bottom;F+R>window.innerHeight-Eo&&(F=Math.max(Eo,E.top-R));const U=Math.min(Math.max(E.left,Eo),window.innerWidth-j-Eo);v({top:F,left:U})},[]);c.useLayoutEffect(()=>{if(!x)return;k();const T=()=>k();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[x,k]),c.useEffect(()=>{if(!x)return;const T=E=>{var j,F;const R=E.target;(j=h.current)!=null&&j.contains(R)||(F=y.current)!=null&&F.contains(R)||b(!1)},I=E=>{var R;E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),b(!1),(R=C.current)==null||R.focus())};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",I,!0)}},[x]);const P=T=>{m(T)},N=`${nn.bar}${!t||n?` ${nn.barEmpty}`:""}`,D=t&&!n?{backgroundColor:t}:void 0,A=o.jsxs("div",{className:nn.wrap,ref:h,children:[o.jsxs("button",{ref:C,type:"button",className:`${q.iconButton} ${nn.button}`,"aria-label":g(a),"aria-expanded":x,"aria-haspopup":"listbox","aria-controls":x?p:void 0,disabled:u,onMouseDown:T=>T.preventDefault(),onClick:()=>b(T=>!T),children:[o.jsx(e,{className:`${q.icon} ${nn.icon}`}),o.jsx("span",{className:N,style:D})]}),x?o.jsx(ce,{children:o.jsx("div",{ref:y,id:p,className:nn.popover,style:{top:S.top,left:S.left},children:o.jsx(as,{value:t,mixed:n,noneLabel:g(r),ariaLabel:g(a),disabled:u,fallbackCustom:l,onChange:P,onCommit:()=>b(!1)})})}):null]});return o.jsx(Wt,{label:g(i),children:A})}function $A({commands:e,queries:t,disabled:n}){return o.jsx(Mf,{icon:ld,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}function UA({commands:e,queries:t,disabled:n}){const r=W(),i=!!(n||!t.isVisualMode());return o.jsx(Sf,{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 WA({commands:e,queries:t,disabled:n}){return o.jsx(Mf,{icon:sd,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function GA({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=W(),a=!!(n||!t.isVisualMode());return o.jsx(as,{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 VA="_wrap_1gtdc_1",ZA="_wrapToolbar_1gtdc_7",qA="_field_1gtdc_12",YA="_trigger_1gtdc_20",XA="_chevron_1gtdc_46",JA="_list_1gtdc_69",QA="_option_1gtdc_84",eP="_separator_1gtdc_113",Et={wrap:VA,wrapToolbar:ZA,field:qA,trigger:YA,chevron:XA,list:JA,option:QA,separator:eP},wl={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},tP={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 rd(){const e=W();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 _f({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:i,listRef:a,style:l,customStylesEnabled:u=!1,customStyles:m=[],customStylesLoading:g=!1,onSelect:p,onSelectCustom:h,onAddNew:C}){const y=W(),x=t?null:e,b=u,S=!!(r&&u&&C);return r?o.jsxs(o.Fragment,{children:[Vo.map(v=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitemradio","aria-checked":x===v,disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>p(v),children:y(wl[v])},v)),b?o.jsx("div",{role:"separator",className:q.menuSeparator}):null,b&&g?o.jsx(rd,{}):null,b&&!g?m.map(v=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitem",disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>h==null?void 0:h(v.id),children:v.name},v.id)):null,S?o.jsxs(o.Fragment,{children:[b&&(g||m.length>0)?o.jsx("div",{role:"separator",className:q.menuSeparator}):null,o.jsxs("button",{type:"button",className:q.menuItem,role:"menuitem","aria-label":y("styleAddNewAria"),disabled:n,onMouseDown:v=>v.preventDefault(),onClick:()=>C==null?void 0:C(),children:[o.jsx($g,{className:q.icon}),y("styleAddNew")]})]}):null]}):o.jsxs("ul",{ref:a,className:Et.list,role:"listbox",id:i,style:l,"aria-label":y("commandParagraphStyleAria"),"aria-busy":b&&g?!0:void 0,children:[Vo.map(v=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Et.option,role:"option","aria-selected":x===v,disabled:n,style:tP[v],onMouseDown:k=>k.preventDefault(),onClick:()=>p(v),children:y(wl[v])})},v)),b&&(g||m.length>0)?o.jsx("li",{role:"separator",className:Et.separator}):null,b&&g?o.jsx("li",{role:"presentation",children:o.jsx(rd,{})}):null,b&&!g?m.map(v=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Et.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>h==null?void 0:h(v.id),children:v.name})},v.id)):null]})}const Ro=4;function nP({commands:e,queries:t,disabled:n}){const r=W(),i=c.useId(),a=c.useRef(null),l=c.useRef(null),u=c.useRef(null),[m,g]=c.useState(!1),[p,h]=c.useState({top:0,left:0,width:0}),C=!!(n||!t.isVisualMode()),y=t.isParagraphStyleMixed(),x=y?null:t.getParagraphStyle(),b=x?r(wl[x]):"",S=t.customParagraphStylesEnabled(),v=S?t.getCustomParagraphStyles():[],k=S&&t.isCustomParagraphStylesLoading(),P=c.useCallback(()=>{const D=l.current,A=u.current;if(!D)return;const T=D.getBoundingClientRect(),I=(A==null?void 0:A.offsetHeight)??0,E=Math.max(T.width,(A==null?void 0:A.offsetWidth)??0);let R=T.bottom;R+I>window.innerHeight-Ro&&(R=Math.max(Ro,T.top-I));const j=Math.min(Math.max(T.left,Ro),window.innerWidth-E-Ro);h({top:R,left:j,width:E})},[]);c.useLayoutEffect(()=>{if(!m)return;P();const D=()=>P();return window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[m,P,v.length,k]),c.useEffect(()=>{if(!m)return;const D=T=>{var E,R;const I=T.target;(E=a.current)!=null&&E.contains(I)||(R=u.current)!=null&&R.contains(I)||g(!1)},A=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),g(!1))};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",A,!0)}},[m]);const N=o.jsxs("div",{className:`${Et.wrap} ${Et.wrapToolbar}`,ref:a,children:[o.jsxs("div",{className:Et.field,ref:l,children:[o.jsx("button",{type:"button",className:Et.trigger,disabled:C,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":m,"aria-controls":m?i:void 0,onMouseDown:D=>D.preventDefault(),onClick:()=>g(D=>!D),children:b}),o.jsx("span",{className:Et.chevron,"aria-hidden":"true"})]}),m?o.jsx(ce,{children:o.jsx(_f,{listRef:u,listId:i,value:x,mixed:y,disabled:C,customStylesEnabled:S,customStyles:v,customStylesLoading:k,style:{top:p.top,left:p.left,minWidth:p.width},onSelect:D=>{e.setParagraphStyle(D),g(!1)},onSelectCustom:D=>{e.applyCustomParagraphStyle(D),g(!1)}})}):null]});return o.jsx(Wt,{label:r("commandParagraphStyle"),children:N})}function rP({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),l=a?null:t.getParagraphStyle(),u=t.customParagraphStylesEnabled(),m=u?t.getCustomParagraphStyles():[],g=u&&t.isCustomParagraphStylesLoading();return o.jsx(_f,{menu:!0,value:l,mixed:a,disabled:i,customStylesEnabled:u,customStyles:m,customStylesLoading:g,onSelect:p=>{e.setParagraphStyle(p),r==null||r()},onSelectCustom:p=>{e.openCustomParagraphStyleDialog(p),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const oP={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:rP,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:GA,enabled:"isVisualMode"},paragraph:{id:"paragraph",labelKey:"menuParagraph",ariaKey:"menuParagraphAria"}},groups:{font:{id:"font",labelKey:"toolbarGroupFont"},align:{id:"align",labelKey:"toolbarGroupAlign"},paragraph:{id:"paragraph",labelKey:"toolbarGroupParagraph"}},items:{fontFamily:{id:"fontFamily",widget:U0,icon:kg,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:nP,icon:Kg,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:UA,icon:Pg,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:Ag,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:wg,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:zg,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:cd,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:$A,icon:ld,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:WA,icon:sd,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:gg,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:Ng,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:Yg,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:qg,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:bg,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:Dg,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:ri,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:ni,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:oi,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:id,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:Tg,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:Bg,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:ad,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:ud,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},iP={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:_g,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:pg,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:cd,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},audio:{id:"audio",command:"openAudioDialog",icon:fg,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:ep,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:Eg,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},pageBreak:{id:"pageBreak",command:"insertPageBreak",icon:Hg,labelKey:"commandPageBreak",ariaKey:"commandPageBreakAria",enabled:"isVisualMode"},insertPage:{id:"insertPage",command:"insertPage",icon:dd,labelKey:"commandInsertPage",ariaKey:"commandInsertPageAria",enabled:"canInsertPage"}}},aP={menus:{table:{id:"table",labelKey:"menuTable",ariaKey:"menuTableAria"}},submenus:{insertRow:{id:"insertRow",labelKey:"menuInsertRow",ariaKey:"menuInsertRowAria",enabled:"isInTable"},insertColumn:{id:"insertColumn",labelKey:"menuInsertColumn",ariaKey:"menuInsertColumnAria",enabled:"isInTable"}},groups:{table:{id:"table",labelKey:"toolbarGroupTable"}},items:{table:{id:"table",command:"openTableDialog",icon:zc,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:Da,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:Da,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:Da,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:Pa,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:Pa,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:Pa,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:Ig,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:Jg,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:zc,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:hg,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:Vg,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},lP={menus:{view:{id:"view",labelKey:"menuView",ariaKey:"menuViewAria"}},submenus:{toolbar:{id:"toolbar",labelKey:"menuToolbar",ariaKey:"menuToolbarAria"},toolbarPosition:{id:"toolbarPosition",labelKey:"menuToolbarPosition",ariaKey:"menuToolbarPositionAria"},zoom:{id:"zoom",labelKey:"menuZoom",ariaKey:"menuZoomAria"}},groups:{view:{id:"view",labelKey:"toolbarGroupView"},fullscreen:{id:"fullscreen",labelKey:"toolbarGroupFullscreen"}},items:{visual:{id:"visual",command:"setVisualMode",icon:Qg,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:Rg,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:vg,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:Mg,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:Sg,labelKey:"modeDark",ariaKey:"modeDarkAria",active:"isDarkMode"},pageZoomFitWidth:{id:"pageZoomFitWidth",command:"setPageZoomFitWidth",labelKey:"pageZoomFitWidth",ariaKey:"pageZoomFitWidthAria",active:"isPageZoomFitWidth"},pageZoomFitPage:{id:"pageZoomFitPage",command:"setPageZoomFitPage",labelKey:"pageZoomFitPage",ariaKey:"pageZoomFitPageAria",active:"isPageZoomFitPage"},pageZoom50:{id:"pageZoom50",command:"setPageZoom50",labelKey:"pageZoom50",ariaKey:"pageZoom50Aria",active:"isPageZoom50"},pageZoom75:{id:"pageZoom75",command:"setPageZoom75",labelKey:"pageZoom75",ariaKey:"pageZoom75Aria",active:"isPageZoom75"},pageZoom100:{id:"pageZoom100",command:"setPageZoom100",labelKey:"pageZoom100",ariaKey:"pageZoom100Aria",active:"isPageZoom100"},pageZoom125:{id:"pageZoom125",command:"setPageZoom125",labelKey:"pageZoom125",ariaKey:"pageZoom125Aria",active:"isPageZoom125"},pageZoom150:{id:"pageZoom150",command:"setPageZoom150",labelKey:"pageZoom150",ariaKey:"pageZoom150Aria",active:"isPageZoom150"},pageZoom200:{id:"pageZoom200",command:"setPageZoom200",labelKey:"pageZoom200",ariaKey:"pageZoom200Aria",active:"isPageZoom200"},preview:{id:"preview",command:"openDocumentPreview",icon:Og,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:Wg,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:jg,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function sP(...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 cP=sP(KA,dA,iP,aP,lP,oP),uP={menus:[{id:"file",items:["save","open",de,"print"]},{id:"edit",items:["undo","redo",de,{submenu:"page",items:["pageProperties"]}]},{id:"insert",items:["link","bookmark",de,"image","audio","youtube","table","horizontalRule","pageBreak","insertComment","insertPage"]},{id:"table",items:["table",de,{submenu:"insertRow",items:["insertRowBelow","insertRowBefore","deleteRow"]},{submenu:"insertColumn",items:["insertColumnAfter","insertColumnBefore","deleteColumn"]},de,"mergeCells","unmergeCells",de,"tableProperties","cellProperties","rowProperties"]},{id:"view",items:["visual","html",de,{submenu:"toolbar",items:["customizeToolbar",de,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},de,{submenu:"zoom",items:["pageZoomFitWidth","pageZoomFitPage",de,"pageZoom50","pageZoom75","pageZoom100","pageZoom125","pageZoom150","pageZoom200"]},de,"lightMode","darkMode",de,"toggleCommentsVisible","preview","readAloud","fullscreen"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},de,{submenu:"font",items:["fontProperties","customCss",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,"imageProperties"]}],iconGroups:[{id:"file",items:["save","open"]},{id:"print",items:["print"]},{id:"edit",items:["undo","redo"]},{id:"insert",items:["link","bookmark","image","table","horizontalRule","addComment"]},{id:"table",items:["mergeCells","unmergeCells"]},{id:"font",items:["fontFamily","paragraphStyle","fontSize","fontColor","highlightColor","customCss","formatBrush","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","readAloud","toggleCommentsVisible"]},{id:"fullscreen",items:["fullscreen"]}]},od={items:{addComment:{id:"addComment",command:"addComment",icon:Hc,labelKey:"commandAddComment",ariaKey:"commandAddCommentAria",enabled:"canAddComment"},insertComment:{id:"insertComment",command:"addComment",icon:Hc,labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:"canAddComment"},toggleCommentsVisible:{id:"toggleCommentsVisible",command:"toggleCommentsVisible",icon:yg,labelKey:"showComments",ariaKey:"toggleCommentsVisibleAria",toggle:!0,active:"areCommentsVisible"}}},dP=["addComment","insertComment","toggleCommentsVisible"],mP=new Set(["insert","view"]);function Lf(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!dP.includes(e):!0:!1}function fP(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!mP.has(e):!0:!1}function gP(e,t){const n=t?"hideComments":"showComments",r=od.items.toggleCommentsVisible;return{...e,items:{...e.items,...od.items,toggleCommentsVisible:r&&{...r,labelKey:n}}}}function pP(e){return{...e,menus:e.menus.map(t=>{if(t.id==="insert"){const n=[...t.items],r=n.indexOf("insertPage"),i=r===-1?n.length:r;return n.includes("insertComment")||n.splice(i,0,"insertComment"),{...t,items:n}}if(t.id==="view"){const n=[...t.items],r=n.indexOf("preview"),i=r===-1?n.length:r;return n.includes("toggleCommentsVisible")||n.splice(i,0,"toggleCommentsVisible"),{...t,items:n}}return t}),iconGroups:e.iconGroups.map(t=>t.id==="insert"&&!t.items.includes("addComment")?{...t,items:[...t.items,"addComment"]}:t.id==="view"&&!t.items.includes("toggleCommentsVisible")?{...t,items:[...t.items,"toggleCommentsVisible"]}:t)}}const To="fullscreen";function hP(e){const t=[];let n=null;for(const r of e){const i=r.items.filter(a=>a!==To);i.length>0&&t.push({id:r.id,items:i}),r.items.includes(To)&&(n={id:To,items:[To]})}return{main:t,trailing:n}}function bP({groups:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a}){const l=W(),{main:u,trailing:m}=hP(e),g=p=>{const h=t.groups[p.id];return o.jsx("div",{className:q.iconGroup,role:"group","aria-label":h?Gt(l,h):void 0,"data-toolbar-group":p.id,children:p.items.map(C=>{const y=t.items[C];if(!y)return null;const x=y.enabled?!r[y.enabled]():!1;if(y.widget){const k=y.widget;return o.jsx(k,{commands:n,queries:r,disabled:i||x},C)}if(!y.icon||!y.command)return null;const b=y.icon,S=y.command,v=y.active?r[y.active]():void 0;return o.jsx(Wt,{label:y.tooltip??Gt(l,y),children:o.jsx("button",{type:"button",className:q.iconButton,"aria-label":ei(l,y),"aria-pressed":v,disabled:i||(a?Lf(C,a):!1)||x,onPointerDown:k=>k.preventDefault(),onMouseDown:k=>k.preventDefault(),onClick:()=>{kl(n,S)},children:o.jsx(b,{className:q.icon})})},C)})},p.id)};return o.jsxs("div",{className:q.iconNav,role:"toolbar","aria-label":l("toolbarAria"),children:[u.length>0?o.jsx("div",{className:q.iconNavMain,children:u.map(g)}):null,m?o.jsx("div",{className:q.iconNavEnd,children:g(m)}):null]})}const yP=["--wysiwyg-menu-color","--wysiwyg-menu-background","--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function xP(e){const t={};for(const n of yP){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 CP({menus:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,compact:l,openMenuId:u,onOpenMenuIdChange:m}){const g=W(),[p,h]=c.useState(!1),[C,y]=c.useState({}),x=c.useRef(null),b=c.useRef(null),S=c.useRef(null),v=c.useRef(null),k=c.useCallback(()=>{h(!1),m(null)},[m]);c.useLayoutEffect(()=>{!p||!x.current||y(xP(x.current))},[p]),c.useEffect(()=>{var N;p&&((N=S.current)==null||N.focus())},[p]),c.useEffect(()=>{if(!p)return;const N=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=N}},[p]),c.useEffect(()=>{if(!p)return;const N=A=>{var T;if(A.key==="Escape"){if(A.preventDefault(),A.stopPropagation(),u){m(null);return}k(),(T=b.current)==null||T.focus()}},D=A=>{var T;v.current&&!v.current.contains(A.target)&&(k(),(T=b.current)==null||T.focus())};return document.addEventListener("keydown",N,!0),document.addEventListener("pointerdown",D),()=>{document.removeEventListener("keydown",N,!0),document.removeEventListener("pointerdown",D)}},[p,u,m,k]);const P=N=>e.map(D=>{const A=t.menus[D.id];return A?o.jsx(vP,{def:A,itemIds:D.items,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:N,open:(N==="overlay"||!p)&&u===D.id,onOpenChange:T=>m(T?D.id:null),onItemRun:N==="overlay"?()=>{var T;k(),(T=b.current)==null||T.focus()}:void 0},`${N}-${D.id}`):null});return o.jsxs("div",{className:q.menuBar,ref:x,children:[o.jsx(Wt,{label:g("brandMarkAria"),children:o.jsx("span",{className:q.brandMark,role:"img","aria-label":g("brandMarkAria"),children:o.jsx(xg,{className:q.brandMarkIcon})})}),o.jsx("div",{className:q.menuBarCompact,hidden:l===void 0?void 0:!l,children:o.jsx(Wt,{label:g("menuHamburgerAria"),children:o.jsx("button",{ref:b,type:"button",className:`${q.menuButton} ${q.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":p,"aria-label":g("menuHamburgerAria"),disabled:i||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>{if(p){k();return}m(null),h(!0)},children:o.jsx(Lg,{className:q.icon})})})}),o.jsx("div",{className:q.menuBarDesktop,hidden:l===void 0?void 0:l,children:P("dropdown")}),p?o.jsx(ce,{children:o.jsx("div",{className:q.toolbar,"data-menu-overlay-portal":"",style:C,children:o.jsxs("div",{ref:v,className:q.menuOverlay,role:"dialog","aria-modal":"true","aria-label":g("menuOverlayAria"),children:[o.jsxs("div",{className:q.menuOverlayHeader,children:[o.jsx("span",{className:q.menuOverlayTitle,children:g("menuOverlayAria")}),o.jsx("button",{ref:S,type:"button",className:q.iconButton,"aria-label":g("menuCloseAria"),onClick:()=>{var N;k(),(N=b.current)==null||N.focus()},children:o.jsx(Ie,{className:q.icon})})]}),o.jsx("div",{className:q.menuOverlayBody,children:P("overlay")})]})})}):null]})}function ti(e,t){var n,r;if(Kt(e))return!1;if(yr(e)){const i=(n=t.submenus)==null?void 0:n[e.submenu];return i?i.panel?!0:e.items.some(a=>ti(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function wP(e,t,n){if(!Kt(e[t])||!e.slice(t+1).some(a=>ti(a,n)))return!1;let i=!1;for(let a=t-1;a>=0;a--){const l=e[a];if(Kt(l)){i=!0;continue}if(ti(l,n))return!i}return!1}function vP({def:e,itemIds:t,catalog:n,commands:r,queries:i,disabled:a,chromeLock:l,variant:u,open:m,onOpenChange:g,onItemRun:p}){const h=W(),C=c.useRef(null),y=u==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[x,b]=c.useState(null);c.useEffect(()=>{m||b(null)},[m]),c.useEffect(()=>{if(!m||u==="overlay")return;const v=P=>{C.current&&!C.current.contains(P.target)&&g(!1)},k=P=>{if(P.key==="Escape"){if(P.preventDefault(),P.stopPropagation(),x){b(null);return}g(!1)}};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",k,!0),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",k,!0)}},[m,x,g,u]);const S=()=>{g(!1),p==null||p()};return o.jsxs("div",{className:q.menuWrap,ref:C,children:[o.jsx("button",{type:"button",className:q.menuButton,"aria-haspopup":"menu","aria-expanded":m,"aria-controls":y,"aria-label":ei(h,e),disabled:a||(l?fP(e.id,l):!1),onClick:()=>g(!m),children:Gt(h,e)}),m?o.jsx("div",{className:q.menu,role:"menu",id:y,onMouseDown:v=>v.preventDefault(),children:o.jsx(If,{entries:t,catalog:n,commands:r,queries:i,disabled:a,chromeLock:l,variant:u,onClose:S,openSubmenuId:x,onOpenSubmenuIdChange:b})}):null]})}function If({entries:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,openSubmenuId:m,onOpenSubmenuIdChange:g}){return o.jsx(o.Fragment,{children:e.map((p,h)=>{if(Kt(p))return wP(e,h,t)?o.jsx("div",{role:"separator",className:q.menuSeparator},`separator-${h}`):null;if(yr(p))return o.jsx(kP,{entry:p,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,open:m===p.submenu,onOpenChange:y=>g==null?void 0:g(y?p.submenu:null)},`submenu-${p.submenu}-${h}`);const C=t.items[p];return!C||!C.command?null:o.jsx(SP,{item:C,commands:n,queries:r,disabled:i,chromeLock:a,onClose:u},p)})})}function SP({item:e,commands:t,queries:n,disabled:r,chromeLock:i,onClose:a}){const l=W();if(!e.command)return null;const u=e.icon,m=e.command,g=e.active?n[e.active]():void 0,p=e.enabled?!n[e.enabled]():!1,h=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return o.jsxs("button",{type:"button",role:h,className:q.menuItem,"aria-checked":g,disabled:r||(i?Lf(e.id,i):!1)||p,onClick:()=>{a(),kl(t,m)},children:[u?o.jsx(u,{className:q.icon}):null,Gt(l,e)]})}function kP({entry:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,open:m,onOpenChange:g}){var A;const p=W(),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState(null),b=(A=t.submenus)==null?void 0:A[e.submenu],S=l==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,v=b==null?void 0:b.panel,k=b!=null&&b.enabled?!r[b.enabled]():!1,P=l==="overlay";if(c.useEffect(()=>{m||x(null)},[m]),!b||!v&&!e.items.some(T=>ti(T,t)))return null;const N=T=>{(T.key==="ArrowRight"||T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),g(!0),requestAnimationFrame(()=>{var E;const I=(E=C.current)==null?void 0:E.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');I==null||I.focus()}))},D=T=>{var I;T.key==="ArrowLeft"&&(T.preventDefault(),T.stopPropagation(),g(!1),(I=h.current)==null||I.focus())};return o.jsxs("div",{className:q.submenuWrap,onMouseEnter:P?void 0:()=>g(!0),onMouseLeave:P?void 0:()=>g(!1),children:[o.jsx("button",{ref:h,type:"button",role:"menuitem",className:`${q.menuItem} ${q.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":m,"aria-controls":S,"aria-label":ei(p,b),disabled:i||k||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>g(P?!m:!0),onKeyDown:N,children:Gt(p,b)}),m?o.jsx("div",{ref:C,className:`${q.menu} ${q.submenu}`,role:"menu",id:S,"aria-label":ei(p,b),onMouseDown:T=>T.preventDefault(),onKeyDown:D,children:v?o.jsx(v,{commands:n,queries:r,disabled:i||k,onMenuClose:u}):o.jsx(If,{entries:e.items,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,openSubmenuId:y,onOpenSubmenuIdChange:x})}):null]})}function Ua({catalog:e,layout:t,commands:n,queries:r,disabled:i,chromeLock:a,menuVisible:l=!0,toolbarVisible:u=!0,compact:m,position:g="top"}){const[p,h]=c.useState(null);return!l&&!u?null:o.jsxs("div",{className:q.toolbar,"data-compact":m?"":void 0,"data-toolbar-position":g,children:[l?o.jsx(CP,{menus:t.menus,catalog:e,commands:n,queries:r,disabled:i,chromeLock:a,compact:m,openMenuId:p,onOpenMenuIdChange:h}):null,u?o.jsx(bP,{groups:t.iconGroups,catalog:e,commands:n,queries:r,disabled:i,chromeLock:a}):null]})}const AP="_root_3hjd3_1",PP="_fullscreen_3hjd3_36",DP="_exitFullscreen_3hjd3_48",jP="_exitFullscreenIcon_3hjd3_79",EP="_menuChrome_3hjd3_94",RP="_body_3hjd3_105",TP="_iconChrome_3hjd3_135",NP="_workspace_3hjd3_179",MP="_workspacePageSized_3hjd3_191",_P="_pageCanvasViewport_3hjd3_195",LP="_htmlFileDropOverlay_3hjd3_205",IP="_surface_3hjd3_219",FP="_visual_3hjd3_226",BP="_multiPageContainer_3hjd3_258",HP="_pageBlock_3hjd3_266",zP="_pageGap_3hjd3_273",OP="_pageSurface_3hjd3_279",KP="_html_3hjd3_205",ge={root:AP,fullscreen:PP,exitFullscreen:DP,exitFullscreenIcon:jP,menuChrome:EP,body:RP,iconChrome:TP,workspace:NP,workspacePageSized:MP,pageCanvasViewport:_P,htmlFileDropOverlay:LP,surface:IP,visual:FP,multiPageContainer:BP,pageBlock:HP,pageGap:zP,pageSurface:OP,html:KP},$P=c.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i},a){const l=W();return o.jsx("textarea",{ref:a,className:`${ge.surface} ${ge.html}`,value:t,onChange:u=>n(u.target.value),placeholder:r,disabled:i,"aria-label":l("htmlEditorAria"),spellCheck:!1})}),UP=c.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i,onBeforeInput:a,onPointerDown:l,onMouseUp:u,onContextMenu:m},g){const p=W(),h=c.useRef(null),C=c.useRef(a);C.current=a;const y=x=>{h.current=x,typeof g=="function"?g(x):g&&(g.current=x)};return c.useLayoutEffect(()=>{const x=h.current;if(!x)return;const b=Rn(t);x.innerHTML!==b&&(x.innerHTML=b),ii(x),Ar(x,t)},[t]),c.useLayoutEffect(()=>{const x=h.current;if(!x)return;const b=S=>{var v;(v=C.current)==null||v.call(C,S)};return x.addEventListener("beforeinput",b),()=>x.removeEventListener("beforeinput",b)},[]),o.jsx("div",{ref:y,className:`${ge.surface} ${ge.visual}`,contentEditable:!i,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":p("visualEditorAria"),"aria-disabled":i||void 0,"data-placeholder":r,onPointerDown:l,onMouseUp:u,onContextMenu:m,onInput:x=>{n(x.currentTarget.innerHTML)}})}),WP=c.forwardRef(function({pages:t,activePageIndex:n,onActivePageIndexChange:r,onPageChange:i,placeholder:a,disabled:l,onBeforeInput:u,onPointerDown:m,onMouseUp:g,onContextMenu:p},h){const C=W(),y=c.useRef(null),x=c.useRef(n);x.current=n;const b=c.useRef(u);b.current=u;const S=c.useRef(t);S.current=t,c.useImperativeHandle(h,()=>({getContainer:()=>y.current,getActivePageRoot:()=>{const P=y.current;return P?Mo(P,x.current):null},getActivePageIndex:()=>x.current,flushPageHtml:P=>{var D;const N=y.current;return N?((D=Mo(N,P))==null?void 0:D.innerHTML)??null:null}}));const v=c.useCallback((P,N)=>{const D=Rn(Ce(N).body);P.innerHTML!==D&&(P.innerHTML=D),ii(P),Ar(P,N)},[]);c.useLayoutEffect(()=>{const P=y.current;if(P)for(let N=0;N<t.length;N+=1){const D=Mo(P,N);D&&v(D,t[N]??"")}},[t,v]),c.useLayoutEffect(()=>{const P=y.current;if(!P)return;const N=D=>{var A;(A=b.current)==null||A.call(b,D)};return P.addEventListener("beforeinput",N),()=>P.removeEventListener("beforeinput",N)},[]);const k=P=>{P!==n&&r(P)};return o.jsx("div",{ref:y,className:ge.multiPageContainer,children:t.map((P,N)=>o.jsxs("div",{className:ge.pageBlock,children:[N>0?o.jsx("div",{className:ge.pageGap,"aria-hidden":"true"}):null,o.jsx("div",{className:`${ge.surface} ${ge.visual} ${ge.pageSurface}`,[Ga]:"","data-page-index":N,contentEditable:!l,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":C("visualEditorAria"),"aria-disabled":l||void 0,"data-placeholder":N===0?a:void 0,onFocus:()=>k(N),onPointerDown:m,onMouseUp:g,onContextMenu:p,onInput:D=>{i(N,D.currentTarget.innerHTML)}})]},N))})});function GP({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:i,onOpen:a,mode:l,defaultMode:u="visual",onModeChange:m,fullscreen:g,defaultFullscreen:p=!1,onFullscreenChange:h,placeholder:C,disabled:y,readOnly:x=!1,className:b,locale:S="en",toolbarBackground:v,menuColor:k,menuBackground:P,menuFontSize:N,menuFontFamily:D,border:A,menuVisible:T=!0,toolbarVisible:I=!0,allowedChrome:E,customActions:R,customFonts:j,transformHtml:F,loadCustomParagraphStyles:U,onSaveCustomParagraphStyle:$,onDeleteCustomParagraphStyle:X,customImagePicker:J,disableBuiltinImageInsert:he,customAudioPicker:Y,disableBuiltinAudioInsert:be,customVideoPicker:te,disableBuiltinVideoInsert:ae,disableHtmlFileDrop:M=!1,toolbarCustomization:Z,darkMode:ie=!1,darkModePersistence:G,toolbarPosition:xe="top",toolbarPositionPersistence:Fe,enableMultiPages:ve=!1,pages:Yt,defaultPages:Pr,onPagesChange:zn,enableComments:Be=!1,defaultCommentsVisible:Ff=!0,commentAuthor:Dr,comments:Bf,defaultComments:Hf=[],onCommentsChange:zf}){const ne=!!(y||x),On=!!y,Of=Uc(Pr??(t.trim()?[t]:[Va()])),Kf=ve?pt(Of):t,$f=ve&&Yt!==void 0?pt(Uc(Yt)):e,[Pe,ms]=wo({value:$f,defaultValue:Kf,onChange:ve?void 0:n}),[ye,fs]=wo({value:l,defaultValue:u,onChange:m}),[vt,Kn]=wo({value:g,defaultValue:p,onChange:h}),[ut,Uf]=c.useState(Ff),[dt,St]=c.useState(null),[un,$n]=wo({value:Bf,defaultValue:Hf,onChange:zf}),L=c.useRef(null),hi=c.useRef(null),gs=c.useRef(null),jr=c.useRef(null),Ue=c.useRef(null),_e=c.useRef(ve);_e.current=ve;const Xt=c.useRef(Be);Xt.current=Be;const ps=c.useRef(x);ps.current=x;const hs=c.useRef(ne);hs.current=ne;const Er=c.useRef(ut);Er.current=ut;const Rr=c.useRef(un);Rr.current=un;const Tr=c.useRef(zn);Tr.current=zn;const[dn,bs]=c.useState(0),Mt=c.useRef(dn);Mt.current=dn;const bi=c.useRef(null);bi.current===null&&(bi.current=fA(Pe));const Ye=bi.current,re=c.useRef(Pe);re.current=Pe;const Nr=c.useRef(!0),yi=c.useRef(""),mn=c.useRef(null),H=c.useRef(ye);H.current=ye;const ys=c.useRef(vt);ys.current=vt;const ke=c.useRef(null),[,Wf]=c.useState(0),Un=c.useRef(null);Un.current===null&&(Un.current=iC(()=>{Wf(s=>s+1)}));const Mr=c.useRef(F);Mr.current=F;const Xe=c.useRef({}),We=c.useRef(null),Je=c.useRef(null),rt=c.useRef(null),ot=c.useRef(null),_t=c.useRef(null),Ge=c.useRef(null),[_r,xi]=c.useState(Rt),Ci=c.useRef(_r);Ci.current=_r;const kt=c.useRef(rn),[Wn,Lr]=c.useState({value:null,unit:rn,mixed:!1}),Lt=c.useRef(Wn);Lt.current=Wn;const[Gn,wi]=c.useState({value:null,mixed:!1}),Vn=c.useRef(Gn);Vn.current=Gn;const[Zn,vi]=c.useState({value:null,mixed:!1}),qn=c.useRef(Zn);qn.current=Zn;const[Yn,Si]=c.useState({value:null,mixed:!1}),Xn=c.useRef(Yn);Xn.current=Yn;const[ki,Ai]=c.useState({tag:null,mixed:!1}),Pi=c.useRef(ki);Pi.current=ki;const[xs,Di]=c.useState({align:"left",mixed:!1}),ji=c.useRef(xs);ji.current=xs;const[Cs,Ei]=c.useState({type:null,mixed:!1}),Jn=c.useRef(Cs);Jn.current=Cs;const[ws,Ri]=c.useState(!1),vs=c.useRef(ws);vs.current=ws;const[Ti,Ni]=c.useState(!1),Mi=c.useRef(Ti);Mi.current=Ti;const[_i,Ss]=c.useState(!1),Ir=c.useRef(_i);Ir.current=_i;const Fr=c.useRef(null),Br=c.useRef(null),[ks,As]=c.useState(!1),Ps=c.useRef(ks);Ps.current=ks;const[Qn,Hr]=c.useState({open:!1,tab:"general"}),[Li,Ds]=c.useState(!1),[er,js]=c.useState({open:!1,html:""}),[Ii,zr]=c.useState(null),[Gf,Fi]=c.useState(!1),[Vf,Bi]=c.useState(!1),[fn,Or]=c.useState(()=>G?ie:Ju()??ie),[it,Kr]=c.useState(()=>Fe?xe:Qu()??xe),[$r,Zf]=c.useState(()=>Uk()??"fitWidth"),[Hi,qf]=c.useState(1),[Jt,Ur]=c.useState({open:!1,tab:"general",value:ur()}),[Wr,zi]=c.useState({open:!1,value:""}),[Qt,gn]=c.useState({open:!1,tab:"font",value:gl()}),[Oi,Es]=c.useState([]),[Ki,$i]=c.useState(!1),[Yf,Gr]=c.useState(!1),[De,tr]=c.useState({open:!1}),[Ve,Vr]=c.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[Ui,Wi]=c.useState({open:!1,existingIds:[]}),[Xf,Zr]=c.useState({open:!1}),[Jf,qr]=c.useState({open:!1}),[Qf,nr]=c.useState({open:!1}),[Yr,Xr]=c.useState({open:!1,tab:"general",value:$m(),aspectRatio:1}),[Gi,Vi]=c.useState({open:!1}),[Jr,Zi]=c.useState({open:!1,value:qC()}),[Qr,qi]=c.useState({open:!1,value:iw()}),[eo,Yi]=c.useState({open:!1,value:pw()}),[en,Xi]=c.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1}),[je,pn]=c.useState(null),Ji=c.useRef(je);Ji.current=je;const[Qi,Rs]=c.useState(!1),Ts=c.useRef(Qi);Ts.current=Qi;const[ea,Ns]=c.useState(!1),Ms=c.useRef(ea);Ms.current=ea;const[ta,_s]=c.useState(!1),Ls=c.useRef(ta);Ls.current=ta;const Is=c.useRef(void 0),to=c.useRef(Oi);to.current=Oi;const Fs=c.useRef(Ki);Fs.current=Ki;const na=!!(U&&$),ra=c.useRef(na);ra.current=na;const Bs=c.useRef(U);Bs.current=U;const Hs=c.useRef($);Hs.current=$;const zs=c.useRef(X);zs.current=X;const Os=c.useRef(i);Os.current=i;const Ks=c.useRef(a);Ks.current=a;const $s=c.useRef(J);$s.current=J;const Us=c.useRef(Y);Us.current=Y;const Ws=c.useRef(te);Ws.current=te;const Gs=c.useRef(Z);Gs.current=Z;const Vs=c.useRef(G);Vs.current=G;const Zs=c.useRef(Fe);Zs.current=Fe;const qs=c.useRef(fn);qs.current=fn;const Ys=c.useRef(it);Ys.current=it;const oa=c.useRef($r);oa.current=$r;const Xs=c.useRef(he);Xs.current=he;const Js=c.useRef(be);Js.current=be;const Qs=c.useRef(ae);Qs.current=ae;const ia=c.useRef(0),rr=c.useRef(0),ec=c.useRef(0),no=c.useRef(0),tc=c.useRef(0),ro=c.useRef(0),nc=c.useRef(0),It=c.useMemo(()=>Ad(j),[j]),hn=c.useRef(It);hn.current=It;const aa=c.useMemo(()=>Vp(Pe,It).join(`
95
+ `),[Pe,It]),oo=c.useMemo(()=>ze(Pe).map(s=>Ce(s).body),[Pe]),rc=c.useMemo(()=>ve?oo[dn]??"":Ce(Pe).body,[ve,oo,dn,Pe]),oc=c.useMemo(()=>ex(ln(rc)),[rc]);c.useEffect(()=>{const f=(aa?aa.split(`
96
+ `):[]).map(w=>{const _=document.createElement("link");return _.rel="stylesheet",_.href=w,_.setAttribute(ai,""),document.head.append(_),_});return()=>{for(const w of f)w.remove()}},[aa]);const io=c.useCallback(async()=>{const s=Bs.current;if(!s)return;const f=++ia.current;$i(!0);try{const w=await s();if(f!==ia.current)return;Es(w)}catch{}finally{f===ia.current&&$i(!1)}},[]);c.useEffect(()=>{if(!U||!$){Es([]),$i(!1);return}io()},[U,$,io]);const ic=c.useCallback(async s=>{zr(s);const f=Gs.current;if(f!=null&&f.load&&f.save){const w=++ec.current;Bi(!0);try{await f.save(s)}catch{}finally{w===ec.current&&Bi(!1)}return}bA(s)},[]);c.useEffect(()=>{const s=Z;if(!(s!=null&&s.load)||!s.save){zr(hA()),Fi(!1),Bi(!1);return}const f=++rr.current;return Fi(!0),(async()=>{try{const w=await s.load();if(f!==rr.current)return;zr(w)}catch{if(f!==rr.current)return;zr(null)}finally{f===rr.current&&Fi(!1)}})(),()=>{rr.current+=1}},[Z]);const ac=c.useCallback(async s=>{Or(s);const f=Vs.current;if(f!=null&&f.load&&f.save){const w=++tc.current;try{await f.save(s)}catch{}finally{if(w!==tc.current)return}return}Ok(s)},[]),lc=c.useCallback(s=>{Zf(s),Wk(s)},[]);c.useEffect(()=>{const s=G;if(!(s!=null&&s.load)||!s.save){Or(Ju()??ie);return}const f=++no.current;return(async()=>{try{const w=await s.load();if(f!==no.current)return;Or(typeof w=="boolean"?w:ie)}catch{if(f!==no.current)return;Or(ie)}})(),()=>{no.current+=1}},[G,ie]),c.useLayoutEffect(()=>{if(ye!=="visual")return;const s=gs.current;if(!s)return;const f=()=>{const O=L.current,V=getComputedStyle(s),Ee=parseFloat(V.paddingLeft)+parseFloat(V.paddingRight),ir=parseFloat(V.paddingTop)+parseFloat(V.paddingBottom),Fc=Math.max(0,s.clientWidth-Ee),Bc=Math.max(0,s.clientHeight-ir),dg=(O==null?void 0:O.offsetWidth)??Fc,mg=(O==null?void 0:O.offsetHeight)??Bc;qf(Pb(oa.current,Fc,Bc,dg,mg))};if(f(),typeof ResizeObserver>"u")return;const w=new ResizeObserver(f);w.observe(s);const _=L.current;return _&&w.observe(_),f(),()=>w.disconnect()},[ye,Pe,dn,oo,$r,oc]);const sc=c.useCallback(async s=>{Kr(s);const f=Zs.current;if(f!=null&&f.load&&f.save){const w=++nc.current;try{await f.save(s)}catch{}finally{if(w!==nc.current)return}return}Vk(s)},[]);c.useEffect(()=>{const s=Fe;if(!(s!=null&&s.load)||!s.save){Kr(Qu()??xe);return}const f=++ro.current;return(async()=>{try{const w=await s.load();if(f!==ro.current)return;Kr(Tf(w)??xe)}catch{if(f!==ro.current)return;Kr(xe)}})(),()=>{ro.current+=1}},[Fe,xe]);const bn=c.useCallback(s=>{var w,_;const f=((w=Mr.current)==null?void 0:w.call(Mr,s))??s;return f!==re.current&&(Nr.current=!0),ms(f),_e.current&&((_=Tr.current)==null||_.call(Tr,ze(f),Mt.current)),f},[ms]),me=c.useCallback((s,f)=>{const w=bn(s);return Ye.record(w,{coalesce:f}),w},[bn,Ye]),eg=c.useCallback(s=>{if(_e.current){const f=ze(re.current),w=Mt.current,_=[...f];_[w]=s,me(pt(_),!1);return}me(s,!1)},[me]),or=uA({enabled:!ne&&!M,onHtml:eg}),oe=c.useCallback((s,f)=>me(bo(s,yo(s,re.current,hn.current)),f),[me]),tg=c.useCallback((s,f)=>oe(gt(s,re.current),f),[oe]),ao=c.useCallback((s,f)=>bo(s,yo(s,f,hn.current)),[]),At=c.useCallback(()=>{const s=jr.current;return(s==null?void 0:s.getContainer())?ze(re.current).map((_,O)=>{const V=s==null?void 0:s.flushPageHtml(O);if(V===null)return _;const Ee=gt(V,Ce(_).body);return ao(Ee,_)}):ze(re.current)},[ao]),la=c.useCallback((s,f,w)=>{const _=ze(re.current),O=[..._];O[s]=ao(f,_[s]??""),me(pt(O),w)},[me,ao]),ee=c.useCallback((s,f)=>{var _;if(!_e.current){oe(gt(s.innerHTML,re.current),f);return}const w=(_=jr.current)==null?void 0:_.getContainer();if(!w){oe(gt(s.innerHTML,re.current),f);return}for(let O=0;O<ze(re.current).length;O+=1)if(Mo(w,O)===s){const V=ze(re.current)[O]??"";la(O,gt(s.innerHTML,Ce(V).body),f);return}oe(gt(s.innerHTML,re.current),f)},[la,oe]),cc=c.useCallback((s,f)=>{ps.current||ee(s,f)},[ee]),uc=c.useCallback(()=>{const s=_e.current?At():ze(re.current);return s[Mt.current]??s[0]??""},[At]),lo=c.useCallback(()=>_e.current?At():[re.current],[At]),dc=c.useCallback(()=>{if(!_e.current||H.current!=="visual")return;const s=At(),f=Mt.current+1,w=[...s];w.splice(f,0,Va()),me(pt(w),!1),bs(f)},[At,me]),so=c.useCallback(()=>{const s=Ye.undo();s!==null&&(Ye.markApplying(),bn(s))},[bn,Ye]),co=c.useCallback(()=>{const s=Ye.redo();s!==null&&(Ye.markApplying(),bn(s))},[bn,Ye]);c.useEffect(()=>{Ye.syncExternal(Pe)},[Pe,Ye]);const B=c.useCallback(()=>{ke.current=ft({mode:H.current,visualEl:L.current,htmlEl:Ue.current})},[]),mt=c.useCallback(s=>{if(!s||H.current!=="visual"){Rs(!1),Ns(!1),_s(!1);return}Rs(ql(s)!==null),Ns(iu(s)),_s(au(s))},[]),sa=c.useCallback(()=>{const s=ft({mode:H.current,visualEl:L.current,htmlEl:Ue.current}),f=ke.current;Zc(f,s)||(ke.current=s)},[]),ca=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){Lr({value:null,unit:kt.current,mixed:!1});return}const f=sm(s,kt.current);We.current&&(f.value=We.current.value,f.unit=We.current.unit,f.mixed=!1),kt.current=f.unit,Lr(w=>w.value===f.value&&w.unit===f.unit&&w.mixed===f.mixed?w:f)},[]),ua=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){wi({value:null,mixed:!1});return}const f=jd(s);Je.current&&(f.value=Je.current.value,f.mixed=!1),wi(w=>w.value===f.value&&w.mixed===f.mixed?w:f)},[]),da=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){vi({value:null,mixed:!1}),Si({value:null,mixed:!1});return}const f=Oo(s,"color");rt.current&&(f.value=rt.current.value,f.mixed=!1);const w=Oo(s,"backgroundColor");ot.current&&(w.value=ot.current.value,w.mixed=!1),vi(_=>_.value===f.value&&_.mixed===f.mixed?_:f),Si(_=>_.value===w.value&&_.mixed===w.mixed?_:w)},[]),ma=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){Ai({tag:null,mixed:!1});return}const f=py(s);Ai(w=>w.tag===f.tag&&w.mixed===f.mixed?w:f)},[]),fa=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){Di({align:null,mixed:!1}),Ei({type:null,mixed:!1}),Ri(!1),As(!1);return}const f=Im(s);Di(V=>V.align===f.align&&V.mixed===f.mixed?V:f);const w=wm(s);Ei(V=>V.type===w.type&&V.mixed===w.mixed?V:w);const _=Ay(s);Ri(V=>V===_?V:_);const O=k1(s);As(V=>V===O?V:O)},[]),z=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){xi(Rt()),Ni(!1),ca(),ua(),da(),ma(),fa();return}const f=ke.current,w=!!(f&&!f.collapsed);Ni(O=>O===w?O:w);const _=fm(Sn(s),Xe.current);xi(O=>Vb(O,_)?O:_),ca(),ua(),da(),ma(),fa()},[ca,ua,da,ma,fa]),mc=c.useCallback(()=>{const s=ke.current,f=Ge.current;!f||!s||s.collapsed&&s.start===f.start&&s.end===f.end||(Xe.current={},We.current=null,Je.current=null,rt.current=null,ot.current=null,_t.current=null,Ge.current=null)},[]);c.useEffect(()=>{Nr.current=!0},[Pe]),c.useEffect(()=>{if(ye==="visual"){z();return}Xe.current={},We.current=null,Je.current=null,rt.current=null,ot.current=null,_t.current=null,Ge.current=null,xi(Rt()),Lr({value:null,unit:kt.current,mixed:!1}),wi({value:null,mixed:!1}),vi({value:null,mixed:!1}),Si({value:null,mixed:!1}),Ai({tag:null,mixed:!1}),Di({align:null,mixed:!1}),Ei({type:null,mixed:!1}),Ri(!1),Ni(!1)},[ye,z]);const yn=c.useCallback((s,f,w)=>{fh({snapshot:s,visualEl:L.current,htmlEl:Ue.current,getHtml:()=>H.current==="visual"&&L.current?L.current.innerHTML:re.current,setHtml:_=>{if(H.current==="visual"){oe(gt(Ce(_).body,Ce(re.current).body),!1);return}me(_,!1)},content:f,asHtml:w})},[me,oe]),fc=c.useCallback(s=>{if(H.current==="visual"&&s==="html"){if(_e.current){const f=pt(At());f!==re.current&&me(f,!0)}else if(L.current){const f=gt(L.current.innerHTML,Ce(re.current).body),w=bo(f,yo(f,re.current,hn.current));w!==re.current&&me(w,!0)}}fs(s)},[me,fs,At]);c.useEffect(()=>{if(!vt)return;const s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}},[vt]),c.useEffect(()=>{if(!vt)return;const s=f=>{f.key==="Escape"&&(f.defaultPrevented||Qn.open||Wr.open||Jt.open||Qt.open||Gi.open||Jr.open||Qr.open||eo.open||Li||er.open||(f.preventDefault(),Kn(!1)))};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[vt,Kn,Qn.open,Wr.open,Jt.open,Qt.open,Gi.open,Jr.open,Qr.open,eo.open,Li,er.open]),c.useEffect(()=>{const s=()=>{if(H.current!=="visual"||!L.current)return;const f=window.getSelection();if(!f||f.rangeCount===0)return;const w=f.anchorNode;!w||!L.current.contains(w)&&L.current!==w||mn.current===null&&(mn.current=window.requestAnimationFrame(()=>{var O;mn.current=null;const _=L.current;if(!(!_||H.current!=="visual")&&(B(),mc(),z(),pn(Ot(_)),mt(_),Xt.current&&Er.current&&!((O=hi.current)!=null&&O.contains(document.activeElement)))){const V=ke.current;V&&St(xu(_,V))}}))};return document.addEventListener("selectionchange",s),()=>{document.removeEventListener("selectionchange",s),mn.current!==null&&(window.cancelAnimationFrame(mn.current),mn.current=null)}},[B,mc,z,mt]),c.useEffect(()=>{(!Be||ye!=="visual"||!ut)&&St(null)},[Be,ye,ut]),c.useEffect(()=>{if(!dt)return;const s=f=>{var O;const w=f.target;if((O=hi.current)!=null&&O.contains(w))return;const _=L.current;_&&wu(_,w)||St(null)};return document.addEventListener("pointerdown",s),()=>document.removeEventListener("pointerdown",s)},[dt]),c.useEffect(()=>{if(ye!=="html")return;const s=Ue.current;if(!s)return;const f=()=>B();return s.addEventListener("select",f),s.addEventListener("keyup",f),s.addEventListener("mouseup",f),()=>{s.removeEventListener("select",f),s.removeEventListener("keyup",f),s.removeEventListener("mouseup",f)}},[ye,B]),c.useLayoutEffect(()=>{if(ye!=="visual"||ne){pn(null);return}const s=L.current;if(!s)return;const f=Ot(s);pn(w=>f||(w&&w.isConnected&&s.contains(w)?w:null))},[Pe,ye,ne]);const K=c.useCallback(s=>{const f=ft({mode:"visual",visualEl:s,htmlEl:Ue.current}),w=ke.current,_=Zc(w,f)?w:f.visualRange?f:w??f;ke.current=_,s.focus();const O=mh(s,_);if(O){const V=window.getSelection();try{V==null||V.removeAllRanges(),V==null||V.addRange(O),ke.current={..._,visualRange:O}}catch{}}return ke.current??_},[]),Pt=c.useCallback(()=>{Fr.current=null,Br.current=null,Ss(!1)},[]),gc=c.useCallback(()=>{if(!Ir.current||!Fr.current||!Br.current||H.current!=="visual")return;const s=L.current;if(!s)return;B();const f=ke.current;!f||f.collapsed||tC(f,Br.current)||(K(s),rC(s,Fr.current),ee(s,!1),B(),z(),Pt())},[B,K,oe,z,Pt]),pc=c.useCallback(()=>{if(H.current!=="visual"){Pt();return}if(Ir.current){Pt();return}const s=L.current;if(!s){Pt();return}const f=K(s);if(f.collapsed){Pt();return}Fr.current=nC(s),Br.current={...f},Ss(!0),B()},[Pt,K,B]),hc=c.useCallback(()=>{gc()},[gc]);c.useEffect(()=>{(ye!=="visual"||ne)&&Pt()},[ye,ne,Pt]);const ga=c.useCallback((s,f)=>{if(H.current!=="visual")return;const w=L.current;if(!w)return;const _=f??kt.current,O=on(s,_);if(!O)return;kt.current=O.unit;const V=K(w);if(V.collapsed){We.current=O,Ge.current={start:V.start,end:V.end},z();return}We.current=null,tl(w,O.value,O.unit)&&(ee(w,!1),B(),z())},[K,oe,B,z]),bc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(w.collapsed){Je.current={value:s},Ge.current={start:w.start,end:w.end},z();return}Je.current=null,qa(f,s)&&(ee(f,!1),B(),z())},[K,oe,B,z]),pa=c.useCallback((s,f)=>{if(H.current!=="visual")return;const w=L.current;if(!w)return;const _=K(w),O=s==="color"?rt:ot;if(_.collapsed){O.current={value:f},Ge.current={start:_.start,end:_.end},z();return}O.current=null,cr(w,s,f)&&(ee(w,!1),B(),z())},[K,oe,B,z]),ha=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(Hr({open:!1,tab:"general"}),w.collapsed){if(s.size!==null){const Ee=on(s.size,s.unit);Ee&&(We.current=Ee,kt.current=Ee.unit)}const O=Sn(f),V={};for(const Ee of tt)s.marks[Ee]!==O[Ee]&&(V[Ee]=s.marks[Ee]);Xe.current=V,s.fontColorMixed||(rt.current={value:s.fontColor}),s.highlightColorMixed||(ot.current={value:s.highlightColor}),s.fontFamilyMixed||(Je.current={value:s.fontFamily}),Ge.current={start:w.start,end:w.end},z();return}if(Xe.current={},We.current=null,Je.current=null,rt.current=null,ot.current=null,Ge.current=null,s.size!==null){const O=on(s.size,s.unit);O&&(kt.current=O.unit,tl(f,O.value,O.unit))}const _=Sn(f);for(const O of tt)s.marks[O]!==_[O]&&ol(f,O);s.fontFamilyMixed||qa(f,s.fontFamily),s.fontColorMixed||cr(f,"color",s.fontColor),s.highlightColorMixed||cr(f,"backgroundColor",s.highlightColor),ee(f,!1),B(),z()},[K,oe,B,z]),yc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Ur(w=>({...w,open:!1})),!Bm(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),xc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(zi(_=>({..._,open:!1})),!ui(s)){B(),z();return}if(w.collapsed){_t.current=s,Ge.current={start:w.start,end:w.end},z();return}if(_t.current=null,!mm(f,s)){B(),z();return}ee(f,!1),B(),z()},[K,oe,B,z]),Cc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;K(f),gn(V=>({...V,open:!1}));const w=_e.current?ze(re.current)[Mt.current]??"":re.current,_=JSON.stringify(s.atRule)!==JSON.stringify(ln(Ce(w).body)),O=p1(f,s);if(_&&Ar(f,O.pageHtml),!O.changed&&!_){B(),z();return}oe(Ce(O.pageHtml).body,!1),B(),z()},[K,oe,B,z]),wc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Vr(w=>({...w,open:!1})),!R1(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),vc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Wi(w=>({...w,open:!1})),!_1(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),uo=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Zr({open:!1}),!hx(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),mo=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),qr({open:!1}),!bC(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Sc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),nr({open:!1}),!AC(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),kc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Vi({open:!1}),!Ly(f,s)){B(),z();return}ee(f,!1),B(),z(),mt(f)}},[K,oe,B,z,mt]),Ac=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Zi(w=>({...w,open:!1})),!QC(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Pc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),qi(w=>({...w,open:!1})),!cw(f,s)){B(),z();return}ee(f,!1),B(),z(),mt(f)}},[K,oe,B,z,mt]),Dc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Yi(w=>({...w,open:!1})),!xw(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Dt=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),!s(f)){B(),z();return}ee(f,!1),B(),z(),mt(f)}},[K,oe,B,z,mt]),ba=c.useCallback(s=>{uo({src:s.src,alt:s.alt??"",title:s.title??"",css:s.css})},[uo]),ya=c.useCallback(s=>{mo({src:s.src,title:s.title??"",css:s.css})},[mo]),xa=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),nr({open:!1}),!PC(f,{src:s.src,title:s.title??"",css:s.css})){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),jc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Xr(w=>({...w,open:!1})),!Mx(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),ng=c.useCallback((s,f)=>{je!=null&&je.isConnected&&ZC(je,s,f)},[je]),rg=c.useCallback(()=>{const s=L.current;!s||!(je!=null&&je.isConnected)||(ee(s,!1),Ma(s,je),B(),z())},[je,oe,B,z]),Ft=c.useCallback(()=>{if(_e.current){if(H.current==="visual"){const s=At(),f=pt(s);if(f!==re.current)return me(f,!0)}return re.current}if(H.current==="visual"&&L.current){const s=gt(L.current.innerHTML,Ce(re.current).body),f=bo(s,yo(s,re.current,hn.current));if(f!==re.current)return me(f,!0)}return re.current},[me]),Ca=c.useCallback(()=>{if(!Nr.current&&yi.current)return yi.current;const s=JSON.stringify(lo());return yi.current=s,Nr.current=!1,s},[lo]),og=c.useCallback(()=>_e.current?Ca():Ft(),[Ft,Ca]);Pw({onAutoSave:r?()=>{const s=_e.current?JSON.parse(Ca()):Ft();return r(s)}:void 0,getHtml:og}),c.useEffect(()=>()=>{var s;(s=Un.current)==null||s.cancel()},[]);const se=c.useMemo(()=>({getHtml:Ft,setHtml:s=>{me(s,!1)},getMode:()=>H.current,setMode:fc,getFullscreen:()=>ys.current,setFullscreen:Kn,getDarkMode:()=>qs.current,setDarkMode:s=>{ac(s)},getPageZoom:()=>oa.current,setPageZoom:lc,getToolbarPosition:()=>Ys.current,setToolbarPosition:s=>{sc(s)},openCustomizeToolbar:()=>{Ds(!0)},openDocumentPreview:()=>{js({open:!0,html:Ft()})},toggleReadAloud:()=>{const s=Un.current;if(!s)return;const f=ke.current??ft({mode:H.current,visualEl:L.current,htmlEl:Ue.current}),w=Su(xo(f),Ft());w&&s.toggle(w)},isReadingAloud:()=>{var s;return((s=Un.current)==null?void 0:s.isSpeaking())??!1},canReadAloud:()=>{if(!Lo())return!1;const s=ke.current??ft({mode:H.current,visualEl:L.current,htmlEl:Ue.current});return Su(xo(s),Ft())!==null},undo:so,redo:co,canUndo:()=>Ye.canUndo(),canRedo:()=>Ye.canRedo(),getSelection:()=>{const s=ke.current??ft({mode:H.current,visualEl:L.current,htmlEl:Ue.current});return xo(s)},insertText:s=>{const f=ke.current??ft({mode:H.current,visualEl:L.current,htmlEl:Ue.current});yn(f,s,!1)},insertHtml:(s,f)=>{const w=ke.current??ft({mode:H.current,visualEl:L.current,htmlEl:Ue.current}),_=f===void 0;yn(w,_?s:f,_)},toggleFontMark:s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(w.collapsed){const _=Sn(f);Xe.current=qb(Xe.current,_,s),Ge.current={start:w.start,end:w.end},z();return}Xe.current={},Ge.current=null,ol(f,s)&&(ee(f,!1),B(),z())},clearFormatting:()=>{if(H.current!=="visual")return;const s=L.current;!s||K(s).collapsed||(Xe.current={},We.current=null,Je.current=null,rt.current=null,ot.current=null,_t.current=null,Ge.current=null,eC(s)&&(ee(s,!1),B(),z()))},toggleFormatBrush:pc,isFormatBrushActive:()=>Ir.current,isFontMarkActive:s=>Ci.current[s],hasTextSelection:()=>H.current==="visual"&&Mi.current,setFontSize:(s,f)=>{ga(s,f)},setFontSizeUnit:s=>{var Ee;const f=L.current,w=Lt.current;if(H.current!=="visual"||!f||w.value===null||w.mixed){kt.current=s,Lr(ir=>({...ir,unit:s}));return}const _=K(f),O=Ib(f,((Ee=_.visualRange)==null?void 0:Ee.startContainer)??f),V=Rd(w.value,w.unit,s,O.parentPx,O.rootPx);ga(V,s)},getFontSize:()=>Lt.current.value,getFontSizeUnit:()=>Lt.current.unit,isFontSizeMixed:()=>Lt.current.mixed,setFontFamily:s=>{bc(s)},getFontFamily:()=>Vn.current.value,isFontFamilyMixed:()=>Vn.current.mixed,getFontFaces:()=>hn.current,setFontColor:s=>{pa("color",s)},setHighlightColor:s=>{pa("backgroundColor",s)},getFontColor:()=>qn.current.value,isFontColorMixed:()=>qn.current.mixed,getHighlightColor:()=>Xn.current.value,isHighlightColorMixed:()=>Xn.current.mixed,setParagraphStyle:s=>{if(H.current!=="visual")return;const f=L.current;f&&(K(f),hy(f,s)&&(ee(f,!1),B(),z()))},getParagraphStyle:()=>Pi.current.tag,isParagraphStyleMixed:()=>Pi.current.mixed,setTextAlign:s=>{if(H.current!=="visual")return;const f=L.current;f&&(K(f),Fm(f,s)&&(ee(f,!1),B(),z()))},getTextAlign:()=>ji.current.align,isTextAlignMixed:()=>ji.current.mixed,indent:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),Py(s)&&(ee(s,!1),B(),z()))},outdent:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),Dy(s)&&(ee(s,!1),B(),z()))},canOutdent:()=>H.current==="visual"&&vs.current,toggleList:s=>{if(H.current!=="visual")return;const f=L.current;f&&(K(f),xy(f,s)&&(ee(f,!1),B(),z()))},isBulletList:()=>Jn.current.type==="ul"&&!Jn.current.mixed,isNumberedList:()=>Jn.current.type==="ol"&&!Jn.current.mixed,openFontProperties:s=>{H.current==="visual"&&Hr({open:!0,tab:s??"general"})},applyFontProperties:s=>{ha(s)},openCustomCss:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=s?um(s):{value:null,mixed:!1},w=f.mixed||!f.value?"":Kb(f.value);zi({open:!0,value:w})},applyCustomCss:s=>{xc(s)},openParagraphProperties:s=>{if(H.current!=="visual")return;const f=L.current;f&&K(f),Ur({open:!0,tab:s??"general",value:f?cu(f):ur()})},applyParagraphProperties:s=>{yc(s)},openPageProperties:s=>{if(H.current!=="visual")return;const f=L.current;f&&K(f);const w=_e.current?ze(re.current)[Mt.current]??"":re.current,_=f?g1(f):gl();gn({open:!0,tab:s??"font",value:{..._,atRule:ln(Ce(w).body)}})},applyPageProperties:s=>{Cc(s)},openCustomParagraphStyleDialog:s=>{if(H.current!=="visual"||!ra.current)return;if(s){const w=to.current.find(_=>_.id===s);if(!w)return;tr({open:!0,mode:"edit",style:w});return}const f=L.current;f&&K(f),tr({open:!0,mode:"create",font:{size:Lt.current.mixed?null:Lt.current.value,unit:Lt.current.unit,marks:{...Ci.current},fontFamily:Vn.current.mixed?null:Vn.current.value,fontColor:qn.current.mixed?null:qn.current.value,highlightColor:Xn.current.mixed?null:Xn.current.value},paragraph:Hm(f?cu(f):ur())})},applyCustomParagraphStyle:s=>{const f=to.current.find(_=>_.id===s);if(!f||(ha({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 w=L.current;!w||H.current!=="visual"||(K(w),Jy(w,f.paragraph)&&(ee(w,!1),B(),z()))},customParagraphStylesEnabled:()=>ra.current,getCustomParagraphStyles:()=>to.current,isCustomParagraphStylesLoading:()=>Fs.current,openLinkDialog:s=>{if(H.current!=="visual")return;const f=L.current;f&&K(f);const w=f?tf(f):fi(),_=f?pl(f):[],O=(w==null?void 0:w.href)??"",V=O.startsWith("#")?O.slice(1):"",Ee=_.some(ir=>ir.id===V)?V:"";Vr({open:!0,tab:s??"link",href:O,title:(w==null?void 0:w.title)??"",targetBlank:(w==null?void 0:w.targetBlank)??!1,textDecorationNone:(w==null?void 0:w.textDecorationNone)??!1,hoverMode:(w==null?void 0:w.hoverMode)??"color",hoverColor:(w==null?void 0:w.hoverColor)??null,hoverHtml:(w==null?void 0:w.hoverHtml)??"",bookmarks:_,selectedBookmarkId:Ee})},applyLink:s=>{wc(s)},openBookmarkDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s),Wi({open:!0,existingIds:s?pl(s).map(f=>f.id):[]})},applyBookmark:s=>{vc(s)},openImageDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=$s.current;if(Xs.current&&f){f.onPick(ba);return}Zr({open:!0})},applyImage:s=>{uo(s)},openAudioDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=Us.current;if(Js.current&&f){f.onPick(ya);return}qr({open:!0})},applyAudio:s=>{mo(s)},openYoutubeDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=Ws.current;if(Qs.current&&f){f.onPick(xa);return}nr({open:!0})},applyYoutube:s=>{Sc(s)},openImageProperties:s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;K(f);const w=Ot(f),_=Nx(f);!w||!_||Xr({open:!0,tab:s??"general",value:_,aspectRatio:Ex(w)})},applyImageProperties:s=>{jc(s)},insertHorizontalRule:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),BC(s)&&(ee(s,!1),B(),z()))},insertPageBreak:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),KC(s)&&(ee(s,!1),B(),z()))},insertPage:()=>{dc()},isMultiPagesEnabled:()=>_e.current,getActivePageHtml:()=>uc(),getAllPagesHtml:()=>lo(),openTableDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s),Vi({open:!0})},applyTable:s=>{kc(s)},openTableProperties:()=>{if(H.current!=="visual")return;const s=L.current;if(!s)return;K(s);const f=JC(s);f&&Zi({open:!0,value:f})},applyTableProperties:s=>{Ac(s)},openCellProperties:()=>{if(H.current!=="visual")return;const s=L.current;if(!s)return;K(s);const f=sw(s);f&&qi({open:!0,value:f})},applyCellProperties:s=>{Pc(s)},openRowProperties:()=>{if(H.current!=="visual")return;const s=L.current;if(!s)return;K(s);const f=yw(s);f&&Yi({open:!0,value:f})},applyRowProperties:s=>{Dc(s)},insertRowBelow:()=>{Dt(s=>ll(s,"below"))},insertRowBefore:()=>{Dt(s=>ll(s,"before"))},deleteRow:()=>{Dt(s=>Iy(s))},insertColumnAfter:()=>{Dt(s=>ou(s,"after"))},insertColumnBefore:()=>{Dt(s=>ou(s,"before"))},deleteColumn:()=>{Dt(s=>Fy(s))},mergeCells:()=>{Dt(s=>zy(s))},unmergeCells:()=>{Dt(s=>Oy(s))},cut:async()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),await q1(s)&&(ee(s,!1),B(),z()))},copy:async()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),await sf(s))},deleteSelection:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),lf(s)&&(ee(s,!1),B(),z()))},addComment:()=>{if(!Xt.current||y||H.current!=="visual")return;const s=L.current;if(!s)return;const f=K(s),w=xu(s,f);if(w){St(w);return}const _=B1(s,f);if(!_)return;const O=$1(_);H1(s,O.id,f)&&(vu(s,O.id),B(),cc(s,!1),$n([...Rr.current,O]),St(O.id))},toggleCommentsVisible:()=>{Uf(s=>{const f=!s,w=L.current;return w&&Cu(w,f),f})},areCommentsVisible:()=>Er.current,canAddComment:()=>!Xt.current||y||H.current!=="visual"?!1:Mi.current||Ji.current!==null,isCommentsEnabled:()=>Xt.current,getCommentThreads:()=>Rr.current,setCommentThreads:s=>$n(s),openCommentThread:s=>{const f=L.current;!f||H.current!=="visual"||vu(f,s)&&(B(),St(s))},isContentLocked:()=>hs.current,isLink:()=>Ps.current,isImageSelected:()=>H.current==="visual"&&Ji.current!==null,isInTable:()=>H.current==="visual"&&Ts.current,canMergeCells:()=>H.current==="visual"&&Ms.current,canUnmergeCells:()=>H.current==="visual"&&Ls.current,...i!=null?{onSave:s=>Os.current(s)}:{},...a!=null?{onOpen:()=>Ks.current()}:{}}),[me,oe,ee,cc,fc,Kn,ac,lc,sc,yn,so,co,B,z,K,ga,bc,pa,ha,xc,yc,Cc,wc,vc,uo,mo,Sc,jc,kc,Ac,Pc,Dc,Dt,ba,ya,xa,Ft,uc,lo,dc,pc,i,a,y,$n]),Ec=c.useCallback(()=>{const s=ke.current??ft({mode:H.current,visualEl:L.current,htmlEl:Ue.current});return{mode:s.mode,selection:xo(s),getHtml:se.getHtml,setHtml:f=>{me(f,!1)},insertText:f=>yn(s,f,!1),insertHtml:(f,w)=>{const _=w===void 0;yn(s,_?f:w,_)}}},[yn,se.getHtml,me]),{catalog:fo,layout:Rc}=c.useMemo(()=>sp(R,cP,uP),[R]),go=c.useMemo(()=>OA(Rc,E),[Rc,E]),wa=c.useMemo(()=>({...go,iconGroups:gA(go.iconGroups,Ii)}),[go,Ii]),va=c.useMemo(()=>Be?gP(fo,ut):fo,[fo,Be,ut]),Sa=c.useMemo(()=>Be?pP(wa):wa,[wa,Be]),ka=c.useMemo(()=>({disabled:On,readOnly:x,enableComments:Be}),[On,x,Be]),Tc=c.useMemo(()=>dt?G1(un,dt):null,[dt,un]),ig=c.useCallback(s=>{if(!dt||!Dr||y)return;const f=U1(Dr,s);$n(W1(Rr.current,dt,f))},[dt,Dr,y,$n]),xn=c.useMemo(()=>({...Tb(se),...cp(R,Ec)}),[se,R,Ec]),Aa=c.useMemo(()=>Nb(se),[se,_r,Wn,Gn,Zn,Yn,ki,Oi,Ki,na,It,je,Qi,ea,ta,Ti,_i,fn,it,$r]),Nc=c.useCallback(s=>{if(ne||s.inputType!=="insertText"&&s.inputType!=="insertReplacementText"||!s.data||!Zb(Xe.current)&&!We.current&&!Xp(Je.current)&&!Ah({color:rt.current,backgroundColor:ot.current})&&!Wb(_t.current))return;const f=L.current;f&&(s.preventDefault(),oy(f,s.data,Xe.current,We.current,{color:rt.current,backgroundColor:ot.current},Je.current,_t.current),Xe.current={},We.current=null,Je.current=null,rt.current=null,ot.current=null,_t.current=null,Ge.current=null,ee(f,!0),B(),z())},[ne,oe,B,z]),Mc=c.useCallback(s=>{if(ne||!Ap(s,Is.current))return;s.preventDefault(),s.stopPropagation();const f=L.current;if(!f)return;K(f);const w=dl(f,s.target),_=qo(f,s.target);_&&!kr(f).includes(_)&&Hy(f,_);const O={inTable:Ke(f,s.target)!==null,canMergeCells:iu(f),canUnmergeCells:au(f)};if(w){Ma(f,w),B(),pn(w),Xi({open:!0,x:s.clientX,y:s.clientY,kind:"image",...O,inTable:Ke(f,w)!==null});return}const V=ft({mode:"visual",visualEl:f,htmlEl:Ue.current});ke.current=V,Xi({open:!0,x:s.clientX,y:s.clientY,kind:V.collapsed?"caret":"text",...O})},[ne,B,K]),_c=c.useCallback(s=>{if(Is.current=s.pointerType,y)return;const f=L.current;if(!f)return;if(Xt.current&&Er.current){const _=wu(f,s.target);if(_){const O=_.getAttribute("data-comment-thread");O&&St(O);return}}if(ne&&!Xt.current)return;const w=dl(f,s.target);if(!w){pn(null);return}s.preventDefault(),Ma(f,w),B(),pn(w)},[y,ne,B]);c.useEffect(()=>{if(!Be||ye!=="visual")return;const s=L.current;s&&(K1(s,un),Cu(s,ut))},[Be,ye,un,ut,Pe]);const Lc=c.useCallback(s=>{if(ne)return;if(s.key==="Tab"&&!s.ctrlKey&&!s.metaKey&&!s.altKey){if(H.current!=="visual")return;const w=L.current;if(!w)return;const _=s.target;if(!(_ instanceof Node)||!w.contains(_))return;K(w);const O=By(w,s.shiftKey);if(!O)return;s.preventDefault(),typeof O=="object"&&O.changed&&ee(w,!1),B(),z(),mt(w);return}if(!(s.ctrlKey||s.metaKey))return;if(s.key==="Enter"&&!s.shiftKey){s.preventDefault(),se.insertPageBreak();return}const f=s.key.toLowerCase();if(f==="z"&&!s.shiftKey){s.preventDefault(),so();return}if(f==="z"&&s.shiftKey||f==="y"){s.preventDefault(),co();return}if(f==="b"&&!s.shiftKey){s.preventDefault(),se.toggleFontMark("bold");return}if(f==="i"&&!s.shiftKey){s.preventDefault(),se.toggleFontMark("italic");return}if(f==="u"&&!s.shiftKey){s.preventDefault(),se.toggleFontMark("underline");return}if(f==="x"&&s.shiftKey){s.preventDefault(),se.toggleFontMark("strikethrough");return}f==="p"&&!s.shiftKey&&(s.preventDefault(),xn.print())},[ne,so,co,se,xn,K,oe,B,z,mt]),ag=c.useCallback(s=>{if(s.key==="Escape"&&dt){s.preventDefault(),St(null);return}Lc(s)},[dt,Lc]),lg=[ge.root,Wa(fn).className,vt?ge.fullscreen:"",b].filter(Boolean).join(" "),sg=VP({toolbarBackground:v,menuColor:k,menuBackground:P,menuFontSize:N,menuFontFamily:D,border:A}),cg=Wa(fn)["data-wysiwyg-theme"],ug=c.useMemo(()=>{if(!(ye!=="visual"||Hi===1))return{transform:`scale(${Hi})`}},[ye,Hi]),Ic=ye==="visual"?ve?o.jsx(WP,{ref:jr,pages:oo,activePageIndex:dn,onActivePageIndexChange:s=>{var w;bs(s);const f=(w=jr.current)==null?void 0:w.getActivePageRoot();f instanceof HTMLDivElement&&(L.current=f)},onPageChange:(s,f)=>{const w=ze(re.current)[s]??"";la(s,gt(f,Ce(w).body),!0)},onBeforeInput:Nc,onPointerDown:s=>{s.currentTarget instanceof HTMLDivElement&&(L.current=s.currentTarget),_c(s)},onMouseUp:hc,onContextMenu:Mc,placeholder:C,disabled:ne}):o.jsx(UP,{ref:L,html:Ce(Pe).body,onChange:s=>tg(s,!0),onBeforeInput:Nc,onPointerDown:_c,onMouseUp:hc,onContextMenu:Mc,placeholder:C,disabled:ne}):o.jsx($P,{ref:Ue,html:Pe,onChange:s=>me(s,!0),placeholder:C,disabled:ne});return o.jsx(bp,{locale:S,children:o.jsx(fp,{dark:fn,children:o.jsxs("div",{className:lg,style:sg,"data-fullscreen":vt?"":void 0,"data-wysiwyg-theme":cg,"data-toolbar-position":it,"data-comments-visible":Be&&ut?"":void 0,onKeyDown:ag,children:[T?o.jsx("div",{className:ge.menuChrome,onPointerDownCapture:sa,children:o.jsx(Ua,{catalog:va,layout:Sa,commands:xn,queries:Aa,disabled:On,chromeLock:ka,menuVisible:!0,toolbarVisible:!1})}):null,o.jsxs("div",{className:ge.body,"data-icon-dock":I?it:void 0,children:[I&&(it==="top"||it==="left")?o.jsx("div",{className:ge.iconChrome,onPointerDownCapture:sa,children:o.jsx(Ua,{catalog:va,layout:Sa,commands:xn,queries:Aa,disabled:On,chromeLock:ka,menuVisible:!1,toolbarVisible:!0,position:it})}):null,o.jsxs("div",{ref:gs,className:`${ge.workspace} ${oc?ge.workspacePageSized:""}`,onDragEnter:or.onDragEnter,onDragOver:or.onDragOver,onDragLeave:or.onDragLeave,onDrop:or.onDrop,children:[ye==="visual"?o.jsx("div",{className:ge.pageCanvasViewport,style:ug,children:Ic}):Ic,or.dragging?o.jsx(qP,{}):null]}),I&&(it==="bottom"||it==="right")?o.jsx("div",{className:ge.iconChrome,onPointerDownCapture:sa,children:o.jsx(Ua,{catalog:va,layout:Sa,commands:xn,queries:Aa,disabled:On,chromeLock:ka,menuVisible:!1,toolbarVisible:!0,position:it})}):null]}),vt?o.jsx(ZP,{onClick:()=>Kn(!1)}):null,o.jsx(zA,{open:Li,catalog:fo,groups:go.iconGroups,settings:Ii,loading:Gf,busy:Vf,disabled:ne,onChange:s=>{ic(s)},onReset:()=>{ic(null)},onClose:()=>Ds(!1)}),o.jsx(Hk,{open:er.open,html:er.html,onClose:()=>js({open:!1,html:er.html})}),o.jsx(Xv,{open:Qn.open,tab:Qn.tab,size:Wn.value,unit:Wn.unit,marks:_r,fontFamily:Gn.value,fontFamilyMixed:Gn.mixed,fontColor:Zn.value,fontColorMixed:Zn.mixed,highlightColor:Yn.value,highlightColorMixed:Yn.mixed,fonts:It,disabled:ne,onTabChange:s=>Hr({open:!0,tab:s}),onApply:s=>se.applyFontProperties(s),onClose:()=>Hr({open:!1,tab:Qn.tab})}),o.jsx(CS,{open:Jt.open,tab:Jt.tab,value:Jt.value,disabled:ne,onTabChange:s=>Ur({...Jt,open:!0,tab:s}),onApply:s=>se.applyParagraphProperties(s),onClose:()=>Ur({...Jt,open:!1})}),o.jsx(MS,{open:Wr.open,value:Wr.value,disabled:ne,onApply:s=>se.applyCustomCss(s),onClose:()=>zi(s=>({...s,open:!1}))}),o.jsx(jS,{open:Qt.open,tab:Qt.tab,value:Qt.value,fonts:It,disabled:ne,customImagePicker:J,onCustomImagePick:()=>{J==null||J.onPick(s=>{gn(f=>({...f,tab:"paragraph",value:{...f.value,backgroundImage:{...f.value.backgroundImage,src:s.src}}}))})},onTabChange:s=>gn({...Qt,open:!0,tab:s}),onApply:s=>se.applyPageProperties(s),onResetAtRule:()=>{const s=L.current;if(!s||H.current!=="visual")return;const f=_e.current?ze(re.current)[Mt.current]??"":Ce(re.current).body,w=h1(s,f);w.changed&&(oe(Ce(w.pageHtml).body,!1),gn(_=>({..._,value:{..._.value,atRule:an()}})))},onClose:()=>gn({...Qt,open:!1})}),o.jsx(TS,{open:De.open,mode:De.open?De.mode:"create",styleId:De.open&&De.mode==="edit"?De.style.id:void 0,name:De.open&&De.mode==="edit"?De.style.name:"",font:De.open?De.mode==="edit"?De.style.font:De.font:{size:null,unit:rn,marks:Rt(),fontFamily:null,fontColor:null,highlightColor:null},paragraph:De.open?De.mode==="edit"?De.style.paragraph:De.paragraph:void 0,canDelete:!!X,fonts:It,busy:Yf,disabled:ne,onSave:async s=>{const f=Hs.current;if(f){Gr(!0);try{await f(s),tr({open:!1}),await io()}finally{Gr(!1)}}},onDelete:async s=>{const f=zs.current;if(f){Gr(!0);try{await f(s),tr({open:!1}),await io()}finally{Gr(!1)}}},onClose:()=>tr({open:!1})}),o.jsx(ak,{open:Ve.open,tab:Ve.tab,href:Ve.href,title:Ve.title,targetBlank:Ve.targetBlank,textDecorationNone:Ve.textDecorationNone,hoverMode:Ve.hoverMode,hoverColor:Ve.hoverColor,hoverHtml:Ve.hoverHtml,bookmarks:Ve.bookmarks,selectedBookmarkId:Ve.selectedBookmarkId,disabled:ne,onTabChange:s=>Vr({...Ve,open:!0,tab:s}),onApply:s=>se.applyLink(s),onClose:()=>Vr({...Ve,open:!1})}),o.jsx(LS,{open:Ui.open,existingIds:Ui.existingIds,disabled:ne,onApply:s=>se.applyBookmark(s),onClose:()=>Wi({...Ui,open:!1})}),o.jsx(HS,{open:Xf.open,disabled:ne,customImagePicker:J,onApply:s=>se.applyImage(s),onCustomPick:()=>{Zr({open:!1}),J==null||J.onPick(ba)},onClose:()=>Zr({open:!1})}),o.jsx(BS,{open:Jf.open,disabled:ne,customAudioPicker:Y,onApply:s=>se.applyAudio(s),onCustomPick:()=>{qr({open:!1}),Y==null||Y.onPick(ya)},onClose:()=>qr({open:!1})}),o.jsx(lk,{open:Qf.open,disabled:ne,customVideoPicker:te,onApply:s=>se.applyYoutube(s),onCustomPick:()=>{nr({open:!1}),te==null||te.onPick(xa)},onClose:()=>nr({open:!1})}),o.jsx(JS,{open:Yr.open,tab:Yr.tab,value:Yr.value,aspectRatio:Yr.aspectRatio,disabled:ne,onTabChange:s=>Xr(f=>({...f,tab:s})),onApply:s=>se.applyImageProperties(s),onClose:()=>Xr(s=>({...s,open:!1}))}),o.jsx(fk,{open:Gi.open,disabled:ne,onApply:s=>se.applyTable(s),onClose:()=>Vi({open:!1})}),o.jsx(yk,{open:Jr.open,value:Jr.value,disabled:ne,onApply:s=>se.applyTableProperties(s),onClose:()=>Zi(s=>({...s,open:!1}))}),o.jsx(Ak,{open:Qr.open,value:Qr.value,disabled:ne,onApply:s=>se.applyCellProperties(s),onClose:()=>qi(s=>({...s,open:!1}))}),o.jsx(Ek,{open:eo.open,value:eo.value,disabled:ne,onApply:s=>se.applyRowProperties(s),onClose:()=>Yi(s=>({...s,open:!1}))}),ye==="visual"&&!ne&&(je!=null&&je.isConnected)?o.jsx(ik,{img:je,onResize:ng,onResizeEnd:rg}):null,Be&&ut&&Tc?o.jsx(cA,{panelRef:hi,thread:Tc,locale:S,disabled:y,commentAuthor:Dr,onPost:ig,onClose:()=>St(null)}):null,o.jsx(Sp,{open:en.open,x:en.x,y:en.y,kind:en.kind,inTable:en.inTable,canMergeCells:en.canMergeCells,canUnmergeCells:en.canUnmergeCells,commands:xn,onClose:()=>Xi(s=>({...s,open:!1}))})]})})})}function VP({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 ZP({onClick:e}){const t=W();return o.jsx("button",{type:"button",className:ge.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:o.jsx(Ie,{className:ge.exitFullscreenIcon})})}function qP(){const e=W();return o.jsx("div",{className:ge.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}function YP(e){var n;if(e.tagName.toLowerCase()!=="span")return!1;const t=[...e.attributes];return t.length===0||t.length===1&&((n=t[0])==null?void 0:n.name)===Ne?!0:t.length===2&&t.some(r=>r.name===Ne)&&t.some(r=>r.name==="class"&&r.value.includes("wysiwyg-comment-anchor"))?!e.hasAttribute("style"):!1}function XP(e){for(const t of[...e.querySelectorAll(`[${Ne}]`)])t.removeAttribute(Ne),t instanceof HTMLElement&&t.classList.remove("wysiwyg-comment-anchor");for(const t of[...e.querySelectorAll("span")]){if(!YP(t))continue;const n=t.parentNode;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}}function JP(e){const t=e.trim();if(!t)return e;const n=new DOMParser().parseFromString(t,"text/html");return XP(n.body),n.body.innerHTML}exports.Editor=GP;exports.PAGE_SEPARATOR=Bo;exports.joinPagesToHtml=pt;exports.splitPagesFromHtml=ze;exports.stripCommentAnchors=JP;