commspliant-html-editor 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("react"),Au=require("react-dom");function lx({className:e}){return i.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:[i.jsx("path",{d:"M9 18V5l12-2v13"}),i.jsx("circle",{cx:"6",cy:"18",r:"3"}),i.jsx("circle",{cx:"18",cy:"16",r:"3"})]})}function As({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M7 12h10"}),i.jsx("path",{d:"M4 18h16"})]})}function Ep({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h16"}),i.jsx("path",{d:"M4 18h16"})]})}function Ts({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h10"}),i.jsx("path",{d:"M4 18h16"})]})}function Rs({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M10 12h10"}),i.jsx("path",{d:"M4 18h16"})]})}function cx({className:e}){return i.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:[i.jsx("path",{d:"M7 5h6.5a3.5 3.5 0 0 1 0 7H7z"}),i.jsx("path",{d:"M7 12h7.5a3.5 3.5 0 0 1 0 7H7z"}),i.jsx("path",{d:"M7 5v14"})]})}function ux({className:e}){return i.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:i.jsx("path",{d:"M6 4h12a1 1 0 0 1 1 1v16l-7-4-7 4V5a1 1 0 0 1 1-1z"})})}function _p({className:e}){return i.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:[i.jsx("path",{d:"M9 6h12"}),i.jsx("path",{d:"M9 12h12"}),i.jsx("path",{d:"M9 18h12"}),i.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"})]})}function dx({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M12 4v16"}),i.jsx("rect",{x:"12.5",y:"4.5",width:"8",height:"7",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function mx({className:e}){return i.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:[i.jsx("path",{d:"M4 5h12"}),i.jsx("path",{d:"M10 5v8"}),i.jsx("path",{d:"m14 15 6 6"}),i.jsx("path",{d:"m20 15-6 6"})]})}function Ge({className:e}){return i.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:[i.jsx("path",{d:"M18 6L6 18"}),i.jsx("path",{d:"M6 6l12 12"})]})}function sf({className:e}){return i.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:i.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 fx({className:e}){return i.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:[i.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"}),i.jsx("path",{d:"M8 9h8M8 13h5"})]})}function Mp({className:e}){return i.jsx("svg",{className:e,viewBox:"0 0 616.23 542.09",width:"45",height:"40","aria-hidden":"true","data-icon":"commspliant-shield",children:i.jsxs("g",{transform:"translate(129.79555,688.75474)",children:[i.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"}),i.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"}),i.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"}),i.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"}),i.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 px({className:e}){return i.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:[i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),i.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"}),i.jsx("path",{d:"M10.5 14v.5"}),i.jsx("path",{d:"M15 10v4"}),i.jsx("path",{d:"M13 12h4"})]})}function gx({className:e}){return i.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:[i.jsx("path",{d:"M8 6h12"}),i.jsx("path",{d:"M8 12h12"}),i.jsx("path",{d:"M8 18h8"}),i.jsx("path",{d:"M4 6h.01"}),i.jsx("path",{d:"M4 12h.01"}),i.jsx("path",{d:"M4 18h.01"})]})}function hx({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"7",height:"7",rx:"1"}),i.jsx("rect",{x:"14",y:"4",width:"7",height:"7",rx:"1"}),i.jsx("rect",{x:"3",y:"13",width:"7",height:"7",rx:"1"}),i.jsx("rect",{x:"14",y:"13",width:"7",height:"7",rx:"1"})]})}function bx({className:e}){return i.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:i.jsx("path",{d:"M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z"})})}function Np({className:e}){return i.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:[i.jsx("path",{d:"M6 18L12 4l6 14"}),i.jsx("path",{d:"M8.5 13h7"})]})}function yx({className:e}){return i.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:[i.jsx("path",{d:"M4 18L9 6l5 12"}),i.jsx("path",{d:"M6.2 13h5.6"}),i.jsx("path",{d:"M16 18V9"}),i.jsx("path",{d:"M16 9h5"})]})}function xx({className:e}){return i.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:[i.jsx("path",{d:"M4 20h4"}),i.jsx("path",{d:"M6 20V6"}),i.jsx("path",{d:"M4 6h4"}),i.jsx("path",{d:"M12 20V9"}),i.jsx("path",{d:"M12 9h8"}),i.jsx("path",{d:"M16 9v11"})]})}function wx({className:e}){return i.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:[i.jsx("path",{d:"M4 18V8h3"}),i.jsx("path",{d:"M4 8h8"}),i.jsx("path",{d:"M10 8v10"}),i.jsx("path",{d:"M16 18V12h2"}),i.jsx("path",{d:"M16 12h5"}),i.jsx("path",{d:"M19 12v6"})]})}function Cx({className:e}){return i.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:[i.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"}),i.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"}),i.jsx("path",{d:"M7.07 14.94 4.01 18"})]})}function vx({className:e}){return i.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:[i.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),i.jsx("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),i.jsx("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),i.jsx("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]})}function dc({className:e}){return i.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":"help",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.jsx("path",{d:"M12 17h.01"})]})}function Lp({className:e}){return i.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:[i.jsx("path",{d:"M15.5 4.5l4 4-9 9H6.5v-4.5z"}),i.jsx("path",{d:"M13.5 6.5l4 4"}),i.jsx("path",{d:"M4 20h8"})]})}function kx({className:e}){return i.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:i.jsx("path",{d:"M4 12h16"})})}function Sx({className:e}){return i.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:[i.jsx("path",{d:"M8 8l-4 4 4 4"}),i.jsx("path",{d:"M16 8l4 4-4 4"})]})}function Bp({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),i.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),i.jsx("path",{d:"m21 15-4.5-4.5L7 20"})]})}function Px({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M12 12h8"}),i.jsx("path",{d:"M4 18h16"}),i.jsx("path",{d:"M4 9l4 3-4 3"})]})}function Ax({className:e}){return i.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:[i.jsx("path",{d:"M10 4h9"}),i.jsx("path",{d:"M5 20h9"}),i.jsx("path",{d:"M14 4L8 20"})]})}function Tx({className:e}){return i.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:[i.jsx("circle",{cx:"12",cy:"12",r:"4"}),i.jsx("path",{d:"M12 2v2"}),i.jsx("path",{d:"M12 20v2"}),i.jsx("path",{d:"M4.93 4.93l1.41 1.41"}),i.jsx("path",{d:"M17.66 17.66l1.41 1.41"}),i.jsx("path",{d:"M2 12h2"}),i.jsx("path",{d:"M20 12h2"}),i.jsx("path",{d:"M4.93 19.07l1.41-1.41"}),i.jsx("path",{d:"M17.66 6.34l1.41-1.41"})]})}function Rx({className:e}){return i.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:[i.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"}),i.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 Dx({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h16"}),i.jsx("path",{d:"M4 18h16"})]})}function jx({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 12h5"}),i.jsx("path",{d:"M16 12h5"}),i.jsx("path",{d:"M12 4v16"}),i.jsx("path",{d:"M9 9l3 3-3 3"}),i.jsx("path",{d:"M15 9l-3 3 3 3"})]})}function Fp({className:e}){return i.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:[i.jsx("path",{d:"M10 6h11"}),i.jsx("path",{d:"M10 12h11"}),i.jsx("path",{d:"M10 18h11"}),i.jsx("path",{d:"M4 5v3h2"}),i.jsx("path",{d:"M4 11h2l-2 2h2"}),i.jsx("path",{d:"M4 19h2"}),i.jsx("path",{d:"M4 17h2v2"})]})}function Ix({className:e}){return i.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:[i.jsx("path",{d:"M3 7h6l2 2h10v3"}),i.jsx("path",{d:"M3 10l2.2 9h13.6L21 10H3z"})]})}function Ex({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M12 12h8"}),i.jsx("path",{d:"M4 18h16"}),i.jsx("path",{d:"M8 9l-4 3 4 3"})]})}function _x({className:e}){return i.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:[i.jsx("path",{d:"M4 10h16",strokeDasharray:"3 2"}),i.jsx("path",{d:"M14 10v8"}),i.jsx("path",{d:"M18 14h4v4h-4z"})]})}function mi({className:e}){return i.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:[i.jsx("path",{d:"M6 3h8l6 6v12H6z"}),i.jsx("path",{d:"M14 3v6h6"})]})}function Hp({className:e}){return i.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:[i.jsx("path",{d:"M13 4H9a4 4 0 0 0 0 8h2"}),i.jsx("path",{d:"M15 4v16"}),i.jsx("path",{d:"M11 4v16"})]})}function Mx({className:e}){return i.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:[i.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),i.jsx("path",{d:"M14 2v6h6"}),i.jsx("path",{d:"M8 13h8"}),i.jsx("path",{d:"M8 17h5"})]})}function Nx({className:e}){return i.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:[i.jsx("path",{d:"M5 6h14"}),i.jsx("path",{d:"M5 10h10"}),i.jsx("path",{d:"M5 14h14"}),i.jsx("path",{d:"M5 18h8"})]})}function Lx({className:e}){return i.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:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]})}function Bx({className:e}){return i.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:[i.jsx("path",{d:"M6 9V3h12v6"}),i.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"}),i.jsx("path",{d:"M6 14h12v8H6z"})]})}function Fx({className:e}){return i.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:[i.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),i.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),i.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}function Hx({className:e}){return i.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:[i.jsx("path",{d:"M21 10H10a5 5 0 0 0 0 10h1"}),i.jsx("path",{d:"M17 6l4 4-4 4"})]})}function zx({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Ox({className:e}){return i.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":"ruler",children:[i.jsx("path",{d:"M4 8h16"}),i.jsx("path",{d:"M4 16h16"}),i.jsx("path",{d:"M6 8v8"}),i.jsx("path",{d:"M10 8v4"}),i.jsx("path",{d:"M14 8v6"}),i.jsx("path",{d:"M18 8v8"})]})}function Kx({className:e}){return i.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:[i.jsx("path",{d:"M5 3h11l5 5v13H5V3z"}),i.jsx("path",{d:"M15 3v6H9V3"}),i.jsx("path",{d:"M8 21v-7h8v7"})]})}function mc({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("path",{d:"M9 4v16"}),i.jsx("path",{d:"M15 4v16"}),i.jsx("rect",{x:"9.5",y:"5",width:"5",height:"14",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function lf({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("path",{d:"M9 4v16"}),i.jsx("path",{d:"M15 4v16"})]})}function fc({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("rect",{x:"4",y:"10.5",width:"16",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function $x({className:e}){return i.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:[i.jsx("path",{d:"M6 7.5C6 5.5 8 4 12 4s6 1.5 6 3.5-1.8 2.8-6 3.5"}),i.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"}),i.jsx("path",{d:"M4 12h16"})]})}function Ux({className:e}){return i.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:[i.jsx("path",{d:"M7 4v8a5 5 0 0 0 10 0V4"}),i.jsx("path",{d:"M5 20h14"})]})}function Vx({className:e}){return i.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:[i.jsx("path",{d:"M3 10h11a5 5 0 0 1 0 10h-1"}),i.jsx("path",{d:"M7 6L3 10l4 4"})]})}function Wx({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M12 4v16"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M9 9l-3 3 3 3"}),i.jsx("path",{d:"M15 9l3 3-3 3"})]})}function Gx({className:e}){return i.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:[i.jsx("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"}),i.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function qx({className:e}){return i.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:[i.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3"}),i.jsx("path",{d:"m10 9 6 3-6 3V9Z",fill:"currentColor",stroke:"none"})]})}const ke="---";function cr(e){return e===ke}function zn(e){return typeof e=="object"&&e!==null&&"submenu"in e}const Tu=new Set(["save","open","print","undo","redo","link","bookmark","horizontalRule","pageBreak","insertPageBefore","insertPageAfter","deletePage","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"]),Zx=new Set(["file","edit","view","insert","format","table","help"]),zp="custom",Op="custom";function Kp(e){return`custom:${e}`}function Yx(e){return e==="menu"||e==="both"}function Xx(e){return e==="toolbar"||e==="both"}function $p(e){return e.map(t=>zn(t)?{submenu:t.submenu,items:$p(t.items)}:t)}function Jx(e){return{menus:e.menus.map(t=>({id:t.id,items:$p(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function Up(e){return cr(e)?!0:zn(e)?e.items.every(Up):Tu.has(e)}function Vp(e,t){for(const n of e)if(n===t||zn(n)&&Vp(n.items,t))return!0;return!1}function Qx(e){const t=e.tooltip??e.label;return{id:e.id,command:Kp(e.id),icon:e.icon??px,label:e.label,ariaLabel:e.label,tooltip:t}}function ew(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Zx.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===zp&&!r)e.menus[n]={id:n,labelKey:"menuCustom",ariaKey:"menuCustomAria"};else{const o=r??n;e.menus[n]={id:n,label:o,ariaLabel:o}}t.menus.some(o=>o.id===n)||t.menus.push({id:n,items:[]})}function tw(e,t,n){if(e.groups[n]||(n===Op?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:[]},o=t.iconGroups.findIndex(a=>a.items.includes("fullscreen"));o===-1?t.iconGroups.push(r):t.iconGroups.splice(o,0,r)}}function nw(e,t,n){var a,s;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},o=Jx(n);for(const u of e??[])if(!(Tu.has(u.id)||cr(u.id))){if(r.items[u.id]=Qx(u),Yx(u.showIn)){const d=((a=u.menu)==null?void 0:a.id)??zp;ew(r,o,d,(s=u.menu)==null?void 0:s.label);const f=o.menus.find(h=>h.id===d);if(f&&!Vp(f.items,u.id)){const h=f.items[f.items.length-1];h!==void 0&&!cr(h)&&f.items.every(Up)&&f.items.push(ke),f.items.push(u.id)}}if(Xx(u.showIn)){const d=u.toolbarGroup??Op;tw(r,o,d);const f=o.iconGroups.find(h=>h.id===d);f&&!f.items.includes(u.id)&&f.items.push(u.id)}}return{catalog:r,layout:o}}function rw(e,t,n){const r={};for(const o of e??[])Tu.has(o.id)||cr(o.id)||(r[Kp(o.id)]=()=>{n==null||n(),o.onAction(t())});return r}function ow(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const iw="_chrome_boy0f_1",aw={chrome:iw},Wp=l.createContext(!1);function sw({dark:e,children:t}){return i.jsx(Wp.Provider,{value:e,children:t})}function Gp(){return l.useContext(Wp)}function zc(e){return{className:aw.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function Pe({children:e}){const t=Gp(),n=zc(t);return Au.createPortal(i.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function Ru(e,t){const n=e[t];n==null||n()}const To={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",htmlModePageTab:"Page {n}",htmlModePageTabsAria:"HTML source pages",htmlModePageTabsScrollLeftAria:"Scroll page tabs left",htmlModePageTabsScrollRightAria:"Scroll page tabs right",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",commandPageBackgroundImage:"Page background image",commandPageBackgroundImageAria:"Insert page background image",commandParagraphBackgroundImage:"Paragraph background image",commandParagraphBackgroundImageAria:"Insert paragraph background 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",menuInsertPage:"Page",menuInsertPageAria:"Insert page submenu",commandInsertPageBefore:"Page before",commandInsertPageBeforeAria:"Insert page before selected page",commandInsertPageAfter:"Page after",commandInsertPageAfterAria:"Insert page after selected page",commandTableProperties:"Table properties…",commandTablePropertiesAria:"Table properties",commandCellProperties:"Cell properties…",commandCellPropertiesAria:"Cell properties",commandRowProperties:"Row properties…",commandRowPropertiesAria:"Row properties",commandInsertRowBelow:"Insert row below",commandInsertRowBelowAria:"Insert row below",commandInsertRowBefore:"Insert row above",commandInsertRowBeforeAria:"Insert row above",commandDeleteRow:"Delete row",commandDeleteRowAria:"Delete row",commandInsertColumnAfter:"Insert column right",commandInsertColumnAfterAria:"Insert column right",commandInsertColumnBefore:"Insert column left",commandInsertColumnBeforeAria:"Insert column left",commandDeleteColumn:"Delete column",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",commandBackgroundImageProperties:"Background image properties…",commandBackgroundImagePropertiesAria:"Background image properties",commandDeletePage:"Delete page",commandDeletePageAria:"Delete selected page",deletePageDialogTitle:"Delete page",deletePageDialogCloseAria:"Close",deletePageConfirmMessage:"Are you sure you want to delete the selected page?",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",commandRuler:"Ruler",commandRulerAria:"Show or hide rulers",rulerMarginLeft:"Left margin",rulerMarginRight:"Right margin",rulerMarginTop:"Top margin",rulerMarginBottom:"Bottom margin",rulerFirstLineIndent:"First line indent",rulerLeftIndent:"Left indent",rulerRightIndent:"Right indent",commentPanelTitle:"Comment",commentPlaceholder:"Write a comment…",commentReplyPlaceholder:"Write a reply…",commentPost:"Post",commentEmpty:"No messages yet.",commentPanelCloseAria:"Close comment panel",menuHelp:"Help",menuHelpAria:"Help menu",commandEditorHelp:"Editor Help",commandEditorHelpAria:"Open editor help",commandKeyboardShortcuts:"Keyboard shortcuts",commandKeyboardShortcutsAria:"Open keyboard shortcuts help",commandAbout:"About",commandAboutAria:"About this editor",helpDialogTitle:"Help",helpDialogCloseAria:"Close help",helpDialogSearchPlaceholder:"Search help topics…",helpDialogSearchAria:"Search help",helpDialogContentsAria:"Help contents",helpDialogNoResults:"No help topics match your search.",helpDialogRelatedTitle:"Related topics",aboutDialogTitle:"About",aboutDialogCloseAria:"Close about dialog",aboutDialogClose:"Close",aboutDialogVersion:"Version {version}",aboutDialogDescription:"CommsPliant HTML editor is a reusable React WYSIWYG component with Visual and HTML editing modes. Licensed under the MIT License.",aboutDialogWebsiteCta:"See what we're building for regulated communication solutions.",aboutDialogWebsite:"Visit commspliant.com",aboutDialogWebsiteAria:"Visit CommsPliant — regulated communication management",helpCategoryGetStarted:"Get started",helpCategoryFile:"File",helpCategoryEdit:"Edit",helpCategoryInsert:"Insert",helpCategoryFormat:"Format",helpCategoryTable:"Table",helpCategoryView:"View",helpCategoryKeyboard:"Keyboard",helpTopicGetStartedTitle:"How do I use this editor?",helpTopicGetStartedBody:`1. Type in the visual editing area.
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("react"),Au=require("react-dom");function lx({className:e}){return i.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:[i.jsx("path",{d:"M9 18V5l12-2v13"}),i.jsx("circle",{cx:"6",cy:"18",r:"3"}),i.jsx("circle",{cx:"18",cy:"16",r:"3"})]})}function As({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M7 12h10"}),i.jsx("path",{d:"M4 18h16"})]})}function Ep({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h16"}),i.jsx("path",{d:"M4 18h16"})]})}function Ts({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h10"}),i.jsx("path",{d:"M4 18h16"})]})}function Rs({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M10 12h10"}),i.jsx("path",{d:"M4 18h16"})]})}function cx({className:e}){return i.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:[i.jsx("path",{d:"M7 5h6.5a3.5 3.5 0 0 1 0 7H7z"}),i.jsx("path",{d:"M7 12h7.5a3.5 3.5 0 0 1 0 7H7z"}),i.jsx("path",{d:"M7 5v14"})]})}function ux({className:e}){return i.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:i.jsx("path",{d:"M6 4h12a1 1 0 0 1 1 1v16l-7-4-7 4V5a1 1 0 0 1 1-1z"})})}function _p({className:e}){return i.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:[i.jsx("path",{d:"M9 6h12"}),i.jsx("path",{d:"M9 12h12"}),i.jsx("path",{d:"M9 18h12"}),i.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"})]})}function dx({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M12 4v16"}),i.jsx("rect",{x:"12.5",y:"4.5",width:"8",height:"7",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function mx({className:e}){return i.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:[i.jsx("path",{d:"M4 5h12"}),i.jsx("path",{d:"M10 5v8"}),i.jsx("path",{d:"m14 15 6 6"}),i.jsx("path",{d:"m20 15-6 6"})]})}function Ge({className:e}){return i.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:[i.jsx("path",{d:"M18 6L6 18"}),i.jsx("path",{d:"M6 6l12 12"})]})}function sf({className:e}){return i.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:i.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 fx({className:e}){return i.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:[i.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"}),i.jsx("path",{d:"M8 9h8M8 13h5"})]})}function Mp({className:e}){return i.jsx("svg",{className:e,viewBox:"0 0 616.23 542.09",width:"45",height:"40","aria-hidden":"true","data-icon":"commspliant-shield",children:i.jsxs("g",{transform:"translate(129.79555,688.75474)",children:[i.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"}),i.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"}),i.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"}),i.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"}),i.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 px({className:e}){return i.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:[i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),i.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"}),i.jsx("path",{d:"M10.5 14v.5"}),i.jsx("path",{d:"M15 10v4"}),i.jsx("path",{d:"M13 12h4"})]})}function gx({className:e}){return i.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:[i.jsx("path",{d:"M8 6h12"}),i.jsx("path",{d:"M8 12h12"}),i.jsx("path",{d:"M8 18h8"}),i.jsx("path",{d:"M4 6h.01"}),i.jsx("path",{d:"M4 12h.01"}),i.jsx("path",{d:"M4 18h.01"})]})}function hx({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"7",height:"7",rx:"1"}),i.jsx("rect",{x:"14",y:"4",width:"7",height:"7",rx:"1"}),i.jsx("rect",{x:"3",y:"13",width:"7",height:"7",rx:"1"}),i.jsx("rect",{x:"14",y:"13",width:"7",height:"7",rx:"1"})]})}function bx({className:e}){return i.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:i.jsx("path",{d:"M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z"})})}function Np({className:e}){return i.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:[i.jsx("path",{d:"M6 18L12 4l6 14"}),i.jsx("path",{d:"M8.5 13h7"})]})}function yx({className:e}){return i.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:[i.jsx("path",{d:"M4 18L9 6l5 12"}),i.jsx("path",{d:"M6.2 13h5.6"}),i.jsx("path",{d:"M16 18V9"}),i.jsx("path",{d:"M16 9h5"})]})}function xx({className:e}){return i.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:[i.jsx("path",{d:"M4 20h4"}),i.jsx("path",{d:"M6 20V6"}),i.jsx("path",{d:"M4 6h4"}),i.jsx("path",{d:"M12 20V9"}),i.jsx("path",{d:"M12 9h8"}),i.jsx("path",{d:"M16 9v11"})]})}function wx({className:e}){return i.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:[i.jsx("path",{d:"M4 18V8h3"}),i.jsx("path",{d:"M4 8h8"}),i.jsx("path",{d:"M10 8v10"}),i.jsx("path",{d:"M16 18V12h2"}),i.jsx("path",{d:"M16 12h5"}),i.jsx("path",{d:"M19 12v6"})]})}function Cx({className:e}){return i.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:[i.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"}),i.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"}),i.jsx("path",{d:"M7.07 14.94 4.01 18"})]})}function vx({className:e}){return i.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:[i.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),i.jsx("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),i.jsx("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),i.jsx("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]})}function dc({className:e}){return i.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":"help",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.jsx("path",{d:"M12 17h.01"})]})}function Lp({className:e}){return i.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:[i.jsx("path",{d:"M15.5 4.5l4 4-9 9H6.5v-4.5z"}),i.jsx("path",{d:"M13.5 6.5l4 4"}),i.jsx("path",{d:"M4 20h8"})]})}function kx({className:e}){return i.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:i.jsx("path",{d:"M4 12h16"})})}function Sx({className:e}){return i.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:[i.jsx("path",{d:"M8 8l-4 4 4 4"}),i.jsx("path",{d:"M16 8l4 4-4 4"})]})}function Bp({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),i.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),i.jsx("path",{d:"m21 15-4.5-4.5L7 20"})]})}function Px({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M12 12h8"}),i.jsx("path",{d:"M4 18h16"}),i.jsx("path",{d:"M4 9l4 3-4 3"})]})}function Ax({className:e}){return i.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:[i.jsx("path",{d:"M10 4h9"}),i.jsx("path",{d:"M5 20h9"}),i.jsx("path",{d:"M14 4L8 20"})]})}function Tx({className:e}){return i.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:[i.jsx("circle",{cx:"12",cy:"12",r:"4"}),i.jsx("path",{d:"M12 2v2"}),i.jsx("path",{d:"M12 20v2"}),i.jsx("path",{d:"M4.93 4.93l1.41 1.41"}),i.jsx("path",{d:"M17.66 17.66l1.41 1.41"}),i.jsx("path",{d:"M2 12h2"}),i.jsx("path",{d:"M20 12h2"}),i.jsx("path",{d:"M4.93 19.07l1.41-1.41"}),i.jsx("path",{d:"M17.66 6.34l1.41-1.41"})]})}function Rx({className:e}){return i.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:[i.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"}),i.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 Dx({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h16"}),i.jsx("path",{d:"M4 18h16"})]})}function Ix({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 12h5"}),i.jsx("path",{d:"M16 12h5"}),i.jsx("path",{d:"M12 4v16"}),i.jsx("path",{d:"M9 9l3 3-3 3"}),i.jsx("path",{d:"M15 9l-3 3 3 3"})]})}function Fp({className:e}){return i.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:[i.jsx("path",{d:"M10 6h11"}),i.jsx("path",{d:"M10 12h11"}),i.jsx("path",{d:"M10 18h11"}),i.jsx("path",{d:"M4 5v3h2"}),i.jsx("path",{d:"M4 11h2l-2 2h2"}),i.jsx("path",{d:"M4 19h2"}),i.jsx("path",{d:"M4 17h2v2"})]})}function jx({className:e}){return i.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:[i.jsx("path",{d:"M3 7h6l2 2h10v3"}),i.jsx("path",{d:"M3 10l2.2 9h13.6L21 10H3z"})]})}function Ex({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M12 12h8"}),i.jsx("path",{d:"M4 18h16"}),i.jsx("path",{d:"M8 9l-4 3 4 3"})]})}function _x({className:e}){return i.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:[i.jsx("path",{d:"M4 10h16",strokeDasharray:"3 2"}),i.jsx("path",{d:"M14 10v8"}),i.jsx("path",{d:"M18 14h4v4h-4z"})]})}function mi({className:e}){return i.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:[i.jsx("path",{d:"M6 3h8l6 6v12H6z"}),i.jsx("path",{d:"M14 3v6h6"})]})}function Hp({className:e}){return i.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:[i.jsx("path",{d:"M13 4H9a4 4 0 0 0 0 8h2"}),i.jsx("path",{d:"M15 4v16"}),i.jsx("path",{d:"M11 4v16"})]})}function Mx({className:e}){return i.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:[i.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),i.jsx("path",{d:"M14 2v6h6"}),i.jsx("path",{d:"M8 13h8"}),i.jsx("path",{d:"M8 17h5"})]})}function Nx({className:e}){return i.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:[i.jsx("path",{d:"M5 6h14"}),i.jsx("path",{d:"M5 10h10"}),i.jsx("path",{d:"M5 14h14"}),i.jsx("path",{d:"M5 18h8"})]})}function Lx({className:e}){return i.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:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]})}function Bx({className:e}){return i.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:[i.jsx("path",{d:"M6 9V3h12v6"}),i.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"}),i.jsx("path",{d:"M6 14h12v8H6z"})]})}function Fx({className:e}){return i.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:[i.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),i.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),i.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}function Hx({className:e}){return i.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:[i.jsx("path",{d:"M21 10H10a5 5 0 0 0 0 10h1"}),i.jsx("path",{d:"M17 6l4 4-4 4"})]})}function zx({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Ox({className:e}){return i.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":"ruler",children:[i.jsx("path",{d:"M4 8h16"}),i.jsx("path",{d:"M4 16h16"}),i.jsx("path",{d:"M6 8v8"}),i.jsx("path",{d:"M10 8v4"}),i.jsx("path",{d:"M14 8v6"}),i.jsx("path",{d:"M18 8v8"})]})}function Kx({className:e}){return i.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:[i.jsx("path",{d:"M5 3h11l5 5v13H5V3z"}),i.jsx("path",{d:"M15 3v6H9V3"}),i.jsx("path",{d:"M8 21v-7h8v7"})]})}function mc({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("path",{d:"M9 4v16"}),i.jsx("path",{d:"M15 4v16"}),i.jsx("rect",{x:"9.5",y:"5",width:"5",height:"14",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function lf({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("path",{d:"M9 4v16"}),i.jsx("path",{d:"M15 4v16"})]})}function fc({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("rect",{x:"4",y:"10.5",width:"16",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function $x({className:e}){return i.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:[i.jsx("path",{d:"M6 7.5C6 5.5 8 4 12 4s6 1.5 6 3.5-1.8 2.8-6 3.5"}),i.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"}),i.jsx("path",{d:"M4 12h16"})]})}function Ux({className:e}){return i.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:[i.jsx("path",{d:"M7 4v8a5 5 0 0 0 10 0V4"}),i.jsx("path",{d:"M5 20h14"})]})}function Vx({className:e}){return i.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:[i.jsx("path",{d:"M3 10h11a5 5 0 0 1 0 10h-1"}),i.jsx("path",{d:"M7 6L3 10l4 4"})]})}function Wx({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M12 4v16"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M9 9l-3 3 3 3"}),i.jsx("path",{d:"M15 9l3 3-3 3"})]})}function Gx({className:e}){return i.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:[i.jsx("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"}),i.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function qx({className:e}){return i.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:[i.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3"}),i.jsx("path",{d:"m10 9 6 3-6 3V9Z",fill:"currentColor",stroke:"none"})]})}const ke="---";function cr(e){return e===ke}function zn(e){return typeof e=="object"&&e!==null&&"submenu"in e}const Tu=new Set(["save","open","print","undo","redo","link","bookmark","horizontalRule","pageBreak","insertPageBefore","insertPageAfter","deletePage","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"]),Zx=new Set(["file","edit","view","insert","format","table","help"]),zp="custom",Op="custom";function Kp(e){return`custom:${e}`}function Yx(e){return e==="menu"||e==="both"}function Xx(e){return e==="toolbar"||e==="both"}function $p(e){return e.map(t=>zn(t)?{submenu:t.submenu,items:$p(t.items)}:t)}function Jx(e){return{menus:e.menus.map(t=>({id:t.id,items:$p(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function Up(e){return cr(e)?!0:zn(e)?e.items.every(Up):Tu.has(e)}function Vp(e,t){for(const n of e)if(n===t||zn(n)&&Vp(n.items,t))return!0;return!1}function Qx(e){const t=e.tooltip??e.label;return{id:e.id,command:Kp(e.id),icon:e.icon??px,label:e.label,ariaLabel:e.label,tooltip:t}}function ew(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Zx.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===zp&&!r)e.menus[n]={id:n,labelKey:"menuCustom",ariaKey:"menuCustomAria"};else{const o=r??n;e.menus[n]={id:n,label:o,ariaLabel:o}}t.menus.some(o=>o.id===n)||t.menus.push({id:n,items:[]})}function tw(e,t,n){if(e.groups[n]||(n===Op?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:[]},o=t.iconGroups.findIndex(a=>a.items.includes("fullscreen"));o===-1?t.iconGroups.push(r):t.iconGroups.splice(o,0,r)}}function nw(e,t,n){var a,s;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},o=Jx(n);for(const u of e??[])if(!(Tu.has(u.id)||cr(u.id))){if(r.items[u.id]=Qx(u),Yx(u.showIn)){const d=((a=u.menu)==null?void 0:a.id)??zp;ew(r,o,d,(s=u.menu)==null?void 0:s.label);const f=o.menus.find(h=>h.id===d);if(f&&!Vp(f.items,u.id)){const h=f.items[f.items.length-1];h!==void 0&&!cr(h)&&f.items.every(Up)&&f.items.push(ke),f.items.push(u.id)}}if(Xx(u.showIn)){const d=u.toolbarGroup??Op;tw(r,o,d);const f=o.iconGroups.find(h=>h.id===d);f&&!f.items.includes(u.id)&&f.items.push(u.id)}}return{catalog:r,layout:o}}function rw(e,t,n){const r={};for(const o of e??[])Tu.has(o.id)||cr(o.id)||(r[Kp(o.id)]=()=>{n==null||n(),o.onAction(t())});return r}function ow(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const iw="_chrome_boy0f_1",aw={chrome:iw},Wp=l.createContext(!1);function sw({dark:e,children:t}){return i.jsx(Wp.Provider,{value:e,children:t})}function Gp(){return l.useContext(Wp)}function zc(e){return{className:aw.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function Pe({children:e}){const t=Gp(),n=zc(t);return Au.createPortal(i.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function Ru(e,t){const n=e[t];n==null||n()}const To={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",htmlModePageTab:"Page {n}",htmlModePageTabsAria:"HTML source pages",htmlModePageTabsScrollLeftAria:"Scroll page tabs left",htmlModePageTabsScrollRightAria:"Scroll page tabs right",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",commandPageBackgroundImage:"Page background image",commandPageBackgroundImageAria:"Insert page background image",commandParagraphBackgroundImage:"Paragraph background image",commandParagraphBackgroundImageAria:"Insert paragraph background 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",menuInsertPage:"Page",menuInsertPageAria:"Insert page submenu",commandInsertPageBefore:"Page before",commandInsertPageBeforeAria:"Insert page before selected page",commandInsertPageAfter:"Page after",commandInsertPageAfterAria:"Insert page after selected page",commandTableProperties:"Table properties…",commandTablePropertiesAria:"Table properties",commandCellProperties:"Cell properties…",commandCellPropertiesAria:"Cell properties",commandRowProperties:"Row properties…",commandRowPropertiesAria:"Row properties",commandInsertRowBelow:"Insert row below",commandInsertRowBelowAria:"Insert row below",commandInsertRowBefore:"Insert row above",commandInsertRowBeforeAria:"Insert row above",commandDeleteRow:"Delete row",commandDeleteRowAria:"Delete row",commandInsertColumnAfter:"Insert column right",commandInsertColumnAfterAria:"Insert column right",commandInsertColumnBefore:"Insert column left",commandInsertColumnBeforeAria:"Insert column left",commandDeleteColumn:"Delete column",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",commandBackgroundImageProperties:"Background image properties…",commandBackgroundImagePropertiesAria:"Background image properties",commandDeletePage:"Delete page",commandDeletePageAria:"Delete selected page",deletePageDialogTitle:"Delete page",deletePageDialogCloseAria:"Close",deletePageConfirmMessage:"Are you sure you want to delete the selected page?",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",commandRuler:"Ruler",commandRulerAria:"Show or hide rulers",rulerMarginLeft:"Left margin",rulerMarginRight:"Right margin",rulerMarginTop:"Top margin",rulerMarginBottom:"Bottom margin",rulerFirstLineIndent:"First line indent",rulerLeftIndent:"Left indent",rulerRightIndent:"Right indent",commentPanelTitle:"Comment",commentPlaceholder:"Write a comment…",commentReplyPlaceholder:"Write a reply…",commentPost:"Post",commentEmpty:"No messages yet.",commentPanelCloseAria:"Close comment panel",menuHelp:"Help",menuHelpAria:"Help menu",commandEditorHelp:"Editor Help",commandEditorHelpAria:"Open editor help",commandKeyboardShortcuts:"Keyboard shortcuts",commandKeyboardShortcutsAria:"Open keyboard shortcuts help",commandAbout:"About",commandAboutAria:"About this editor",helpDialogTitle:"Help",helpDialogCloseAria:"Close help",helpDialogSearchPlaceholder:"Search help topics…",helpDialogSearchAria:"Search help",helpDialogContentsAria:"Help contents",helpDialogNoResults:"No help topics match your search.",helpDialogRelatedTitle:"Related topics",aboutDialogTitle:"About",aboutDialogCloseAria:"Close about dialog",aboutDialogClose:"Close",aboutDialogVersion:"Version {version}",aboutDialogDescription:"CommsPliant HTML editor is a reusable React WYSIWYG component with Visual and HTML editing modes. Licensed under the MIT License.",aboutDialogWebsiteCta:"See what we're building for regulated communication solutions.",aboutDialogWebsite:"Visit commspliant.com",aboutDialogWebsiteAria:"Visit CommsPliant — regulated communication management",helpCategoryGetStarted:"Get started",helpCategoryFile:"File",helpCategoryEdit:"Edit",helpCategoryInsert:"Insert",helpCategoryFormat:"Format",helpCategoryTable:"Table",helpCategoryView:"View",helpCategoryKeyboard:"Keyboard",helpTopicGetStartedTitle:"How do I use this editor?",helpTopicGetStartedBody:`1. Type in the visual editing area.
2
2
  2. Use the menu bar and icon toolbar for formatting and inserts.
3
3
  3. Open Help → Editor Help (or press F1) anytime you need guidance.`,helpTopicGetStartedKeywords:"start basics toolbar menu",helpTopicSwitchModesTitle:"How do I switch between Visual and HTML?",helpTopicSwitchModesBody:`1. Open View → Visual for WYSIWYG editing.
4
4
  2. Open View → HTML to edit the source directly.
@@ -136,10 +136,10 @@ Tachado: Ctrl+Mayús+X
136
136
  Imprimir: Ctrl+P | Salto de página: Ctrl+Intro
137
137
  Tabla: Tab / Mayús+Tab
138
138
  Salir de pantalla completa o cerrar paneles: Escape
139
- Abrir Ayuda: F1`,helpTopicKeyboardShortcutsKeywords:"atajos teclado",commandCompatibilityCheck:"Compatibilidad",commandCompatibilityCheckAria:"Comprobar compatibilidad del documento",capabilitiesPanelTitle:"Compatibilidad",capabilitiesPanelCloseAria:"Cerrar panel de compatibilidad",capabilitiesPanelEmpty:"No se encontraron problemas de compatibilidad.",capabilitiesPanelSummary:"{errors} errores, {warnings} advertencias",capabilitiesPanelErrors:"Errores",capabilitiesPanelWarnings:"Advertencias",capabilitiesViolationPage:"Página",capabilitiesViolationDisallowedTag:"Elemento no permitido: <{tag}>",capabilitiesViolationUnknownTag:"Elemento desconocido: <{tag}>",capabilitiesViolationRestrictedTag:"Elemento restringido: <{tag}>",capabilitiesViolationMissingRequiredAttribute:'<{tag}> falta el atributo obligatorio {attribute}="{expected}"',capabilitiesViolationUnknownAttribute:"<{tag}> tiene el atributo no permitido {attribute}",capabilitiesViolationTagDisallowedCss:"<{tag}> usa la propiedad CSS no permitida {property}",capabilitiesViolationMissingForcedCss:"<{tag}> debe incluir {property}: {expected}",capabilitiesViolationCssDisallowed:"Propiedad CSS no permitida: {property}",capabilitiesViolationCssRestricted:"Propiedad CSS restringida: {property}",capabilitiesViolationCssWrongTag:"CSS {property} no está permitido en <{tag}> (permitido en: {allowedTags})",capabilitiesViolationCssValueNotAllowed:"Valor CSS {property} no permitido: {value}",capabilitiesViolationContainerWidthExceeded:"Ancho del contenedor {width}px supera el máximo {max}px"},lw={en:To,es:qp},Zp=l.createContext(e=>To[e]),Yp=l.createContext("en");function cw({locale:e="en",children:t}){const n=l.useMemo(()=>{const r=lw[e]??To;return o=>r[o]},[e]);return i.jsx(Yp.Provider,{value:e,children:i.jsx(Zp.Provider,{value:n,children:t})})}function J(){return l.useContext(Zp)}function uw(){return l.useContext(Yp)}const dw="_menu_c1m45_1",mw="_item_c1m45_19",fw="_separator_c1m45_59",pc={menu:dw,item:mw,separator:fw},za=8,pw=[{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:"item",command:"addComment",labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:(e,t)=>t.canAddComment&&(e==="text"||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:"openPageProperties",labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openPageBackgroundImage",labelKey:"commandBackgroundImageProperties",ariaKey:"commandBackgroundImagePropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"deletePage",labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:(e,t)=>t.canDeletePage},{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 gw(e,t,n){const r=[];let o=!1;for(const a of pw){if(a.type==="separator"){r.length>0&&(o=!0);continue}n!=null&&n.has(a.command)||a.enabled(e,t)&&(o&&(r.push({type:"separator"}),o=!1),r.push(a))}return r}function cf(){return'[role="menuitem"]:not(:disabled)'}function hw({open:e,x:t,y:n,kind:r,inTable:o=!1,canMergeCells:a=!1,canUnmergeCells:s=!1,canDeletePage:u=!1,canAddComment:d=!1,hiddenCommands:f,commands:h,onClose:g}){const y=J(),b=l.useId(),w=l.useRef(null);if(l.useLayoutEffect(()=>{var D;if(!e)return;const k=w.current;if(!k)return;const v=k.getBoundingClientRect(),A=Math.max(za,Math.min(t,window.innerWidth-v.width-za)),j=Math.max(za,Math.min(n,window.innerHeight-v.height-za));k.style.left=`${A}px`,k.style.top=`${j}px`,(D=k.querySelector(cf()))==null||D.focus()},[e,t,n,r]),l.useEffect(()=>{if(!e)return;const k=D=>{var R;(R=w.current)!=null&&R.contains(D.target)||g()},v=D=>{D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),g())},A=()=>{g()},j=D=>{var R;if((R=w.current)!=null&&R.contains(D.target)){D.preventDefault();return}D.defaultPrevented||g()};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",v,!0),window.addEventListener("scroll",A,!0),document.addEventListener("contextmenu",j),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",v,!0),window.removeEventListener("scroll",A,!0),document.removeEventListener("contextmenu",j)}},[e,g]),!e)return null;const x=gw(r,{inTable:o,canMergeCells:a,canUnmergeCells:s,canDeletePage:u,canAddComment:d},f),S=k=>{var R;if(k.key!=="ArrowDown"&&k.key!=="ArrowUp")return;const v=[...((R=w.current)==null?void 0:R.querySelectorAll(cf()))??[]];if(v.length===0)return;const A=v.indexOf(document.activeElement),j=k.key==="ArrowDown"?1:-1,D=v[(A+j+v.length)%v.length];k.preventDefault(),D==null||D.focus()};return i.jsx(Pe,{children:i.jsxs("div",{ref:w,className:pc.menu,role:"menu","aria-labelledby":b,style:{left:t,top:n},onMouseDown:k=>k.preventDefault(),onKeyDown:S,children:[i.jsx("span",{id:b,hidden:!0,children:y("contextMenuAria")}),x.map((k,v)=>k.type==="separator"?i.jsx("div",{role:"separator",className:pc.separator},`separator-${v}`):i.jsx("button",{type:"button",role:"menuitem",className:pc.item,"aria-label":y(k.ariaKey),onClick:()=>{g(),Ru(h,k.command)},children:y(k.labelKey)},k.command))]})})}function bw(e){return e==="touch"||e==="pen"}function yw(e,t){return e.button===2||e.ctrlKey?!0:!bw(t)}const xw=new Set(["span","strong","b","em","i","u","s","strike","del"]);function Te(e,t){return t?e===t||e.contains(t):!1}function Pn(e){return xw.has(e.tagName.toLowerCase())}function ww(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 _t(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 o;for(;o=r.nextNode();)o.nodeValue&&ww(e,o)&&n.push(o);return n}function kn(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType===Node.TEXT_NODE){const a=t;if(n>0&&n<a.length){const s=a.splitText(n);e.setStart(s,0),e.endContainer===a&&e.setEnd(s,e.endOffset-n)}}const r=e.endContainer,o=e.endOffset;if(r.nodeType===Node.TEXT_NODE){const a=r;o>0&&o<a.length&&(a.splitText(o),e.setEnd(a,a.length))}}function gr(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function Ot(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function hr(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<=-1||n.length===1)return;const o=e.parentNode;if(!o)return;const a=n.slice(0,r),s=n.slice(r+1);if(a.length>0){const u=e.cloneNode(!1);for(const d of a)u.appendChild(d);o.insertBefore(u,e)}if(s.length>0){const u=e.cloneNode(!1);for(const d of s)u.appendChild(d);o.insertBefore(u,e.nextSibling)}}function Ur(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 o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)}function Di(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 Ds="data-wysiwyg-font",Cw=[{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 zr(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function ji(e,t){return e===t?!0:!e||!t?!1:zr(e)===zr(t)}function Xp(e=[]){var r;const t=[],n=new Set;for(const o of[...Cw,...e]){const a=o.family.trim();if(!a)continue;const s=zr(a);if(n.has(s))continue;n.add(s);const u=(r=o.css)==null?void 0:r.trim();t.push({name:o.name.trim()||a,family:a,...u?{css:u}:{}})}return t}function vw(e,t){return e?t.find(n=>ji(n.family,e))??null:null}function kw(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Sw(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function js(e){const t=new Set,n=[];for(const r of e){const o=r.trim();!o||!kw(o)||t.has(o)||(t.add(o),n.push(o))}return n}function Pw(e){return e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&amp;/g,"&")}const Aw=new RegExp(`<link\\b[^>]*\\b${Ds}\\b[^>]*>`,"gi");function he(e){if(!e.includes(Ds))return{hrefs:[],body:e};const t=[],n=e.replace(Aw,r=>{var a,s;const o=((a=r.match(/\bhref\s*=\s*"([^"]*)"/i))==null?void 0:a[1])??((s=r.match(/\bhref\s*=\s*'([^']*)'/i))==null?void 0:s[1]);return o&&t.push(Pw(o)),""});return{hrefs:js(t),body:n}}function ri(e,t){const n=js(t);return n.length===0?e:`${n.map(o=>`<link rel="stylesheet" href="${Sw(o)}" ${Ds}="">`).join("")}${e}`}function Du(e){return e.style.fontFamily.trim()||null}const Tw=32,li=new Map;function Jp(e,t){return`${zr(t)}\0${e}`}function Rw(e,t){return li.get(Jp(e,t))}function gc(e,t,n){const r=Jp(e,t);if(li.size>=Tw){const o=li.keys().next().value;o!==void 0&&li.delete(o)}li.set(r,n)}function Qp(e,t){const n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let r=n.currentNode;for(;r;){if(r instanceof HTMLElement){const o=Du(r);if(o&&zr(o)===t)return!0}r=n.nextNode()}return!1}function Dw(e,t){const n=zr(t);return n?Qp(e,n):!1}function jw(e,t){const n=zr(t);if(!n)return!1;const r=Rw(e,t);if(r!==void 0)return r;const o=e.toLowerCase();if(!o.includes("font-family")&&!o.includes("face="))return gc(e,t,!1),!1;const a=n.split(",")[0].replace(/['"]/g,"").trim().toLowerCase();if(a&&!o.includes(a))return gc(e,t,!1),!1;const s=new DOMParser().parseFromString(e,"text/html"),u=Qp(s.body,n);return gc(e,t,u),u}function Oa(e,t,n=[],r){const o=he(t).hrefs,a=n.filter(s=>s.css?r!=null&&r.liveRoot?Dw(r.liveRoot,s.family):jw(e,s.family):!1).map(s=>s.css??"");return js([...o,...a])}function uf(e,t=[]){const n=he(e).hrefs,r=t.map(o=>o.css??"");return js([...n,...r])}function Iw(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function ju(e,t){let n=Iw(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Du(n);if(r)return r;n=n.parentElement}return null}function Oc(e){return e instanceof HTMLElement&&Du(e)!==null}function Iu(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function Ew(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Pn(r)||!Oc(r)){n=r;continue}if(hr(r,n),Oc(r)&&(Iu(r),gr(r))){Ot(r);continue}n=r}}function eg(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function tg(e){const t=eg(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:_t(t).filter(u=>u.data.length>0),o=(n.length>0?n:[t.startContainer]).map(u=>ju(e,u)),a=o[0]??null;return o.every(u=>ji(u,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function Kc(e,t){const n=eg(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;kn(n);const o=_t(n).filter(a=>a.data.length>0);for(const a of o){const s=ju(e,a);if(r===null){if(s===null)continue;Ew(e,a);continue}ji(s,r)||Di(a,u=>{u.style.fontFamily=r})}return Ur(o),!0}function _w(e,t){if(t){if(t.value===null){Iu(e);return}e.style.fontFamily=t.value}}function Mw(e){return e!=null}function Nw(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 o=r.splitText(n);e.setStart(o,0),e.collapse(!0)}function Lw(e){var r,o,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 s=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(s,e.startContainer.nextSibling),s}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const s=document.createTextNode("");return(o=e.startContainer.parentNode)==null||o.insertBefore(s,e.startContainer),s}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function $c(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Pn(r)||!Oc(r)){n=r;continue}if(hr(r,n),Iu(r),gr(r)){Ot(r);continue}n=r.isConnected?r:t}return t}function Bw(e,t){Nw(t);const n=Lw(t);return $c(e,n)}function Fw(e,t,n){return!!(n&&n.value===null&&ju(e,t))}const Eu=["pt","px","em","rem","%"],xo="pt",Hw={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]},zw={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},Ow=new Set(Eu),Kw=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function Is(e){return Ow.has(e)}function at(e){return Math.round(e*100)/100}function be(e){const t=at(e);return Number.isInteger(t),String(t)}function _u(e,t){return`${be(e)}${t}`}function Mu(e){const t=e.trim();if(!t)return null;const n=t.match(Kw);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return{value:r,unit:o}}function $w(e,t){const n=e.trim();if(!n)return null;const r=Mu(n);if(r)return Is(r.unit)?Fr(r.value,r.unit):null;const o=Number(n.replace(",","."));return Number.isFinite(o)?Fr(o,t):null}function Fr(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=zw[t];return{value:at(Math.min(r,Math.max(n,e))),unit:t}}function ng(e,t,n,r){const o=n>0?n:16,a=r>0?r:16;switch(t){case"px":return at(e);case"pt":return at(e*.75);case"em":return at(e/o);case"rem":return at(e/a);case"%":return at(e/o*100)}}function Uw(e,t,n,r){const o=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*o;case"rem":return e*a;case"%":return e/100*o}}function rg(e,t,n,r,o){if(t===n)return at(e);const a=Uw(e,t,r,o);return ng(a,n,r,o)}const Nu="pt",Vw=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,Ww=/^[+-]?0(?:\.0+)?$/;function Ie(e){return`${be(e.value)}${e.unit}`}function vt(e){const t=e.trim();if(!t)return null;if(Ww.test(t))return{value:0,unit:"px"};const n=t.match(Vw);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return Is(o)?{value:at(r),unit:o}:null}function xi(e,t,n){const r=e.trim();if(!r)return null;const o=vt(r);if(o)return!n&&o.value<0?{...o,value:0}:o;const a=Number(r.replace(",","."));return Number.isFinite(a)?!n&&a<0?{value:0,unit:t}:{value:at(a),unit:t}:null}function br(e){return e.value>=0?e:{value:0,unit:e.unit}}function Yt(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function Ka(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function Gw(e,t){return t?e===t||e.contains(t):!1}function df(e,t){var a;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=0,o;for(;o=n.nextNode();){if(o===t||t.contains(o)||t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)return r;r+=((a=o.textContent)==null?void 0:a.length)??0}return r}function mf(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return df(e,t)+n;let r=0;const o=t.childNodes;for(let s=0;s<n&&s<o.length;s+=1)r+=((a=o[s].textContent)==null?void 0:a.length)??0;return df(e,t)+r}function ff(e,t){var s,u;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=Math.max(0,t),o,a=null;for(;o=n.nextNode();){a=o;const d=((s=o.textContent)==null?void 0:s.length)??0;if(r<=d)return{node:o,offset:r};r-=d}return a?{node:a,offset:((u=a.textContent)==null?void 0:u.length)??0}:{node:e,offset:e.childNodes.length}}function og(e,t,n){const r=document.createRange(),o=ff(e,t),a=ff(e,n);return r.setStart(o.node,o.offset),r.setEnd(a.node,a.offset),r}function ig(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Uc(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function wi(e,t){return t.mode!=="visual"?null:t.visualRange&&ig(t.visualRange,e)?t.visualRange:og(e,t.start,t.end)}function qw(e){const t=wn({mode:e.mode,visualEl:e.visualEl,htmlEl:e.htmlEl}),n=e.stored;return Uc(n,t)?n:t.visualRange?t:n??t}function Zw(e,t,n){if(!n)return null;const r=e.indexOf(n);if(r!==-1)return{start:r,end:r+n.length,corpus:"pageBody"};const o=t.indexOf(n);return o!==-1?{start:o,end:o+n.length,corpus:"visualInner"}:null}function Yw(e,t){if(!t)return null;const n=[e,...e.querySelectorAll("*")];for(const a of n){if(a!==e&&a.outerHTML===t){const s=document.createRange();return s.selectNode(a),s}if(a.innerHTML===t){const s=document.createRange();return s.selectNodeContents(a),s}}const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o;for(;o=r.nextNode();){const s=(o.textContent??"").indexOf(t);if(s!==-1){const u=document.createRange();return u.setStart(o,s),u.setEnd(o,s+t.length),u}}return null}function Xw(e,t,n){if(t.visualRange&&ig(t.visualRange,e)&&!t.visualRange.collapsed)return t.visualRange;const r=Yw(e,n);if(r&&!r.collapsed)return r;if(t.collapsed)return null;const o=wi(e,t);return o&&!o.collapsed?o:null}function Jw(e,t,n){if(e.deleteContents(),!t)return;if(n){const o=e.createContextualFragment(t),a=o.lastChild;e.insertNode(o),a&&(e.setStartAfter(a),e.collapse(!0));return}const r=document.createTextNode(t);e.insertNode(r),e.setStartAfter(r),e.collapse(!0)}function Qw(e,t){if(t.mode!=="visual"||t.collapsed)return"";const n=wi(e,t);if(!n||n.collapsed)return"";const r=n.cloneContents(),o=document.createElement("div");return o.appendChild(r),o.innerHTML}function wn(e){var n;if(e.mode==="html"&&e.htmlEl){const r=e.htmlEl.selectionStart,o=e.htmlEl.selectionEnd;return{mode:"html",text:e.htmlEl.value.slice(r,o),collapsed:r===o,start:r,end:o,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(Gw(t,a.commonAncestorContainer)){const s=mf(t,a.startContainer,a.startOffset),u=mf(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(s,u),end:Math.max(s,u),visualRange:a.cloneRange()}}}const o=((n=t.textContent)==null?void 0:n.length)??0;return{mode:"visual",text:"",collapsed:!0,start:o,end:o,visualRange:null}}return{mode:e.mode,text:"",collapsed:!0,start:0,end:0,visualRange:null}}function hc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pf(e){if(e.snapshot.mode==="html"){const o=e.getHtml(),a=e.snapshot.start,s=e.snapshot.end,u=e.asHtml?e.content:hc(e.content);e.setHtml(o.slice(0,a)+u+o.slice(s));const d=e.htmlEl;if(d){const f=a+u.length;d.focus(),d.setSelectionRange(f,f)}return}const t=e.visualEl;if(!t){const o=e.asHtml?e.content:hc(e.content);e.setHtml(e.getHtml()+o);return}const n=wi(t,e.snapshot);if(!n){const o=e.asHtml?e.content:hc(e.content);e.setHtml(e.getHtml()+o);return}if(n.deleteContents(),e.content)if(e.asHtml){const o=n.createContextualFragment(e.content),a=o.lastChild;n.insertNode(o),a&&(n.setStartAfter(a),n.collapse(!0))}else{const o=document.createTextNode(e.content);n.insertNode(o),n.setStartAfter(o),n.collapse(!0)}const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(n),e.setHtml(t.innerHTML)}const Lu=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),ag=new Set(["table","thead","tbody","tr","td","th"]),Bu=new Set([...ag,"ul","ol","li","pre","hr"]);function _e(e){return e.tagName.toLowerCase()}function Ii(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Fu(e){return e instanceof HTMLElement&&(_e(e)==="ul"||_e(e)==="ol")}function Xt(e){return e instanceof HTMLElement&&_e(e)==="li"}function An(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function Hu(e){const t=e.collapsed?[]:_t(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function wo(e,t,n){var d,f,h;if(t.nodeType===Node.TEXT_NODE){const g=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let y=0,b;for(;b=g.nextNode();){if(b===t)return y+n;y+=((d=b.textContent)==null?void 0:d.length)??0}return y}let r=0;const o=t.childNodes;for(let g=0;g<n&&g<o.length;g+=1)r+=((f=o[g].textContent)==null?void 0:f.length)??0;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let s=0,u;for(;u=a.nextNode();){if(t.contains(u)||t.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING)return s+r;s+=((h=u.textContent)==null?void 0:h.length)??0}return s+r}function zu(e,t,n){const r=og(e,t,n),o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)}function yr(e,t){const n=An(e);if(!n)return!1;const r=wo(e,n.startContainer,n.startOffset),o=wo(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=t();return zu(e,a,s),u}function Ou(e,t){if(_e(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 jt(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function eC(e,t){let n=Ii(t);for(;n&&n!==e;){if(Zg(n,e)||kt(n)){n=n.parentElement;continue}const r=_e(n);if(Lu.has(r)&&n instanceof HTMLElement)return n;if(ag.has(r)||r==="pre")return null;n=n.parentElement}return null}function $n(e){const t=An(e);if(!t)return[];const n=new Set,r=[];for(const o of Hu(t)){const a=eC(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Vc(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=_e(e);return Lu.has(t)||Bu.has(t)?!1:Pn(e)||t==="br"||t==="a"||t==="img"||t==="span"}function tC(e,t){let n=Ii(t);for(;n&&n!==e;){if(Bu.has(_e(n)))return!0;n=n.parentElement}return!1}function nC(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function rC(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&Vc(n[o-1]);)o-=1;for(;a<n.length-1&&Vc(n[a+1]);)a+=1;return n.slice(o,a+1)}function Wc(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t)))return t;return null}function oC(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&&kt(r)?Wc(e):r}return n.startContainer===t&&e!==t?Wc(e):nC(e,n.startContainer)}function iC(e,t){const n=Xu(e);if(tC(e,t.startContainer))return null;if(!Wc(n)){const s=document.createElement("p");return s.appendChild(document.createElement("br")),n.appendChild(s),s}const r=oC(n,e,t);if(!r||r instanceof HTMLElement&&kt(r)||r instanceof Element&&Bu.has(_e(r))||r instanceof HTMLElement&&Lu.has(_e(r))||!Vc(r))return null;const o=rC(n,r),a=document.createElement("p");n.insertBefore(a,o[0]);for(const s of o)a.appendChild(s);return a}function Vr(e){const t=$n(e);if(t.length>0)return t;const n=An(e);if(!n)return[];const r=iC(e,n);return r?[r]:[]}function Co(e){const t=e.parentElement;return t&&Fu(t)?t:null}function sg(e){if(e.length===0)return[];const t=[[e[0]]];for(let n=1;n<e.length;n+=1){const r=e[n-1],o=e[n];r.parentNode===o.parentNode&&aC(r,o)?t[t.length-1].push(o):t.push([o])}return t}function aC(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 sC(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function bc(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]),o=Number(t[3]),a=t[4]===void 0?1:Number(t[4]);return[n,r,o,a].every(s=>Number.isFinite(s))?{r:n,g:r,b:o,a}:null}function yc(e,t,n){const r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function xc(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 lC={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 cC(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function Ke(e){const t=e.trim();if(!t||cC(t))return null;const n=xc(t);if(n)return n;const r=bc(t);if(r)return r.a===0?null:yc(r.r,r.g,r.b);const o=lC[t.toLowerCase()];if(o)return o;const a=document.createElement("canvas").getContext("2d");if(!a)return null;a.fillStyle="#010203";try{a.fillStyle=t}catch{return null}const s=String(a.fillStyle);if(s==="#010203"){const d=xc(t);if(d==="#010203")return d;const f=bc(t);return f&&yc(f.r,f.g,f.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(s.startsWith("#"))return xc(s);const u=bc(s);return!u||u.a===0?null:yc(u.r,u.g,u.b)}function lg(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?Ke(n):null}function ns(e,t,n){let r=sC(t);for(;r&&r!==e&&r instanceof HTMLElement;){const o=lg(r,n);if(o)return o;r=r.parentElement}return null}function rs(e,t){return e instanceof HTMLElement?lg(e,t)!==null:!1}function Ku(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function cg(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function uC(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!Pn(o)||!rs(o,n)){r=o;continue}if(hr(o,r),rs(o,n)&&(Ku(o,n),gr(o))){Ot(o);continue}r=o}}function ug(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function os(e,t){const n=ug(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:_t(n).filter(d=>d.data.length>0),a=(r.length>0?r:[n.startContainer]).map(d=>ns(e,d,t)),s=a[0]??null;return a.every(d=>d===s)?{value:s,mixed:!1}:{value:null,mixed:!0}}function fi(e,t,n){const r=ug(e);if(!r||r.collapsed)return!1;const o=n===null?null:Ke(n);if(n!==null&&o===null)return!1;kn(r);const a=_t(r).filter(s=>s.data.length>0);for(const s of a){const u=ns(e,s,t);if(o===null){if(u===null)continue;uC(e,s,t);continue}u!==o&&Di(s,d=>{cg(d,t,o)})}return Ur(a),!0}function gf(e,t,n){if(n.value===null){Ku(e,t);return}const r=Ke(n.value);r&&cg(e,t,r)}function dC(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function mC(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 o=r.splitText(n);e.setStart(o,0),e.collapse(!0)}function fC(e){var r,o,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 s=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(s,e.startContainer.nextSibling),s}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const s=document.createTextNode("");return(o=e.startContainer.parentNode)==null||o.insertBefore(s,e.startContainer),s}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function dg(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!Pn(o)||!n.some(a=>rs(o,a))){r=o;continue}hr(o,r);for(const a of n)rs(o,a)&&Ku(o,a);if(gr(o)){Ot(o);continue}r=o.isConnected?o:t}return t}function pC(e,t,n){mC(t);const r=fC(t);return dg(e,r,n)}function gC(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&ns(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&ns(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const mg=["auto","avoid"],Gc=["auto","avoid","page"];new Set(mg);new Set(Gc);function fg(e){return e.trim().toLowerCase()}function hf(e){return fg(e)==="avoid"?"avoid":"auto"}function is(e){const t=fg(e);return t==="avoid"?"avoid":t==="page"||t==="always"?"page":"auto"}function pg(e){const t=e.style.breakInside;if(t)return hf(t);const n=e.style.pageBreakInside;return n?hf(n):"auto"}function gg(e){const t=e.style.breakAfter;if(t)return is(t);const n=e.style.pageBreakAfter;return n?is(n):"auto"}function hg(e){const t=e.style.breakBefore;if(t)return is(t);const n=e.style.pageBreakBefore;return n?is(n):"auto"}function hC(e){e.style.removeProperty("break-inside"),e.style.removeProperty("page-break-inside")}function bC(e){e.style.removeProperty("break-after"),e.style.removeProperty("page-break-after")}function yC(e){e.style.removeProperty("break-before"),e.style.removeProperty("page-break-before")}function xC(e){return{breakInside:pg(e),breakAfter:gg(e),breakBefore:hg(e)}}function wC(e,t){return pg(e)===t?!1:t==="auto"?(hC(e),!0):(e.style.breakInside="avoid",e.style.pageBreakInside="avoid",!0)}function CC(e,t){return gg(e)===t?!1:t==="auto"?(bC(e),!0):t==="avoid"?(e.style.breakAfter="avoid",e.style.pageBreakAfter="avoid",!0):(e.style.breakAfter="page",e.style.pageBreakAfter="always",!0)}function vC(e,t){return hg(e)===t?!1:t==="auto"?(yC(e),!0):t==="avoid"?(e.style.breakBefore="avoid",e.style.pageBreakBefore="avoid",!0):(e.style.breakBefore="page",e.style.pageBreakBefore="always",!0)}function kC(e,t){return e===t}function bf(e,t){return e===t}const st=["top","right","bottom","left"],Es=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],un={top:null,right:null,bottom:null,left:null},$u={style:"none",width:null,color:null},SC=new Set(Es),yf={value:0,unit:"px"};function PC(){return{margin:{...un},padding:{...un},lineHeight:null,border:{...$u},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null,breakInside:"auto",breakAfter:"auto",breakBefore:"auto"}}function Wr(){const e=PC();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 On(e,t){return st.every(n=>Yt(e[n],t[n]))}function bg(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 yg(e,t){return e.style===t.style&&Yt(e.width,t.width)&&e.color===t.color}function xg(e,t){return e===t?!0:!e||!t?!1:Yt(e.offsetX,t.offsetX)&&Yt(e.offsetY,t.offsetY)&&Yt(e.blur,t.blur)&&Yt(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function AC(e){return e.kind==="normal"?"normal":e.kind==="number"?be(e.value):Ie({value:e.value,unit:e.unit})}function TC(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)?ur(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?ur(n):null}function ur(e){return at(Math.min(1,Math.max(0,e)))}function as(e){return at(ur(e)*100)}function wg(e){return ur(e/100)}function Cg(e){return be(ur(e))}function RC(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:at(r)}}const n=vt(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function DC(e,t){const n=[];let r="",o=0;for(const a of e){if(a==="("){o+=1,r+=a;continue}if(a===")"){o=Math.max(0,o-1),r+=a;continue}if(a===t&&o===0){r.trim()&&n.push(r.trim()),r="";continue}r+=a}return r.trim()&&n.push(r.trim()),n}function jC(e){const t=[];let n="",r=0;for(const o of e){if(o==="("){r+=1,n+=o;continue}if(o===")"){r=Math.max(0,r-1),n+=o;continue}if(/\s/.test(o)&&r===0){n&&t.push(n),n="";continue}n+=o}return n&&t.push(n),t}function IC(e){const t=[Ie(e.offsetX),Ie(e.offsetY),Ie(e.blur),Ie(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function EC(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=DC(t,",")[0];if(!n)return null;const r=jC(n);let o=!1,a=null;const s=[];for(const u of r){if(u.toLowerCase()==="inset"){o=!0;continue}const d=vt(u);if(d){s.push(d);continue}const f=Ke(u);if(f){a=f;continue}return null}return s.length<2||s.length>4?null:{offsetX:s[0],offsetY:s[1],blur:s[2]??yf,spread:s[3]??yf,color:a,inset:o}}function fo(e,t){return vt(e.style.getPropertyValue(t))}function _C(e,t,n,r){const o=n&&r?br(n):n,a=o?Ie(o):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function xf(e,t){return{top:fo(e,`${t}-top`),right:fo(e,`${t}-right`),bottom:fo(e,`${t}-bottom`),left:fo(e,`${t}-left`)}}function wf(e,t,n,r){let o=!1;for(const a of st)_C(e,`${t}-${a}`,n[a],r)&&(o=!0);return o}function MC(e){const t=e.trim().toLowerCase();return SC.has(t)?t:"none"}function vg(e){const t=MC(e.style.borderStyle||e.style.borderTopStyle),n=fo(e,"border-width")??fo(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,o=r?Ke(r):null;return{style:t,width:n,color:o}}function NC(e,t){const n=vg(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?br(t.width):null,color:t.color};return yg(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=Ie(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function kg(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return vt(n)}function LC(e,t){const n=t?br(t):null,r=kg(e);return Yt(r,n)?!1:(n?e.style.borderRadius=Ie(n):e.style.removeProperty("border-radius"),!0)}function Sg(e){return EC(e.style.boxShadow)}function BC(e,t){const n=Sg(e),r=t?{...t,blur:br(t.blur)}:null;return xg(n,r)?!1:(r?e.style.boxShadow=IC(r):e.style.removeProperty("box-shadow"),!0)}function Pg(e){return RC(e.style.lineHeight)}function FC(e,t){const n=Pg(e);return bg(n,t)?!1:(t?e.style.lineHeight=AC(t):e.style.removeProperty("line-height"),!0)}function Ag(e){const t=e.style.backgroundColor;return t?Ke(t):null}function HC(e,t){const n=t?Ke(t):null;return Ag(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Tg(e){return TC(e.style.opacity)}function zC(e,t){const n=Tg(e),r=t===null?null:ur(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Cg(r),!0)}function Ro(e){const t=xC(e);return{margin:xf(e,"margin"),padding:xf(e,"padding"),lineHeight:Pg(e),border:vg(e),borderRadius:kg(e),boxShadow:Sg(e),backgroundColor:Ag(e),opacity:Tg(e),breakInside:t.breakInside,breakAfter:t.breakAfter,breakBefore:t.breakBefore}}function Do(e,t){let n=!1;return!t.marginMixed&&wf(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&wf(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&FC(e,t.lineHeight)&&(n=!0),!t.borderMixed&&NC(e,t.border)&&(n=!0),!t.radiusMixed&&LC(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&BC(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&HC(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&zC(e,t.opacity)&&(n=!0),!t.breakInsideMixed&&wC(e,t.breakInside)&&(n=!0),!t.breakAfterMixed&&CC(e,t.breakAfter)&&(n=!0),!t.breakBeforeMixed&&vC(e,t.breakBefore)&&(n=!0),n&&jt(e),n}function OC(e){const t=Wr(),n=$n(e);if(n.length===0)return t;const r=n.map(Ro),o=r[0];return{margin:o.margin,marginMixed:r.some(a=>!On(a.margin,o.margin)),padding:o.padding,paddingMixed:r.some(a=>!On(a.padding,o.padding)),lineHeight:o.lineHeight,lineHeightMixed:r.some(a=>!bg(a.lineHeight,o.lineHeight)),border:o.border,borderMixed:r.some(a=>!yg(a.border,o.border)),borderRadius:o.borderRadius,radiusMixed:r.some(a=>!Yt(a.borderRadius,o.borderRadius)),boxShadow:o.boxShadow,shadowMixed:r.some(a=>!xg(a.boxShadow,o.boxShadow)),backgroundColor:o.backgroundColor,backgroundMixed:r.some(a=>a.backgroundColor!==o.backgroundColor),opacity:o.opacity,opacityMixed:r.some(a=>a.opacity!==o.opacity),breakInside:o.breakInside,breakInsideMixed:r.some(a=>!kC(a.breakInside,o.breakInside)),breakAfter:o.breakAfter,breakAfterMixed:r.some(a=>!bf(a.breakAfter,o.breakAfter)),breakBefore:o.breakBefore,breakBeforeMixed:r.some(a=>!bf(a.breakBefore,o.breakBefore))}}function KC(e,t){return yr(e,()=>{const n=Vr(e);if(n.length===0)return!1;let r=!1;for(const o of n)Do(o,t)&&(r=!0);return r})}const Ci=96,$C=25.4,Uu=Ci/$C,Rg=Uu*10,Dg=72,UC=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(in|cm|mm|pt|px|em|rem|%)$/i;function jg(e){const t=e.trim();if(!t)return null;if(/^[+-]?0(?:\.0+)?$/.test(t))return{value:0,unit:"px"};const n=t.match(UC);if(!n)return null;const r=Number(n[1]);return Number.isFinite(r)?{value:at(r),unit:n[2].toLowerCase()}:null}function vi(e,t){switch(t){case"in":return e/Ci;case"cm":return e/Rg;case"mm":return e/Uu;case"pt":return e/Ci*Dg;case"px":default:return e}}function ki(e,t){switch(t){case"in":return e*Ci;case"cm":return e*Rg;case"mm":return e*Uu;case"pt":return e/Dg*Ci;case"em":case"rem":return e*16;case"px":default:return e}}function rr(e,t=0){if(!e)return t;const n=typeof e=="string"?jg(e):e;return!n||!Number.isFinite(n.value)?t:ki(n.value,n.unit)}function wc(e,t="in"){const n=vi(e,t);return{value:Math.round(n*1e3)/1e3,unit:t}}function ci(e){const t=vi(e,"pt");return{value:Math.round(t*1e3)/1e3,unit:"pt"}}function Ig(e,t="in"){const n=vi(e,t),r=t==="in"?2:t==="cm"?1:0;return`${n.toFixed(r)} ${t}`}function Mr(e,t="in",n=!1,r=0){if(n)return e;const o=e-r,s=ki(t==="in"?.125:t==="cm"?.25:t==="mm"?2.5:10,t);if(s<=0)return e;const u=Math.round(o/s)*s;return r+u}function Eg(e,t,n="in"){const r=[];if(e<=0)return r;const o=n==="in",a=o?.125:.1;if(ki(a,n)<=0)return r;const u=-vi(t,n),d=vi(e-t,n),f=Math.floor(u/a),h=Math.ceil(d/a);for(let g=f;g<=h;g++){const y=g*a,b=t+ki(y,n);if(b<0||b>e)continue;const w=Math.round(y),x=Math.abs(y-w)<.001,S=o?Math.abs(y-(Math.floor(y)+.5))<.001:!1,k=o?Math.abs(y-(Math.floor(y)+.25))<.001||Math.abs(y-(Math.floor(y)+.75))<.001:!1;let v=4;x?v=10:S?v=7:k&&(v=5);const A={positionPx:Math.round(b),unitValue:y,major:x,height:v};x&&y>=0&&(A.label=String(Math.abs(w))),r.push(A)}return r}function _g(e){const t=vt(e);if(t)return t;const n=jg(e);return n&&(n.unit==="in"||n.unit==="cm"||n.unit==="mm")?ci(ki(n.value,n.unit)):null}const Si="data-page-at-rule";function or(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...un},marginMixed:!1}}function Vu(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Mg(e){return e.body.innerHTML.replace(/\s*data-page=""/g," data-page")}function Pi(e){var r;const n=Vu(e).querySelector(`style[${Si}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function $a(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?_g(r[1].trim()):null}function VC(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...un};const n=t[1].trim().split(/\s+/).map(u=>_g(u)),[r,o=r,a=r,s=o]=n;return{top:r??null,right:o??null,bottom:a??null,left:s??null}}function WC(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 o=r.includes("landscape"),a=r.includes("portrait"),s=o?"landscape":a?"portrait":null,u=r.replace(/\b(landscape|portrait)\b/g,"").trim(),d=u.split(/\s+/).filter(Boolean);if(d.length===1){if(d[0]==="a4")return{sizePreset:"A4",customWidth:null,customHeight:null,orientation:s};if(d[0]==="letter")return{sizePreset:"letter",customWidth:null,customHeight:null,orientation:s};if(d[0]==="legal")return{sizePreset:"legal",customWidth:null,customHeight:null,orientation:s}}if(d.length>=2){const f=vt(d[0]),h=vt(d[1]);if(f&&h)return{sizePreset:"custom",customWidth:f,customHeight:h,orientation:s}}return!u&&s?{sizePreset:"auto",customWidth:null,customHeight:null,orientation:s}:t}function GC(e){const t=or();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],o=WC(r),a={top:$a(r,"top"),right:$a(r,"right"),bottom:$a(r,"bottom"),left:$a(r,"left")},u=st.some(d=>a[d]!==null)?a:VC(r);return{...o,margin:u,marginMixed:!1}}function it(e){return GC(Pi(e))}function Zt(e,t){return Pi(e)||!Pi(t)?e:ss(e,it(t))}function qC(e){const t=st.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?Ie(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:st.map(r=>e[r]?`margin-${r}: ${Ie(e[r])};`:null).filter(Boolean).join(" ")}function ZC(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(Ie(e.customWidth),Ie(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function YC(e){const t=ZC(e),n=qC(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function cn(e){const t=Vu(e);for(const n of t.querySelectorAll(`style[${Si}]`))n.remove();return Mg(t)}function XC(e,t){const n=Vu(e);let r=n.querySelector(`style[${Si}]`);return r||(r=n.createElement("style"),r.setAttribute(Si,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,Mg(n)}function ss(e,t){const n=YC(t);return n?XC(e,n):Ng(e)}function Ng(e){return cn(e)}function Lg(e){const t=e.map(n=>Pi(n)).filter(n=>!!n);return t.length===0?"":t.join(`
140
- `)}const Wu="data-page-sized",qc={top:"--wysiwyg-page-margin-top",right:"--wysiwyg-page-margin-right",bottom:"--wysiwyg-page-margin-bottom",left:"--wysiwyg-page-margin-left"},JC="0.75rem",Zc=["top","right","bottom","left"],Cc={A4:{width:"210mm",height:"297mm"},letter:{width:"8.5in",height:"11in"},legal:{width:"8.5in",height:"14in"}};function jo(e,t=!1){let n=null;return e.sizePreset==="A4"||e.sizePreset==="letter"||e.sizePreset==="legal"?n={...Cc[e.sizePreset]}:e.sizePreset==="custom"&&e.customWidth&&e.customHeight?n={width:Ie(e.customWidth),height:Ie(e.customHeight)}:e.orientation?n=t?{...Cc.letter}:null:n=t?{...Cc.letter}:null,n?e.orientation==="landscape"?{width:n.height,height:n.width}:n:null}function Bg(e){return jo(e,!1)!==null}function QC(e){const t=jo(e);if(!t)return null;const n=document.createElement("div");n.style.position="fixed",n.style.left="-10000px",n.style.top="0",n.style.visibility="hidden",n.style.boxSizing="border-box",n.style.width=t.width,n.style.minHeight=t.height;const r=Ei(e);for(const a of st){const s=r[a];s&&n.style.setProperty(`padding-${a}`,s)}document.body.appendChild(n);const o={width:n.offsetWidth,height:n.offsetHeight};return n.remove(),o}function Ei(e){return ev(e.margin)}function ev(e){return{top:e.top?Ie(e.top):null,right:e.right?Ie(e.right):null,bottom:e.bottom?Ie(e.bottom):null,left:e.left?Ie(e.left):null}}const tv=["width","min-height","padding-top","padding-right","padding-bottom","padding-left"];function Fg(e){for(const t of Zc)e.style.removeProperty(qc[t])}function nv(e){const t=e.querySelector("[data-page-bg]");if(!(t instanceof HTMLElement))return!1;const n=t.style.backgroundImage.trim();if(n&&n!=="none")return!0;const r=t.getAttribute("style")??"";return/background-image\s*:\s*(?!none\b)/i.test(r)}function rv(e,t){if(!nv(e)){Fg(e);return}const n=it(t);if(jo(n)){const o=Ei(n);for(const a of Zc){const s=o[a]??"0px";e.style.setProperty(qc[a],s)}return}for(const o of Zc)e.style.setProperty(qc[o],JC)}function ov(e){e.removeAttribute(Wu);for(const t of tv)e.style.removeProperty(t);Fg(e)}function Hg(e,t){const n=it(e),r={...n.margin};return t.left!==void 0&&(r.left=ci(t.left)),t.right!==void 0&&(r.right=ci(t.right)),t.top!==void 0&&(r.top=ci(t.top)),t.bottom!==void 0&&(r.bottom=ci(t.bottom)),ss(e,{...n,margin:r})}function iv(e,t,n){Io(e,Hg(t,n))}function Io(e,t){const n=it(t),r=jo(n);if(!r){ov(e);return}e.setAttribute(Wu,""),e.style.width=r.width,e.style.minHeight=r.height;const o=Ei(n);for(const a of st){const s=`padding-${a}`,u=o[a];u?e.style.setProperty(s,u):e.style.removeProperty(s)}rv(e,t)}const zg="data-template-tag",Og=/\{\{/;function Gu(e){return e instanceof HTMLSpanElement&&e.hasAttribute(zg)}function Kg(e){return Og.test(e)}function $g(e){return Og.test(e)}function av(e,t){if(!Kg(e))return!0;const n=(e.match(/data-template-tag/g)??[]).length,r=t.querySelectorAll(`[${zg}]`).length;if(n>0&&r<n)return!1;const o=e.match(/\{\{[^}]*\}\}/g)??[],a=t.textContent??"";return o.every(s=>a.includes(s))}const dr="data-page",Or="data-page-bg",ls="commspliant-background";function kt(e){return e instanceof HTMLElement&&(e.id===ls||e.hasAttribute(Or))}function sv(e){return e.hasAttribute(dr)&&e.parentElement?e.parentElement:e}function qu(e){const t=sv(e),n=new Set,r=[],o=a=>{a instanceof HTMLElement&&kt(a)&&!n.has(a)&&(n.add(a),r.push(a))};o(t.querySelector(`#${ls}`));for(const a of t.querySelectorAll(`[${Or}]`))o(a);return o(t),r}function Zu(e){return qu(e)[0]??null}function pi(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 Ug(e,t){if(!e.hasAttribute(Wu))return pi(t);let n=!1;return t.style.width!=="100%"&&(t.style.width="100%",n=!0),t.style.height!=="auto"&&(t.style.height="auto",n=!0),n}const lv=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre","div"]);function Vg(e){return lv.has(e.tagName.toLowerCase())}function _s(e){const t=e.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li");return t[t.length-1]??null}function Wg(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t))&&t instanceof HTMLElement&&Vg(t))return t;return null}function Gg(e){const t=Wg(e)??_s(e);if(t)return t;const n=e.ownerDocument.createElement("p");return n.appendChild(e.ownerDocument.createElement("br")),e.appendChild(n),n}function Ms(e){let t=!1;for(const n of[...e.childNodes]){if(n instanceof HTMLElement&&kt(n)||n instanceof HTMLElement&&Gu(n)||n.nodeType!==Node.TEXT_NODE)continue;const r=n.textContent??"";if(!r.trim()){n.remove(),t=!0;continue}if($g(r))continue;(_s(e)??Gg(e)).appendChild(n),t=!0}return t}function Ns(e){const t=yt(e);if(!t)return!1;let n=!1;for(const r of[...e.childNodes])r!==t&&r instanceof HTMLElement&&kt(r)&&(t.insertBefore(r,t.firstChild),n=!0);return n}function Ai(e){const t=yt(e);if(!t)return{changed:!1,absorbedBlocks:[]};let n=Ns(e);const r=[];for(const o of[...e.childNodes])if(o!==t&&!(o instanceof HTMLElement&&kt(o))){if(o.nodeType===Node.TEXT_NODE){const a=o.textContent??"";if(!a.trim()){o.remove(),n=!0;continue}if($g(a))continue;let s=_s(t);s||(s=document.createElement("p"),t.appendChild(s)),s.appendChild(o),n=!0;continue}if(o instanceof HTMLElement&&Vg(o)&&r.push(o),o instanceof HTMLElement&&Gu(o)){t.appendChild(o),n=!0;continue}t.appendChild(o),n=!0}return Ms(t)&&(n=!0),{changed:n,absorbedBlocks:r}}function cv(e){const t=document.createRange(),n=e.firstChild;(n==null?void 0:n.nodeType)===Node.TEXT_NODE?t.setStart(n,0):n?t.setStartBefore(n):t.setStart(e,0),t.collapse(!0);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}const uv="p, h1, h2, h3, h4, h5, h6, li, blockquote, pre";function qg(e,t){if(t<=0)return;const n=yt(e);if(!n)return;const r=n.querySelectorAll(uv);if(r.length===0)return;const o=r[r.length-1],a=window.getSelection();if(!a||a.rangeCount===0)return;const s=a.getRangeAt(0).startContainer;o.contains(s)||cv(o)}function Zg(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(dr)}function Yg(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function dv(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function yt(e){return Yg(e).find(n=>n.hasAttribute(dr))??null}function mv(e){if(dv(e))return null;const t=Yg(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"||kt(n)?null:n}function Yu(e){const t=yt(e);if(t)return pi(t),t;const n=mv(e);if(n)return n.setAttribute(dr,""),pi(n),n;const r=document.createElement("div");for(r.setAttribute(dr,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),pi(r),r}function Xu(e){return yt(e)??e}function fv(e,t,n){const{startContainer:r}=n;return r===t||t.contains(r)?!1:r===e?!0:e.contains(r)}function pv(e,t){const{startContainer:n}=t;return n===e||n.nodeType===Node.TEXT_NODE&&n.parentElement===e}function gv(e){var o;const t=document.createRange(),n=e.lastChild;(n==null?void 0:n.nodeType)===Node.TEXT_NODE?t.setStart(n,((o=n.textContent)==null?void 0:o.length)??0):n?t.setStartAfter(n):t.setStart(e,0),t.collapse(!0);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}function Yc(e){Ms(e);const t=_s(e)??Wg(e)??Gg(e);gv(t)}function hv(e){const t=yt(e);e.focus(),t&&Yc(t)}function vo(e){const t=yt(e);if(!t)return;Ms(t);const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0);if(pv(t,r)){Yc(t);return}fv(e,t,r)&&Yc(t)}const bv=["background-image","background-size","background-position","background-repeat","opacity"];function yv(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 Ls(e){const t=yt(e);yv(e,t,"background-color");for(const n of bv)e.style.removeProperty(n)}const cs="<!-- wysiwyg-page-separator -->",Kr="data-page-surface";function ar(e){const t=e.trim();return t?t.includes(cs)?e.split(cs).map(n=>n.trim()):[e]:[""]}function zt(e){return e.length===0?"":e.length===1?e[0]??"":e.join(`
139
+ Abrir Ayuda: F1`,helpTopicKeyboardShortcutsKeywords:"atajos teclado",commandCompatibilityCheck:"Compatibilidad",commandCompatibilityCheckAria:"Comprobar compatibilidad del documento",capabilitiesPanelTitle:"Compatibilidad",capabilitiesPanelCloseAria:"Cerrar panel de compatibilidad",capabilitiesPanelEmpty:"No se encontraron problemas de compatibilidad.",capabilitiesPanelSummary:"{errors} errores, {warnings} advertencias",capabilitiesPanelErrors:"Errores",capabilitiesPanelWarnings:"Advertencias",capabilitiesViolationPage:"Página",capabilitiesViolationDisallowedTag:"Elemento no permitido: <{tag}>",capabilitiesViolationUnknownTag:"Elemento desconocido: <{tag}>",capabilitiesViolationRestrictedTag:"Elemento restringido: <{tag}>",capabilitiesViolationMissingRequiredAttribute:'<{tag}> falta el atributo obligatorio {attribute}="{expected}"',capabilitiesViolationUnknownAttribute:"<{tag}> tiene el atributo no permitido {attribute}",capabilitiesViolationTagDisallowedCss:"<{tag}> usa la propiedad CSS no permitida {property}",capabilitiesViolationMissingForcedCss:"<{tag}> debe incluir {property}: {expected}",capabilitiesViolationCssDisallowed:"Propiedad CSS no permitida: {property}",capabilitiesViolationCssRestricted:"Propiedad CSS restringida: {property}",capabilitiesViolationCssWrongTag:"CSS {property} no está permitido en <{tag}> (permitido en: {allowedTags})",capabilitiesViolationCssValueNotAllowed:"Valor CSS {property} no permitido: {value}",capabilitiesViolationContainerWidthExceeded:"Ancho del contenedor {width}px supera el máximo {max}px"},lw={en:To,es:qp},Zp=l.createContext(e=>To[e]),Yp=l.createContext("en");function cw({locale:e="en",children:t}){const n=l.useMemo(()=>{const r=lw[e]??To;return o=>r[o]},[e]);return i.jsx(Yp.Provider,{value:e,children:i.jsx(Zp.Provider,{value:n,children:t})})}function J(){return l.useContext(Zp)}function uw(){return l.useContext(Yp)}const dw="_menu_c1m45_1",mw="_item_c1m45_19",fw="_separator_c1m45_59",pc={menu:dw,item:mw,separator:fw},za=8,pw=[{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:"item",command:"addComment",labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:(e,t)=>t.canAddComment&&(e==="text"||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:"openPageProperties",labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openPageBackgroundImage",labelKey:"commandBackgroundImageProperties",ariaKey:"commandBackgroundImagePropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"deletePage",labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:(e,t)=>t.canDeletePage},{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 gw(e,t,n){const r=[];let o=!1;for(const a of pw){if(a.type==="separator"){r.length>0&&(o=!0);continue}n!=null&&n.has(a.command)||a.enabled(e,t)&&(o&&(r.push({type:"separator"}),o=!1),r.push(a))}return r}function cf(){return'[role="menuitem"]:not(:disabled)'}function hw({open:e,x:t,y:n,kind:r,inTable:o=!1,canMergeCells:a=!1,canUnmergeCells:s=!1,canDeletePage:u=!1,canAddComment:d=!1,hiddenCommands:f,commands:h,onClose:g}){const y=J(),b=l.useId(),w=l.useRef(null);if(l.useLayoutEffect(()=>{var D;if(!e)return;const k=w.current;if(!k)return;const v=k.getBoundingClientRect(),A=Math.max(za,Math.min(t,window.innerWidth-v.width-za)),I=Math.max(za,Math.min(n,window.innerHeight-v.height-za));k.style.left=`${A}px`,k.style.top=`${I}px`,(D=k.querySelector(cf()))==null||D.focus()},[e,t,n,r]),l.useEffect(()=>{if(!e)return;const k=D=>{var R;(R=w.current)!=null&&R.contains(D.target)||g()},v=D=>{D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),g())},A=()=>{g()},I=D=>{var R;if((R=w.current)!=null&&R.contains(D.target)){D.preventDefault();return}D.defaultPrevented||g()};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",v,!0),window.addEventListener("scroll",A,!0),document.addEventListener("contextmenu",I),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",v,!0),window.removeEventListener("scroll",A,!0),document.removeEventListener("contextmenu",I)}},[e,g]),!e)return null;const x=gw(r,{inTable:o,canMergeCells:a,canUnmergeCells:s,canDeletePage:u,canAddComment:d},f),S=k=>{var R;if(k.key!=="ArrowDown"&&k.key!=="ArrowUp")return;const v=[...((R=w.current)==null?void 0:R.querySelectorAll(cf()))??[]];if(v.length===0)return;const A=v.indexOf(document.activeElement),I=k.key==="ArrowDown"?1:-1,D=v[(A+I+v.length)%v.length];k.preventDefault(),D==null||D.focus()};return i.jsx(Pe,{children:i.jsxs("div",{ref:w,className:pc.menu,role:"menu","aria-labelledby":b,style:{left:t,top:n},onMouseDown:k=>k.preventDefault(),onKeyDown:S,children:[i.jsx("span",{id:b,hidden:!0,children:y("contextMenuAria")}),x.map((k,v)=>k.type==="separator"?i.jsx("div",{role:"separator",className:pc.separator},`separator-${v}`):i.jsx("button",{type:"button",role:"menuitem",className:pc.item,"aria-label":y(k.ariaKey),onClick:()=>{g(),Ru(h,k.command)},children:y(k.labelKey)},k.command))]})})}function bw(e){return e==="touch"||e==="pen"}function yw(e,t){return e.button===2||e.ctrlKey?!0:!bw(t)}const xw=new Set(["span","strong","b","em","i","u","s","strike","del"]);function Te(e,t){return t?e===t||e.contains(t):!1}function Pn(e){return xw.has(e.tagName.toLowerCase())}function ww(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 _t(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 o;for(;o=r.nextNode();)o.nodeValue&&ww(e,o)&&n.push(o);return n}function kn(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType===Node.TEXT_NODE){const a=t;if(n>0&&n<a.length){const s=a.splitText(n);e.setStart(s,0),e.endContainer===a&&e.setEnd(s,e.endOffset-n)}}const r=e.endContainer,o=e.endOffset;if(r.nodeType===Node.TEXT_NODE){const a=r;o>0&&o<a.length&&(a.splitText(o),e.setEnd(a,a.length))}}function gr(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function Ot(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function hr(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<=-1||n.length===1)return;const o=e.parentNode;if(!o)return;const a=n.slice(0,r),s=n.slice(r+1);if(a.length>0){const u=e.cloneNode(!1);for(const d of a)u.appendChild(d);o.insertBefore(u,e)}if(s.length>0){const u=e.cloneNode(!1);for(const d of s)u.appendChild(d);o.insertBefore(u,e.nextSibling)}}function Ur(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 o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)}function Di(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 Ds="data-wysiwyg-font",Cw=[{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 zr(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function Ii(e,t){return e===t?!0:!e||!t?!1:zr(e)===zr(t)}function Xp(e=[]){var r;const t=[],n=new Set;for(const o of[...Cw,...e]){const a=o.family.trim();if(!a)continue;const s=zr(a);if(n.has(s))continue;n.add(s);const u=(r=o.css)==null?void 0:r.trim();t.push({name:o.name.trim()||a,family:a,...u?{css:u}:{}})}return t}function vw(e,t){return e?t.find(n=>Ii(n.family,e))??null:null}function kw(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Sw(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Is(e){const t=new Set,n=[];for(const r of e){const o=r.trim();!o||!kw(o)||t.has(o)||(t.add(o),n.push(o))}return n}function Pw(e){return e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&amp;/g,"&")}const Aw=new RegExp(`<link\\b[^>]*\\b${Ds}\\b[^>]*>`,"gi");function ge(e){if(!e.includes(Ds))return{hrefs:[],body:e};const t=[],n=e.replace(Aw,r=>{var a,s;const o=((a=r.match(/\bhref\s*=\s*"([^"]*)"/i))==null?void 0:a[1])??((s=r.match(/\bhref\s*=\s*'([^']*)'/i))==null?void 0:s[1]);return o&&t.push(Pw(o)),""});return{hrefs:Is(t),body:n}}function ri(e,t){const n=Is(t);return n.length===0?e:`${n.map(o=>`<link rel="stylesheet" href="${Sw(o)}" ${Ds}="">`).join("")}${e}`}function Du(e){return e.style.fontFamily.trim()||null}const Tw=32,li=new Map;function Jp(e,t){return`${zr(t)}\0${e}`}function Rw(e,t){return li.get(Jp(e,t))}function gc(e,t,n){const r=Jp(e,t);if(li.size>=Tw){const o=li.keys().next().value;o!==void 0&&li.delete(o)}li.set(r,n)}function Qp(e,t){const n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let r=n.currentNode;for(;r;){if(r instanceof HTMLElement){const o=Du(r);if(o&&zr(o)===t)return!0}r=n.nextNode()}return!1}function Dw(e,t){const n=zr(t);return n?Qp(e,n):!1}function Iw(e,t){const n=zr(t);if(!n)return!1;const r=Rw(e,t);if(r!==void 0)return r;const o=e.toLowerCase();if(!o.includes("font-family")&&!o.includes("face="))return gc(e,t,!1),!1;const a=n.split(",")[0].replace(/['"]/g,"").trim().toLowerCase();if(a&&!o.includes(a))return gc(e,t,!1),!1;const s=new DOMParser().parseFromString(e,"text/html"),u=Qp(s.body,n);return gc(e,t,u),u}function Oa(e,t,n=[],r){const o=ge(t).hrefs,a=n.filter(s=>s.css?r!=null&&r.liveRoot?Dw(r.liveRoot,s.family):Iw(e,s.family):!1).map(s=>s.css??"");return Is([...o,...a])}function uf(e,t=[]){const n=ge(e).hrefs,r=t.map(o=>o.css??"");return Is([...n,...r])}function jw(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Iu(e,t){let n=jw(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Du(n);if(r)return r;n=n.parentElement}return null}function Oc(e){return e instanceof HTMLElement&&Du(e)!==null}function ju(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function Ew(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Pn(r)||!Oc(r)){n=r;continue}if(hr(r,n),Oc(r)&&(ju(r),gr(r))){Ot(r);continue}n=r}}function eg(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function tg(e){const t=eg(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:_t(t).filter(u=>u.data.length>0),o=(n.length>0?n:[t.startContainer]).map(u=>Iu(e,u)),a=o[0]??null;return o.every(u=>Ii(u,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function Kc(e,t){const n=eg(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;kn(n);const o=_t(n).filter(a=>a.data.length>0);for(const a of o){const s=Iu(e,a);if(r===null){if(s===null)continue;Ew(e,a);continue}Ii(s,r)||Di(a,u=>{u.style.fontFamily=r})}return Ur(o),!0}function _w(e,t){if(t){if(t.value===null){ju(e);return}e.style.fontFamily=t.value}}function Mw(e){return e!=null}function Nw(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 o=r.splitText(n);e.setStart(o,0),e.collapse(!0)}function Lw(e){var r,o,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 s=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(s,e.startContainer.nextSibling),s}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const s=document.createTextNode("");return(o=e.startContainer.parentNode)==null||o.insertBefore(s,e.startContainer),s}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function $c(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Pn(r)||!Oc(r)){n=r;continue}if(hr(r,n),ju(r),gr(r)){Ot(r);continue}n=r.isConnected?r:t}return t}function Bw(e,t){Nw(t);const n=Lw(t);return $c(e,n)}function Fw(e,t,n){return!!(n&&n.value===null&&Iu(e,t))}const Eu=["pt","px","em","rem","%"],xo="pt",Hw={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]},zw={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},Ow=new Set(Eu),Kw=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function js(e){return Ow.has(e)}function at(e){return Math.round(e*100)/100}function he(e){const t=at(e);return Number.isInteger(t),String(t)}function _u(e,t){return`${he(e)}${t}`}function Mu(e){const t=e.trim();if(!t)return null;const n=t.match(Kw);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return{value:r,unit:o}}function $w(e,t){const n=e.trim();if(!n)return null;const r=Mu(n);if(r)return js(r.unit)?Fr(r.value,r.unit):null;const o=Number(n.replace(",","."));return Number.isFinite(o)?Fr(o,t):null}function Fr(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=zw[t];return{value:at(Math.min(r,Math.max(n,e))),unit:t}}function ng(e,t,n,r){const o=n>0?n:16,a=r>0?r:16;switch(t){case"px":return at(e);case"pt":return at(e*.75);case"em":return at(e/o);case"rem":return at(e/a);case"%":return at(e/o*100)}}function Uw(e,t,n,r){const o=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*o;case"rem":return e*a;case"%":return e/100*o}}function rg(e,t,n,r,o){if(t===n)return at(e);const a=Uw(e,t,r,o);return ng(a,n,r,o)}const Nu="pt",Vw=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,Ww=/^[+-]?0(?:\.0+)?$/;function je(e){return`${he(e.value)}${e.unit}`}function vt(e){const t=e.trim();if(!t)return null;if(Ww.test(t))return{value:0,unit:"px"};const n=t.match(Vw);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return js(o)?{value:at(r),unit:o}:null}function xi(e,t,n){const r=e.trim();if(!r)return null;const o=vt(r);if(o)return!n&&o.value<0?{...o,value:0}:o;const a=Number(r.replace(",","."));return Number.isFinite(a)?!n&&a<0?{value:0,unit:t}:{value:at(a),unit:t}:null}function br(e){return e.value>=0?e:{value:0,unit:e.unit}}function Yt(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function Ka(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function Gw(e,t){return t?e===t||e.contains(t):!1}function df(e,t){var a;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=0,o;for(;o=n.nextNode();){if(o===t||t.contains(o)||t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)return r;r+=((a=o.textContent)==null?void 0:a.length)??0}return r}function mf(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return df(e,t)+n;let r=0;const o=t.childNodes;for(let s=0;s<n&&s<o.length;s+=1)r+=((a=o[s].textContent)==null?void 0:a.length)??0;return df(e,t)+r}function ff(e,t){var s,u;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=Math.max(0,t),o,a=null;for(;o=n.nextNode();){a=o;const d=((s=o.textContent)==null?void 0:s.length)??0;if(r<=d)return{node:o,offset:r};r-=d}return a?{node:a,offset:((u=a.textContent)==null?void 0:u.length)??0}:{node:e,offset:e.childNodes.length}}function og(e,t,n){const r=document.createRange(),o=ff(e,t),a=ff(e,n);return r.setStart(o.node,o.offset),r.setEnd(a.node,a.offset),r}function ig(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Uc(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function wi(e,t){return t.mode!=="visual"?null:t.visualRange&&ig(t.visualRange,e)?t.visualRange:og(e,t.start,t.end)}function qw(e){const t=wn({mode:e.mode,visualEl:e.visualEl,htmlEl:e.htmlEl}),n=e.stored;return Uc(n,t)?n:t.visualRange?t:n??t}function Zw(e,t,n){if(!n)return null;const r=e.indexOf(n);if(r!==-1)return{start:r,end:r+n.length,corpus:"pageBody"};const o=t.indexOf(n);return o!==-1?{start:o,end:o+n.length,corpus:"visualInner"}:null}function Yw(e,t){if(!t)return null;const n=[e,...e.querySelectorAll("*")];for(const a of n){if(a!==e&&a.outerHTML===t){const s=document.createRange();return s.selectNode(a),s}if(a.innerHTML===t){const s=document.createRange();return s.selectNodeContents(a),s}}const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o;for(;o=r.nextNode();){const s=(o.textContent??"").indexOf(t);if(s!==-1){const u=document.createRange();return u.setStart(o,s),u.setEnd(o,s+t.length),u}}return null}function Xw(e,t,n){if(t.visualRange&&ig(t.visualRange,e)&&!t.visualRange.collapsed)return t.visualRange;const r=Yw(e,n);if(r&&!r.collapsed)return r;if(t.collapsed)return null;const o=wi(e,t);return o&&!o.collapsed?o:null}function Jw(e,t,n){if(e.deleteContents(),!t)return;if(n){const o=e.createContextualFragment(t),a=o.lastChild;e.insertNode(o),a&&(e.setStartAfter(a),e.collapse(!0));return}const r=document.createTextNode(t);e.insertNode(r),e.setStartAfter(r),e.collapse(!0)}function Qw(e,t){if(t.mode!=="visual"||t.collapsed)return"";const n=wi(e,t);if(!n||n.collapsed)return"";const r=n.cloneContents(),o=document.createElement("div");return o.appendChild(r),o.innerHTML}function wn(e){var n;if(e.mode==="html"&&e.htmlEl){const r=e.htmlEl.selectionStart,o=e.htmlEl.selectionEnd;return{mode:"html",text:e.htmlEl.value.slice(r,o),collapsed:r===o,start:r,end:o,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(Gw(t,a.commonAncestorContainer)){const s=mf(t,a.startContainer,a.startOffset),u=mf(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(s,u),end:Math.max(s,u),visualRange:a.cloneRange()}}}const o=((n=t.textContent)==null?void 0:n.length)??0;return{mode:"visual",text:"",collapsed:!0,start:o,end:o,visualRange:null}}return{mode:e.mode,text:"",collapsed:!0,start:0,end:0,visualRange:null}}function hc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pf(e){if(e.snapshot.mode==="html"){const o=e.getHtml(),a=e.snapshot.start,s=e.snapshot.end,u=e.asHtml?e.content:hc(e.content);e.setHtml(o.slice(0,a)+u+o.slice(s));const d=e.htmlEl;if(d){const f=a+u.length;d.focus(),d.setSelectionRange(f,f)}return}const t=e.visualEl;if(!t){const o=e.asHtml?e.content:hc(e.content);e.setHtml(e.getHtml()+o);return}const n=wi(t,e.snapshot);if(!n){const o=e.asHtml?e.content:hc(e.content);e.setHtml(e.getHtml()+o);return}if(n.deleteContents(),e.content)if(e.asHtml){const o=n.createContextualFragment(e.content),a=o.lastChild;n.insertNode(o),a&&(n.setStartAfter(a),n.collapse(!0))}else{const o=document.createTextNode(e.content);n.insertNode(o),n.setStartAfter(o),n.collapse(!0)}const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(n),e.setHtml(t.innerHTML)}const Lu=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),ag=new Set(["table","thead","tbody","tr","td","th"]),Bu=new Set([...ag,"ul","ol","li","pre","hr"]);function _e(e){return e.tagName.toLowerCase()}function ji(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Fu(e){return e instanceof HTMLElement&&(_e(e)==="ul"||_e(e)==="ol")}function Xt(e){return e instanceof HTMLElement&&_e(e)==="li"}function An(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function Hu(e){const t=e.collapsed?[]:_t(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function wo(e,t,n){var d,f,h;if(t.nodeType===Node.TEXT_NODE){const g=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let y=0,b;for(;b=g.nextNode();){if(b===t)return y+n;y+=((d=b.textContent)==null?void 0:d.length)??0}return y}let r=0;const o=t.childNodes;for(let g=0;g<n&&g<o.length;g+=1)r+=((f=o[g].textContent)==null?void 0:f.length)??0;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let s=0,u;for(;u=a.nextNode();){if(t.contains(u)||t.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING)return s+r;s+=((h=u.textContent)==null?void 0:h.length)??0}return s+r}function zu(e,t,n){const r=og(e,t,n),o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)}function yr(e,t){const n=An(e);if(!n)return!1;const r=wo(e,n.startContainer,n.startOffset),o=wo(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=t();return zu(e,a,s),u}function Ou(e,t){if(_e(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 eC(e,t){let n=ji(t);for(;n&&n!==e;){if(Zg(n,e)||kt(n)){n=n.parentElement;continue}const r=_e(n);if(Lu.has(r)&&n instanceof HTMLElement)return n;if(ag.has(r)||r==="pre")return null;n=n.parentElement}return null}function $n(e){const t=An(e);if(!t)return[];const n=new Set,r=[];for(const o of Hu(t)){const a=eC(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Vc(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=_e(e);return Lu.has(t)||Bu.has(t)?!1:Pn(e)||t==="br"||t==="a"||t==="img"||t==="span"}function tC(e,t){let n=ji(t);for(;n&&n!==e;){if(Bu.has(_e(n)))return!0;n=n.parentElement}return!1}function nC(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function rC(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&Vc(n[o-1]);)o-=1;for(;a<n.length-1&&Vc(n[a+1]);)a+=1;return n.slice(o,a+1)}function Wc(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t)))return t;return null}function oC(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&&kt(r)?Wc(e):r}return n.startContainer===t&&e!==t?Wc(e):nC(e,n.startContainer)}function iC(e,t){const n=Xu(e);if(tC(e,t.startContainer))return null;if(!Wc(n)){const s=document.createElement("p");return s.appendChild(document.createElement("br")),n.appendChild(s),s}const r=oC(n,e,t);if(!r||r instanceof HTMLElement&&kt(r)||r instanceof Element&&Bu.has(_e(r))||r instanceof HTMLElement&&Lu.has(_e(r))||!Vc(r))return null;const o=rC(n,r),a=document.createElement("p");n.insertBefore(a,o[0]);for(const s of o)a.appendChild(s);return a}function Vr(e){const t=$n(e);if(t.length>0)return t;const n=An(e);if(!n)return[];const r=iC(e,n);return r?[r]:[]}function Co(e){const t=e.parentElement;return t&&Fu(t)?t:null}function sg(e){if(e.length===0)return[];const t=[[e[0]]];for(let n=1;n<e.length;n+=1){const r=e[n-1],o=e[n];r.parentNode===o.parentNode&&aC(r,o)?t[t.length-1].push(o):t.push([o])}return t}function aC(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 sC(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function bc(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]),o=Number(t[3]),a=t[4]===void 0?1:Number(t[4]);return[n,r,o,a].every(s=>Number.isFinite(s))?{r:n,g:r,b:o,a}:null}function yc(e,t,n){const r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function xc(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 lC={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 cC(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function Ke(e){const t=e.trim();if(!t||cC(t))return null;const n=xc(t);if(n)return n;const r=bc(t);if(r)return r.a===0?null:yc(r.r,r.g,r.b);const o=lC[t.toLowerCase()];if(o)return o;const a=document.createElement("canvas").getContext("2d");if(!a)return null;a.fillStyle="#010203";try{a.fillStyle=t}catch{return null}const s=String(a.fillStyle);if(s==="#010203"){const d=xc(t);if(d==="#010203")return d;const f=bc(t);return f&&yc(f.r,f.g,f.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(s.startsWith("#"))return xc(s);const u=bc(s);return!u||u.a===0?null:yc(u.r,u.g,u.b)}function lg(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?Ke(n):null}function ns(e,t,n){let r=sC(t);for(;r&&r!==e&&r instanceof HTMLElement;){const o=lg(r,n);if(o)return o;r=r.parentElement}return null}function rs(e,t){return e instanceof HTMLElement?lg(e,t)!==null:!1}function Ku(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function cg(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function uC(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!Pn(o)||!rs(o,n)){r=o;continue}if(hr(o,r),rs(o,n)&&(Ku(o,n),gr(o))){Ot(o);continue}r=o}}function ug(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function os(e,t){const n=ug(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:_t(n).filter(d=>d.data.length>0),a=(r.length>0?r:[n.startContainer]).map(d=>ns(e,d,t)),s=a[0]??null;return a.every(d=>d===s)?{value:s,mixed:!1}:{value:null,mixed:!0}}function fi(e,t,n){const r=ug(e);if(!r||r.collapsed)return!1;const o=n===null?null:Ke(n);if(n!==null&&o===null)return!1;kn(r);const a=_t(r).filter(s=>s.data.length>0);for(const s of a){const u=ns(e,s,t);if(o===null){if(u===null)continue;uC(e,s,t);continue}u!==o&&Di(s,d=>{cg(d,t,o)})}return Ur(a),!0}function gf(e,t,n){if(n.value===null){Ku(e,t);return}const r=Ke(n.value);r&&cg(e,t,r)}function dC(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function mC(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 o=r.splitText(n);e.setStart(o,0),e.collapse(!0)}function fC(e){var r,o,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 s=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(s,e.startContainer.nextSibling),s}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const s=document.createTextNode("");return(o=e.startContainer.parentNode)==null||o.insertBefore(s,e.startContainer),s}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function dg(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!Pn(o)||!n.some(a=>rs(o,a))){r=o;continue}hr(o,r);for(const a of n)rs(o,a)&&Ku(o,a);if(gr(o)){Ot(o);continue}r=o.isConnected?o:t}return t}function pC(e,t,n){mC(t);const r=fC(t);return dg(e,r,n)}function gC(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&ns(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&ns(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const mg=["auto","avoid"],Gc=["auto","avoid","page"];new Set(mg);new Set(Gc);function fg(e){return e.trim().toLowerCase()}function hf(e){return fg(e)==="avoid"?"avoid":"auto"}function is(e){const t=fg(e);return t==="avoid"?"avoid":t==="page"||t==="always"?"page":"auto"}function pg(e){const t=e.style.breakInside;if(t)return hf(t);const n=e.style.pageBreakInside;return n?hf(n):"auto"}function gg(e){const t=e.style.breakAfter;if(t)return is(t);const n=e.style.pageBreakAfter;return n?is(n):"auto"}function hg(e){const t=e.style.breakBefore;if(t)return is(t);const n=e.style.pageBreakBefore;return n?is(n):"auto"}function hC(e){e.style.removeProperty("break-inside"),e.style.removeProperty("page-break-inside")}function bC(e){e.style.removeProperty("break-after"),e.style.removeProperty("page-break-after")}function yC(e){e.style.removeProperty("break-before"),e.style.removeProperty("page-break-before")}function xC(e){return{breakInside:pg(e),breakAfter:gg(e),breakBefore:hg(e)}}function wC(e,t){return pg(e)===t?!1:t==="auto"?(hC(e),!0):(e.style.breakInside="avoid",e.style.pageBreakInside="avoid",!0)}function CC(e,t){return gg(e)===t?!1:t==="auto"?(bC(e),!0):t==="avoid"?(e.style.breakAfter="avoid",e.style.pageBreakAfter="avoid",!0):(e.style.breakAfter="page",e.style.pageBreakAfter="always",!0)}function vC(e,t){return hg(e)===t?!1:t==="auto"?(yC(e),!0):t==="avoid"?(e.style.breakBefore="avoid",e.style.pageBreakBefore="avoid",!0):(e.style.breakBefore="page",e.style.pageBreakBefore="always",!0)}function kC(e,t){return e===t}function bf(e,t){return e===t}const st=["top","right","bottom","left"],Es=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],un={top:null,right:null,bottom:null,left:null},$u={style:"none",width:null,color:null},SC=new Set(Es),yf={value:0,unit:"px"};function PC(){return{margin:{...un},padding:{...un},lineHeight:null,border:{...$u},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null,breakInside:"auto",breakAfter:"auto",breakBefore:"auto"}}function Wr(){const e=PC();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 On(e,t){return st.every(n=>Yt(e[n],t[n]))}function bg(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 yg(e,t){return e.style===t.style&&Yt(e.width,t.width)&&e.color===t.color}function xg(e,t){return e===t?!0:!e||!t?!1:Yt(e.offsetX,t.offsetX)&&Yt(e.offsetY,t.offsetY)&&Yt(e.blur,t.blur)&&Yt(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function AC(e){return e.kind==="normal"?"normal":e.kind==="number"?he(e.value):je({value:e.value,unit:e.unit})}function TC(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)?ur(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?ur(n):null}function ur(e){return at(Math.min(1,Math.max(0,e)))}function as(e){return at(ur(e)*100)}function wg(e){return ur(e/100)}function Cg(e){return he(ur(e))}function RC(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:at(r)}}const n=vt(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function DC(e,t){const n=[];let r="",o=0;for(const a of e){if(a==="("){o+=1,r+=a;continue}if(a===")"){o=Math.max(0,o-1),r+=a;continue}if(a===t&&o===0){r.trim()&&n.push(r.trim()),r="";continue}r+=a}return r.trim()&&n.push(r.trim()),n}function IC(e){const t=[];let n="",r=0;for(const o of e){if(o==="("){r+=1,n+=o;continue}if(o===")"){r=Math.max(0,r-1),n+=o;continue}if(/\s/.test(o)&&r===0){n&&t.push(n),n="";continue}n+=o}return n&&t.push(n),t}function jC(e){const t=[je(e.offsetX),je(e.offsetY),je(e.blur),je(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function EC(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=DC(t,",")[0];if(!n)return null;const r=IC(n);let o=!1,a=null;const s=[];for(const u of r){if(u.toLowerCase()==="inset"){o=!0;continue}const d=vt(u);if(d){s.push(d);continue}const f=Ke(u);if(f){a=f;continue}return null}return s.length<2||s.length>4?null:{offsetX:s[0],offsetY:s[1],blur:s[2]??yf,spread:s[3]??yf,color:a,inset:o}}function fo(e,t){return vt(e.style.getPropertyValue(t))}function _C(e,t,n,r){const o=n&&r?br(n):n,a=o?je(o):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function xf(e,t){return{top:fo(e,`${t}-top`),right:fo(e,`${t}-right`),bottom:fo(e,`${t}-bottom`),left:fo(e,`${t}-left`)}}function wf(e,t,n,r){let o=!1;for(const a of st)_C(e,`${t}-${a}`,n[a],r)&&(o=!0);return o}function MC(e){const t=e.trim().toLowerCase();return SC.has(t)?t:"none"}function vg(e){const t=MC(e.style.borderStyle||e.style.borderTopStyle),n=fo(e,"border-width")??fo(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,o=r?Ke(r):null;return{style:t,width:n,color:o}}function NC(e,t){const n=vg(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?br(t.width):null,color:t.color};return yg(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=je(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function kg(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return vt(n)}function LC(e,t){const n=t?br(t):null,r=kg(e);return Yt(r,n)?!1:(n?e.style.borderRadius=je(n):e.style.removeProperty("border-radius"),!0)}function Sg(e){return EC(e.style.boxShadow)}function BC(e,t){const n=Sg(e),r=t?{...t,blur:br(t.blur)}:null;return xg(n,r)?!1:(r?e.style.boxShadow=jC(r):e.style.removeProperty("box-shadow"),!0)}function Pg(e){return RC(e.style.lineHeight)}function FC(e,t){const n=Pg(e);return bg(n,t)?!1:(t?e.style.lineHeight=AC(t):e.style.removeProperty("line-height"),!0)}function Ag(e){const t=e.style.backgroundColor;return t?Ke(t):null}function HC(e,t){const n=t?Ke(t):null;return Ag(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Tg(e){return TC(e.style.opacity)}function zC(e,t){const n=Tg(e),r=t===null?null:ur(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Cg(r),!0)}function Ro(e){const t=xC(e);return{margin:xf(e,"margin"),padding:xf(e,"padding"),lineHeight:Pg(e),border:vg(e),borderRadius:kg(e),boxShadow:Sg(e),backgroundColor:Ag(e),opacity:Tg(e),breakInside:t.breakInside,breakAfter:t.breakAfter,breakBefore:t.breakBefore}}function Do(e,t){let n=!1;return!t.marginMixed&&wf(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&wf(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&FC(e,t.lineHeight)&&(n=!0),!t.borderMixed&&NC(e,t.border)&&(n=!0),!t.radiusMixed&&LC(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&BC(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&HC(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&zC(e,t.opacity)&&(n=!0),!t.breakInsideMixed&&wC(e,t.breakInside)&&(n=!0),!t.breakAfterMixed&&CC(e,t.breakAfter)&&(n=!0),!t.breakBeforeMixed&&vC(e,t.breakBefore)&&(n=!0),n&&It(e),n}function OC(e){const t=Wr(),n=$n(e);if(n.length===0)return t;const r=n.map(Ro),o=r[0];return{margin:o.margin,marginMixed:r.some(a=>!On(a.margin,o.margin)),padding:o.padding,paddingMixed:r.some(a=>!On(a.padding,o.padding)),lineHeight:o.lineHeight,lineHeightMixed:r.some(a=>!bg(a.lineHeight,o.lineHeight)),border:o.border,borderMixed:r.some(a=>!yg(a.border,o.border)),borderRadius:o.borderRadius,radiusMixed:r.some(a=>!Yt(a.borderRadius,o.borderRadius)),boxShadow:o.boxShadow,shadowMixed:r.some(a=>!xg(a.boxShadow,o.boxShadow)),backgroundColor:o.backgroundColor,backgroundMixed:r.some(a=>a.backgroundColor!==o.backgroundColor),opacity:o.opacity,opacityMixed:r.some(a=>a.opacity!==o.opacity),breakInside:o.breakInside,breakInsideMixed:r.some(a=>!kC(a.breakInside,o.breakInside)),breakAfter:o.breakAfter,breakAfterMixed:r.some(a=>!bf(a.breakAfter,o.breakAfter)),breakBefore:o.breakBefore,breakBeforeMixed:r.some(a=>!bf(a.breakBefore,o.breakBefore))}}function KC(e,t){return yr(e,()=>{const n=Vr(e);if(n.length===0)return!1;let r=!1;for(const o of n)Do(o,t)&&(r=!0);return r})}const Ci=96,$C=25.4,Uu=Ci/$C,Rg=Uu*10,Dg=72,UC=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(in|cm|mm|pt|px|em|rem|%)$/i;function Ig(e){const t=e.trim();if(!t)return null;if(/^[+-]?0(?:\.0+)?$/.test(t))return{value:0,unit:"px"};const n=t.match(UC);if(!n)return null;const r=Number(n[1]);return Number.isFinite(r)?{value:at(r),unit:n[2].toLowerCase()}:null}function vi(e,t){switch(t){case"in":return e/Ci;case"cm":return e/Rg;case"mm":return e/Uu;case"pt":return e/Ci*Dg;case"px":default:return e}}function ki(e,t){switch(t){case"in":return e*Ci;case"cm":return e*Rg;case"mm":return e*Uu;case"pt":return e/Dg*Ci;case"em":case"rem":return e*16;case"px":default:return e}}function rr(e,t=0){if(!e)return t;const n=typeof e=="string"?Ig(e):e;return!n||!Number.isFinite(n.value)?t:ki(n.value,n.unit)}function wc(e,t="in"){const n=vi(e,t);return{value:Math.round(n*1e3)/1e3,unit:t}}function ci(e){const t=vi(e,"pt");return{value:Math.round(t*1e3)/1e3,unit:"pt"}}function jg(e,t="in"){const n=vi(e,t),r=t==="in"?2:t==="cm"?1:0;return`${n.toFixed(r)} ${t}`}function Mr(e,t="in",n=!1,r=0){if(n)return e;const o=e-r,s=ki(t==="in"?.125:t==="cm"?.25:t==="mm"?2.5:10,t);if(s<=0)return e;const u=Math.round(o/s)*s;return r+u}function Eg(e,t,n="in"){const r=[];if(e<=0)return r;const o=n==="in",a=o?.125:.1;if(ki(a,n)<=0)return r;const u=-vi(t,n),d=vi(e-t,n),f=Math.floor(u/a),h=Math.ceil(d/a);for(let g=f;g<=h;g++){const y=g*a,b=t+ki(y,n);if(b<0||b>e)continue;const w=Math.round(y),x=Math.abs(y-w)<.001,S=o?Math.abs(y-(Math.floor(y)+.5))<.001:!1,k=o?Math.abs(y-(Math.floor(y)+.25))<.001||Math.abs(y-(Math.floor(y)+.75))<.001:!1;let v=4;x?v=10:S?v=7:k&&(v=5);const A={positionPx:Math.round(b),unitValue:y,major:x,height:v};x&&y>=0&&(A.label=String(Math.abs(w))),r.push(A)}return r}function _g(e){const t=vt(e);if(t)return t;const n=Ig(e);return n&&(n.unit==="in"||n.unit==="cm"||n.unit==="mm")?ci(ki(n.value,n.unit)):null}const Si="data-page-at-rule";function or(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...un},marginMixed:!1}}function Vu(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Mg(e){return e.body.innerHTML.replace(/\s*data-page=""/g," data-page")}function Pi(e){var r;const n=Vu(e).querySelector(`style[${Si}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function $a(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?_g(r[1].trim()):null}function VC(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...un};const n=t[1].trim().split(/\s+/).map(u=>_g(u)),[r,o=r,a=r,s=o]=n;return{top:r??null,right:o??null,bottom:a??null,left:s??null}}function WC(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 o=r.includes("landscape"),a=r.includes("portrait"),s=o?"landscape":a?"portrait":null,u=r.replace(/\b(landscape|portrait)\b/g,"").trim(),d=u.split(/\s+/).filter(Boolean);if(d.length===1){if(d[0]==="a4")return{sizePreset:"A4",customWidth:null,customHeight:null,orientation:s};if(d[0]==="letter")return{sizePreset:"letter",customWidth:null,customHeight:null,orientation:s};if(d[0]==="legal")return{sizePreset:"legal",customWidth:null,customHeight:null,orientation:s}}if(d.length>=2){const f=vt(d[0]),h=vt(d[1]);if(f&&h)return{sizePreset:"custom",customWidth:f,customHeight:h,orientation:s}}return!u&&s?{sizePreset:"auto",customWidth:null,customHeight:null,orientation:s}:t}function GC(e){const t=or();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],o=WC(r),a={top:$a(r,"top"),right:$a(r,"right"),bottom:$a(r,"bottom"),left:$a(r,"left")},u=st.some(d=>a[d]!==null)?a:VC(r);return{...o,margin:u,marginMixed:!1}}function it(e){return GC(Pi(e))}function Zt(e,t){return Pi(e)||!Pi(t)?e:ss(e,it(t))}function qC(e){const t=st.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?je(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:st.map(r=>e[r]?`margin-${r}: ${je(e[r])};`:null).filter(Boolean).join(" ")}function ZC(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(je(e.customWidth),je(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function YC(e){const t=ZC(e),n=qC(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function cn(e){const t=Vu(e);for(const n of t.querySelectorAll(`style[${Si}]`))n.remove();return Mg(t)}function XC(e,t){const n=Vu(e);let r=n.querySelector(`style[${Si}]`);return r||(r=n.createElement("style"),r.setAttribute(Si,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,Mg(n)}function ss(e,t){const n=YC(t);return n?XC(e,n):Ng(e)}function Ng(e){return cn(e)}function Lg(e){const t=e.map(n=>Pi(n)).filter(n=>!!n);return t.length===0?"":t.join(`
140
+ `)}const Wu="data-page-sized",qc={top:"--wysiwyg-page-margin-top",right:"--wysiwyg-page-margin-right",bottom:"--wysiwyg-page-margin-bottom",left:"--wysiwyg-page-margin-left"},JC="0.75rem",Zc=["top","right","bottom","left"],Cc={A4:{width:"210mm",height:"297mm"},letter:{width:"8.5in",height:"11in"},legal:{width:"8.5in",height:"14in"}};function Io(e,t=!1){let n=null;return e.sizePreset==="A4"||e.sizePreset==="letter"||e.sizePreset==="legal"?n={...Cc[e.sizePreset]}:e.sizePreset==="custom"&&e.customWidth&&e.customHeight?n={width:je(e.customWidth),height:je(e.customHeight)}:e.orientation?n=t?{...Cc.letter}:null:n=t?{...Cc.letter}:null,n?e.orientation==="landscape"?{width:n.height,height:n.width}:n:null}function Bg(e){return Io(e,!1)!==null}function QC(e){const t=Io(e);if(!t)return null;const n=document.createElement("div");n.style.position="fixed",n.style.left="-10000px",n.style.top="0",n.style.visibility="hidden",n.style.boxSizing="border-box",n.style.width=t.width,n.style.minHeight=t.height;const r=Ei(e);for(const a of st){const s=r[a];s&&n.style.setProperty(`padding-${a}`,s)}document.body.appendChild(n);const o={width:n.offsetWidth,height:n.offsetHeight};return n.remove(),o}function Ei(e){return ev(e.margin)}function ev(e){return{top:e.top?je(e.top):null,right:e.right?je(e.right):null,bottom:e.bottom?je(e.bottom):null,left:e.left?je(e.left):null}}const tv=["width","min-height","padding-top","padding-right","padding-bottom","padding-left"];function Fg(e){for(const t of Zc)e.style.removeProperty(qc[t])}function nv(e){const t=e.querySelector("[data-page-bg]");if(!(t instanceof HTMLElement))return!1;const n=t.style.backgroundImage.trim();if(n&&n!=="none")return!0;const r=t.getAttribute("style")??"";return/background-image\s*:\s*(?!none\b)/i.test(r)}function rv(e,t){if(!nv(e)){Fg(e);return}const n=it(t);if(Io(n)){const o=Ei(n);for(const a of Zc){const s=o[a]??"0px";e.style.setProperty(qc[a],s)}return}for(const o of Zc)e.style.setProperty(qc[o],JC)}function ov(e){e.removeAttribute(Wu);for(const t of tv)e.style.removeProperty(t);Fg(e)}function Hg(e,t){const n=it(e),r={...n.margin};return t.left!==void 0&&(r.left=ci(t.left)),t.right!==void 0&&(r.right=ci(t.right)),t.top!==void 0&&(r.top=ci(t.top)),t.bottom!==void 0&&(r.bottom=ci(t.bottom)),ss(e,{...n,margin:r})}function iv(e,t,n){jo(e,Hg(t,n))}function jo(e,t){const n=it(t),r=Io(n);if(!r){ov(e);return}e.setAttribute(Wu,""),e.style.width=r.width,e.style.minHeight=r.height;const o=Ei(n);for(const a of st){const s=`padding-${a}`,u=o[a];u?e.style.setProperty(s,u):e.style.removeProperty(s)}rv(e,t)}const zg="data-template-tag",Og=/\{\{/;function Gu(e){return e instanceof HTMLSpanElement&&e.hasAttribute(zg)}function Kg(e){return Og.test(e)}function $g(e){return Og.test(e)}function av(e,t){if(!Kg(e))return!0;const n=(e.match(/data-template-tag/g)??[]).length,r=t.querySelectorAll(`[${zg}]`).length;if(n>0&&r<n)return!1;const o=e.match(/\{\{[^}]*\}\}/g)??[],a=t.textContent??"";return o.every(s=>a.includes(s))}const dr="data-page",Or="data-page-bg",ls="commspliant-background";function kt(e){return e instanceof HTMLElement&&(e.id===ls||e.hasAttribute(Or))}function sv(e){return e.hasAttribute(dr)&&e.parentElement?e.parentElement:e}function qu(e){const t=sv(e),n=new Set,r=[],o=a=>{a instanceof HTMLElement&&kt(a)&&!n.has(a)&&(n.add(a),r.push(a))};o(t.querySelector(`#${ls}`));for(const a of t.querySelectorAll(`[${Or}]`))o(a);return o(t),r}function Zu(e){return qu(e)[0]??null}function pi(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 Ug(e,t){if(!e.hasAttribute(Wu))return pi(t);let n=!1;return t.style.width!=="100%"&&(t.style.width="100%",n=!0),t.style.height!=="auto"&&(t.style.height="auto",n=!0),n}const lv=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre","div"]);function Vg(e){return lv.has(e.tagName.toLowerCase())}function _s(e){const t=e.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li");return t[t.length-1]??null}function Wg(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t))&&t instanceof HTMLElement&&Vg(t))return t;return null}function Gg(e){const t=Wg(e)??_s(e);if(t)return t;const n=e.ownerDocument.createElement("p");return n.appendChild(e.ownerDocument.createElement("br")),e.appendChild(n),n}function Ms(e){let t=!1;for(const n of[...e.childNodes]){if(n instanceof HTMLElement&&kt(n)||n instanceof HTMLElement&&Gu(n)||n.nodeType!==Node.TEXT_NODE)continue;const r=n.textContent??"";if(!r.trim()){n.remove(),t=!0;continue}if($g(r))continue;(_s(e)??Gg(e)).appendChild(n),t=!0}return t}function Ns(e){const t=yt(e);if(!t)return!1;let n=!1;for(const r of[...e.childNodes])r!==t&&r instanceof HTMLElement&&kt(r)&&(t.insertBefore(r,t.firstChild),n=!0);return n}function Ai(e){const t=yt(e);if(!t)return{changed:!1,absorbedBlocks:[]};let n=Ns(e);const r=[];for(const o of[...e.childNodes])if(o!==t&&!(o instanceof HTMLElement&&kt(o))){if(o.nodeType===Node.TEXT_NODE){const a=o.textContent??"";if(!a.trim()){o.remove(),n=!0;continue}if($g(a))continue;let s=_s(t);s||(s=document.createElement("p"),t.appendChild(s)),s.appendChild(o),n=!0;continue}if(o instanceof HTMLElement&&Vg(o)&&r.push(o),o instanceof HTMLElement&&Gu(o)){t.appendChild(o),n=!0;continue}t.appendChild(o),n=!0}return Ms(t)&&(n=!0),{changed:n,absorbedBlocks:r}}function cv(e){const t=document.createRange(),n=e.firstChild;(n==null?void 0:n.nodeType)===Node.TEXT_NODE?t.setStart(n,0):n?t.setStartBefore(n):t.setStart(e,0),t.collapse(!0);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}const uv="p, h1, h2, h3, h4, h5, h6, li, blockquote, pre";function qg(e,t){if(t<=0)return;const n=yt(e);if(!n)return;const r=n.querySelectorAll(uv);if(r.length===0)return;const o=r[r.length-1],a=window.getSelection();if(!a||a.rangeCount===0)return;const s=a.getRangeAt(0).startContainer;o.contains(s)||cv(o)}function Zg(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(dr)}function Yg(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function dv(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function yt(e){return Yg(e).find(n=>n.hasAttribute(dr))??null}function mv(e){if(dv(e))return null;const t=Yg(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"||kt(n)?null:n}function Yu(e){const t=yt(e);if(t)return pi(t),t;const n=mv(e);if(n)return n.setAttribute(dr,""),pi(n),n;const r=document.createElement("div");for(r.setAttribute(dr,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),pi(r),r}function Xu(e){return yt(e)??e}function fv(e,t,n){const{startContainer:r}=n;return r===t||t.contains(r)?!1:r===e?!0:e.contains(r)}function pv(e,t){const{startContainer:n}=t;return n===e||n.nodeType===Node.TEXT_NODE&&n.parentElement===e}function gv(e){var o;const t=document.createRange(),n=e.lastChild;(n==null?void 0:n.nodeType)===Node.TEXT_NODE?t.setStart(n,((o=n.textContent)==null?void 0:o.length)??0):n?t.setStartAfter(n):t.setStart(e,0),t.collapse(!0);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}function Yc(e){Ms(e);const t=_s(e)??Wg(e)??Gg(e);gv(t)}function hv(e){const t=yt(e);e.focus(),t&&Yc(t)}function vo(e){const t=yt(e);if(!t)return;Ms(t);const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0);if(pv(t,r)){Yc(t);return}fv(e,t,r)&&Yc(t)}const bv=["background-image","background-size","background-position","background-repeat","opacity"];function yv(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 Ls(e){const t=yt(e);yv(e,t,"background-color");for(const n of bv)e.style.removeProperty(n)}const cs="<!-- wysiwyg-page-separator -->",Kr="data-page-surface";function ar(e){const t=e.trim();return t?t.includes(cs)?e.split(cs).map(n=>n.trim()):[e]:[""]}function zt(e){return e.length===0?"":e.length===1?e[0]??"":e.join(`
141
141
  ${cs}
142
- `)}function nr(){return"<p></p>"}function ir(e){return e.length===0?[nr()]:e.map(t=>t.trim())}function vc(e,t){if(e.length===t.length){let a=!1;const s=[],u=[];for(let d=0;d<t.length;d+=1){const f=t[d]??"";e[d]===f?s.push(e[d]):(s.push(f),a=!0,u.push(d))}return a?{pages:s,changed:!0,changedIndices:u}:{pages:e,changed:!1,changedIndices:[]}}const n=[],r=[];for(let a=0;a<t.length;a+=1){const s=t[a]??"";a<e.length&&e[a]===s?n.push(e[a]):(n.push(s),r.push(a))}return r.length>0||e.length!==t.length||!Nr(e,n)?{pages:n,changed:!0,changedIndices:r}:{pages:e,changed:!1,changedIndices:[]}}function Nr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Xc(e,t,n){if(t<0||t>=e.length)return{pages:[...e],changed:!1};if(e[t]===n)return{pages:e,changed:!1};const r=e.slice();return r[t]=n,{pages:r,changed:!0}}function We(e,t){const n=e.querySelector(`[${Kr}][data-page-index="${t}"]`);return n||([...e.querySelectorAll(`[${Kr}]`)][t]??null)}function xv(e){if(!e)return null;const t=e instanceof Element?e:e.parentElement;return(t==null?void 0:t.closest(`[${Kr}]`))??null}function Cf(e){const t=e.getAttribute("data-page-index");if(t!==null){const r=Number.parseInt(t,10);if(!Number.isNaN(r))return r}let n=e.parentElement;for(;n;){const o=[...n.querySelectorAll(`[${Kr}]`)].indexOf(e);if(o!==-1)return o;n=n.parentElement}return null}const Ft="data-wysiwyg-img-id",Jc="data-page-bg",wv=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,Qc=/background-image:\s*url\(\s*(["']?)(.+?)\1\s*\)/i;function vf(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function kf(e){return e.body.innerHTML}function kc(e){return wv.test(e.trim())}function Sf(e){return e.includes("<img")||e.includes("IMG")||e.includes(Jc)||e.includes(Ft)}function Cv(e){var r;const t=Qc.exec(e);return t&&(((r=t[2])==null?void 0:r.trim())??"")||null}function Ua(e,t){const r=`url("${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`;if(Qc.test(e))return e.replace(Qc,`background-image: ${r}`);const o=e.trim().replace(/;+$/,"");return o?`${o};background-image: ${r}`:`background-image: ${r}`}function vv(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`img-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function kv(){const e=new Map;function t(b,w){const x=e.get(b);if(x){if(x.dataUrl!==w){URL.revokeObjectURL(x.objectUrl);const k=URL.createObjectURL(Pf(w));return e.set(b,{dataUrl:w,objectUrl:k}),k}return x.objectUrl}const S=URL.createObjectURL(Pf(w));return e.set(b,{dataUrl:w,objectUrl:S}),S}function n(b,w){if(!(w!=null&&w.trim())){for(const[S,k]of e)if(k.dataUrl===b)return S}const x=(w==null?void 0:w.trim())||vv();return t(x,b),x}function r(b){var w;return((w=e.get(b))==null?void 0:w.dataUrl)??null}function o(b){var w;return((w=e.get(b))==null?void 0:w.objectUrl)??null}function a(b){return e.has(b)}function s(b){const w=b.trim();if(!w)return null;for(const[x,S]of e)if(S.objectUrl===w)return x;return null}function u(b,w){const x=b.trim();if(!x)return null;if(kc(x))return x;const S=(w==null?void 0:w.trim())||s(x);return S?r(S):null}function d(b,w){var x,S;for(const k of b.querySelectorAll("img")){const v=(x=k.getAttribute(Ft))==null?void 0:x.trim(),A=((S=k.getAttribute("src"))==null?void 0:S.trim())??"";if(w==="hydrate"){const T=u(A,v);if(!T)continue;k.setAttribute("src",T);continue}if(v&&a(v)){const T=o(v);T&&k.setAttribute("src",T);continue}const j=s(A);if(j){k.setAttribute(Ft,j);const T=o(j);T&&k.setAttribute("src",T);continue}if(!kc(A))continue;const D=n(A);k.setAttribute(Ft,D);const R=o(D);R&&k.setAttribute("src",R)}}function f(b,w){var x;for(const S of b.querySelectorAll(`[${Jc}]`)){if(!(S instanceof HTMLElement))continue;const k=(x=S.getAttribute(Ft))==null?void 0:x.trim(),v=S.getAttribute("style")??"",A=Cv(v);if(w==="hydrate"){if(!A)continue;const T=u(A,k);if(!T)continue;S.setAttribute("style",Ua(v,T));continue}if(!A)continue;if(k&&a(k)){const T=o(k);T&&S.setAttribute("style",Ua(v,T));continue}const j=s(A);if(j){S.setAttribute(Ft,j);const T=o(j);T&&S.setAttribute("style",Ua(v,T));continue}if(!kc(A))continue;const D=n(A);S.setAttribute(Ft,D);const R=o(D);R&&S.setAttribute("style",Ua(v,R))}}function h(b){const w=b.trim();if(!w||!Sf(w))return b;const x=vf(b);return d(x,"externalize"),f(x,"externalize"),kf(x)}function g(b){const w=b.trim();if(!w||!Sf(w))return b;const x=vf(b);f(x,"hydrate"),d(x,"hydrate");for(const S of x.querySelectorAll("img"))S.removeAttribute(Ft);for(const S of x.querySelectorAll(`[${Jc}]`))S.removeAttribute(Ft);return kf(x)}function y(){for(const b of e.values())URL.revokeObjectURL(b.objectUrl);e.clear()}return{register:n,getDataUrl:r,getObjectUrl:o,has:a,externalizeHtml:h,hydrateHtml:g,clear:y}}function Pf(e){const t=e.indexOf(",");if(t<0)return new Blob;const n=e.slice(0,t),r=e.slice(t+1),o=/^data:([^;,]+)/i.exec(n),a=(o==null?void 0:o[1])??"application/octet-stream",s=atob(r),u=new Uint8Array(s.length);for(let d=0;d<s.length;d+=1)u[d]=s.charCodeAt(d);return new Blob([u],{type:a})}const Sv=.85,Pv=new Set(["image/webp","image/avif","image/gif"]);let oi=null;function Av(){if(oi!==null)return oi;oi=!1;try{oi=document.createElement("canvas").toDataURL("image/webp").startsWith("data:image/webp")}catch{}return oi}function Tv(e){const t=e.type.trim().toLowerCase();if(t&&Pv.has(t))return!1;const n=jv(e.name);return!(!t&&(n==="webp"||n==="avif"||n==="gif"))}function Rv(e,t=Sv){return typeof createImageBitmap!="function"?Promise.resolve(null):createImageBitmap(e).then(n=>Dv(n,t)).catch(()=>null)}function Dv(e,t){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");if(!r)return e.close(),Promise.resolve(null);try{r.drawImage(e,0,0)}finally{e.close()}return new Promise(o=>{n.toBlob(a=>{if(!a){o(null);return}const s=new FileReader;s.onload=()=>{const u=String(s.result??"");o(u.startsWith("data:image/webp")?u:null)},s.onerror=()=>o(null),s.readAsDataURL(a)},"image/webp",t)})}function jv(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Xg=2*1024*1024,Iv="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",Ev=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),_v=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),Jg=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,Mv=/^(javascript|vbscript|file|blob):/i;function Nv(e={}){return{src:"",alt:"",title:"",...e}}function Sn(e){const t=e.trim();if(!t)return"empty";if(Mv.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return Jg.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 Lv(e){return e.size>Xg?"tooLarge":Uv(e)?null:"type"}function Bv(e){const t=Lv(e);return t?Promise.reject(new Error(t)):Fv(e)}async function Fv(e){if(Tv(e)&&Av()){const t=await Rv(e);if(t&&Sn(t)===null&&zv(t)<=Xg)return t}return Hv(e)}function Hv(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const o=String(r.result??"");if(Sn(o)){n(new Error("invalid"));return}t(o)},r.onerror=()=>n(r.error??new Error("Failed to read file")),r.readAsDataURL(e)})}function zv(e){const t=e.indexOf(",");if(t<0)return e.length;const n=e.slice(t+1),r=n.endsWith("==")?2:n.endsWith("=")?1:0;return Math.floor(n.length*3/4)-r}function Ov(e,t,n){const r=Qg(t,n);e.setAttribute("src",r.src.trim()),r.registryId?e.setAttribute(Ft,r.registryId):e.removeAttribute(Ft);const o=t.alt.trim(),a=t.title.trim();o?e.setAttribute("alt",o):e.removeAttribute("alt"),a?e.setAttribute("title",a):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.height="auto",Kv(e,t.css)}function Kv(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim(),s=r.slice(o+1).trim();a&&s&&e.style.setProperty(a,s)}}function Qg(e,t){if(!t)return e;const n=e.src.trim();if(Sn(n)||!Jg.test(n))return e;const r=t.register(n),o=t.getObjectUrl(r);return o?{...e,src:o,registryId:r}:e}function $v(e,t,n){const r=Nv(t),o=n?Qg(r,n):r;if(o.registryId){const d=n==null?void 0:n.getDataUrl(o.registryId);if(!d||Sn(d))return!1}else if(Sn(o.src))return!1;const a=window.getSelection();if(!a||a.rangeCount===0)return!1;const s=a.getRangeAt(0);if(!Te(e,s.commonAncestorContainer))return!1;s.collapsed||s.deleteContents();const u=document.createElement("img");return Ov(u,o,n),s.insertNode(u),s.setStartAfter(u),s.collapse(!0),a.removeAllRanges(),a.addRange(s),!0}function eu(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function Sc(e,t){if(!Te(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 Uv(e){const t=e.type.trim().toLowerCase();if(t&&Ev.has(t))return!0;const n=Vv(e.name);return!!(!t&&n&&_v.has(n))}function Vv(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const eh=["%","px","pt","pc","em","rem"],Wv="%",Gv={"%":[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]},ko={"%":{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}},qv=new Set(eh),Zv=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function Yv(e){return qv.has(e)}function Lr(e){return`${be(e.value)}${e.unit}`}function us(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(Zv);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r)||r<=0)return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return Yv(o)?So(r,o):null}function Af(e,t){const n=e.trim();if(!n)return null;const r=us(n);if(r)return r;const o=Number(n.replace(",","."));return Number.isFinite(o)?So(o,t):null}function So(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=ko[t];return{value:at(Math.min(r,Math.max(n,e))),unit:t}}function gi(e,t,n){const r=n>0?n:1;if(e==="width"){const a=So(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:So(t.value*r,t.unit)??t,height:t}}const Ja="data-hover-css",Ju=["fill","contain","cover","none","scale-down"],Qu=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],Xv=new Set(Ju),Jv=new Set(Qu),Tf="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",Qv="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",e1=/^-?[a-z][a-z0-9-]*$/i,t1=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,tu=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function th(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...un},border:{...$u},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function n1(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function r1(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=gi("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=gi("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function o1(e){const t=[];for(const n of e.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim().toLowerCase(),s=r.slice(o+1).trim();!a||!s||e1.test(a)&&(a==="behavior"||a.endsWith("binding")||t1.test(s)||t.push(`${a}: ${s}`))}return t.join("; ")}function sr(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!Te(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&&Te(e,r))return r}return eu(e,n.commonAncestorContainer)}function i1(e){const t=sr(e);return t?nh(t):null}function nh(e){const t=Ro(e),n=u1(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,o=s1(e);return th({sizeMode:o.sizeMode,width:o.width,height:o.height,align:n,margin:r,border:t.border,borderRadius:t.borderRadius,boxShadow:t.boxShadow,opacity:t.opacity,objectFit:oh(e),objectPosition:p1(e),rotateDeg:ih(e),hoverCss:e.getAttribute(Ja)??""})}function rh(e,t){let n=!1;return l1(e,t)&&(n=!0),Do(e,{...Wr(),margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:un,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),d1(e,t.align)&&(n=!0),m1(e,t.objectFit)&&(n=!0),f1(e,t.objectPosition)&&(n=!0),h1(e,t.rotateDeg)&&(n=!0),b1(e,t.hoverCss)&&(n=!0),n}function a1(e,t){const n=sr(e);return n?rh(n,t):!1}function s1(e){const t=us(e.style.width),n=us(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 l1(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=c1(t);return r.width?e.style.width=Lr(r.width):e.style.removeProperty("width"),r.height?e.style.height=Lr(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 c1(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 u1(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(),o=e.style.marginRight.trim().toLowerCase();return n==="block"&&r==="auto"&&o==="auto"?"center":null}function d1(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 oh(e){const t=e.style.objectFit.trim().toLowerCase();return Xv.has(t)?t:null}function m1(e,t){return oh(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function f1(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 p1(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Jv.has(t),t):null}function ih(e){const t=tu.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?at(n):null}function g1(e){const t=e.trim();return t?tu.test(t)&&t.replace(tu,"").trim()==="":!0}function h1(e,t){const n=ih(e),r=t===null||t===0?null:at(t);return n===r?!1:r===null?g1(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${be(r)}deg)`,!0)}function b1(e,t){const n=o1(t),r=e.getAttribute(Ja)??"",o=e.getAttribute("onmouseover")??"";return r===n&&(n&&o===Tf||!n&&!o)?!1:n?(e.setAttribute(Ja,n),e.setAttribute("onmouseover",Tf),e.setAttribute("onmouseout",Qv),!0):(e.removeAttribute(Ja),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const yo={value:100,unit:"%"},y1=new Set(Ju),x1=new Set(Qu),w1=new Set(["cover","contain","scale-down","none"]),Rf={contain:"contain",cover:"cover",auto:"none"},Df={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function vn(){return{src:null,opacity:null,fit:null,position:null,width:{...yo},height:null}}function ah(e){return e!=null&&w1.has(e)}function sh(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?ur(n):null}function jf(e,t){const n=sh(e),r=t===null?null:ur(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Cg(r),!0)}function lh(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 C1(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function If(e,t){const n=lh(e),r=(t==null?void 0:t.trim())??"",o=r&&Sn(r)===null?r:null;return n===o?!1:(o?e.style.backgroundImage=C1(o):e.style.removeProperty("background-image"),!0)}function ed(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Pc(e){return!e||e==="auto"?null:us(e)}function v1(e){return ah(e.fit)&&e.fit?Df[e.fit]:e.fit==="fill"?Df.fill:e.width&&e.height?`${Lr(e.width)} ${Lr(e.height)}`:e.width?Lr(e.width):e.height?`auto ${Lr(e.height)}`:null}function k1(e){const t=ed(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...yo},height:{...yo}};if(Rf[t])return{fit:Rf[t],width:null,height:null};if(y1.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:Pc(n[0]),height:null}:n.length===2?{fit:null,width:Pc(n[0]),height:Pc(n[1])}:{fit:null,width:null,height:null}}function S1(e,t){const n=ed(e.style.backgroundSize),r=v1(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function P1(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(x1.has(t),t):null}function Ef(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 ds(e){let t=!1;return e.id!==ls&&(e.id=ls,t=!0),e.hasAttribute(Or)||(e.setAttribute(Or,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function ms(e){const t=e.getAttribute("style");e.style.position="absolute",e.style.inset="0",e.style.zIndex="0",e.style.pointerEvents="none",e.style.userSelect="none",e.style.backgroundRepeat="no-repeat",e.style.setProperty("print-color-adjust","exact");const n=e.style.cssText;return n.includes("-webkit-print-color-adjust")||e.setAttribute("style",`${n};-webkit-print-color-adjust:exact`),e.getAttribute("style")!==t}function ch(e){const t=qu(e),n=t[0]??null;if(n){let o=ds(n);for(const a of t.slice(1))a.remove(),o=!0;return(n.parentNode!==e||n!==e.firstChild)&&(e.insertBefore(n,e.firstChild),o=!0),{layer:n,changed:o}}const r=document.createElement("div");return ds(r),ms(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function A1(e){const t=qu(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function fs(e){let t=!1;return Zu(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 td(e){if(!Zu(e))return fs(e);const n=ch(e);let r=n.changed;return ds(n.layer)&&(r=!0),ms(n.layer)&&(r=!0),fs(e)&&(r=!0),r}function Bs(e){const t=yt(e);if(!t)return!1;let n=Ns(e);return td(t)&&(n=!0),n}function T1(e){return e.includes(Or)||e.includes(dr)}function R1(e){const t=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");Ns(t.body);const n=yt(t.body);return n&&(td(n),Ms(n)),t.body.innerHTML}function _f(e){return T1(e)?R1(e):e}function uh(e){const t=k1(e);return{src:lh(e),opacity:sh(e),fit:t.fit,position:P1(e),width:t.width,height:t.height}}function dh(e,t){var a;const n=((a=t.src)==null?void 0:a.trim())??"",r=n.length>0&&Sn(n)===null;let o=!1;return r?(If(e,n)&&(o=!0),S1(e,t)&&(o=!0),Ef(e,t.position)&&(o=!0),jf(e,t.opacity)&&(o=!0),e.style.backgroundRepeat!=="no-repeat"&&(e.style.backgroundRepeat="no-repeat",o=!0),o&&jt(e),o):(If(e,null)&&(o=!0),ed(e.style.backgroundSize)&&(e.style.removeProperty("background-size"),o=!0),Ef(e,null)&&(o=!0),jf(e,null)&&(o=!0),e.style.backgroundRepeat&&(e.style.removeProperty("background-repeat"),o=!0),o&&jt(e),o)}function D1(e){const t=Zu(e);return t?uh(t):vn()}function j1(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&Sn(n)===null)){const d=A1(e),f=fs(e);return(d||f)&&jt(e),d||f}const o=ch(e),a=o.layer;let s=o.changed;return ds(a)&&(s=!0),ms(a)&&(s=!0),fs(e)&&(s=!0),dh(a,t)&&(s=!0),ms(a)&&(s=!0),s&&(jt(a),jt(e)),s}function I1(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function E1(e){const t=e.style.backgroundImage.trim();if(t&&t!=="none")return!0;const n=e.getAttribute("style")??"";return/background-image\s*:\s*(?!none\b)/i.test(n)}function Mf(e){const t=e.trim().match(/^([\d.]+)pt$/i);return t?Number.parseFloat(t[1]):null}function _1(e,t){if(!t)return e;if(!e)return t;const n=Mf(e),r=Mf(t);return n!==null&&r!==null?`${Math.max(n,r)}pt`:t}function M1(e,t){const n=it(t),r=Ei(n);e.style.boxSizing="border-box",e.style.position!=="relative"&&(e.style.position="relative"),e.style.isolation!=="isolate"&&(e.style.isolation="isolate");const o=jo(n);o?(e.style.width=o.width,e.style.minHeight=o.height):(e.style.width||(e.style.width="100%"),e.style.minHeight="100vh"),e.style.height="auto";for(const a of st){const s=`padding-${a}`,u=r[a],d=e.style.getPropertyValue(s).trim()||null,f=_1(d,u);f&&e.style.setProperty(s,f)}}function nd(e){const t=I1(e);let n=!1;Ns(t.body);for(const r of t.querySelectorAll(`[${dr}]`)){if(!(r instanceof HTMLElement))continue;const o=r.querySelector(`[${Or}]`);!(o instanceof HTMLElement)||!E1(o)||(n=!0,M1(r,e),td(r))}return{html:t.body.innerHTML,hasBleed:n}}const Nf=`
142
+ `)}function nr(){return"<p></p>"}function ir(e){return e.length===0?[nr()]:e.map(t=>t.trim())}function vc(e,t){if(e.length===t.length){let a=!1;const s=[],u=[];for(let d=0;d<t.length;d+=1){const f=t[d]??"";e[d]===f?s.push(e[d]):(s.push(f),a=!0,u.push(d))}return a?{pages:s,changed:!0,changedIndices:u}:{pages:e,changed:!1,changedIndices:[]}}const n=[],r=[];for(let a=0;a<t.length;a+=1){const s=t[a]??"";a<e.length&&e[a]===s?n.push(e[a]):(n.push(s),r.push(a))}return r.length>0||e.length!==t.length||!Nr(e,n)?{pages:n,changed:!0,changedIndices:r}:{pages:e,changed:!1,changedIndices:[]}}function Nr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Xc(e,t,n){if(t<0||t>=e.length)return{pages:[...e],changed:!1};if(e[t]===n)return{pages:e,changed:!1};const r=e.slice();return r[t]=n,{pages:r,changed:!0}}function We(e,t){const n=e.querySelector(`[${Kr}][data-page-index="${t}"]`);return n||([...e.querySelectorAll(`[${Kr}]`)][t]??null)}function xv(e){if(!e)return null;const t=e instanceof Element?e:e.parentElement;return(t==null?void 0:t.closest(`[${Kr}]`))??null}function Cf(e){const t=e.getAttribute("data-page-index");if(t!==null){const r=Number.parseInt(t,10);if(!Number.isNaN(r))return r}let n=e.parentElement;for(;n;){const o=[...n.querySelectorAll(`[${Kr}]`)].indexOf(e);if(o!==-1)return o;n=n.parentElement}return null}const Ft="data-wysiwyg-img-id",Jc="data-page-bg",wv=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,Qc=/background-image:\s*url\(\s*(["']?)(.+?)\1\s*\)/i;function vf(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function kf(e){return e.body.innerHTML}function kc(e){return wv.test(e.trim())}function Sf(e){return e.includes("<img")||e.includes("IMG")||e.includes(Jc)||e.includes(Ft)}function Cv(e){var r;const t=Qc.exec(e);return t&&(((r=t[2])==null?void 0:r.trim())??"")||null}function Ua(e,t){const r=`url("${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`;if(Qc.test(e))return e.replace(Qc,`background-image: ${r}`);const o=e.trim().replace(/;+$/,"");return o?`${o};background-image: ${r}`:`background-image: ${r}`}function vv(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`img-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function kv(){const e=new Map;function t(b,w){const x=e.get(b);if(x){if(x.dataUrl!==w){URL.revokeObjectURL(x.objectUrl);const k=URL.createObjectURL(Pf(w));return e.set(b,{dataUrl:w,objectUrl:k}),k}return x.objectUrl}const S=URL.createObjectURL(Pf(w));return e.set(b,{dataUrl:w,objectUrl:S}),S}function n(b,w){if(!(w!=null&&w.trim())){for(const[S,k]of e)if(k.dataUrl===b)return S}const x=(w==null?void 0:w.trim())||vv();return t(x,b),x}function r(b){var w;return((w=e.get(b))==null?void 0:w.dataUrl)??null}function o(b){var w;return((w=e.get(b))==null?void 0:w.objectUrl)??null}function a(b){return e.has(b)}function s(b){const w=b.trim();if(!w)return null;for(const[x,S]of e)if(S.objectUrl===w)return x;return null}function u(b,w){const x=b.trim();if(!x)return null;if(kc(x))return x;const S=(w==null?void 0:w.trim())||s(x);return S?r(S):null}function d(b,w){var x,S;for(const k of b.querySelectorAll("img")){const v=(x=k.getAttribute(Ft))==null?void 0:x.trim(),A=((S=k.getAttribute("src"))==null?void 0:S.trim())??"";if(w==="hydrate"){const T=u(A,v);if(!T)continue;k.setAttribute("src",T);continue}if(v&&a(v)){const T=o(v);T&&k.setAttribute("src",T);continue}const I=s(A);if(I){k.setAttribute(Ft,I);const T=o(I);T&&k.setAttribute("src",T);continue}if(!kc(A))continue;const D=n(A);k.setAttribute(Ft,D);const R=o(D);R&&k.setAttribute("src",R)}}function f(b,w){var x;for(const S of b.querySelectorAll(`[${Jc}]`)){if(!(S instanceof HTMLElement))continue;const k=(x=S.getAttribute(Ft))==null?void 0:x.trim(),v=S.getAttribute("style")??"",A=Cv(v);if(w==="hydrate"){if(!A)continue;const T=u(A,k);if(!T)continue;S.setAttribute("style",Ua(v,T));continue}if(!A)continue;if(k&&a(k)){const T=o(k);T&&S.setAttribute("style",Ua(v,T));continue}const I=s(A);if(I){S.setAttribute(Ft,I);const T=o(I);T&&S.setAttribute("style",Ua(v,T));continue}if(!kc(A))continue;const D=n(A);S.setAttribute(Ft,D);const R=o(D);R&&S.setAttribute("style",Ua(v,R))}}function h(b){const w=b.trim();if(!w||!Sf(w))return b;const x=vf(b);return d(x,"externalize"),f(x,"externalize"),kf(x)}function g(b){const w=b.trim();if(!w||!Sf(w))return b;const x=vf(b);f(x,"hydrate"),d(x,"hydrate");for(const S of x.querySelectorAll("img"))S.removeAttribute(Ft);for(const S of x.querySelectorAll(`[${Jc}]`))S.removeAttribute(Ft);return kf(x)}function y(){for(const b of e.values())URL.revokeObjectURL(b.objectUrl);e.clear()}return{register:n,getDataUrl:r,getObjectUrl:o,has:a,externalizeHtml:h,hydrateHtml:g,clear:y}}function Pf(e){const t=e.indexOf(",");if(t<0)return new Blob;const n=e.slice(0,t),r=e.slice(t+1),o=/^data:([^;,]+)/i.exec(n),a=(o==null?void 0:o[1])??"application/octet-stream",s=atob(r),u=new Uint8Array(s.length);for(let d=0;d<s.length;d+=1)u[d]=s.charCodeAt(d);return new Blob([u],{type:a})}const Sv=.85,Pv=new Set(["image/webp","image/avif","image/gif"]);let oi=null;function Av(){if(oi!==null)return oi;oi=!1;try{oi=document.createElement("canvas").toDataURL("image/webp").startsWith("data:image/webp")}catch{}return oi}function Tv(e){const t=e.type.trim().toLowerCase();if(t&&Pv.has(t))return!1;const n=Iv(e.name);return!(!t&&(n==="webp"||n==="avif"||n==="gif"))}function Rv(e,t=Sv){return typeof createImageBitmap!="function"?Promise.resolve(null):createImageBitmap(e).then(n=>Dv(n,t)).catch(()=>null)}function Dv(e,t){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");if(!r)return e.close(),Promise.resolve(null);try{r.drawImage(e,0,0)}finally{e.close()}return new Promise(o=>{n.toBlob(a=>{if(!a){o(null);return}const s=new FileReader;s.onload=()=>{const u=String(s.result??"");o(u.startsWith("data:image/webp")?u:null)},s.onerror=()=>o(null),s.readAsDataURL(a)},"image/webp",t)})}function Iv(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Xg=2*1024*1024,jv="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",Ev=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),_v=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),Jg=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,Mv=/^(javascript|vbscript|file|blob):/i;function Nv(e={}){return{src:"",alt:"",title:"",...e}}function Sn(e){const t=e.trim();if(!t)return"empty";if(Mv.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return Jg.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 Lv(e){return e.size>Xg?"tooLarge":Uv(e)?null:"type"}function Bv(e){const t=Lv(e);return t?Promise.reject(new Error(t)):Fv(e)}async function Fv(e){if(Tv(e)&&Av()){const t=await Rv(e);if(t&&Sn(t)===null&&zv(t)<=Xg)return t}return Hv(e)}function Hv(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const o=String(r.result??"");if(Sn(o)){n(new Error("invalid"));return}t(o)},r.onerror=()=>n(r.error??new Error("Failed to read file")),r.readAsDataURL(e)})}function zv(e){const t=e.indexOf(",");if(t<0)return e.length;const n=e.slice(t+1),r=n.endsWith("==")?2:n.endsWith("=")?1:0;return Math.floor(n.length*3/4)-r}function Ov(e,t,n){const r=Qg(t,n);e.setAttribute("src",r.src.trim()),r.registryId?e.setAttribute(Ft,r.registryId):e.removeAttribute(Ft);const o=t.alt.trim(),a=t.title.trim();o?e.setAttribute("alt",o):e.removeAttribute("alt"),a?e.setAttribute("title",a):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.height="auto",Kv(e,t.css)}function Kv(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim(),s=r.slice(o+1).trim();a&&s&&e.style.setProperty(a,s)}}function Qg(e,t){if(!t)return e;const n=e.src.trim();if(Sn(n)||!Jg.test(n))return e;const r=t.register(n),o=t.getObjectUrl(r);return o?{...e,src:o,registryId:r}:e}function $v(e,t,n){const r=Nv(t),o=n?Qg(r,n):r;if(o.registryId){const d=n==null?void 0:n.getDataUrl(o.registryId);if(!d||Sn(d))return!1}else if(Sn(o.src))return!1;const a=window.getSelection();if(!a||a.rangeCount===0)return!1;const s=a.getRangeAt(0);if(!Te(e,s.commonAncestorContainer))return!1;s.collapsed||s.deleteContents();const u=document.createElement("img");return Ov(u,o,n),s.insertNode(u),s.setStartAfter(u),s.collapse(!0),a.removeAllRanges(),a.addRange(s),!0}function eu(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function Sc(e,t){if(!Te(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 Uv(e){const t=e.type.trim().toLowerCase();if(t&&Ev.has(t))return!0;const n=Vv(e.name);return!!(!t&&n&&_v.has(n))}function Vv(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const eh=["%","px","pt","pc","em","rem"],Wv="%",Gv={"%":[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]},ko={"%":{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}},qv=new Set(eh),Zv=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function Yv(e){return qv.has(e)}function Lr(e){return`${he(e.value)}${e.unit}`}function us(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(Zv);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r)||r<=0)return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return Yv(o)?So(r,o):null}function Af(e,t){const n=e.trim();if(!n)return null;const r=us(n);if(r)return r;const o=Number(n.replace(",","."));return Number.isFinite(o)?So(o,t):null}function So(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=ko[t];return{value:at(Math.min(r,Math.max(n,e))),unit:t}}function gi(e,t,n){const r=n>0?n:1;if(e==="width"){const a=So(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:So(t.value*r,t.unit)??t,height:t}}const Ja="data-hover-css",Ju=["fill","contain","cover","none","scale-down"],Qu=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],Xv=new Set(Ju),Jv=new Set(Qu),Tf="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",Qv="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",e1=/^-?[a-z][a-z0-9-]*$/i,t1=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,tu=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function th(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...un},border:{...$u},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function n1(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function r1(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=gi("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=gi("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function o1(e){const t=[];for(const n of e.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim().toLowerCase(),s=r.slice(o+1).trim();!a||!s||e1.test(a)&&(a==="behavior"||a.endsWith("binding")||t1.test(s)||t.push(`${a}: ${s}`))}return t.join("; ")}function sr(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!Te(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&&Te(e,r))return r}return eu(e,n.commonAncestorContainer)}function i1(e){const t=sr(e);return t?nh(t):null}function nh(e){const t=Ro(e),n=u1(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,o=s1(e);return th({sizeMode:o.sizeMode,width:o.width,height:o.height,align:n,margin:r,border:t.border,borderRadius:t.borderRadius,boxShadow:t.boxShadow,opacity:t.opacity,objectFit:oh(e),objectPosition:p1(e),rotateDeg:ih(e),hoverCss:e.getAttribute(Ja)??""})}function rh(e,t){let n=!1;return l1(e,t)&&(n=!0),Do(e,{...Wr(),margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:un,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),d1(e,t.align)&&(n=!0),m1(e,t.objectFit)&&(n=!0),f1(e,t.objectPosition)&&(n=!0),h1(e,t.rotateDeg)&&(n=!0),b1(e,t.hoverCss)&&(n=!0),n}function a1(e,t){const n=sr(e);return n?rh(n,t):!1}function s1(e){const t=us(e.style.width),n=us(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 l1(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=c1(t);return r.width?e.style.width=Lr(r.width):e.style.removeProperty("width"),r.height?e.style.height=Lr(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 c1(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 u1(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(),o=e.style.marginRight.trim().toLowerCase();return n==="block"&&r==="auto"&&o==="auto"?"center":null}function d1(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 oh(e){const t=e.style.objectFit.trim().toLowerCase();return Xv.has(t)?t:null}function m1(e,t){return oh(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function f1(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 p1(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Jv.has(t),t):null}function ih(e){const t=tu.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?at(n):null}function g1(e){const t=e.trim();return t?tu.test(t)&&t.replace(tu,"").trim()==="":!0}function h1(e,t){const n=ih(e),r=t===null||t===0?null:at(t);return n===r?!1:r===null?g1(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${he(r)}deg)`,!0)}function b1(e,t){const n=o1(t),r=e.getAttribute(Ja)??"",o=e.getAttribute("onmouseover")??"";return r===n&&(n&&o===Tf||!n&&!o)?!1:n?(e.setAttribute(Ja,n),e.setAttribute("onmouseover",Tf),e.setAttribute("onmouseout",Qv),!0):(e.removeAttribute(Ja),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const yo={value:100,unit:"%"},y1=new Set(Ju),x1=new Set(Qu),w1=new Set(["cover","contain","scale-down","none"]),Rf={contain:"contain",cover:"cover",auto:"none"},Df={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function vn(){return{src:null,opacity:null,fit:null,position:null,width:{...yo},height:null}}function ah(e){return e!=null&&w1.has(e)}function sh(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?ur(n):null}function If(e,t){const n=sh(e),r=t===null?null:ur(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Cg(r),!0)}function lh(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 C1(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function jf(e,t){const n=lh(e),r=(t==null?void 0:t.trim())??"",o=r&&Sn(r)===null?r:null;return n===o?!1:(o?e.style.backgroundImage=C1(o):e.style.removeProperty("background-image"),!0)}function ed(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Pc(e){return!e||e==="auto"?null:us(e)}function v1(e){return ah(e.fit)&&e.fit?Df[e.fit]:e.fit==="fill"?Df.fill:e.width&&e.height?`${Lr(e.width)} ${Lr(e.height)}`:e.width?Lr(e.width):e.height?`auto ${Lr(e.height)}`:null}function k1(e){const t=ed(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...yo},height:{...yo}};if(Rf[t])return{fit:Rf[t],width:null,height:null};if(y1.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:Pc(n[0]),height:null}:n.length===2?{fit:null,width:Pc(n[0]),height:Pc(n[1])}:{fit:null,width:null,height:null}}function S1(e,t){const n=ed(e.style.backgroundSize),r=v1(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function P1(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(x1.has(t),t):null}function Ef(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 ds(e){let t=!1;return e.id!==ls&&(e.id=ls,t=!0),e.hasAttribute(Or)||(e.setAttribute(Or,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function ms(e){const t=e.getAttribute("style");e.style.position="absolute",e.style.inset="0",e.style.zIndex="0",e.style.pointerEvents="none",e.style.userSelect="none",e.style.backgroundRepeat="no-repeat",e.style.setProperty("print-color-adjust","exact");const n=e.style.cssText;return n.includes("-webkit-print-color-adjust")||e.setAttribute("style",`${n};-webkit-print-color-adjust:exact`),e.getAttribute("style")!==t}function ch(e){const t=qu(e),n=t[0]??null;if(n){let o=ds(n);for(const a of t.slice(1))a.remove(),o=!0;return(n.parentNode!==e||n!==e.firstChild)&&(e.insertBefore(n,e.firstChild),o=!0),{layer:n,changed:o}}const r=document.createElement("div");return ds(r),ms(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function A1(e){const t=qu(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function fs(e){let t=!1;return Zu(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 td(e){if(!Zu(e))return fs(e);const n=ch(e);let r=n.changed;return ds(n.layer)&&(r=!0),ms(n.layer)&&(r=!0),fs(e)&&(r=!0),r}function Bs(e){const t=yt(e);if(!t)return!1;let n=Ns(e);return td(t)&&(n=!0),n}function T1(e){return e.includes(Or)||e.includes(dr)}function R1(e){const t=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");Ns(t.body);const n=yt(t.body);return n&&(td(n),Ms(n)),t.body.innerHTML}function _f(e){return T1(e)?R1(e):e}function uh(e){const t=k1(e);return{src:lh(e),opacity:sh(e),fit:t.fit,position:P1(e),width:t.width,height:t.height}}function dh(e,t){var a;const n=((a=t.src)==null?void 0:a.trim())??"",r=n.length>0&&Sn(n)===null;let o=!1;return r?(jf(e,n)&&(o=!0),S1(e,t)&&(o=!0),Ef(e,t.position)&&(o=!0),If(e,t.opacity)&&(o=!0),e.style.backgroundRepeat!=="no-repeat"&&(e.style.backgroundRepeat="no-repeat",o=!0),o&&It(e),o):(jf(e,null)&&(o=!0),ed(e.style.backgroundSize)&&(e.style.removeProperty("background-size"),o=!0),Ef(e,null)&&(o=!0),If(e,null)&&(o=!0),e.style.backgroundRepeat&&(e.style.removeProperty("background-repeat"),o=!0),o&&It(e),o)}function D1(e){const t=Zu(e);return t?uh(t):vn()}function I1(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&Sn(n)===null)){const d=A1(e),f=fs(e);return(d||f)&&It(e),d||f}const o=ch(e),a=o.layer;let s=o.changed;return ds(a)&&(s=!0),ms(a)&&(s=!0),fs(e)&&(s=!0),dh(a,t)&&(s=!0),ms(a)&&(s=!0),s&&(It(a),It(e)),s}function j1(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function E1(e){const t=e.style.backgroundImage.trim();if(t&&t!=="none")return!0;const n=e.getAttribute("style")??"";return/background-image\s*:\s*(?!none\b)/i.test(n)}function Mf(e){const t=e.trim().match(/^([\d.]+)pt$/i);return t?Number.parseFloat(t[1]):null}function _1(e,t){if(!t)return e;if(!e)return t;const n=Mf(e),r=Mf(t);return n!==null&&r!==null?`${Math.max(n,r)}pt`:t}function M1(e,t){const n=it(t),r=Ei(n);e.style.boxSizing="border-box",e.style.position!=="relative"&&(e.style.position="relative"),e.style.isolation!=="isolate"&&(e.style.isolation="isolate");const o=Io(n);o?(e.style.width=o.width,e.style.minHeight=o.height):(e.style.width||(e.style.width="100%"),e.style.minHeight="100vh"),e.style.height="auto";for(const a of st){const s=`padding-${a}`,u=r[a],d=e.style.getPropertyValue(s).trim()||null,f=_1(d,u);f&&e.style.setProperty(s,f)}}function nd(e){const t=j1(e);let n=!1;Ns(t.body);for(const r of t.querySelectorAll(`[${dr}]`)){if(!(r instanceof HTMLElement))continue;const o=r.querySelector(`[${Or}]`);!(o instanceof HTMLElement)||!E1(o)||(n=!0,M1(r,e),td(r))}return{html:t.body.innerHTML,hasBleed:n}}const Nf=`
143
143
  @page {
144
144
  margin: 0;
145
145
  }
@@ -310,12 +310,12 @@ body:has([data-page-bg]) {
310
310
  box-sizing: border-box;
311
311
  }
312
312
  }
313
- `.trim();function mh(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function L1(e){return mh(e).replace(/'/g,"&#39;")}function fh(e){const t=e.trim();if(!/^<!DOCTYPE/i.test(t)&&!/^<html[\s>]/i.test(t))return e;const n=new DOMParser().parseFromString(t,"text/html"),r=[];for(const o of n.body.childNodes)if(o.nodeType===Node.ELEMENT_NODE)r.push(o.outerHTML);else if(o.nodeType===Node.TEXT_NODE){const a=o.textContent??"";a.trim()&&r.push(a)}return r.join("")||n.body.innerHTML}function B1(e,t="Document"){const n=ar(e),r=n.map(b=>nd(b)),o=r.some(b=>b.hasBleed),a=[],s=[];for(const b of r){const w=he(b.html);a.push(...w.hrefs),s.push(w.body)}const u=s.length<=1?s[0]??"":s.map((b,w)=>`<div data-wysiwyg-print-page="" style="${w===s.length-1?"display: block; break-inside: avoid; page-break-inside: avoid;":"display: block; break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid;"}">${b}</div>`).join(""),d=Lg(n),f=o?"@page { margin: 0 !important; }":"",h=ph(o),g=[d,f,h].filter(Boolean).join(`
313
+ `.trim();function mh(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function L1(e){return mh(e).replace(/'/g,"&#39;")}function fh(e){const t=e.trim();if(!/^<!DOCTYPE/i.test(t)&&!/^<html[\s>]/i.test(t))return e;const n=new DOMParser().parseFromString(t,"text/html"),r=[];for(const o of n.body.childNodes)if(o.nodeType===Node.ELEMENT_NODE)r.push(o.outerHTML);else if(o.nodeType===Node.TEXT_NODE){const a=o.textContent??"";a.trim()&&r.push(a)}return r.join("")||n.body.innerHTML}function B1(e,t="Document"){const n=ar(e),r=n.map(b=>nd(b)),o=r.some(b=>b.hasBleed),a=[],s=[];for(const b of r){const w=ge(b.html);a.push(...w.hrefs),s.push(w.body)}const u=s.length<=1?s[0]??"":s.map((b,w)=>`<div data-wysiwyg-print-page="" style="${w===s.length-1?"display: block; break-inside: avoid; page-break-inside: avoid;":"display: block; break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid;"}">${b}</div>`).join(""),d=Lg(n),f=o?"@page { margin: 0 !important; }":"",h=ph(o),g=[d,f,h].filter(Boolean).join(`
314
314
  `),y=Array.from(new Set(a)).map(b=>`<link rel="stylesheet" href="${L1(b)}" />`).join(`
315
315
  `);return["<!DOCTYPE html>",'<html lang="en">',"<head>",'<meta charset="utf-8">',`<title>${mh(t)}</title>`,`<style>${g}</style>`,y,"</head>","<body>",u,"</body>","</html>"].filter(Boolean).join(`
316
316
  `)}function ph(e){return e?`${Nf}
317
- ${N1}`:Nf}function nu(e,t,n="​"){const r=nd(t),{hrefs:o,body:a}=he(r.html),s=e.createElement("meta");s.setAttribute("charset","utf-8");const u=e.createElement("title");u.textContent=n;const d=e.createElement("style");d.textContent=ph(r.hasBleed);const f=o.map(h=>{const g=e.createElement("link");return g.rel="stylesheet",g.href=h,g});e.head.replaceChildren(s,u,d,...f),e.title=n,e.body.innerHTML=a}function rd(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 F1(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function Va(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 o=0;o<n.length;o++)if(((r=n[o])==null?void 0:r.kind)==="file")return!0}return!1}function H1(e){var r;const t=[],n=e.files;if(n)for(let o=0;o<n.length;o++){const a=((r=n.item)==null?void 0:r.call(n,o))??n[o];a&&t.push(a)}if(t.length===0&&e.items)for(let o=0;o<e.items.length;o++){const a=e.items[o];if((a==null?void 0:a.kind)!=="file")continue;const s=a.getAsFile();s&&t.push(s)}return t}function z1(e){return e?H1(e).find(F1)??null:null}const gh={description:"HTML",accept:{"text/html":[".html",".htm"]}},O1="document.html";function hh(){return window}function bh(e){return e instanceof DOMException&&e.name==="AbortError"}function K1(e,t){const n=new Blob([e],{type:"text/html;charset=utf-8"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=t,o.rel="noopener",document.body.append(o),o.click(),o.remove(),URL.revokeObjectURL(r)}function $1(){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 o;const r=(o=t.files)==null?void 0:o[0];if(!r){n(null);return}rd(r).then(a=>n(fh(a)),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function U1(e,t=O1){const n=hh().showSaveFilePicker;if(typeof n=="function"){try{const o=await(await n({suggestedName:t,types:[gh]})).createWritable();await o.write(e),await o.close()}catch(r){if(bh(r))return;throw r}return}K1(e,t)}async function V1(){const e=hh().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[gh]}),n=await t.getFile();return fh(await rd(n))}catch(t){if(bh(t))return null;throw t}return $1()}const W1=1e3;function G1(e){var t;return e.complete&&e.naturalWidth>0?Promise.resolve((t=e.decode)==null?void 0:t.call(e)).catch(()=>{}):new Promise(n=>{const r=()=>{var o;Promise.resolve((o=e.decode)==null?void 0:o.call(e)).catch(()=>{}).then(()=>n())};e.addEventListener("load",r,{once:!0}),e.addEventListener("error",r,{once:!0})})}function q1(e){const t=[...e.images];return t.length===0?Promise.resolve():Promise.all(t.map(G1)).then(()=>{})}function yh(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.setAttribute("data-wysiwyg-print",""),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.width="1px",e.style.height="1px",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}}async function xh(e,t,n,r){nu(e,r);let o=!1;const a=()=>{o||(o=!0,n.remove())};t.addEventListener("afterprint",a),await q1(e),t.focus(),t.print(),window.setTimeout(a,W1)}function Z1(e){const t=yh();t&&xh(t.doc,t.win,t.iframe,e)}function Y1(e){const t=yh();if(!t)return;const n=e.map(nd),r=n.some(h=>h.hasBleed),o=[],a=[];for(const h of n){const g=he(h.html);o.push(...g.hrefs),a.push(g.body)}const s=a.map((h,g)=>`<div data-wysiwyg-print-page="" style="${g===a.length-1?"display: block; break-inside: avoid; page-break-inside: avoid;":"display: block; break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid;"}">${h}</div>`).join(""),u=Lg(e),d=r?"@page { margin: 0 !important; }":"",f=[u?`<style>${u}</style>`:"",d?`<style>${d}</style>`:"",...Array.from(new Set(o)).map(h=>`<link rel="stylesheet" href="${h}" />`),s].filter(Boolean).join("");xh(t.doc,t.win,t.iframe,f)}function X1(e){return{save:async()=>{if(e.onSave){const t=e.isMultiPagesEnabled()?e.getAllPagesHtml():e.getHtml();await e.onSave(t);return}await U1(B1(e.getHtml()))},open:async()=>{const t=e.onOpen?await e.onOpen():await V1();if(t!==null){if(Array.isArray(t)){e.setHtml(zt(t));return}if(e.isMultiPagesEnabled()){e.setHtml(zt([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){Y1(ar(e.getHtml()));return}Z1(e.getHtml())}}}function J1(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 Q1(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 ek(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function tk(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function nk(e){return{openLinkDialog:t=>{e.openLinkDialog(t)},applyLink:t=>{e.applyLink(t)},openBookmarkDialog:()=>{e.openBookmarkDialog()},applyBookmark:t=>{e.applyBookmark(t)},openImageDialog:()=>{e.openImageDialog()},openPageBackgroundImage:()=>{e.openPageBackgroundImage()},openParagraphBackgroundImage:()=>{e.openParagraphBackgroundImage()},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()},insertPageBefore:()=>{e.insertPageBefore()},insertPageAfter:()=>{e.insertPageAfter()},deletePage:()=>{e.deletePage()}}}function rk(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),hasSelectedPage:()=>e.hasSelectedPage(),canDeletePage:()=>e.canDeletePage(),canInsertPageBackgroundImage:()=>e.canInsertPageBackgroundImage(),canInsertParagraphBackgroundImage:()=>e.canInsertParagraphBackgroundImage()}}function ok(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 ik(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}function ak(e){return{openHelp:()=>{e.openHelp()},openKeyboardShortcuts:()=>{e.openKeyboardShortcuts()},openAbout:()=>{e.openAbout()}}}const sk=[50,75,100,125,150,200],lk=.1,ck=3;function Ac(e){return!Number.isFinite(e)||e<=0?1:Math.min(ck,Math.max(lk,e))}function uk(e,t,n,r,o){if(e==="fitWidth")return r<=0?1:Ac(t/r);if(e==="fitPage"){if(r<=0||o<=0)return 1;const a=t/r,s=n/o;return Ac(Math.min(a,s))}return Ac(e/100)}function dk(e){let t=null;return{schedule(){t===null&&(t=window.requestAnimationFrame(()=>{t=null,e()}))},cancel(){t!==null&&(window.cancelAnimationFrame(t),t=null)}}}function Qn(e,t){return()=>{e.setPageZoom(t)}}function er(e,t){return()=>e.getPageZoom()===t}function mk(e){return{setVisualMode:()=>{e.setMode("visual")},setHtmlMode:()=>{e.setMode("html")},toggleFullscreen:()=>{e.setFullscreen(!e.getFullscreen())},openCustomizeToolbar:()=>{e.openCustomizeToolbar()},openDocumentPreview:()=>{e.openDocumentPreview()},toggleReadAloud:()=>{e.toggleReadAloud()},toggleRuler:()=>{e.toggleRuler()},setLightMode:()=>{e.setDarkMode(!1)},setDarkMode:()=>{e.setDarkMode(!0)},setPageZoomFitWidth:Qn(e,"fitWidth"),setPageZoomFitPage:Qn(e,"fitPage"),setPageZoom50:Qn(e,50),setPageZoom75:Qn(e,75),setPageZoom100:Qn(e,100),setPageZoom125:Qn(e,125),setPageZoom150:Qn(e,150),setPageZoom200:Qn(e,200),setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function fk(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isPageZoomFitWidth:er(e,"fitWidth"),isPageZoomFitPage:er(e,"fitPage"),isPageZoom50:er(e,50),isPageZoom75:er(e,75),isPageZoom100:er(e,100),isPageZoom125:er(e,125),isPageZoom150:er(e,150),isPageZoom200:er(e,200),isToolbarPositionTop:()=>e.getToolbarPosition()==="top",isToolbarPositionLeft:()=>e.getToolbarPosition()==="left",isToolbarPositionRight:()=>e.getToolbarPosition()==="right",isToolbarPositionBottom:()=>e.getToolbarPosition()==="bottom",isReadingAloud:()=>e.isReadingAloud(),isRulerVisible:()=>e.isRulerVisible(),canReadAloud:()=>e.canReadAloud()}}function pk(e){return{addComment:()=>e.addComment(),toggleCommentsVisible:()=>e.toggleCommentsVisible()}}function gk(e){return{canAddComment:()=>e.canAddComment(),areCommentsVisible:()=>e.areCommentsVisible(),isCommentsEnabled:()=>e.isCommentsEnabled()}}function hk(e){return{openCompatibilityCheck:()=>{e.openCompatibilityCheck()}}}function bk(e){return{...X1(e),...ek(e),...ow(e),...nk(e),...ok(e),...mk(e),...J1(e),...pk(e),...hk(e),...ak(e)}}function yk(e){return{...fk(e),...tk(e),...rk(e),...ik(e),...Q1(e),...gk(e)}}function ps(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function xk(e){const t=e.style.fontSize;if(!t)return null;const n=Mu(t);return!n||!Is(n.unit)?null:{value:n.value,unit:n.unit}}function wh(e,t){let n=ps(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=xk(n);if(r)return r;n=n.parentElement}return null}function wk(e,t){const n=ps(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function Ch(e,t){var a;let n=ps(t);for(;n&&n!==e;){if(n.style.fontSize){const u=n.parentElement??e,d=parseFloat(getComputedStyle(u).fontSize);return Number.isFinite(d)&&d>0?d:16}n=n.parentElement}const r=((a=ps(t))==null?void 0:a.parentElement)??e,o=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(o)&&o>0?o:16}function vh(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function Ck(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function Lf(e=xo){return{value:null,unit:e,mixed:!1}}function kh(e,t=xo){const n=window.getSelection();if(!n||n.rangeCount===0)return Lf(t);const r=n.getRangeAt(0);if(!Te(e,r.commonAncestorContainer))return Lf(t);const o=r.collapsed?[]:_t(r).filter(f=>f.data.length>0),a=o.length>0?o:[r.startContainer],s=a.map(f=>wh(e,f)),u=s[0];if(s.every(f=>Ck(f,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(s.every(f=>f===null)){const f=a.map(g=>wk(g,e)),h=f[0];if(f.every(g=>Math.abs(g-h)<.05)){const g=Ch(e,a[0]),y=vh(e);return{value:ng(h,t,g,y),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function vk(e,t){return{parentPx:Ch(e,t),rootPx:vh(e)}}function kk(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function ru(e,t,n){const r=Fr(t,n);if(!r)return!1;const o=kk(e);if(!o||o.collapsed)return!1;const a=_u(r.value,r.unit);kn(o);const s=_t(o).filter(u=>u.data.length>0);for(const u of s){const d=wh(e,u);d&&d.value===r.value&&d.unit===r.unit||Di(u,f=>{f.style.fontSize=a})}return Ur(s),!0}function Sk(e,t){e.style.fontSize=_u(t.value,t.unit)}function Pk(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Ak(e){return e.trim().toLowerCase()}function ou(e){const t={};for(const n of e.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=Ak(r.slice(0,o)),s=r.slice(o+1).trim();a&&(t[a]=s)}return t}function Sh(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function Tk(e,t){const n={...e};for(const[r,o]of Object.entries(t))o.trim()?n[r]=o:delete n[r];return n}function Rk(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(`
318
- `)}function Fs(e){const t=ou(e);return Sh(t)}function Dk(e,t){let n=Pk(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function Ph(e){const t=An(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:_t(t).filter(d=>d.data.length>0),a=(n.length>0?n:[t.startContainer]).map(d=>Dk(e,d)).map(d=>d.trim()),s=a[0]??"";return a.every(d=>d===s)?{value:s||null,mixed:!1}:{value:null,mixed:!0}}function Ah(e,t){const n=ou(e.style.cssText),r=ou(t),o=Tk(n,r),a=Sh(o);a?e.style.cssText=a:e.removeAttribute("style")}function Th(e,t){const n=Fs(t);if(!n)return!1;const r=An(e);if(!r||r.collapsed)return!1;kn(r);const o=_t(r).filter(a=>a.data.length>0);if(o.length===0)return!1;for(const a of o)Di(a,s=>{Ah(s,n),gr(s)&&Ot(s)});return Ur(o),!0}function jk(e,t){const n=Fs(t);n&&Ah(e,n)}function Ik(e){return!!(e&&Fs(e))}const Jt=["bold","italic","underline","strikethrough"],po={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},Ek=new Set(["underline","line-through","overline"]);function lr(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function _k(e,t){return Jt.every(n=>e[n]===t[n])}function Mk(e){return Jt.some(t=>e[t]!==void 0)}function Rh(e,t){const n={...e};if(!t)return n;for(const r of Jt){const o=t[r];o!==void 0&&(n[r]=o)}return n}function Nk(e,t,n){const r=e[n]??t[n],o={...e,[n]:!r};return o[n]===t[n]&&delete o[n],o}function mr(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>Ek.has(n))}function Po(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 Dh(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(po.bold.has(r))return!0;const s=n.style.fontWeight;if(!s)return null;if(s==="bold"||s==="bolder")return!0;const u=Number(s);return Number.isNaN(u)?s==="normal"||s==="lighter"?!1:null:u>=700}if(t==="italic"){if(po.italic.has(r))return!0;const s=n.style.fontStyle;return s?s==="italic"||s==="oblique"?!0:s==="normal"?!1:null:null}if(t==="underline"){if(po.underline.has(r))return!0;const s=n.style.textDecorationLine||n.style.textDecoration;if(!s)return null;if(s==="none")return!1;const u=mr(n);return u.includes("underline")?!0:u.length>0?!1:null}if(po.strikethrough.has(r))return!0;const o=n.style.textDecorationLine||n.style.textDecoration;if(!o)return null;if(o==="none")return!1;const a=mr(n);return a.includes("line-through")?!0:a.length>0?!1:null}function gs(e,t){return Dh(e,t)===!0}function Ao(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const o=Dh(r,n);if(o!==null)return o;r=r.parentElement}return!1}function jh(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=mr(e);r.includes("underline")||r.push("underline"),Po(e,r);return}const n=mr(e);n.includes("line-through")||n.push("line-through"),Po(e,n)}function Ih(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"){Po(e,mr(e).filter(n=>n!=="underline"));return}Po(e,mr(e).filter(n=>n!=="line-through"))}function Lk(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=mr(e).filter(o=>o!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}Po(e,r);return}const n=mr(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}Po(e,n)}function Bk(e,t){Di(e,n=>jh(n,t))}function Fk(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!Pn(o)||!gs(o,n)){r=o;continue}if(hr(o,r),gs(o,n)){if(po[n].has(o.tagName.toLowerCase())){Ot(o);continue}if(Ih(o,n),gr(o)){Ot(o);continue}}r=o}}function Hk(e,t,n){const r=_t(t).filter(o=>o.data.length>0);return r.length===0?Ao(e,t.startContainer,n):r.every(o=>Ao(e,o,n))}function zk(e,t,n,r){kn(t);const o=_t(t).filter(a=>a.data.length>0);for(const a of o)r?Ao(e,a,n)||Bk(a,n):Fk(e,a,n);Ur(o)}function go(e){const t=window.getSelection();if(!t||t.rangeCount===0)return lr();const n=t.getRangeAt(0);if(!Te(e,n.commonAncestorContainer))return lr();if(n.collapsed)return iu(e,n);const r=_t(n).filter(a=>a.data.length>0);if(r.length===0)return iu(e,n);const o=lr();for(const a of Jt)o[a]=Ao(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const s of Jt)o[s]=o[s]&&Ao(e,r[a],s);return o}function iu(e,t){const n=lr();for(const r of Jt)n[r]=Ao(e,t.startContainer,r);return n}function au(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Te(e,r.commonAncestorContainer)||r.collapsed)return!1;const o=Hk(e,r,t);return zk(e,r,t,!o),!0}function Ok(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 o=r.splitText(n);e.setStart(o,0),e.collapse(!0)}function Kk(e,t,n){var a,s,u;Ok(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 d=document.createTextNode("");(a=t.startContainer.parentNode)==null||a.insertBefore(d,t.startContainer.nextSibling),r=d}else if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0){const d=document.createTextNode("");(s=t.startContainer.parentNode)==null||s.insertBefore(d,t.startContainer),r=d}else{const d=document.createTextNode("");r&&r!==t.startContainer?(u=r.parentNode)==null||u.insertBefore(d,r):t.startContainer.appendChild(d),r=d}let o=r;for(;o.parentElement&&o.parentElement!==e;){const d=o.parentElement;if(!Pn(d)){o=d;continue}if(!n.some(h=>gs(d,h))){o=d;continue}hr(d,o);for(const h of n)if(gs(d,h)){if(po[h].has(d.tagName.toLowerCase())){Ot(d);break}if(Ih(d,h),gr(d)){Ot(d);break}}o=d.isConnected?d:r}return r}function $k(e,t,n){for(const r of Jt)n[r]!==t[r]&&(n[r]?jh(e,r):Lk(e,r))}function Uk(e,t,n,r,o,a,s){var v,A;const u=window.getSelection();if(!u||u.rangeCount===0)return;const d=u.getRangeAt(0);if(!Te(e,d.commonAncestorContainer))return;const f=iu(e,d),h=Rh(f,n),g=Jt.filter(j=>f[j]&&!h[j]),y=gC(e,d.startContainer,o),b=Fw(e,d.startContainer,a);let w=null;g.length>0?(w=Kk(e,d,g),y.length>0&&dg(e,w,y),b&&$c(e,w)):y.length>0?(w=pC(e,d,y),b&&$c(e,w)):b?w=Bw(e,d):d.deleteContents();const x=document.createElement("span");$k(x,f,h),r&&Sk(x,r),o!=null&&o.color&&gf(x,"color",o.color),o!=null&&o.backgroundColor&&gf(x,"backgroundColor",o.backgroundColor),a&&_w(x,a),s&&jk(x,s),x.textContent=t;const S=x.style.cssText.trim()?x:document.createTextNode(t);w?((v=w.parentNode)==null||v.insertBefore(S,w),w.nodeType===Node.TEXT_NODE&&!w.data&&((A=w.parentNode)==null||A.removeChild(w))):d.insertNode(S);const k=document.createRange();k.selectNodeContents(S),k.collapse(!1),u.removeAllRanges(),u.addRange(k)}const Hr=["p","h1","h2","h3","h4","h5","h6"],Vk=new Set(Hr),Eh=new Set([...Hr,"div"]),Hs=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),Wk=()=>({tag:null,mixed:!1});function _h(e){return Vk.has(e)}function Gk(e){return _h(e)?e:e==="div"?"p":null}function qk(e){return e instanceof Element&&Hs.has(_e(e))}function Mh(e){return e instanceof HTMLElement&&!kt(e)&&Eh.has(_e(e))}function su(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=_e(e);return Eh.has(t)||Hs.has(t)?!1:Pn(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Zk(e,t){let n=Ii(t);for(;n&&n!==e;){if(Hs.has(_e(n)))return!0;n=n.parentElement}return!1}function Nh(e,t){let n=Ii(t);for(;n&&n!==e;){if(Zg(n,e)){n=n.parentElement;continue}if(Mh(n))return n;if(Hs.has(_e(n)))return null;n=n.parentElement}return null}function Yk(e,t){const n=new Set,r=[];for(const o of Hu(t)){const a=Nh(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Xk(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function Jk(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&su(n[o-1]);)o-=1;for(;a<n.length-1&&su(n[a+1]);)a+=1;return n.slice(o,a+1)}function lu(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t)))return t;return null}function Qk(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&&kt(r)?lu(e):r}return n.startContainer===t&&e!==t?lu(e):Xk(e,n.startContainer)}function eS(e,t,n){const r=Xu(e);if(Zk(e,t.startContainer))return!1;if(!lu(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const o=Qk(r,e,t);if(!o||o instanceof HTMLElement&&kt(o)||qk(o)||Mh(o)||!su(o))return!1;const a=Jk(r,o),s=document.createElement(n);r.insertBefore(s,a[0]);for(const u of a)s.appendChild(u);return!0}function tS(e){const t=An(e);if(!t)return Wk();const n=Hu(t).map(o=>{const a=Nh(e,o);return a?Gk(_e(a)):null}),r=n[0];return n.every(o=>o===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function nS(e,t){if(!_h(t))return!1;const n=An(e);if(!n)return!1;const r=wo(e,n.startContainer,n.startOffset),o=wo(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=Yk(e,n);let d=!1;if(u.length===0)d=eS(e,n,t);else for(const f of u)_e(f)!==t&&(Ou(f,t),d=!0);return zu(e,a,s),d}function od(e){if(!Xt(e))return null;const t=Co(e);if(!t)return null;const n=_e(t);return n==="ul"||n==="ol"?n:null}function Lh(e){const t=$n(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(od),r=n[0];return n.every(o=>o===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function rS(e,t,n){const r=[...e.children].filter(o=>Fu(o));for(const o of r)t.insertBefore(o,n)}function Bh(e){const t=Co(e),n=document.createElement("p");for(const f of[...e.attributes])n.setAttribute(f.name,f.value);for(n.style.marginLeft="",jt(n);e.firstChild&&!Fu(e.firstChild);)n.appendChild(e.firstChild);const r=[];let o=e.nextElementSibling;for(;o;)r.push(o),o=o.nextElementSibling;const a=(t==null?void 0:t.parentNode)??e.parentNode;if(!t||!a)return e.replaceWith(n),n;const s=Xt(a)?a.parentNode??a:a,u=Xt(a)?a.nextSibling:t.nextSibling;e.remove();let d=null;if(r.length>0){d=document.createElement(t.tagName);for(const f of r)d.appendChild(f)}return s.insertBefore(n,u),d&&s.insertBefore(d,n.nextSibling),rS(e,s,n.nextSibling),t.childElementCount===0&&t.remove(),n}function oS(e){if(Xt(e))return e;const t=Ou(e,"li");return t.style.marginLeft="",jt(t),t}function Fh(e,t){if(e.length===0)return!1;if(e.every(Xt)){const a=Co(e[0]);if(a&&e.every(s=>s.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return _e(a)===t?!1:(Ou(a,t),!0)}const n=e[0],r=n.parentNode;if(!r)return!1;const o=document.createElement(t);r.insertBefore(o,n);for(const a of e){const s=Xt(a)?Co(a):null;o.appendChild(oS(a)),s&&s!==o&&s.childElementCount===0&&s.remove()}return!0}function Hh(e){let t=!1;for(const n of[...e].reverse())Xt(n)&&(Bh(n),t=!0);return t}function iS(e,t){return yr(e,()=>{const n=Vr(e);if(n.length===0)return!1;if(n.every(a=>od(a)===t))return Hh(n);let o=!1;for(const a of sg(n))Fh(a,t)&&(o=!0);return o})}function aS(e,t){return yr(e,()=>{const n=Vr(e);if(n.length===0)return!1;if(t===null)return Hh(n);if(n.every(a=>od(a)===t))return!1;let o=!1;for(const a of sg(n))Fh(a,t)&&(o=!0);return o})}const zh=40;function id(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function Oh(e,t){if(t<=0){e.style.marginLeft="",jt(e);return}e.style.marginLeft=`${t}px`}function sS(e){let t=e.previousElementSibling;for(;t;){if(Xt(t))return t;t=t.previousElementSibling}return null}function lS(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(_e(n)==="ul"||_e(n)==="ol"))return n}return null}function cS(e){const t=sS(e);if(!t)return!1;const n=Co(e);if(!n)return!1;const r=_e(n)==="ol"?"ol":"ul";let o=lS(t);return(!o||_e(o)!==r)&&(o=document.createElement(r),t.appendChild(o)),o.appendChild(e),!0}function uS(e){const t=Co(e);if(!t)return!1;const n=t.parentElement;if(n&&Xt(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return Bh(e),!0}function dS(e){return $n(e).some(n=>Xt(n)||id(n)>0)}function mS(e){return yr(e,()=>{const t=Vr(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(Xt(r)){cS(r)&&(n=!0);continue}Oh(r,id(r)+zh),n=!0}return n})}function fS(e){return yr(e,()=>{const t=$n(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(Xt(r)){uS(r)&&(n=!0);continue}const o=id(r);o<=0||(Oh(r,Math.max(0,o-zh)),n=!0)}return n})}function zs(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function $r(e,t,n){const r=Math.max(1,Math.floor(t)),o=Math.max(1,Math.floor(n));r<=1?e.removeAttribute("colspan"):e.colSpan=r,o<=1?e.removeAttribute("rowspan"):e.rowSpan=o}function Kt(e){const t=e.rows.length,n=Array.from({length:t},()=>[]),r=[];let o=0;for(let a=0;a<t;a+=1){const s=e.rows[a];let u=0;for(const d of Array.from(s.cells)){for(;n[a][u];)u+=1;const f=zs(d),h={cell:d,originRow:a,originCol:u,rowSpan:f.rowSpan,colSpan:f.colSpan};r.push(h);for(let g=0;g<f.rowSpan;g+=1){const y=a+g;if(y>=t)break;for(let b=0;b<f.colSpan;b+=1)n[y][u+b]=h}u+=f.colSpan,o=Math.max(o,u)}o=Math.max(o,n[a].length)}return{table:e,slots:n,unique:r,rowCount:t,colCount:o}}function hs(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function dn(e,t){return e.unique.find(n=>n.cell===t)??null}function Kh(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 $h(e){if(e.length===0)return null;let t=1/0,n=-1/0,r=1/0,o=-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),o=Math.max(o,a.originCol+a.colSpan-1);return{minRow:t,maxRow:n,minCol:r,maxCol:o}}function pS(e,t){const n=new Set,r=[];for(let o=t.minRow;o<=t.maxRow;o+=1)for(let a=t.minCol;a<=t.maxCol;a+=1){const s=hs(e,o,a);!s||n.has(s.cell)||(n.add(s.cell),r.push(s.cell))}return r}function Uh(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=hs(e,t.minRow,t.minCol);if(!n||n.originRow!==t.minRow||n.originCol!==t.minCol)return null;const r=new Set,o=[];for(let a=t.minRow;a<=t.maxRow;a+=1)for(let s=t.minCol;s<=t.maxCol;s+=1){const u=hs(e,a,s);if(!u||Kh(u,t))return null;r.has(u.cell)||(r.add(u.cell),o.push(u.cell))}return{origin:n,cells:o,colSpan:t.maxCol-t.minCol+1,rowSpan:t.maxRow-t.minRow+1}}function gS(e,t,n,r){const o={minRow:t.originRow,maxRow:t.originRow+r-1,minCol:t.originCol,maxCol:t.originCol+n-1};if(o.maxRow>=e.rowCount||o.maxCol>=e.colCount)return!1;for(let a=o.minRow;a<=o.maxRow;a+=1)for(let s=o.minCol;s<=o.maxCol;s+=1){const u=hs(e,a,s);if(!u)return!1;if(u.cell!==t.cell&&Kh(u,o))return!1}return!0}const Bf=10,ho=1,bo=50,hS="1px solid #000",bS="0.25em",yS=new Set(["td","th"]);function Vh(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=ho&&t>=ho&&e<=bo&&t<=bo}function Et(e,t){return sd(e,t,n=>n instanceof HTMLTableElement)}function bs(e,t){return sd(e,t,n=>DS(n))}function xS(e,t){return sd(e,t,n=>n instanceof HTMLTableRowElement)}function ad(e){return Et(e,ld(e))}function Tn(e){return bs(e,ld(e))}function Wh(e){return xS(e,ld(e))}function wS(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function _i(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!Te(e,n.commonAncestorContainer))return[];const r=bs(e,n.startContainer),o=bs(e,n.endContainer);if(!r)return[];if(!o||r===o)return[r];const a=Et(e,r);if(!a||Et(e,o)!==a)return[r];const s=Kt(a),u=dn(s,r),d=dn(s,o);if(!u||!d)return[r];const f=$h([u,d]);if(!f)return[r];const h=pS(s,f);return h.length>0?h:[r]}function CS(e,t){if(!Vh(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Te(e,r.commonAncestorContainer))return!1;const o=document.createElement("table");o.style.borderCollapse="collapse",o.style.width="100%";const a=document.createElement("tbody");for(let u=0;u<t.rows;u+=1){const d=document.createElement("tr");for(let f=0;f<t.cols;f+=1)d.appendChild(jS("td"));a.appendChild(d)}o.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(o),MS(e,o);const s=o.querySelector("td, th");return s instanceof HTMLTableCellElement&&It(s),!0}function cu(e,t){var g,y,b,w;const n=Tn(e);if(!n)return!1;const r=Et(e,n);if(!r)return!1;const o=Kt(r),a=dn(o,n);if(!a)return!1;const s=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const x of o.unique)if(x.originRow<s&&x.originRow+x.rowSpan>s){$r(x.cell,x.colSpan,x.rowSpan+1);for(let S=x.originCol;S<x.originCol+x.colSpan;S+=1)u.add(S)}const d=document.createElement("tr"),f=Math.min(s,o.rowCount-1);for(let x=0;x<o.colCount;x+=1){if(u.has(x))continue;const S=((y=(g=o.slots[f])==null?void 0:g[x])==null?void 0:y.cell)??n;d.appendChild(cd(S))}if(s>=r.rows.length)(b=r.rows[r.rows.length-1].parentNode)==null||b.appendChild(d);else{const x=r.rows[s];(w=x.parentNode)==null||w.insertBefore(d,x)}const h=ES(d,o.colCount,u,a.originCol);return It(h||n),!0}function Ff(e,t){var f,h,g,y;const n=Tn(e);if(!n)return!1;const r=Et(e,n);if(!r)return!1;const o=Kt(r),a=dn(o,n);if(!a)return!1;const s=t==="before"?a.originCol:a.originCol+a.colSpan,u=new Set;for(const b of o.unique)if(b.originCol<s&&b.originCol+b.colSpan>s){$r(b.cell,b.colSpan+1,b.rowSpan);for(let w=b.originRow;w<b.originRow+b.rowSpan;w+=1)u.add(w)}let d=null;for(let b=0;b<o.rowCount;b+=1){if(u.has(b))continue;const w=((h=(f=o.slots[b])==null?void 0:f[Math.min(s,Math.max(0,o.colCount-1))])==null?void 0:h.cell)??((y=(g=o.slots[b])==null?void 0:g[Math.max(0,s-1)])==null?void 0:y.cell)??n,x=cd(w);ud(r,b,s,x),b===a.originRow&&(d=x)}return d&&It(d),!0}function vS(e){var y,b;const t=Tn(e);if(!t)return!1;const n=Et(e,t);if(!n)return!1;const r=Kt(n),o=dn(r,t);if(!o)return!1;if(r.rowCount<=1)return uu(e,n);const a=o.originRow,s=a+1,u=[];for(const w of r.unique)w.originRow<=a&&w.originRow+w.rowSpan>a&&(w.originRow<a?$r(w.cell,w.colSpan,w.rowSpan-1):w.originRow===a&&w.rowSpan>1&&u.push(w));u.sort((w,x)=>w.originCol-x.originCol);for(const w of u)$r(w.cell,w.colSpan,w.rowSpan-1),ud(n,s,w.originCol,w.cell);const d=o.originCol;n.rows[a].remove();const f=n.rows[Math.min(a,n.rows.length-1)],h=Kt(n),g=(b=(y=h.slots[Math.min(a,h.rowCount-1)])==null?void 0:y[Math.min(d,Math.max(0,h.colCount-1))])==null?void 0:b.cell;return g?It(g):f!=null&&f.cells[0]?It(f.cells[0]):LS(n),!0}function kS(e){var f,h,g;const t=Tn(e);if(!t)return!1;const n=Et(e,t);if(!n)return!1;const r=Kt(n),o=dn(r,t);if(!o)return!1;if(r.colCount<=1)return uu(e,n);const a=o.originCol,s=o.originRow;for(const y of r.unique)a<y.originCol||a>=y.originCol+y.colSpan||(y.colSpan===1?y.cell.remove():$r(y.cell,y.colSpan-1,y.rowSpan));const u=Kt(n);if(u.colCount===0||u.unique.length===0)return uu(e,n);const d=((h=(f=u.slots[Math.min(s,u.rowCount-1)])==null?void 0:f[Math.min(a,u.colCount-1)])==null?void 0:h.cell)??((g=u.unique[0])==null?void 0:g.cell);return d&&It(d),!0}function SS(e,t){const n=Tn(e);if(!n)return!1;const r=Et(e,n);if(!r)return!1;const o=wS(r),a=o.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(It(o[a-1]),{changed:!1});if(a<o.length-1)return It(o[a+1]),{changed:!1};const s=n.parentElement;if(!cu(e,"below"))return!1;const u=s instanceof HTMLTableRowElement?s.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&It(u.cells[0]),{changed:!0}}function PS(e,t){return!Te(e,t)||t===e?!1:(It(t),!0)}function Hf(e){return Gh(e)!==null}function zf(e){const t=Tn(e);if(!t)return!1;const n=zs(t);return n.colSpan>1||n.rowSpan>1}function AS(e){const t=Gh(e);if(!t)return!1;const n=Et(e,t.origin.cell);return n?qh(n,t):!1}function TS(e){const t=Tn(e);if(!t)return!1;const n=Et(e,t);return n?Zh(n,t):!1}function RS(e,t,n){const r=Tn(e);if(!r)return!1;const o=Et(e,r);if(!o)return!1;const a=Kt(o),s=dn(a,r);if(!s)return!1;const u=Math.min(a.colCount-s.originCol,Math.max(1,Math.floor(t))),d=Math.min(a.rowCount-s.originRow,Math.max(1,Math.floor(n)));if(u===s.colSpan&&d===s.rowSpan||!gS(a,s,u,d))return!1;if((s.colSpan>1||s.rowSpan>1)&&Zh(o,r),u===1&&d===1)return It(r),!0;const f=Kt(o),h=Uh(f,{minRow:s.originRow,maxRow:s.originRow+d-1,minCol:s.originCol,maxCol:s.originCol+u-1});return h?qh(o,h):!0}function sd(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function DS(e){return yS.has(e.tagName.toLowerCase())}function ld(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n.startContainer:null}function Gh(e){const t=_i(e);if(t.length<2)return null;const n=Et(e,t[0]);if(!n)return null;const r=Kt(n),o=[];for(const u of t){const d=dn(r,u);if(!d)return null;o.push(d)}const a=$h(o);if(!a)return null;const s=Uh(r,a);return!s||s.cells.length<2?null:s}function qh(e,t){const n=t.origin.cell,r=Kt(e),o=t.cells.map(a=>dn(r,a)).filter(a=>a!==null).sort((a,s)=>a.originRow-s.originRow||a.originCol-s.originCol);for(const a of o)a.cell!==n&&_S(n,a.cell);$r(n,t.colSpan,t.rowSpan);for(const a of o)a.cell!==n&&a.cell.remove();return It(n),!0}function Zh(e,t){const n=Kt(e),r=dn(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;$r(t,1,1);for(let o=r.originRow;o<r.originRow+r.rowSpan;o+=1)for(let a=r.originCol;a<r.originCol+r.colSpan;a+=1)o===r.originRow&&a===r.originCol||ud(e,o,a,cd(t));return It(t),!0}function jS(e){const t=document.createElement(e);return t.style.border=hS,t.style.padding=bS,t.appendChild(document.createElement("br")),t}function cd(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 IS(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function ud(e,t,n,r){const o=e.rows[t];if(!o)return;const a=Kt(e);let s=0;for(const u of Array.from(o.cells)){if(u===r)continue;const d=dn(a,u);if(!d||d.originCol>=n)break;s+=1}IS(o,s,r)}function ES(e,t,n,r){let o=0;for(let a=0;a<t;a+=1)if(!n.has(a)){if(a>=r)return e.cells[o]??null;o+=1}return e.cells[e.cells.length-1]??null}function Of(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 _S(e,t){if(!(e===t||Of(t)))for(Of(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function MS(e,t){var o;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))&&((o=n.parentNode)==null||o.insertBefore(t,n.nextSibling),NS(n)&&n.remove())}function NS(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 uu(e,t){if(!t.parentNode||!Te(e,t))return!1;const r=document.createRange();r.setStartBefore(t),r.collapse(!0),t.remove();const o=window.getSelection();return o&&(o.removeAllRanges(),o.addRange(r)),!0}function It(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function LS(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const Yh=["left","center","right","justify"];function BS(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function ys(e){return BS(e.style.textAlign)}function du(e,t){const n=t??"left";return ys(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 Kf(e){const t=e[0];return e.every(n=>n===t)?{align:t,mixed:!1}:{align:null,mixed:!0}}function Xh(e){const t=_i(e);if(t.length>0)return Kf(t.map(ys));const n=$n(e);return n.length===0?An(e)?{align:"left",mixed:!1}:{align:null,mixed:!1}:Kf(n.map(ys))}function Jh(e,t){return Yh.includes(t)?yr(e,()=>{const n=_i(e);if(n.length>0){let a=!1;for(const s of n)du(s,t)&&(a=!0);return a}const r=Vr(e);if(r.length===0)return!1;let o=!1;for(const a of r)du(a,t)&&(o=!0);return o}):!1}function Br(){return{...Wr(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function Wa(e){const t=OC(e),n=Xh(e),r=Lh(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function Qh(e,t){let n=!1;return!t.alignMixed&&t.align&&Jh(e,t.align)&&(n=!0),t.listMixed||aS(e,t.list)&&(n=!0),KC(e,t)&&(n=!0),n}function FS(e,t){return Qh(e,mu(t))}function eb(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 mu(e){const t=Br();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}}function Ga(e){return e?Lr(e):""}function HS(e,t){return e.src===t.src&&e.opacity===t.opacity&&e.fit===t.fit&&e.position===t.position&&Ga(e.width)===Ga(t.width)&&Ga(e.height)===Ga(t.height)}function Tc(e){const t=$n(e);if(t.length===0)return vn();const n=t.map(uh),r=n[0];return n.some(o=>!HS(o,r))?vn():r}function zS(e,t){return yr(e,()=>{const n=Vr(e);if(n.length===0)return!1;let r=!1;for(const o of n)dh(o,t)&&(r=!0);return r})}function OS(){return{size:null,unit:xo,marks:lr(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function hi(){return{font:OS(),box:Wr(),backgroundImage:vn(),atRule:or()}}function fu(e,t){return t?{top:t.top!==void 0?t.top:e.top,right:t.right!==void 0?t.right:e.right,bottom:t.bottom!==void 0?t.bottom:e.bottom,left:t.left!==void 0?t.left:e.left}:e}function KS(e,t){if(!t)return e;const{margin:n,padding:r,...o}=t;return{...e,...o,margin:n?fu(e.margin,n):e.margin,padding:r?fu(e.padding,r):e.padding}}function $S(e,t){if(!t)return e;const{marks:n,...r}=t;return{...e,...r,marks:n?{...e.marks,...n}:e.marks}}function US(e,t){const{margin:n,...r}=t.atRule??{};return{font:$S(e.font,t.font),box:KS(e.box,t.box),backgroundImage:t.backgroundImage?{...e.backgroundImage,...t.backgroundImage}:e.backgroundImage,atRule:t.atRule?{...e.atRule,...r,margin:n?fu(e.atRule.margin,n):e.atRule.margin}:e.atRule}}function VS(e){return e?!!(e.font||e.box||e.backgroundImage||e.atRule):!1}function $f(e,t){if(!VS(t))return e;const n=document.createElement("div");n.innerHTML=e;const r=US(ui(n),t);return pu(n,r).pageHtml}function WS(e){const t=e.style.fontSize,n=t?Mu(t):null,r=n&&Is(n.unit)?{value:n.value,unit:n.unit}:null,o=`${e.style.textDecorationLine} ${e.style.textDecoration}`.toLowerCase(),a=e.style.fontWeight.trim().toLowerCase(),s={bold:a==="bold"||Number(a)>=700,italic:e.style.fontStyle.trim().toLowerCase()==="italic",underline:/\bunderline\b/.test(o),strikethrough:/\bline-through\b/.test(o)},u=e.style.color,d=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??xo,marks:s,fontFamily:d||null,fontFamilyMixed:!1,fontColor:u?Ke(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function GS(e,t){const n=e.style.fontSize,r=t.size===null?null:Fr(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const o=_u(r.value,r.unit);return n===o?!1:(e.style.fontSize=o,!0)}function qS(e,t){var o;if(t.fontFamilyMixed)return!1;const n=(o=t.fontFamily)!=null&&o.trim()?t.fontFamily.trim():null,r=e.style.fontFamily.trim()||null;return ji(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function ZS(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?Ke(t.fontColor):null;return(e.style.color?Ke(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function YS(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 o=t.italic?"italic":"";e.style.fontStyle!==o&&(o?e.style.fontStyle=o:e.style.removeProperty("font-style"),n=!0);const a=[];t.underline&&a.push("underline"),t.strikethrough&&a.push("line-through");const s=a.join(" ");return(e.style.textDecorationLine||e.style.textDecoration).trim()!==s&&(s?e.style.textDecoration=s:(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),n=!0),n}function XS(e,t){let n=!1;return GS(e,t)&&(n=!0),qS(e,t)&&(n=!0),ZS(e,t)&&(n=!0),YS(e,t.marks)&&(n=!0),n&&jt(e),n}function JS(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function ui(e){const t=yt(e);if(!t)return hi();const n=Ro(t);return{font:WS(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,breakInside:n.breakInside,breakInsideMixed:!1,breakAfter:n.breakAfter,breakAfterMixed:!1,breakBefore:n.breakBefore,breakBeforeMixed:!1},backgroundImage:D1(t),atRule:it(e.innerHTML)}}function pu(e,t){const n=An(e),r=n?wo(e,n.startContainer,n.startOffset):null,o=n?wo(e,n.endContainer,n.endOffset):null,a=yt(e),s=Yu(e);pi(s);const u=XS(s,t.font),d=Do(s,JS(t)),f=j1(s,t.backgroundImage);Ls(e);const h=it(e.innerHTML),g=ss(e.innerHTML,t.atRule),y=cn(g);y!==cn(e.innerHTML)&&(e.innerHTML=y),Io(e,g);const b=JSON.stringify(h)!==JSON.stringify(t.atRule);r!==null&&o!==null&&zu(e,Math.min(r,o),Math.max(r,o)),Bs(e);const w=ss(e.innerHTML,t.atRule);return{changed:!a||u||d||f||b,pageHtml:w}}function QS(e,t){const n=t??e.innerHTML,r=Ng(n);return Pi(n)?(e.innerHTML=cn(r),Ls(e),Io(e,r),{changed:!0,pageHtml:r}):{changed:!1,pageHtml:r}}function eP(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function tP(e){return e.body.innerHTML.replace(/\s*data-page=""/g," data-page")}function nP(e){const t=[...e.body.querySelectorAll(`[${dr}]`)];for(const n of t){if(!(n instanceof HTMLElement))continue;const r=n.parentElement;if(r){for(;n.firstChild;)r.insertBefore(n.firstChild,n);n.remove()}}}function rP(e){for(const n of[...e.body.querySelectorAll(`[${Or}]`)])n.remove();const t=e.getElementById("commspliant-background");t==null||t.remove()}function Rc(e){const t=eP(e);for(const n of t.querySelectorAll(`style[${Si}]`))n.remove();rP(t),nP(t);for(const n of t.body.querySelectorAll("*"))n instanceof HTMLElement&&kt(n)&&n.remove();return tP(t)}const oP=/<script\b[^>]*>[\s\S]*?<\/script>/gi,iP=/^\s*javascript\s*:/i;function aP(e){return e.replace(/&(#x[0-9a-f]+|#\d+|amp|lt|gt|quot);/gi,(t,n)=>{const r=n.toLowerCase();if(r==="amp")return"&";if(r==="lt")return"<";if(r==="gt")return">";if(r==="quot")return'"';if(r.startsWith("#x")){const o=Number.parseInt(r.slice(2),16);return Number.isFinite(o)?String.fromCodePoint(o):t}if(r.startsWith("#")){const o=Number.parseInt(r.slice(1),10);return Number.isFinite(o)?String.fromCodePoint(o):t}return t}).replace(/\\([0-7]{1,3})/g,(t,n)=>{const r=Number.parseInt(n,8);return Number.isFinite(r)?String.fromCodePoint(r):t})}function tb(e){const t=aP(e).replace(/[\u0000-\u001F\u007F\s]+/g,"");return iP.test(t)}function sP(e){return e.split(";").map(t=>t.trim()).filter(t=>{if(!t)return!1;const n=t.indexOf(":");if(n<=0)return!0;const r=t.slice(n+1);return!tb(r)&&!/url\s*\(\s*["']?\s*javascript:/i.test(r)}).join("; ")}function lP(e){const t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(const n of t)for(const r of[...n.attributes]){if(tb(r.value)){n.removeAttribute(r.name);continue}if(r.name.toLowerCase()==="style"){const o=sP(r.value);o?o!==r.value&&n.setAttribute(r.name,o):n.removeAttribute(r.name)}}}function cP(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function uP(e){return e.body.innerHTML}function gu(e){if(!e.trim())return e;const n=e.replace(oP,"");if(!/javascript\s*:/i.test(n))return n;const r=cP(n);return lP(r.body),uP(r)}function mo(e){if(!e.trim())return e;const n=ar(e);return n.length===1?gu(e):zt(n.map(gu))}const dd="data-hover-html",dP="noopener noreferrer",mP="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)",fP="this._hoverBox&&this._hoverBox.remove()",pP=/^(#(?:[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 Os(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function gP(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function Ti(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&gP(n))return n;n=n.parentNode}return null}function nb(e){return pP.test(e)}function hP(e){var o;const t=e.getAttribute("onmouseover")??"",n=/this\.style\.color\s*=\s*'([^']+)'/.exec(t),r=((o=n==null?void 0:n[1])==null?void 0:o.trim())??"";return r&&nb(r)?r:null}function rb(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function bP(e){const t=e.getAttribute(dd)??"",n=hP(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:rb(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function ob(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!Te(e,n.commonAncestorContainer))return null;const r=Ti(e,n.commonAncestorContainer);return r?bP(r):null}function yP(e){return ob(e)!==null}function xP(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(dd)}function wP(e,t){var r;if(xP(e),t.hoverMode==="html"){const o=t.hoverHtml.trim();if(!o)return;e.setAttribute(dd,o),e.setAttribute("onmouseover",mP),e.setAttribute("onmouseout",fP);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!nb(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function md(e,t){const n=Os(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",dP)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":rb(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),wP(e,n)}function CP(e,t){const n=new Set;for(const r of t){const o=Ti(e,r);o&&!n.has(o)&&n.add(o)}for(const r of n)Ot(r)}function vP(e,t,n){kn(t);const r=_t(t).filter(u=>u.data.length>0);CP(e,r),r.length>0&&Ur(r);const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);kn(a);const s=document.createElement("a");md(s,n);try{return a.surroundContents(s),!0}catch{const u=a.extractContents();return u.hasChildNodes()?(s.appendChild(u),a.insertNode(s),!0):!1}}function kP(e,t){const n=document.createElement("a");md(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 SP(e,t){const n=t.href.trim();if(!n)return!1;const r=Os({...t,href:n}),o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!Te(e,a.commonAncestorContainer))return!1;const s=Ti(e,a.startContainer),u=Ti(e,a.endContainer);return s&&s===u?(md(s,r),!0):a.collapsed?kP(a,r):vP(e,a,r)}const PP=/^[A-Za-z][A-Za-z0-9_-]*$/,ib="​";function hu(e){var r;const t=Xu(e),n=new Set;for(const o of t.querySelectorAll("[id]")){if(o===t)continue;const a=o.id.trim();a&&n.add(a)}for(const o of t.querySelectorAll("a[name]")){const a=(r=o.getAttribute("name"))==null?void 0:r.trim();a&&n.add(a)}return[...n].sort((o,a)=>o.localeCompare(a)).map(o=>({id:o}))}function AP(e){return new Set(hu(e).map(t=>t.id))}function ab(e,t){const n=e.trim();return n?PP.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function Uf(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ib)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function TP(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ib)),(r=e.parentNode)==null||r.insertBefore(n,e)}function RP(e,t){const n=t.trim();if(ab(n,AP(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Te(e,o.commonAncestorContainer))return!1;const a=Ti(e,o.startContainer);if(a)return TP(a,n),!0;if(o.collapsed)return Uf(o,n),!0;kn(o);const s=document.createElement("span");s.id=n;try{return o.surroundContents(s),!0}catch{return Uf(o,n),!0}}const bt="data-comment-thread",Vf="wysiwyg-comment-anchor";function DP(){return`cmt_${crypto.randomUUID()}`}function jP(){return crypto.randomUUID()}const xs=20;function Wf(e,t){if(!e)return null;const n=e instanceof Element?e:e.parentElement;if(!n)return null;const r=n.closest(`[${bt}]`);return r instanceof HTMLElement&&Te(t,r)?r:null}function Gf(e,t,n){var y;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=Math.max(0,t),a=Math.max(t,n),s=null,u=0,d=null,f=0,h;for(;h=r.nextNode();){const b=h,w=((y=b.textContent)==null?void 0:y.length)??0;if(!s&&o<=w&&(s=b,u=o),!d&&a<=w){d=b,f=a;break}o-=w,a-=w}if(!s||!d)return null;const g=document.createRange();return g.setStart(s,u),g.setEnd(d,f),g}function IP(e,t,n){const r=e.textContent??"",o=r.slice(Math.max(0,t-xs),t),a=r.slice(n,n+xs);return{prefix:o,suffix:a}}function EP(e,t){if(t.mode!=="visual")return null;const n=sr(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:o}=IP(e,t.start,t.end);return{type:"text",text:t.text,start:t.start,end:t.end,prefix:r,suffix:o}}function qf(e,t){if(t.mode!=="visual")return null;const n=sr(e);if(n!=null&&n.hasAttribute(bt))return n.getAttribute(bt)??null;if(t.visualRange){const r=Wf(t.visualRange.startContainer,e);if(r)return r.getAttribute(bt)??null;const o=Wf(t.visualRange.endContainer,e);if(o)return o.getAttribute(bt)??null}return null}function bu(e,t,n){if(!Te(e,n.commonAncestorContainer))return!1;kn(n);const r=document.createElement("span");r.setAttribute(bt,t);try{return n.surroundContents(r),!0}catch{const o=n.toString();if(!o)return!1;const a=document.createElement("span");return a.setAttribute(bt,t),a.textContent=o,n.deleteContents(),n.insertNode(a),!0}}function sb(e,t){e.setAttribute(bt,t)}function _P(e,t,n){const r=sr(e);return r?(sb(r,t),!0):n.visualRange?bu(e,t,n.visualRange):!1}function MP(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 NP(e,t,n){if(n.type!=="text")return!1;if(n.start!==void 0&&n.end!==void 0){const s=Gf(e,n.start,n.end);if(s&&s.toString()===n.text)return bu(e,t,s)}const r=e.textContent??"",o=n.text;if(!o)return!1;let a=0;for(;a<=r.length;){const s=r.indexOf(o,a);if(s===-1)return!1;const u=s+o.length,d=r.slice(Math.max(0,s-xs),s),f=r.slice(u,u+xs);if(n.prefix!==void 0&&d!==n.prefix){a=s+1;continue}if(n.suffix!==void 0&&f!==n.suffix){a=s+1;continue}const h=Gf(e,s,u);return h?bu(e,t,h):!1}return!1}function LP(e,t){for(const n of t)if(!e.querySelector(`[${bt}="${n.id}"]`)){if(n.anchor.type==="image"){const o=MP(e,n.anchor);o&&sb(o,n.id);continue}NP(e,n.id,n.anchor)}}function lb(e,t){for(const n of e.querySelectorAll(`[${bt}]`))n instanceof HTMLElement&&(t?n.classList.add(Vf):n.classList.remove(Vf))}function cb(e,t){if(!t)return null;const n=t instanceof Element?t:t.parentElement;if(!n)return null;const r=n.closest(`[${bt}]`);return r instanceof HTMLElement&&Te(e,r)?r:null}function Zf(e,t){const n=e.querySelector(`[${bt}="${t}"]`);if(!(n instanceof HTMLElement))return!1;const r=window.getSelection();if(!r)return!1;const o=document.createRange();if(n instanceof HTMLImageElement)o.selectNode(n);else{const s=document.createTreeWalker(n,NodeFilter.SHOW_TEXT).nextNode();s instanceof Text?(o.setStart(s,0),o.collapse(!0)):(o.selectNodeContents(n),o.collapse(!0))}return r.removeAllRanges(),r.addRange(o),!0}function BP(e,t=[]){return{id:DP(),anchor:e,messages:t,createdAt:new Date().toISOString(),resolvedAt:null,resolvedBy:null}}function FP(e,t){return{id:jP(),userId:e.userId,userName:e.userName,message:t.trim(),createdAt:new Date().toISOString()}}function HP(e,t,n){return e.map(r=>r.id===t?{...r,messages:[...r.messages,n]}:r)}function zP(e,t){return e.find(n=>n.id===t)}function ub(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function OP(e){const t=ub(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 o=t.toString();if(!o){const a=n.querySelector("img");o=(a==null?void 0:a.getAttribute("alt"))??(a==null?void 0:a.getAttribute("src"))??""}return{html:r,text:o}}function db(e){const t=ub(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 KP(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 mb(e){const t=OP(e);return t?KP(t):!1}async function $P(e){return await mb(e)?db(e):!1}const UP=new Set(["strong","b","em","i","u","s","strike","del"]),VP=["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 WP(e){for(const t of VP)e.style.removeProperty(t)}function GP(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Pn(r)){n=r;continue}if(hr(r,n),UP.has(r.tagName.toLowerCase())){Ot(r);continue}if(WP(r),gr(r)){Ot(r);continue}n=r.isConnected?r:t}}function qP(e){const t=An(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;kn(t);const r=_t(t).filter(o=>o.data.length>0);if(r.length===0)return!1;for(const o of r)GP(e,o);return Ur(r),e.innerHTML!==n}function ZP(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function YP(e){const t=go(e),n=kh(e),r=tg(e),o=os(e,"color"),a=os(e,"backgroundColor"),s=Ph(e);return{size:n.mixed?null:n.value,unit:n.unit,marks:t,fontFamily:r.mixed?null:r.value,fontFamilyMixed:r.mixed,fontColor:o.mixed?null:o.value,fontColorMixed:o.mixed,highlightColor:a.mixed?null:a.value,highlightColorMixed:a.mixed,customCss:s.mixed?null:s.value,customCssMixed:s.mixed}}function XP(e,t){t.size!==null&&ru(e,t.size,t.unit);const n=go(e);for(const r of Jt)t.marks[r]!==n[r]&&au(e,r);return t.fontFamilyMixed||Kc(e,t.fontFamily),t.fontColorMixed||fi(e,"color",t.fontColor),t.highlightColorMixed||fi(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&Th(e,t.customCss),!0}function Qa(){return typeof window<"u"&&"speechSynthesis"in window}function JP(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function Yf(e,t){const n=e.text.trim();return n||JP(t)||null}function QP(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!Qa())return;if(t.speaking){t.cancel(),n();return}const o=new SpeechSynthesisUtterance(r);o.onend=n,o.onerror=n,t.speak(o),n()},isSpeaking(){return Qa()&&t.speaking},cancel(){Qa()&&t.speaking&&(t.cancel(),n())}}}const e0=5*1024*1024,t0="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",n0=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),r0=new Set(["mp3","wav","ogg","aac","webm","m4a"]),o0=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,i0=/^(javascript|vbscript|file|blob):/i;function a0(e={}){return{src:"",title:"",...e}}function fd(e){const t=e.trim();if(!t)return"empty";if(i0.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return o0.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 s0(e){return e.size>e0?"tooLarge":m0(e)?null:"type"}function l0(e){const t=s0(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const a=String(o.result??"");if(fd(a)){r(new Error("invalid"));return}n(a)},o.onerror=()=>r(o.error??new Error("Failed to read file")),o.readAsDataURL(e)})}function c0(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%",u0(e,t.css)}function u0(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim(),s=r.slice(o+1).trim();a&&s&&e.style.setProperty(a,s)}}function d0(e,t){const n=a0(t);if(fd(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Te(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=document.createElement("audio");return c0(a,n),o.insertNode(a),o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}function m0(e){const t=e.type.trim().toLowerCase();if(t&&n0.has(t))return!0;const n=f0(e.name);return!!(!t&&n&&r0.has(n))}function f0(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}function Xf(e,t){const r=(t?t(e):e).trim();if(!r)return"";if(!r.includes("<"))return r;const o=new DOMParser().parseFromString(`<body>${r}</body>`,"text/html");for(const a of o.querySelectorAll("img"))a.removeAttribute(Ft);return o.body.innerHTML}function fb(e,t,n){return Xf(e,n)===Xf(t,n)}const p0=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i;function Jf(e,t){var o,a;const n=(o=e.getAttribute(Ft))==null?void 0:o.trim();if(n&&t){const s=t(n);if(s)return`embedded:${s}`}const r=((a=e.getAttribute("src"))==null?void 0:a.trim())??"";return p0.test(r)?`embedded:${r}`:r.startsWith("blob:")&&n?`registry:${n}`:r?`url:${r}`:"empty"}function pb(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}const Qf=/<tr(\s[^>]*)?>([\s\S]*?)<\/tr>/gi;function g0(e){const t=[];let n;for(Qf.lastIndex=0;(n=Qf.exec(e))!==null;)t.push(n[2]??"");return t}function h0(e,t){const n=document.createRange();n.selectNodeContents(e);const r=n.createContextualFragment(t);e.replaceChildren(...r.childNodes)}function b0(e,t){const n=g0(t);if(n.length===0)return;let r=0;e.querySelectorAll("tr").forEach(o=>{r>=n.length||(h0(o,n[r]),r+=1)})}function y0(e){const t=[e,...e.querySelectorAll("table, tbody, thead, tfoot")];for(const n of t)for(const r of[...n.childNodes])r instanceof Element&&Gu(r)&&r.remove()}function x0(e,t){const n=pb(t);e.replaceChildren(...n.childNodes),/<tr[\s>]/i.test(t)&&(y0(e),b0(e,t))}function w0(e,t){for(const n of[...e.attributes])t.hasAttribute(n.name)||e.removeAttribute(n.name);for(const n of[...t.attributes])e.setAttribute(n.name,n.value)}function C0(e,t){e.querySelectorAll("img").forEach((n,r)=>{const o=document.createElement("span");o.setAttribute(t,String(r)),n.replaceWith(o)})}function ep(e,t){const n=e.cloneNode(!0);return C0(n,t),n.innerHTML}function v0(e,t,n){const r=pb(t),o=[...e.querySelectorAll("img")],a=[...r.querySelectorAll("img")];if(o.length===0||o.length!==a.length)return!1;const s=o.map(g=>Jf(g,n)),u=a.map(g=>Jf(g,n));if(!s.every((g,y)=>g===u[y]))return!1;const d="data-wysiwyg-img-marker",f=ep(e,d),h=ep(r,d);if(f!==h)return!1;for(let g=0;g<o.length;g+=1)w0(o[g],a[g]);return!0}function ws(e,t,n={}){const{resolveDataUrl:r,hydrateEmbeddedImages:o}=n;return Kg(t)?e.innerHTML===t?{changed:!1}:(x0(e,t),{changed:!0}):fb(e.innerHTML,t,o)?{changed:!1}:e.innerHTML===t?{changed:!1}:v0(e,t,r)?{changed:!0}:(e.innerHTML=t,{changed:!0})}const gb=/^(javascript|vbscript|file|blob):/i,k0=[/(?: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 S0(e={}){return{url:"",title:"",...e}}function P0(e={}){return{src:"",title:"",...e}}function Ks(e){const t=e.trim();if(!t)return null;for(const n of k0){const r=t.match(n);if(r!=null&&r[1])return r[1]}return null}function hb(e){return`https://www.youtube.com/embed/${e}`}function bb(e){const t=e.trim();return t?gb.test(t)?"invalid":Ks(t)?null:"invalid":"empty"}function A0(e){const t=e.trim();if(!t)return"empty";if(gb.test(t))return"invalid";if(Ks(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 yb(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim(),s=r.slice(o+1).trim();a&&s&&e.style.setProperty(a,s)}}function xb(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",yb(e,n.css)}function T0(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%",yb(e,t.css)}function R0(e,t){const n=S0(t);if(bb(n.url))return!1;const r=Ks(n.url);if(!r)return!1;const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!Te(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const s=document.createElement("iframe");return xb(s,hb(r),n),a.insertNode(s),a.setStartAfter(s),a.collapse(!0),o.removeAllRanges(),o.addRange(a),!0}function D0(e,t){const n=P0(t);if(A0(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Te(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=Ks(n.src);if(a){const s=document.createElement("iframe");xb(s,hb(a),{title:n.title,css:n.css}),o.insertNode(s),o.setStartAfter(s)}else{const s=document.createElement("video");T0(s,n),o.insertNode(s),o.setStartAfter(s)}return o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}const j0=new Set(["p","h1","h2","h3","h4","h5","h6"]),I0=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function wb(e,t){var a;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Te(e,r.commonAncestorContainer))return!1;r.collapsed||r.deleteContents();const o=E0(e,r.startContainer);if(o){const s=_0(o,r);return(a=o.parentNode)==null||a.insertBefore(t,s),np(t),!0}return r.insertNode(t),M0(e,t),B0(t),np(t),!0}function E0(e,t){let n=Ii(t);for(;n&&n!==e;){const r=_e(n);if(j0.has(r)&&n instanceof HTMLElement)return n;if(I0.has(r))return null;n=n.parentElement}return null}function _0(e,t){var a;const n=document.createRange();n.setStart(t.startContainer,t.startOffset),n.setEnd(e,e.childNodes.length);const r=n.extractContents(),o=e.cloneNode(!1);return o.appendChild(r),tp(e),tp(o),(a=e.parentNode)==null||a.insertBefore(o,e.nextSibling),o}function M0(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!N0(n))return;hr(n,t),Ot(n)}}function N0(e){const t=_e(e);return Pn(e)||t==="a"}function tp(e){L0(e)&&e.appendChild(document.createElement("br"))}function L0(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 B0(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 np(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 F0="1em 0",H0="1px solid #d0d0d0";function z0(){const e=document.createElement("hr");return e.style.margin=F0,e.style.border="0",e.style.borderTop=H0,e}function O0(e){return wb(e,z0())}const K0="1.5em 0",$0="2px dashed #bbb",U0="data-wysiwyg-page-break";function V0(){const e=document.createElement("div");return e.setAttribute(U0,""),e.style.display="block",e.style.clear="both",e.style.breakAfter="page",e.style.pageBreakAfter="always",e.style.margin=K0,e.style.border="0",e.style.borderTop=$0,e.style.height="0",e}function W0(e){return wb(e,V0())}const Kn=16;function rp(e){return Math.min(ko.px.max,Math.max(Kn,e))}function G0(e){return e.width>0&&e.height>0?e.width/e.height:1}function q0(e,t){const n=Math.max(Kn,Kn*t),r=Math.min(ko.px.max,ko.px.max*t),o=Math.min(r,Math.max(n,e));return{width:o,height:o/t}}function Z0(e,t){const n=Math.max(Kn,Kn/t),r=Math.min(ko.px.max,ko.px.max/t),o=Math.min(r,Math.max(n,e));return{width:o*t,height:o}}function Y0(e,t,n){const r=G0(t);return e==="e"?q0(t.width+n.x,r):e==="s"?Z0(t.height+n.y,r):{width:rp(t.width+n.x),height:rp(t.height+n.y)}}function X0(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:Kn,height:r>0?r:Kn}}function J0(e,t,n){const r=So(Math.max(Kn,t),"px"),o=So(Math.max(Kn,n),"px");return!r||!o?!1:rh(e,{...nh(e),sizeMode:"lock",width:r,height:o})}function Q0(e={}){return{border:{...$u},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function eA(e){const t=Ro(e);return{border:t.border,borderCollapse:oA(e),borderSpacing:Cb(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:vt(e.style.width)}}function tA(e,t){let n=Do(e,{...Wr(),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 iA(e,t.borderCollapse)&&(n=!0),aA(e,t.borderCollapse,t.borderSpacing)&&(n=!0),sA(e,t.width)&&(n=!0),n&&jt(e),n}function nA(e){const t=ad(e);return t?eA(t):null}function rA(e,t){const n=ad(e);return n?tA(n,t):!1}function oA(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function iA(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function Cb(e){const t=e.style.borderSpacing.trim();return t?vt(t.split(/\s+/)[0]??""):null}function aA(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?br(n):null,o=Cb(e);return Yt(o,r)?!1:(r?e.style.borderSpacing=Ie(r):e.style.removeProperty("border-spacing"),!0)}function sA(e,t){const n=t?br(t):null,r=vt(e.style.width);return Yt(r,n)?!1:(n?e.style.width=Ie(n):e.style.removeProperty("width"),!0)}const $s=["top","middle","bottom","baseline"],lA=new Set($s);function cA(e={}){return{backgroundColor:null,color:null,padding:{...un},textAlign:null,verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function uA(e){const t=Ro(e);return{backgroundColor:t.backgroundColor,color:vb(e),padding:t.padding,textAlign:gA(e),verticalAlign:kb(e),width:vt(e.style.width),...zs(e)}}function dA(e,t){let n=Do(e,{...Wr(),margin:{...un},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 pA(e,t.color)&&(n=!0),du(e,t.textAlign)&&(n=!0),hA(e,t.verticalAlign)&&(n=!0),bA(e,t.width)&&(n=!0),n&&jt(e),n}function mA(e){const t=Tn(e);return t?uA(t):null}function fA(e,t){const n=_i(e);if(n.length===0)return!1;let r=!1;for(const a of n)dA(a,t)&&(r=!0);const o=Tn(e);if(o){const a=zs(o);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&RS(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function vb(e){const t=e.style.color;return t?Ke(t):null}function pA(e,t){const n=t?Ke(t):null;return vb(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function gA(e){const t=ys(e);return t==="left"?null:t}function kb(e){const t=e.style.verticalAlign.trim().toLowerCase();return lA.has(t)?t:null}function hA(e,t){return kb(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function bA(e,t){const n=t?br(t):null,r=vt(e.style.width);return Yt(r,n)?!1:(n?e.style.width=Ie(n):e.style.removeProperty("width"),!0)}const yA=new Set($s);function xA(e={}){return{backgroundColor:null,color:null,padding:{...un},height:null,verticalAlign:null,...e}}function wA(e){const t=e.cells[0],n=t?Ro(t).padding:{...un};return{backgroundColor:Sb(e),color:Pb(e),padding:n,height:vt(e.style.height),verticalAlign:Ab(e)}}function CA(e,t){let n=!1;SA(e,t.backgroundColor)&&(n=!0),PA(e,t.color)&&(n=!0),TA(e,t.height)&&(n=!0),AA(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))Do(r,{...Wr(),margin:{...un},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&&jt(e),n}function vA(e){const t=Wh(e);return t?wA(t):null}function kA(e,t){const n=Wh(e);return n?CA(n,t):!1}function Sb(e){const t=e.style.backgroundColor;return t?Ke(t):null}function SA(e,t){const n=t?Ke(t):null;return Sb(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Pb(e){const t=e.style.color;return t?Ke(t):null}function PA(e,t){const n=t?Ke(t):null;return Pb(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function Ab(e){const t=e.style.verticalAlign.trim().toLowerCase();return yA.has(t)?t:null}function AA(e,t){return Ab(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function TA(e,t){const n=t?br(t):null,r=vt(e.style.height);return Yt(r,n)?!1:(n?e.style.height=Ie(n):e.style.removeProperty("height"),!0)}const RA=1e3;function DA(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function jA({onAutoSave:e,getHtml:t}){const n=l.useRef(e);n.current=e;const r=l.useRef(t);r.current=t;const o=l.useRef(null),a=e!=null;l.useEffect(()=>{if(!a){o.current=null;return}o.current=r.current();const s=window.setInterval(()=>{const u=n.current;if(!u)return;const d=r.current();d!==o.current&&(o.current=d,queueMicrotask(()=>DA(u,d)))},RA);return()=>{window.clearInterval(s)}},[a])}function IA(){const[e,t]=l.useState({open:!1,tab:"general"}),[n,r]=l.useState(!1),[o,a]=l.useState({open:!1,html:""}),[s,u]=l.useState(null),[d,f]=l.useState(!1),[h,g]=l.useState(!1),[y,b]=l.useState({open:!1,tab:"general",value:Br(),backgroundImage:vn()}),[w,x]=l.useState({open:!1,value:""}),[S,k]=l.useState({open:!1,tab:"font",paragraphTab:"spacing",value:hi()}),[v,A]=l.useState(!1),[j,D]=l.useState({open:!1}),[R,T]=l.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[E,N]=l.useState({open:!1,existingIds:[]}),[K,$]=l.useState({open:!1}),[P,F]=l.useState({open:!1}),[U,G]=l.useState({open:!1}),[me,se]=l.useState({open:!1,tab:"general",value:th(),aspectRatio:1}),[V,re]=l.useState({open:!1}),[de,oe]=l.useState({open:!1,value:Q0()}),[_,Q]=l.useState({open:!1,value:cA()}),[xe,ee]=l.useState({open:!1,value:xA()}),[Z,Ee]=l.useState({open:!1,topicId:"getStarted"}),[et,qe]=l.useState(!1);return{fontDialog:e,setFontDialog:t,customizeToolbarOpen:n,setCustomizeToolbarOpen:r,documentPreview:o,setDocumentPreview:a,toolbarSettings:s,setToolbarSettings:u,toolbarSettingsLoading:d,setToolbarSettingsLoading:f,toolbarSettingsBusy:h,setToolbarSettingsBusy:g,paragraphDialog:y,setParagraphDialog:b,customCssDialog:w,setCustomCssDialog:x,pageDialog:S,setPageDialog:k,deletePageConfirmOpen:v,setDeletePageConfirmOpen:A,customStyleDialog:j,setCustomStyleDialog:D,linkDialog:R,setLinkDialog:T,bookmarkDialog:E,setBookmarkDialog:N,imageDialog:K,setImageDialog:$,audioDialog:P,setAudioDialog:F,youtubeDialog:U,setYoutubeDialog:G,imageProperties:me,setImageProperties:se,tableDialog:V,setTableDialog:re,tableProperties:de,setTableProperties:oe,cellProperties:_,setCellProperties:Q,rowProperties:xe,setRowProperties:ee,helpDialog:Z,setHelpDialog:Ee,aboutDialogOpen:et,setAboutDialogOpen:qe}}const op={changed:!1,pages:[],joined:"",changedIndices:[]};function ip(e){return{changed:e.changed,pages:e.pages,joined:zt(e.pages),changedIndices:e.changedIndices}}function ap(e,t,n){return n.size===0?t:t.map((r,o)=>n.has(o)&&e[o]!==void 0&&e[o]!==r?e[o]:r)}function EA({enabled:e,pagesProp:t,defaultPages:n}){const r=e&&t!==void 0,o=l.useMemo(()=>t!==void 0?ir(t):void 0,[t]),[a,s]=l.useState(()=>({pages:ir(n),revision:0})),u=l.useRef(o??ir(n)),d=l.useRef(new Set),f=l.useRef(t);l.useEffect(()=>{if(!e||!r||o===void 0||f.current===t&&Nr(u.current,o))return;f.current=t;const k=ap(u.current,o,d.current),v=vc(u.current,k);if(u.current=v.pages,!!v.changed){for(const A of v.changedIndices)d.current.add(A);s(A=>({pages:v.pages,revision:A.revision+1}))}},[e,r,o,t]);const h=l.useMemo(()=>{if(!e)return[];if(r&&o!==void 0){const k=ap(u.current,o,d.current),v=vc(u.current,k);return u.current=v.pages,v.pages}return a.pages},[e,r,o,a.pages,a.revision]),g=l.useCallback((k,v)=>{if(!e)return op;const A=r?u.current:a.pages,j=vc(A,k);if(!j.changed)return ip(j);for(const D of j.changedIndices)d.current.add(D);return v!==void 0&&d.current.add(v),r?u.current=j.pages:s(D=>({pages:j.pages,revision:D.revision+1})),ip(j)},[e,a.pages,r]),y=l.useCallback((k,v)=>g(k,v==null?void 0:v.editedIndex),[g]),b=l.useCallback((k,v,A)=>{if(!e)return op;const j=r?u.current:a.pages,D=Xc(j,k,v);return D.changed?g(D.pages,(A==null?void 0:A.editedIndex)??k):{changed:!1,pages:j,joined:zt(j),changedIndices:[]}},[g,e,a.pages,r]),w=l.useCallback(k=>g(ir(k)),[g]),x=l.useCallback(k=>{if(k===void 0){d.current.clear();return}for(const v of k)d.current.delete(v)},[]),S=l.useCallback(()=>zt(h),[h]);return l.useMemo(()=>({pages:h,revision:a.revision,dirtyPagesRef:d,setPages:y,updatePage:b,replacePages:w,markPagesClean:x,getJoinedHtml:S}),[h,a.revision,y,b,w,x,S])}function es({value:e,defaultValue:t,onChange:n}){const[r,o]=l.useState(t),a=e!==void 0,s=a?e:r,u=l.useCallback(d=>{a||o(d),n==null||n(d)},[a,n]);return[s,u]}const Tb="commspliant-html-editor.darkMode";function _A(e){return typeof e=="boolean"?e:null}function sp(){try{const e=localStorage.getItem(Tb);return e?_A(JSON.parse(e)):null}catch{return null}}function MA(e){try{localStorage.setItem(Tb,JSON.stringify(e))}catch{}}const Rb="commspliant-html-editor.pageZoom",NA=new Set(["fitWidth","fitPage"]);function LA(e){return typeof e=="string"&&NA.has(e)||typeof e=="number"&&sk.includes(e)?e:null}function BA(){try{const e=localStorage.getItem(Rb);return e?LA(JSON.parse(e)):null}catch{return null}}function FA(e){try{localStorage.setItem(Rb,JSON.stringify(e))}catch{}}const Db="commspliant-html-editor.toolbarPosition",HA=["top","left","right","bottom"];function jb(e){return typeof e=="string"&&HA.includes(e)?e:null}function lp(){try{const e=localStorage.getItem(Db);return e?jb(JSON.parse(e)):null}catch{return null}}function zA(e){try{localStorage.setItem(Db,JSON.stringify(e))}catch{}}const Ib=l.createContext({profile:void 0,validation:null,refreshValidation:()=>{}});function OA({value:e,children:t}){return i.jsx(Ib.Provider,{value:e,children:t})}function pd(){return l.useContext(Ib).profile}function Eb(e){const t=new Map;for(const n of e.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim().toLowerCase(),s=r.slice(o+1).trim();a&&t.set(a,s)}return t}function cp(e,t){const n=e.toLowerCase();switch(t){case"hex":return/#([0-9a-f]{3}|[0-9a-f]{6})\b/i.test(n);case"rgb":return/\brgb\s*\(/i.test(n);case"rgba":return/\brgba\s*\(/i.test(n);case"hsl":return/\bhsl\s*\(/i.test(n)&&!/\bhsla\s*\(/i.test(n);case"hsla":return/\bhsla\s*\(/i.test(n);case"flex":return/\bflex\b/i.test(n);case"inline-flex":return/\binline-flex\b/i.test(n);case"grid":return/\bgrid\b/i.test(n)&&!/\binline-grid\b/i.test(n);case"inline-grid":return/\binline-grid\b/i.test(n);case"contents":return/\bcontents\b/i.test(n);case"block":return/\bblock\b/i.test(n);case"inline-block":return/\binline-block\b/i.test(n);case"none":return/\bnone\b/i.test(n);default:return n.includes(t.toLowerCase())}}function KA(e){if(!e)return null;const t=[...e.matchAll(/<([a-z][a-z0-9]*)\s*>/gi)];return t.length===0?null:t.map(n=>n[1].toLowerCase())}function $A(e){return{tag:e.tag.toLowerCase(),requiredAttributes:{...e.required_attributes??{}},allowedAttributes:e.allowed_attributes?e.allowed_attributes.map(t=>t.toLowerCase()):null,disallowedCss:(e.disallowed_css??[]).map(t=>t.toLowerCase()),forcedCss:Object.fromEntries(Object.entries(e.forced_css??{}).map(([t,n])=>[t.toLowerCase(),n])),defaultAttributes:{...e.default_attributes??{}},status:e.status,notes:e.notes}}function UA(e){var n;const t=((n=e.allowed_on_tags)==null?void 0:n.map(r=>r.toLowerCase()))??KA(e.restrictions);return{property:e.property.toLowerCase(),status:e.status,allowedValues:e.allowed_values??null,disallowedValues:e.disallowed_values??null,allowedOnTags:t,restrictions:e.restrictions,fallback:e.fallback??null}}function Us(e){var u,d;const t=((u=e.html_elements)==null?void 0:u.allowed_tags)??[],n=t.length>0?new Set(t.map(f=>f.tag.toLowerCase())):null,r=new Set((((d=e.html_elements)==null?void 0:d.disallowed_tags)??[]).map(f=>f.toLowerCase())),o=new Map;for(const f of t)o.set(f.tag.toLowerCase(),$A(f));const a=new Map;for(const f of e.css_properties??[])a.set(f.property.toLowerCase(),UA(f));const s=e.global_rules??{};return{allowedTagSet:n,disallowedTagSet:r,tagRules:o,cssPropertyRules:a,globalRules:{layoutMode:s.layout_mode,requireInlining:s.require_inlining,maxContainerWidthPx:s.max_container_width_px,stripUnknownTags:s.strip_unknown_tags??!1,stripUnknownAttributes:s.strip_unknown_attributes??!1}}}const ts={audio:{tags:["audio"]},youtube:{tags:["video","iframe"]},horizontalRule:{tags:["hr"]},bookmark:{tags:["a"],attributes:[{tag:"a",names:["name","id"]}]},bulletList:{tags:["ul","ol","li"]},numberedList:{tags:["ul","ol","li"]},customCss:{cssProperties:["*"]},formatBrush:{cssProperties:["*"]},pageBackgroundImage:{cssProperties:["background-image"],dialogTabs:[{dialog:"page",tabs:["backgroundImage"]}]},paragraphBackgroundImage:{cssProperties:["background-image"],dialogTabs:[{dialog:"paragraph",tabs:["backgroundImage"]}]},pageBreak:{tags:["div"],cssProperties:["page-break-after","break-after"]},indent:{cssProperties:["margin-left","margin-right","margin"]},outdent:{cssProperties:["margin-left","margin-right","margin"]},paragraphStyle:{tags:["h1","h2","h3","h4","h5","h6","p"]},fontFamily:{cssProperties:["font-family"]},openCustomParagraphStyleDialog:{tags:["h1","h2","h3","h4","h5","h6","p","div"]},paragraphProperties:{dialogTabs:[{dialog:"paragraph",tabs:["spacing","border","background","backgroundImage"]}]},pageProperties:{dialogTabs:[{dialog:"page",tabs:["spacing","border","background","backgroundImage"]}]},openPageBackgroundImage:{cssProperties:["background-image"]},openParagraphBackgroundImage:{cssProperties:["background-image"]},openParagraphProperties:{dialogTabs:[{dialog:"paragraph",tabs:["spacing","border","background","backgroundImage"]}]},openPageProperties:{dialogTabs:[{dialog:"page",tabs:["spacing","border","background","backgroundImage"]}]}},up={paragraph:{general:{cssProperties:["font-family","font-size","color"]},spacing:{cssProperties:["margin","margin-top","margin-right","margin-bottom","margin-left","padding"]},border:{cssProperties:["border","border-width","border-style","border-color"]},background:{cssProperties:["background-color"]},backgroundImage:{cssProperties:["background-image"]}},page:{font:{cssProperties:["font-family","font-size","color"]},paragraph:{cssProperties:["margin","padding"]},print:{cssProperties:["page-break-after","break-after"]},spacing:{cssProperties:["margin","padding"]},border:{cssProperties:["border"]},background:{cssProperties:["background-color"]},backgroundImage:{cssProperties:["background-image"]}}},VA={openPageBackgroundImage:ts.openPageBackgroundImage,openPageProperties:ts.openPageProperties,openParagraphProperties:ts.openParagraphProperties};function dp(e,t){const n=e.toLowerCase();return!(t.disallowedTagSet.has(n)||t.globalRules.stripUnknownTags&&t.allowedTagSet&&!t.allowedTagSet.has(n))}function WA(e,t,n){if(!n.globalRules.stripUnknownAttributes)return!0;const r=n.tagRules.get(e.toLowerCase());if(!(r!=null&&r.allowedAttributes))return!0;const o=new Set(r.allowedAttributes);return t.every(a=>o.has(a.toLowerCase()))}function GA(e,t,n){const r=e.toLowerCase(),o=t.cssPropertyRules.get(r);return o?!(o.status==="disallowed"||(o.allowedOnTags,o.status==="restricted")):!0}function qA(e){for(const t of e.cssPropertyRules.values())if(t.status==="disallowed")return!1;return!0}function Vs(e,t){if(!e)return!0;if(e.tags){for(const n of e.tags)if(!dp(n,t))return!1}if(e.attributes){for(const n of e.attributes)if(!dp(n.tag,t)||!WA(n.tag,n.names,t))return!1}if(e.cssProperties){if(e.cssProperties.includes("*")){if(!qA(t))return!1}else for(const n of e.cssProperties)if(!GA(n,t))return!1}return!0}function ZA(e,t,n,r){const o=r[t];return o?Vs(o,n):!0}function YA(e){const t="style";return!(e.disallowedTagSet.has(t)||e.globalRules.stripUnknownTags&&e.allowedTagSet&&!e.allowedTagSet.has(t))}function gd(e){const t=Us(e);return t.globalRules.layoutMode==="table-based"?!1:YA(t)}function XA(e){const t=new Set;for(const[n,r]of Object.entries(ts))Vs(r,e)||t.add(n);return t}function JA(e){const t=new Set;for(const[n,r]of Object.entries(VA))Vs(r,e)||t.add(n);return t}function QA(e){return e.allowedTagSet?Hr.filter(t=>e.allowedTagSet.has(t)):[...Hr]}function eT(e){const t=e.cssPropertyRules.get("font-family");return!(t!=null&&t.allowedValues)||t.allowedValues.length===0?null:[...t.allowedValues]}function tT(e){const t={};for(const n of["paragraph","page"]){const r=[];for(const[o,a]of Object.entries(up[n]))ZA(n,o,e,up[n])&&Vs(a,e)||r.push(o);r.length>0&&(t[n]=r)}return t}function _b(e){const t=Us(e);return{normalized:t,hiddenToolbarItemIds:XA(t),hiddenContextMenuCommands:JA(t),allowedParagraphTags:QA(t),allowedFontFamilies:eT(t),hiddenDialogTabs:tT(t),maxContainerWidthPx:t.globalRules.maxContainerWidthPx,pageLayoutAllowed:gd(e)}}function Mb(e,t){const n=[];let r=!1;for(const o of e){if(o===ke){r=!0;continue}if(zn(o)){const a=Mb(o.items,t);if(a.length===0)continue;r&&n.length>0&&(n.push(ke),r=!1),n.push({submenu:o.submenu,items:a});continue}t.has(o)||(r&&n.length>0&&(n.push(ke),r=!1),n.push(o))}return n}function nT(e,t){if(!t)return e;const n=t.hiddenToolbarItemIds,r=e.menus.map(a=>({...a,items:Mb(a.items,n)})).filter(a=>a.items.length>0),o=e.iconGroups.map(a=>({...a,items:a.items.filter(s=>!n.has(s))})).filter(a=>a.items.length>0);return{menus:r,iconGroups:o}}function rT(e,t){return t?!t.hiddenToolbarItemIds.has(e):!0}function Ws(e){const t=[];let n=e;for(;n&&n.tagName.toLowerCase()!=="body";){const r=n.tagName.toLowerCase(),o=n.parentElement;if(!o){t.unshift(r);break}const s=[...o.children].filter(u=>u.tagName===n.tagName).indexOf(n);t.unshift(`${r}:nth-of-type(${s+1})`),n=o}return t.join(" > ")}function Ht(e,t){e.push(t)}function oT(e,t,n,r){const o=e.tagName.toLowerCase(),a=Ws(e);if(t.disallowedTagSet.has(o)){Ht(n,{code:"disallowed-tag",severity:"error",messageKey:"capabilitiesViolationDisallowedTag",messageParams:{tag:o},selector:a,tag:o,pageIndex:r});return}t.globalRules.stripUnknownTags&&t.allowedTagSet&&!t.allowedTagSet.has(o)&&Ht(n,{code:"unknown-tag",severity:"error",messageKey:"capabilitiesViolationUnknownTag",messageParams:{tag:o},selector:a,tag:o,pageIndex:r});const s=t.tagRules.get(o);(s==null?void 0:s.status)==="restricted"&&Ht(n,{code:"restricted-tag",severity:"warning",messageKey:"capabilitiesViolationRestrictedTag",messageParams:{tag:o},selector:a,tag:o,pageIndex:r})}function iT(e,t,n,r){const o=e.tagName.toLowerCase(),a=t.tagRules.get(o),s=Ws(e);if(a!=null&&a.requiredAttributes)for(const[d,f]of Object.entries(a.requiredAttributes)){const h=e.getAttribute(d);(h===null||h!==f)&&Ht(n,{code:"missing-required-attribute",severity:"error",messageKey:"capabilitiesViolationMissingRequiredAttribute",messageParams:{tag:o,attribute:d,expected:f},selector:s,tag:o,attribute:d,pageIndex:r})}if(!t.globalRules.stripUnknownAttributes||!(a!=null&&a.allowedAttributes))return;const u=new Set(a.allowedAttributes);for(const d of[...e.attributes]){const f=d.name.toLowerCase();f!=="style"&&(u.has(f)||Ht(n,{code:"unknown-attribute",severity:"error",messageKey:"capabilitiesViolationUnknownAttribute",messageParams:{tag:o,attribute:f},selector:s,tag:o,attribute:f,pageIndex:r}))}}function aT(e,t,n){if(n.disallowedValues){for(const r of n.disallowedValues)if(cp(t,r))return!1}return!(n.allowedValues&&n.allowedValues.length>0&&!n.allowedValues.some(o=>cp(t,o))&&!n.allowedValues.includes(t)&&!n.allowedValues.some(a=>t.toLowerCase().includes(a.toLowerCase())))}function sT(e,t,n,r){const o=e.tagName.toLowerCase(),a=t.tagRules.get(o),s=Ws(e),u=e.getAttribute("style");if(!u){if(a!=null&&a.forcedCss)for(const f of Object.keys(a.forcedCss))Ht(n,{code:"missing-forced-css",severity:"warning",messageKey:"capabilitiesViolationMissingForcedCss",messageParams:{tag:o,property:f,expected:a.forcedCss[f]},selector:s,tag:o,cssProperty:f,pageIndex:r});return}const d=Eb(u);if(a!=null&&a.disallowedCss)for(const f of a.disallowedCss)d.has(f)&&Ht(n,{code:"tag-disallowed-css",severity:"error",messageKey:"capabilitiesViolationTagDisallowedCss",messageParams:{tag:o,property:f},selector:s,tag:o,cssProperty:f,pageIndex:r});if(a!=null&&a.forcedCss)for(const[f,h]of Object.entries(a.forcedCss)){const g=d.get(f);(!g||g.replace(/\s+/g,"").toLowerCase()!==h.replace(/\s+/g,"").toLowerCase())&&Ht(n,{code:"missing-forced-css",severity:"warning",messageKey:"capabilitiesViolationMissingForcedCss",messageParams:{tag:o,property:f,expected:h},selector:s,tag:o,cssProperty:f,pageIndex:r})}for(const[f,h]of d.entries()){const g=t.cssPropertyRules.get(f);if(g){if(g.allowedOnTags&&!g.allowedOnTags.includes(o)){Ht(n,{code:"css-wrong-tag",severity:g.status==="disallowed"?"error":"warning",messageKey:"capabilitiesViolationCssWrongTag",messageParams:{property:f,tag:o,allowedTags:g.allowedOnTags.join(", ")},selector:s,tag:o,cssProperty:f,pageIndex:r});continue}if(g.status==="disallowed"){Ht(n,{code:"css-disallowed",severity:"error",messageKey:"capabilitiesViolationCssDisallowed",messageParams:{property:f},selector:s,tag:o,cssProperty:f,pageIndex:r});continue}if(!aT(f,h,g)){Ht(n,{code:"css-value-not-allowed",severity:"error",messageKey:"capabilitiesViolationCssValueNotAllowed",messageParams:{property:f,value:h},selector:s,tag:o,cssProperty:f,pageIndex:r});continue}(g.status==="restricted"||g.status==="allowed_with_degradation")&&Ht(n,{code:"css-restricted",severity:"warning",messageKey:"capabilitiesViolationCssRestricted",messageParams:{property:f},selector:s,tag:o,cssProperty:f,pageIndex:r})}}}function lT(e,t,n,r){const o=t.globalRules.maxContainerWidthPx;if(!o)return;const a=[...e.body.querySelectorAll('table[width], table[style*="width"]'),...e.body.querySelectorAll('div[style*="max-width"], div[style*="width"]')];for(const s of a){const u=s.getAttribute("width"),d=Eb(s.getAttribute("style")??""),f=u??d.get("width")??d.get("max-width");if(!f)continue;const h=Number.parseInt(f,10);Number.isFinite(h)&&h>o&&Ht(n,{code:"container-width-exceeded",severity:"warning",messageKey:"capabilitiesViolationContainerWidthExceeded",messageParams:{width:String(h),max:String(o)},selector:Ws(s),tag:s.tagName.toLowerCase(),pageIndex:r})}}function cT(e,t,n,r){const o=e instanceof Element?e.tagName.toLowerCase()==="body"?[...e.children]:[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(const a of o)a instanceof Element&&(oT(a,t,n,r),iT(a,t,n,r),sT(a,t,n,r))}function Nb(e){const t=e.filter(r=>r.severity==="error").length,n=e.filter(r=>r.severity==="warning").length;return{valid:t===0,errorCount:t,warningCount:n,violations:e}}function Lb(e,t,n){const r=Us(t),o=e.trim();if(!o)return{valid:!0,errorCount:0,warningCount:0,violations:[]};const a=new DOMParser().parseFromString(`<body>${o}</body>`,"text/html"),s=[];return cT(a.body,r,s,n==null?void 0:n.pageIndex),lT(a,r,s,n==null?void 0:n.pageIndex),Nb(s)}function yu(e,t){const n=[];return e.forEach((r,o)=>{const a=Lb(r,t,{pageIndex:o});n.push(...a.violations)}),Nb(n)}const Bb={en:To,es:qp};function Fb(e,t){return Object.entries(t).reduce((n,[r,o])=>n.replaceAll(`{${r}}`,o),e)}function Hb(e,t="en"){const r=(Bb[t]??To)[e.messageKey]??e.messageKey;return Fb(r,e.messageParams)}function zb(e,t="en"){const r=(Bb[t]??To).capabilitiesViolationPage;return e.selector?e.pageIndex!==void 0?`${e.selector} (${r} ${e.pageIndex+1})`:e.selector:e.pageIndex!==void 0?`${r} ${e.pageIndex+1}`:""}const uT={items:{compatibilityCheck:{id:"compatibilityCheck",command:"openCompatibilityCheck",icon:Mp,labelKey:"commandCompatibilityCheck",ariaKey:"commandCompatibilityCheckAria",enabled:"isVisualMode"}}};function dT(e){return{...e,items:{...e.items,...uT.items}}}function mT(e){return{...e,menus:e.menus.map(t=>{if(t.id!=="view")return t;const n=[...t.items];if(!n.includes("compatibilityCheck")){const r=n.indexOf("preview"),o=r===-1?n.length:r;n.splice(o,0,"compatibilityCheck")}return{...t,items:n}}),iconGroups:e.iconGroups.map(t=>t.id!=="view"||t.items.includes("compatibilityCheck")?t:{...t,items:[...t.items,"compatibilityCheck"]})}}const fT='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',pT='[role="listbox"], [data-color-picker]';function $e(e,{open:t,onClose:n,focusableSelector:r=fT,escapeIgnoreSelectors:o=pT}){l.useEffect(()=>{if(!t)return;const a=e.current,s=a==null?void 0:a.querySelector(r);s==null||s.focus();const u=d=>{if(d.key==="Escape"){if(o&&document.querySelector(o))return;d.preventDefault(),d.stopPropagation(),n();return}if(d.key!=="Tab"||!a)return;const f=[...a.querySelectorAll(r)];if(f.length===0)return;const h=f[0],g=f[f.length-1];d.shiftKey&&document.activeElement===h?(d.preventDefault(),g.focus()):!d.shiftKey&&document.activeElement===g&&(d.preventDefault(),h.focus())};return document.addEventListener("keydown",u,!0),()=>document.removeEventListener("keydown",u,!0)},[e,o,r,n,t])}const gT="_backdrop_nnwu2_1",hT="_dialog_nnwu2_12",bT="_headerRow_nnwu2_25",yT="_header_nnwu2_25",xT="_close_nnwu2_40",wT="_body_nnwu2_53",CT="_empty_nnwu2_60",vT="_summary_nnwu2_66",kT="_section_nnwu2_71",ST="_sectionTitle_nnwu2_75",PT="_list_nnwu2_81",AT="_violation_nnwu2_87",TT="_severity_error_nnwu2_97",RT="_severity_warning_nnwu2_101",DT="_violationMessage_nnwu2_105",jT="_violationLocation_nnwu2_109",Je={backdrop:gT,dialog:hT,headerRow:bT,header:yT,close:xT,body:wT,empty:CT,summary:vT,section:kT,sectionTitle:ST,list:PT,violation:AT,severity_error:TT,severity_warning:RT,violationMessage:DT,violationLocation:jT};function mp({violation:e}){const t=uw(),n=Hb(e,t),r=zb(e,t);return i.jsxs("li",{className:`${Je.violation} ${Je[`severity_${e.severity}`]}`,children:[i.jsx("span",{className:Je.violationMessage,children:n}),r?i.jsx("span",{className:Je.violationLocation,children:r}):null]})}function IT({open:e,result:t,onClose:n}){const r=J(),o=l.useId(),a=l.useRef(null);if($e(a,{open:e,onClose:n,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const s=(t==null?void 0:t.violations)??[],u=s.filter(f=>f.severity==="error"),d=s.filter(f=>f.severity==="warning");return i.jsx(Pe,{children:i.jsx("div",{className:Je.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:a,className:Je.dialog,role:"dialog","aria-modal":"true","aria-labelledby":o,onMouseDown:f=>f.stopPropagation(),children:[i.jsxs("div",{className:Je.headerRow,children:[i.jsx("h2",{className:Je.header,id:o,children:r("capabilitiesPanelTitle")}),i.jsx("button",{type:"button",className:Je.close,"aria-label":r("capabilitiesPanelCloseAria"),onClick:n,children:i.jsx(Ge,{})})]}),s.length===0?i.jsx("p",{className:Je.empty,children:r("capabilitiesPanelEmpty")}):i.jsxs("div",{className:Je.body,children:[i.jsx("p",{className:Je.summary,children:Fb(r("capabilitiesPanelSummary"),{errors:String((t==null?void 0:t.errorCount)??0),warnings:String((t==null?void 0:t.warningCount)??0)})}),u.length>0?i.jsxs("section",{className:Je.section,children:[i.jsx("h3",{className:Je.sectionTitle,children:r("capabilitiesPanelErrors")}),i.jsx("ul",{className:Je.list,children:u.map((f,h)=>i.jsx(mp,{violation:f},`error-${h}`))})]}):null,d.length>0?i.jsxs("section",{className:Je.section,children:[i.jsx("h3",{className:Je.sectionTitle,children:r("capabilitiesPanelWarnings")}),i.jsx("ul",{className:Je.list,children:d.map((f,h)=>i.jsx(mp,{violation:f},`warning-${h}`))})]}):null]})]})})})}function ET({enabled:e,onHtml:t}){const[n,r]=l.useState(!1),o=l.useRef(0),a=l.useRef(e),s=l.useRef(t);a.current=e,s.current=t;const u=l.useCallback(()=>{o.current=0,r(!1)},[]);l.useEffect(()=>{e||u()},[e,u]);const d=l.useCallback(y=>{!a.current||!Va(y.dataTransfer)||(y.preventDefault(),o.current+=1,r(!0))},[]),f=l.useCallback(y=>{!a.current||!Va(y.dataTransfer)||(y.preventDefault(),y.dataTransfer&&(y.dataTransfer.dropEffect="copy"))},[]),h=l.useCallback(y=>{if(!a.current||!Va(y.dataTransfer))return;const b=y.relatedTarget;b instanceof Node&&y.currentTarget.contains(b)||(o.current=Math.max(0,o.current-1),o.current===0&&r(!1))},[]),g=l.useCallback(y=>{if(!a.current||!Va(y.dataTransfer))return;y.preventDefault(),u();const b=z1(y.dataTransfer);b&&rd(b).then(w=>{a.current&&s.current(w)},()=>{})},[u]);return{dragging:n,onDragEnter:d,onDragOver:f,onDragLeave:h,onDrop:g}}const _T={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:Vx,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:Hx,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:mi,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"},deletePage:{id:"deletePage",command:"deletePage",icon:mi,labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:"canDeletePage"}}},Ob=400,Cs=100,Kb=2e7;function MT(e){let t=[],n=0,r=e,o=[],a=0,s=!1,u=!1,d=0;function f(){if(t.length>Cs){const S=t.splice(0,t.length-Cs);for(const k of S)n-=k.length}for(;t.length>1&&n+a>Kb;){const S=t.shift();S&&(n-=S.length)}}function h(S){t.push(S),n+=S.length,f()}function g(){o=[],a=0}function y(S,k){if(s){r=S,s=!1;return}if(S===r)return;const v=Date.now(),A=(k==null?void 0:k.coalesce)===!0;if(A&&u&&v-d<Ob){r=S,d=v,o.length>0&&g();return}h(r),r=S,g(),d=v,u=A}function b(){if(t.length===0)return null;u=!1,o.push(r),a+=r.length;const S=t.pop();return n-=S.length,r=S,f(),r}function w(){if(o.length===0)return null;u=!1,h(r);const S=o.pop();return a-=S.length,r=S,r}function x(S){if(s){r=S,s=!1;return}S!==r&&(h(r),r=S,g(),u=!1)}return{record:y,undo:b,redo:w,canUndo:()=>t.length>0,canRedo:()=>o.length>0,syncExternal:x,markApplying:()=>{s=!0},finishApplying:()=>{s=!1}}}function Xe(e){return e.map(t=>t)}function Ir(e){switch(e.type){case"pageEdit":return e.before.length;case"insertPage":return e.page.length;case"deletePage":return e.page.length;case"replaceAll":return e.beforePages.reduce((t,n)=>t+n.length,0)}}function NT(e){let t=[],n=0,r=Xe(e),o=[],a=0,s=!1,u=!1,d=null,f=0;function h(){if(t.length>Cs){const R=t.splice(0,t.length-Cs);for(const T of R)n-=Ir(T)}for(;t.length>1&&n+a>Kb;){const R=t.shift();R&&(n-=Ir(R))}}function g(R){t.push(R),n+=Ir(R),h()}function y(R){o.push(R),a+=Ir(R)}function b(){for(const R of o)a-=Ir(R);o=[],a=0}function w(){u=!1,d=null}function x(R,T,E){if(s){const F=Xe(r);F[R]=T,r=F,s=!1;return}if(r[R]===T)return;const N=Date.now(),K=(E==null?void 0:E.coalesce)===!0,$=K&&u&&d===R&&N-f<Ob,P=Xe(r);if(P[R]=T,$){r=P,f=N;return}g({type:"pageEdit",pageIndex:R,before:r[R]??""}),r=P,b(),f=N,u=K,d=R}function S(R,T){if(s){r=Xe(T),s=!1;return}Nr(r,T)||(g({type:"insertPage",index:R,page:T[R]??""}),r=Xe(T),b(),w())}function k(R,T,E){if(s){r=Xe(E),s=!1;return}Nr(r,E)||(g({type:"deletePage",index:R,page:T}),r=Xe(E),b(),w())}function v(R){if(s){r=Xe(R),s=!1;return}Nr(r,R)||(g({type:"replaceAll",beforePages:Xe(r)}),r=Xe(R),b(),w())}function A(R){if(s){r=Xe(R),s=!1;return}Nr(r,R)||(r=Xe(R))}function j(){if(t.length===0)return null;w();const R=t.pop();switch(n-=Ir(R),R.type){case"pageEdit":{const T=r[R.pageIndex]??"";y({type:"pageEdit",pageIndex:R.pageIndex,before:T}),r[R.pageIndex]=R.before;break}case"insertPage":{const T=r[R.index]??"";y({type:"insertPage",index:R.index,page:T}),r.splice(R.index,1);break}case"deletePage":{y({type:"deletePage",index:R.index,page:R.page}),r.splice(R.index,0,R.page);break}case"replaceAll":{y({type:"replaceAll",beforePages:Xe(r)}),r=Xe(R.beforePages);break}}return h(),Xe(r)}function D(){if(o.length===0)return null;w();const R=o.pop();switch(a-=Ir(R),R.type){case"pageEdit":{const T=r[R.pageIndex]??"";g({type:"pageEdit",pageIndex:R.pageIndex,before:T}),r[R.pageIndex]=R.before;break}case"insertPage":{g({type:"insertPage",index:R.index,page:R.page}),r.splice(R.index,0,R.page);break}case"deletePage":{const T=r[R.index]??"";g({type:"deletePage",index:R.index,page:T}),r.splice(R.index,1);break}case"replaceAll":{g({type:"replaceAll",beforePages:Xe(r)}),r=Xe(R.beforePages);break}}return Xe(r)}return{getPresent:()=>r,recordPageEdit:x,recordInsertPage:S,recordDeletePage:k,recordReplaceAll:v,undo:j,redo:D,canUndo:()=>t.length>0,canRedo:()=>o.length>0,syncPages:R=>v(R),applyPresent:A,markApplying:()=>{s=!0}}}function qt(e){return typeof e=="object"&&e!==null&&"recordPageEdit"in e&&typeof e.recordPageEdit=="function"}function fr(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function vs(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):fr(e,t):""}const Cn="fullscreen",xu="commspliant-html-editor.toolbarCustomization";function wu(e){const t=e.filter(n=>n!==Cn);return e.includes(Cn)?[...t,Cn]:t}function hd(e,t){if(!t||t.length===0)return wu(e);const n=new Set(e),r=t.filter(s=>n.has(s)),o=new Set(r),a=[...r];for(let s=0;s<e.length;s++){const u=e[s];if(o.has(u))continue;let d=0;for(let f=s-1;f>=0;f--){const h=e[f],g=a.indexOf(h);if(g>=0){d=g+1;break}}a.splice(d,0,u),o.add(u)}return wu(a)}function LT(e,t){const n=new Map(e.map(s=>[s.id,s])),r=hd(e.map(s=>s.id),t==null?void 0:t.groupOrder),o=new Set((t==null?void 0:t.hiddenItemIds)??[]),a=[];for(const s of r){const u=n.get(s);if(!u)continue;const d=u.items.filter(f=>!o.has(f));d.length!==0&&a.push({id:s,items:d})}return a}function BT(e){if(e==null||typeof e!="object")return null;const t=e,n=Array.isArray(t.groupOrder)?t.groupOrder.filter(o=>typeof o=="string"):[],r=Array.isArray(t.hiddenItemIds)?[...new Set(t.hiddenItemIds.filter(o=>typeof o=="string"))]:[];return n.length===0&&r.length===0?null:{groupOrder:n,hiddenItemIds:r}}function FT(){try{const e=localStorage.getItem(xu);return e?BT(JSON.parse(e)):null}catch{return null}}function HT(e){try{if(!e){localStorage.removeItem(xu);return}localStorage.setItem(xu,JSON.stringify(e))}catch{}}function bd(e,t){return hd(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function zT(e,t,n,r){const o=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?o.delete(n):o.add(n),{groupOrder:bd(e,t),hiddenItemIds:[...o]}}function $b(e,t,n,r){const o=bd(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===Cn||r===Cn)return{groupOrder:o,hiddenItemIds:a};const s=o.indexOf(n),u=o.indexOf(r);if(s<0||u<0||s===u)return{groupOrder:o,hiddenItemIds:a};const d=[...o],[f]=d.splice(s,1);return d.splice(u,0,f),{groupOrder:wu(d),hiddenItemIds:a}}function fp(e,t,n,r){const o=bd(e,t),a=o.filter(d=>d!==Cn),s=a.indexOf(n),u=s+r;return s<0||u<0||u>=a.length?{groupOrder:o,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:$b(e,t,n,a[u])}const OT="_backdrop_11w4e_1",KT="_dialog_11w4e_12",$T="_header_11w4e_31",UT="_body_11w4e_39",VT="_group_11w4e_49",WT="_groupDragging_11w4e_55",GT="_groupDropTarget_11w4e_59",qT="_groupHeader_11w4e_64",ZT="_groupTitle_11w4e_72",YT="_dragHandle_11w4e_77",XT="_moveButton_11w4e_78",JT="_items_11w4e_119",QT="_item_11w4e_119",eR="_itemIcon_11w4e_135",tR="_itemTitle_11w4e_144",nR="_itemCheckbox_11w4e_151",rR="_actions_11w4e_155",oR="_action_11w4e_155",iR="_spinnerWrap_11w4e_191",aR="_spinner_11w4e_191",He={backdrop:OT,dialog:KT,header:$T,body:UT,group:VT,groupDragging:WT,groupDropTarget:GT,groupHeader:qT,groupTitle:ZT,dragHandle:YT,moveButton:XT,items:JT,item:QT,itemIcon:eR,itemTitle:tR,itemCheckbox:nR,actions:rR,action:oR,spinnerWrap:iR,spinner:aR};function sR(){return i.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"currentColor",children:[i.jsx("circle",{cx:"5",cy:"4",r:"1.2"}),i.jsx("circle",{cx:"11",cy:"4",r:"1.2"}),i.jsx("circle",{cx:"5",cy:"8",r:"1.2"}),i.jsx("circle",{cx:"11",cy:"8",r:"1.2"}),i.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),i.jsx("circle",{cx:"11",cy:"12",r:"1.2"})]})}function lR({open:e,catalog:t,groups:n,settings:r,loading:o=!1,busy:a=!1,disabled:s,isItemAllowed:u,onChange:d,onReset:f,onClose:h}){const g=J(),y=l.useId(),b=l.useRef(null),[w,x]=l.useState(null),[S,k]=l.useState(null),v=hd(n.map(P=>P.id),r==null?void 0:r.groupOrder),A=new Set((r==null?void 0:r.hiddenItemIds)??[]),j=new Map(n.map(P=>[P.id,P])),D=v.map(P=>j.get(P)).filter(P=>!!P),R=s||a||o;if(l.useEffect(()=>{e||(x(null),k(null))},[e]),$e(b,{open:e,onClose:h,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const T=D.map(P=>P.id).filter(P=>P!==Cn),E=(P,F)=>{if(R||F===Cn){P.preventDefault();return}P.dataTransfer.setData("text/plain",F),P.dataTransfer.effectAllowed="move",x(F)},N=(P,F)=>{R||F===Cn||!w||w===F||(P.preventDefault(),P.dataTransfer&&(P.dataTransfer.dropEffect="move"),k(F))},K=(P,F)=>{var G;P.preventDefault();const U=((G=P.dataTransfer)==null?void 0:G.getData("text/plain"))||w;x(null),k(null),!(!U||U===F||R)&&d($b(r,n,U,F))},$=()=>{x(null),k(null)};return i.jsx(Pe,{children:i.jsx("div",{className:He.backdrop,role:"presentation",onMouseDown:h,children:i.jsxs("div",{ref:b,className:He.dialog,role:"dialog","aria-modal":"true","aria-labelledby":y,"aria-busy":o||a?!0:void 0,onMouseDown:P=>P.stopPropagation(),children:[i.jsx("h2",{className:He.header,id:y,children:g("customizeToolbarDialogTitle")}),i.jsx("div",{className:He.body,children:o?i.jsx("div",{className:He.spinnerWrap,role:"status","aria-live":"polite","aria-label":g("customizeToolbarDialogLoading"),children:i.jsx("span",{className:He.spinner,"aria-hidden":"true"})}):D.map(P=>{const F=t.groups[P.id],U=F?fr(g,F):P.id,G=P.id===Cn,me=T.indexOf(P.id);return i.jsxs("section",{className:[He.group,w===P.id?He.groupDragging:"",S===P.id?He.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":P.id,"aria-label":U,onDragOver:se=>N(se,P.id),onDrop:se=>K(se,P.id),onDragLeave:()=>{S===P.id&&k(null)},children:[i.jsxs("div",{className:He.groupHeader,children:[i.jsx("button",{type:"button",className:He.dragHandle,draggable:!R&&!G,disabled:R||G,"aria-label":g("customizeToolbarDragHandle"),onDragStart:se=>E(se,P.id),onDragEnd:$,children:i.jsx(sR,{})}),i.jsx("span",{className:He.groupTitle,children:U}),i.jsx("button",{type:"button",className:He.moveButton,disabled:R||G||me<=0,"aria-label":g("customizeToolbarMoveUp"),onClick:()=>d(fp(r,n,P.id,-1)),children:"↑"}),i.jsx("button",{type:"button",className:He.moveButton,disabled:R||G||me<0||me>=T.length-1,"aria-label":g("customizeToolbarMoveDown"),onClick:()=>d(fp(r,n,P.id,1)),children:"↓"})]}),i.jsx("div",{className:He.items,children:P.items.map(se=>{if(u&&!u(se))return null;const V=t.items[se];if(!V)return null;const re=V.icon,de=fr(g,V),oe=`${y}-${P.id}-${se}`,_=!A.has(se);return i.jsxs("label",{className:He.item,htmlFor:oe,children:[i.jsx("span",{className:He.itemIcon,"aria-hidden":"true",children:re?i.jsx(re,{}):de.slice(0,2)}),i.jsx("span",{className:He.itemTitle,children:de}),i.jsx("input",{id:oe,className:He.itemCheckbox,type:"checkbox",checked:_,disabled:R,"aria-label":`${de}: ${g("customizeToolbarItemVisible")}`,onChange:Q=>d(zT(r,n,se,Q.target.checked))})]},se)})})]},P.id)})}),i.jsxs("div",{className:He.actions,children:[i.jsx("button",{type:"button",className:He.action,disabled:R,onClick:f,children:g("customizeToolbarDialogReset")}),i.jsx("button",{type:"button",className:He.action,"aria-label":g("customizeToolbarDialogCloseAria"),onClick:h,children:g("customizeToolbarDialogClose")})]})]})})})}function cR(e,t){if(!t)return e;const n=t.menus,r=t.toolbar;if(n===void 0&&r===void 0)return e;const o=n===void 0?e.menus:e.menus.filter(s=>n.includes(s.id)),a=r===void 0?e.iconGroups:e.iconGroups.map(s=>({id:s.id,items:s.items.filter(u=>r.includes(u))})).filter(s=>s.items.length>0);return{menus:o,iconGroups:a}}const uR={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:Kx,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:Ix,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:Bx,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},Ub=4;function dR({anchorRect:e,floatingWidth:t,floatingHeight:n,pad:r=Ub,minWidth:o=0,matchAnchorWidth:a=!1}){const s=a?Math.max(e.width,t,o):t;let u=e.bottom;u+n>window.innerHeight-r&&(u=Math.max(r,e.top-n));const d=Math.min(Math.max(e.left,r),window.innerWidth-s-r);return a?{top:u,left:d,width:s}:{top:u,left:d}}function Eo(e,t,n,{pad:r=Ub,minWidth:o=0,matchAnchorWidth:a=!1,deps:s=[]}={}){const[u,d]=l.useState({top:0,left:0}),f=l.useCallback(()=>{const h=t.current,g=n.current;if(!h)return;const y=h.getBoundingClientRect(),b=Math.max(a?y.width:0,(g==null?void 0:g.offsetWidth)??0,o),w=(g==null?void 0:g.offsetHeight)??0;d(dR({anchorRect:y,floatingWidth:b,floatingHeight:w,pad:r,minWidth:o,matchAnchorWidth:a}))},[t,n,a,o,r]);return l.useLayoutEffect(()=>{if(!e)return;f();const h=()=>f();return window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[e,f,...s]),u}const mR="_toolbar_a9bu4_1",fR="_menuBar_a9bu4_35",pR="_menuBarDesktop_a9bu4_43",gR="_brandMark_a9bu4_49",hR="_brandMarkIcon_a9bu4_56",bR="_menuBarCompact_a9bu4_68",yR="_menuWrap_a9bu4_91",xR="_menuButton_a9bu4_97",wR="_iconButton_a9bu4_98",CR="_menuItem_a9bu4_99",vR="_hamburgerButton_a9bu4_144",kR="_iconNav_a9bu4_151",SR="_iconNavMain_a9bu4_162",PR="_iconNavEnd_a9bu4_171",AR="_iconGroup_a9bu4_187",TR="_tooltipTrigger_a9bu4_281",RR="_menu_a9bu4_35",DR="_submenuWrap_a9bu4_311",jR="_submenu_a9bu4_311",IR="_submenuTrigger_a9bu4_321",ER="_menuOverlay_a9bu4_336",_R="_menuOverlayHeader_a9bu4_348",MR="_menuOverlayTitle_a9bu4_358",NR="_menuOverlayBody_a9bu4_364",LR="_menuSeparator_a9bu4_415",BR="_icon_a9bu4_98",FR="_tooltip_a9bu4_281",HR="_tooltipElevated_a9bu4_510",ue={toolbar:mR,menuBar:fR,menuBarDesktop:pR,brandMark:gR,brandMarkIcon:hR,menuBarCompact:bR,menuWrap:yR,menuButton:xR,iconButton:wR,menuItem:CR,hamburgerButton:vR,iconNav:kR,iconNavMain:SR,iconNavEnd:PR,iconGroup:AR,tooltipTrigger:TR,menu:RR,submenuWrap:DR,submenu:jR,submenuTrigger:IR,menuOverlay:ER,menuOverlayHeader:_R,menuOverlayTitle:MR,menuOverlayBody:NR,menuSeparator:LR,icon:BR,tooltip:FR,tooltipElevated:HR},zR=400,pp=6,Dc=4;function pr({label:e,children:t,className:n,elevated:r}){const o=l.useRef(null),a=l.useRef(null),s=l.useRef(null),u=l.useRef(!1),d=l.useRef(!1),[f,h]=l.useState(!1),[g,y]=l.useState({top:0,left:0}),b=l.useCallback(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),w=l.useCallback(k=>{if(!(u.current||d.current)){b(),h(!1);return}if(k||d.current){b(),h(!0);return}b(),s.current=setTimeout(()=>{s.current=null,h(!0)},zR)},[b]),x=l.useCallback(()=>{const k=o.current,v=a.current;if(!k||!v)return;const A=k.getBoundingClientRect(),j=v.offsetWidth,D=v.offsetHeight;let R=A.bottom+pp;R+D>window.innerHeight-Dc&&(R=A.top-pp-D);let T=A.left+A.width/2-j/2;T=Math.min(Math.max(T,Dc),window.innerWidth-j-Dc),y({top:R,left:T})},[]);l.useEffect(()=>()=>b(),[b]),l.useEffect(()=>{const k=o.current;if(!k)return;const v=()=>{d.current=!0,w(!0)},A=()=>{d.current=!1,w(!1)};return k.addEventListener("focusin",v),k.addEventListener("focusout",A),()=>{k.removeEventListener("focusin",v),k.removeEventListener("focusout",A)}},[w]),l.useLayoutEffect(()=>{if(!f)return;x();const k=()=>x();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[f,e,x]);const S=n?`${ue.tooltipTrigger} ${n}`:ue.tooltipTrigger;return i.jsxs(i.Fragment,{children:[i.jsx("span",{ref:o,className:S,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,w(!1)},onMouseLeave:()=>{u.current=!1,w(!1)},children:t}),f?i.jsx(Pe,{children:i.jsx("span",{ref:a,className:r?`${ue.tooltip} ${ue.tooltipElevated}`:ue.tooltip,"data-toolbar-tooltip":"",style:{top:g.top,left:g.left},"aria-hidden":"true",children:e})}):null]})}const gp=8,hp=["#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"],OR=8;let Cu=[];const vu=new Set;function bp(){return Cu}function KR(e){const t=Ke(e);t&&(Cu=[t,...Cu.filter(n=>n!==t)].slice(0,OR),vu.forEach(n=>n()))}function $R(e){return vu.add(e),()=>{vu.delete(e)}}function qa(e){const t=Ke(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 Er(e,t,n){const r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function jc({r:e,g:t,b:n}){const r=e/255,o=t/255,a=n/255,s=Math.max(r,o,a),u=Math.min(r,o,a),d=s-u;let f=0;return d!==0&&(s===r?f=(o-a)/d%6:s===o?f=(a-r)/d+2:f=(r-o)/d+4,f*=60,f<0&&(f+=360)),{h:f,s:s===0?0:d/s,v:s}}function Ic({h:e,s:t,v:n}){const r=(e%360+360)%360,o=n*t,a=o*(1-Math.abs(r/60%2-1)),s=n-o;let u=0,d=0,f=0;return r<60?(u=o,d=a):r<120?(u=a,d=o):r<180?(d=o,f=a):r<240?(d=a,f=o):r<300?(u=a,f=o):(u=o,f=a),{r:Math.round((u+s)*255),g:Math.round((d+s)*255),b:Math.round((f+s)*255)}}function Vb(){return typeof window<"u"&&"EyeDropper"in window}async function UR(){if(!Vb())return null;const e=window.EyeDropper;try{const t=await new e().open();return Ke(t.sRGBHex)}catch{return null}}const VR="_picker_ag1yo_1",WR="_none_ag1yo_12",GR="_customToggle_ag1yo_13",qR="_eyedrop_ag1yo_14",ZR="_swatch_ag1yo_48",YR="_field_ag1yo_49",XR="_grid_ag1yo_54",JR="_recents_ag1yo_55",QR="_sectionLabel_ag1yo_84",eD="_custom_ag1yo_13",tD="_sv_ag1yo_95",nD="_svThumb_ag1yo_105",rD="_hue_ag1yo_116",oD="_rgbRow_ag1yo_155",iD="_hexRow_ag1yo_156",ot={picker:VR,none:WR,customToggle:GR,eyedrop:qR,swatch:ZR,field:YR,grid:XR,recents:JR,sectionLabel:QR,custom:eD,sv:tD,svThumb:nD,hue:rD,rgbRow:oD,hexRow:iD};function aD(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 yd({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:o,menu:a=!1,fallbackCustom:s="#000000",onChange:u,onCommit:d}){const f=J(),h=l.useId(),g=a?"menuitemradio":"option",y=t?null:e,b=qa(y??s)??{r:0,g:0,b:0},[w,x]=l.useState(!1),[S,k]=l.useState(()=>jc(b)),[v,A]=l.useState(()=>({r:String(b.r),g:String(b.g),b:String(b.b)})),[j,D]=l.useState(()=>Er(b.r,b.g,b.b)),[R,T]=l.useState(()=>[...bp()]),E=l.useRef(null),N=l.useRef(Er(b.r,b.g,b.b));l.useEffect(()=>$R(()=>T([...bp()])),[]),l.useEffect(()=>{const _=qa(y??s);if(!_)return;const Q=jc(_);k(Q),A({r:String(_.r),g:String(_.g),b:String(_.b)}),D(Er(_.r,_.g,_.b))},[y,s]);const K=(_,Q,xe)=>{_&&(N.current=_),xe&&_&&KR(_),u(_),Q&&(d==null||d(_))},$=(_,Q,xe)=>{const ee=Er(_.r,_.g,_.b);k(jc(_)),A({r:String(_.r),g:String(_.g),b:String(_.b)}),D(ee),K(ee,Q,xe)},P=(_,Q,xe)=>{const ee=Ic(_),Z=Er(ee.r,ee.g,ee.b);k(_),A({r:String(ee.r),g:String(ee.g),b:String(ee.b)}),D(Z),K(Z,Q,xe)},F=_=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(_.key))return;const xe=[..._.currentTarget.querySelectorAll("button")],ee=xe.findIndex(et=>et===document.activeElement);if(ee<0)return;_.preventDefault();const Z=_.key==="ArrowLeft"?-1:_.key==="ArrowRight"?1:_.key==="ArrowUp"?-gp:gp,Ee=xe[Math.max(0,Math.min(xe.length-1,ee+Z))];Ee==null||Ee.focus()},U=(_,Q)=>{const xe=E.current;if(!xe||o)return;const ee=xe.getBoundingClientRect(),Z=Math.max(0,Math.min(1,(_.clientX-ee.left)/ee.width)),Ee=Math.max(0,Math.min(1,1-(_.clientY-ee.top)/ee.height));P({h:S.h,s:Z,v:Ee},Q,Q)},G=_=>{o||(_.currentTarget.setPointerCapture(_.pointerId),U(_,!1))},me=Ic({h:S.h,s:1,v:1}),se=Er(me.r,me.g,me.b),V=Ic(S),re=Er(V.r,V.g,V.b),de=new Set(hp),oe=R.filter(_=>!de.has(_));return i.jsxs("div",{className:ot.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[i.jsx("button",{type:"button",className:ot.none,role:g,"aria-checked":a?y===null&&!t:void 0,"aria-selected":a?void 0:y===null&&!t,disabled:o,onClick:()=>K(null,!0,!1),children:n}),i.jsx("div",{className:ot.grid,role:a?"group":"none",onKeyDown:F,children:hp.map(_=>{const Q=y===_;return i.jsx("button",{type:"button",className:ot.swatch,role:g,"aria-label":_,"aria-checked":a?Q:void 0,"aria-selected":a?void 0:Q,disabled:o,style:{backgroundColor:_},onMouseDown:xe=>xe.preventDefault(),onClick:()=>K(_,!0,!1)},_)})}),oe.length>0?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:ot.sectionLabel,children:f("colorRecent")}),i.jsx("div",{className:ot.recents,role:a?"group":"none","aria-label":f("colorRecent"),children:oe.map(_=>i.jsx("button",{type:"button",className:ot.swatch,role:g,"aria-label":_,"aria-checked":a?y===_:void 0,"aria-selected":a?void 0:y===_,disabled:o,style:{backgroundColor:_},onMouseDown:Q=>Q.preventDefault(),onClick:()=>K(_,!0,!1)},_))})]}):null,i.jsx("button",{type:"button",className:ot.customToggle,disabled:o,"aria-expanded":w,onClick:()=>x(_=>!_),children:f("colorCustom")}),w?i.jsxs("div",{className:ot.custom,children:[i.jsx("div",{ref:E,className:ot.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${se})`},onPointerDown:G,onPointerMove:_=>{_.currentTarget.hasPointerCapture(_.pointerId)&&U(_,!1)},onPointerUp:_=>{U(_,!0)},children:i.jsx("span",{className:ot.svThumb,style:{left:`${S.s*100}%`,top:`${(1-S.v)*100}%`}})}),i.jsx("input",{className:ot.hue,type:"range",min:0,max:360,value:Math.round(S.h),disabled:o,"aria-label":f("colorCustom"),onChange:_=>P({...S,h:Number(_.target.value)},!1,!1),onPointerUp:()=>K(N.current,!0,!0)}),i.jsx("div",{className:ot.rgbRow,children:["r","g","b"].map(_=>i.jsxs("div",{className:ot.field,children:[i.jsx("label",{htmlFor:`${h}-${_}`,children:f(_==="r"?"colorRgbR":_==="g"?"colorRgbG":"colorRgbB")}),i.jsx("input",{id:`${h}-${_}`,inputMode:"numeric",value:v[_],disabled:o,onChange:Q=>{A(xe=>({...xe,[_]:Q.target.value}))},onBlur:()=>{const Q=aD(v[_]);if(Q===null){A({r:String(V.r),g:String(V.g),b:String(V.b)});return}$({...V,[_]:Q},!0,!0)},onKeyDown:Q=>{Q.key==="Enter"&&Q.currentTarget.blur()}})]},_))}),i.jsx("div",{className:ot.hexRow,children:i.jsxs("div",{className:ot.field,children:[i.jsx("label",{htmlFor:`${h}-hex`,children:f("colorHex")}),i.jsx("input",{id:`${h}-hex`,value:j,disabled:o,onChange:_=>D(_.target.value),onBlur:()=>{const _=Ke(j);if(!_){D(re);return}const Q=qa(_);Q&&$(Q,!0,!0)},onKeyDown:_=>{_.key==="Enter"&&_.currentTarget.blur()}})]})}),Vb()?i.jsx("button",{type:"button",className:ot.eyedrop,disabled:o,onClick:()=>{UR().then(_=>{if(!_)return;const Q=qa(_);Q&&$(Q,!0,!0)})},children:f("colorPickFromScreen")}):null]}):null]})}const sD="_wrap_hfz5s_1",lD="_button_hfz5s_8",cD="_icon_hfz5s_18",uD="_bar_hfz5s_24",dD="_barEmpty_hfz5s_33",mD="_popover_hfz5s_43",_r={wrap:sD,button:lD,icon:cD,bar:uD,barEmpty:dD,popover:mD};function Wb({icon:e,value:t,mixed:n,noneKey:r,labelKey:o,ariaKey:a,fallbackCustom:s,disabled:u,onChange:d}){const f=J(),h=l.useId(),g=l.useRef(null),y=l.useRef(null),b=l.useRef(null),[w,x]=l.useState(!1),S=Eo(w,y,b);l.useEffect(()=>{if(!w)return;const D=T=>{var N,K;const E=T.target;(N=g.current)!=null&&N.contains(E)||(K=b.current)!=null&&K.contains(E)||x(!1)},R=T=>{var E;T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),x(!1),(E=y.current)==null||E.focus())};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",R,!0)}},[w]);const k=D=>{d(D)},v=`${_r.bar}${!t||n?` ${_r.barEmpty}`:""}`,A=t&&!n?{backgroundColor:t}:void 0,j=i.jsxs("div",{className:_r.wrap,ref:g,children:[i.jsxs("button",{ref:y,type:"button",className:`${ue.iconButton} ${_r.button}`,"aria-label":f(a),"aria-expanded":w,"aria-haspopup":"listbox","aria-controls":w?h:void 0,disabled:u,onMouseDown:D=>D.preventDefault(),onClick:()=>x(D=>!D),children:[i.jsx(e,{className:`${ue.icon} ${_r.icon}`}),i.jsx("span",{className:v,style:A})]}),w?i.jsx(Pe,{children:i.jsx("div",{ref:b,id:h,className:_r.popover,style:{top:S.top,left:S.left},children:i.jsx(yd,{value:t,mixed:n,noneLabel:f(r),ariaLabel:f(a),disabled:u,fallbackCustom:s,onChange:k,onCommit:()=>x(!1)})})}):null]});return i.jsx(pr,{label:f(o),children:j})}function fD({commands:e,queries:t,disabled:n}){return i.jsx(Wb,{icon:Np,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}const pD="_wrap_1vjt0_1",gD="_wrapToolbar_1vjt0_7",hD="_field_1vjt0_12",bD="_trigger_1vjt0_20",yD="_chevron_1vjt0_50",xD="_list_1vjt0_73",wD="_listInline_1vjt0_88",CD="_option_1vjt0_96",vD="_separator_1vjt0_125",ln={wrap:pD,wrapToolbar:gD,field:hD,trigger:bD,chevron:yD,list:xD,listInline:wD,option:CD,separator:vD};function kD({value:e,mixed:t=!1,fonts:n,disabled:r,listId:o,listRef:a,inline:s,style:u,onSelect:d}){const f=J(),h=!t&&e===null;return i.jsxs("ul",{ref:a,id:o,className:s?`${ln.list} ${ln.listInline}`:ln.list,role:"listbox","aria-label":f("commandFontFamilyAria"),style:u,children:[i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:ln.option,role:"option","aria-checked":h,disabled:r,onMouseDown:g=>g.preventDefault(),onClick:()=>d(null),children:f("fontFamilyDefault")})}),i.jsx("li",{className:ln.separator,role:"separator"}),n.map(g=>{const y=!t&&ji(e,g.family);return i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:ln.option,role:"option","aria-checked":y,disabled:r,style:{fontFamily:g.family},onMouseDown:b=>b.preventDefault(),onClick:()=>d(g.family),children:g.name})},g.family)})]})}function SD(e,t,n,r){var o;return t?"":e===null?r:((o=vw(e,n))==null?void 0:o.name)??e}function Gb({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:o,toolbar:a=!1,triggerId:s,onChange:u}){const d=J(),f=l.useId(),h=l.useRef(null),g=l.useRef(null),y=l.useRef(null),[b,w]=l.useState(!1),x=SD(e,t,n,d("fontFamilyDefault")),S=Eo(b,g,y,{matchAnchorWidth:!0,deps:[n.length]});l.useEffect(()=>{if(!b)return;const v=j=>{var R,T;const D=j.target;(R=h.current)!=null&&R.contains(D)||(T=y.current)!=null&&T.contains(D)||w(!1)},A=j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),w(!1))};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",A,!0)}},[b]);const k=i.jsxs("div",{className:`${ln.wrap}${a?` ${ln.wrapToolbar}`:""}`,ref:h,children:[i.jsxs("div",{className:ln.field,ref:g,children:[i.jsx("button",{type:"button",id:s,className:ln.trigger,disabled:r,"aria-label":a?d("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":b,"aria-controls":b?f:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:v=>v.preventDefault(),onClick:()=>w(v=>!v),children:x}),i.jsx("span",{className:ln.chevron,"aria-hidden":"true"})]}),b?i.jsx(Pe,{children:i.jsx(kD,{listRef:y,listId:f,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:S.top,left:S.left,minWidth:S.width},onSelect:v=>{u(v),w(!1)}})}):null]});return o?i.jsx(pr,{label:o,children:k}):k}function PD({commands:e,queries:t,disabled:n}){const r=J(),o=pd(),a=!!(n||!t.isVisualMode()),s=(()=>{const u=t.getFontFaces(),d=o==null?void 0:o.allowedFontFamilies;if(!d)return u;const f=new Set(d.map(h=>h.toLowerCase()));return u.filter(h=>f.has(h.family.toLowerCase())||d.some(g=>h.family.toLowerCase().includes(g.toLowerCase())))})();return i.jsx(Gb,{family:t.isFontFamilyMixed()?null:t.getFontFamily(),mixed:t.isFontFamilyMixed(),fonts:s,disabled:a,tooltip:r("commandFontFamily"),toolbar:!0,onChange:u=>{e.setFontFamily(u)}})}const AD="_wrap_58i0x_1",TD="_wrapToolbar_58i0x_9",RD="_field_58i0x_14",DD="_input_58i0x_22",jD="_toggle_58i0x_41",ID="_chevron_58i0x_42",ED="_unit_58i0x_80",_D="_list_58i0x_110",MD="_option_58i0x_125",Ve={wrap:AD,wrapToolbar:TD,field:RD,input:DD,toggle:jD,chevron:ID,unit:ED,list:_D,option:MD},ND={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function qb({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:o,tooltip:a,sizeInputId:s,toolbar:u=!1}){const d=J(),f=l.useId(),h=l.useRef(null),g=l.useRef(null),y=l.useRef(null),[b,w]=l.useState(()=>e===null?"":be(e)),[x,S]=l.useState(!1),[k,v]=l.useState(!1),A=Eo(k,g,y,{matchAnchorWidth:!0,minWidth:72});l.useEffect(()=>{x||w(e===null?"":be(e))},[e,x]),l.useEffect(()=>{if(!k)return;const E=K=>{var P,F;const $=K.target;(P=h.current)!=null&&P.contains($)||(F=y.current)!=null&&F.contains($)||v(!1)},N=K=>{K.key==="Escape"&&(K.preventDefault(),K.stopPropagation(),v(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",N,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",N,!0)}},[k]);const j=E=>{const N=$w(E,t);if(!N){w(e===null?"":be(e));return}n(N.value,N.unit),w(be(N.value))},D=Hw[t],R=k?i.jsx(Pe,{children:i.jsx("ul",{ref:y,className:Ve.list,role:"listbox",id:f,style:{top:A.top,left:A.left,minWidth:A.width},children:D.map(E=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ve.option,role:"option","aria-selected":e===E,onMouseDown:N=>N.preventDefault(),onClick:()=>{n(E,t),w(be(E)),v(!1)},children:be(E)})},E))})}):null,T=i.jsxs("div",{className:`${Ve.wrap}${u?` ${Ve.wrapToolbar}`:""}`,ref:h,children:[i.jsxs("div",{className:Ve.field,ref:g,children:[i.jsx("input",{id:s,className:Ve.input,value:b,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":k,"aria-controls":f,role:"combobox",inputMode:"decimal",onFocus:()=>S(!0),onBlur:()=>{S(!1),j(b)},onChange:E=>w(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),j(b),v(!1),E.currentTarget.blur()),E.key==="ArrowDown"&&(E.preventDefault(),v(!0))}}),i.jsx("button",{type:"button",className:Ve.toggle,tabIndex:-1,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-expanded":k,"aria-controls":f,onMouseDown:E=>E.preventDefault(),onClick:()=>v(E=>!E)})]}),i.jsxs("div",{className:Ve.field,children:[i.jsx("select",{className:Ve.unit,value:t,disabled:o,"aria-label":d("commandFontSizeUnitAria"),onChange:E=>{r(E.target.value)},children:Eu.map(E=>i.jsx("option",{value:E,children:d(ND[E])},E))}),i.jsx("span",{className:Ve.chevron,"aria-hidden":"true"})]}),R]});return a?i.jsx(pr,{label:a,children:T}):T}function LD({commands:e,queries:t,disabled:n}){const r=J(),o=!!(n||!t.isVisualMode());return i.jsx(qb,{size:t.getFontSize(),unit:t.getFontSizeUnit(),disabled:o,tooltip:r("commandFontSize"),toolbar:!0,onSizeChange:(a,s)=>{e.setFontSize(a,s)},onUnitChange:a=>{e.setFontSizeUnit(a)}})}function BD({commands:e,queries:t,disabled:n}){return i.jsx(Wb,{icon:Lp,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function FD({commands:e,queries:t,disabled:n,onMenuClose:r}){const o=J(),a=!!(n||!t.isVisualMode());return i.jsx(yd,{value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneLabel:o("colorNone"),ariaLabel:o("commandHighlightColorAria"),disabled:a,menu:!0,fallbackCustom:"#ffff00",onChange:s=>e.setHighlightColor(s),onCommit:()=>r==null?void 0:r()})}const HD="_wrap_1gtdc_1",zD="_wrapToolbar_1gtdc_7",OD="_field_1gtdc_12",KD="_trigger_1gtdc_20",$D="_chevron_1gtdc_46",UD="_list_1gtdc_69",VD="_option_1gtdc_84",WD="_separator_1gtdc_113",Hn={wrap:HD,wrapToolbar:zD,field:OD,trigger:KD,chevron:$D,list:UD,option:VD,separator:WD},GD="_backdrop_1p9zk_1",qD="_dialog_1p9zk_12",ZD="_dialogWide_1p9zk_31",YD="_header_1p9zk_35",XD="_tabs_1p9zk_43",JD="_tab_1p9zk_43",QD="_body_1p9zk_76",ej="_field_1p9zk_86",tj="_label_1p9zk_92",nj="_sizeRow_1p9zk_96",rj="_fileRow_1p9zk_102",oj="_fileName_1p9zk_108",ij="_previewImage_1p9zk_115",aj="_marks_1p9zk_125",sj="_mark_1p9zk_125",lj="_actions_1p9zk_140",cj="_actionsSpread_1p9zk_148",uj="_actionsEnd_1p9zk_152",dj="_headerRow_1p9zk_157",mj="_close_1p9zk_170",fj="_nameSection_1p9zk_187",pj="_nameInput_1p9zk_192",gj="_labelRow_1p9zk_209",hj="_help_1p9zk_215",bj="_textInput_1p9zk_233",yj="_fullSelect_1p9zk_245",xj="_error_1p9zk_249",wj="_emptyHint_1p9zk_254",Cj="_action_1p9zk_140",vj="_textarea_1p9zk_265",kj="_actionDanger_1p9zk_279",Sj="_confirmBody_1p9zk_285",Pj="_nestedPanel_1p9zk_294",Aj="_spinnerWrap_1p9zk_309",Tj="_spinner_1p9zk_309",Rj="_actionPrimary_1p9zk_344",Dj="_iconButton_1p9zk_358",jj="_select_1p9zk_359",Ij="_lengthInput_1p9zk_360",Ej="_lengthUnit_1p9zk_361",_j="_group_1p9zk_369",Mj="_nestedGroup_1p9zk_379",Nj="_subLabel_1p9zk_389",Lj="_iconRow_1p9zk_393",Bj="_lengthField_1p9zk_425",Fj="_sideLabel_1p9zk_431",Hj="_lengthRow_1p9zk_435",zj="_sideGrid_1p9zk_463",Oj="_shadowGrid_1p9zk_464",p={backdrop:GD,dialog:qD,dialogWide:ZD,header:YD,tabs:XD,tab:JD,body:QD,field:ej,label:tj,sizeRow:nj,fileRow:rj,fileName:oj,previewImage:ij,marks:aj,mark:sj,actions:lj,actionsSpread:cj,actionsEnd:uj,headerRow:dj,close:mj,nameSection:fj,nameInput:pj,labelRow:gj,help:hj,textInput:bj,fullSelect:yj,error:xj,emptyHint:wj,action:Cj,textarea:vj,actionDanger:kj,confirmBody:Sj,nestedPanel:Pj,spinnerWrap:Aj,spinner:Tj,actionPrimary:Rj,iconButton:Dj,select:jj,lengthInput:Ij,lengthUnit:Ej,group:_j,nestedGroup:Mj,subLabel:Nj,iconRow:Lj,lengthField:Bj,sideLabel:Fj,lengthRow:Hj,sideGrid:zj,shadowGrid:Oj},ku={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},Kj={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 yp(){const e=J();return i.jsx("div",{className:p.spinnerWrap,role:"status","aria-live":"polite","aria-label":e("customStyleLoading"),children:i.jsx("span",{className:p.spinner,"aria-hidden":"true"})})}function Zb({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:o,listRef:a,style:s,customStylesEnabled:u=!1,customStyles:d=[],customStylesLoading:f=!1,onSelect:h,onSelectCustom:g,onAddNew:y}){const b=J(),w=pd(),x=w?Hr.filter(A=>w.allowedParagraphTags.includes(A)):Hr,S=t?null:e,k=u&&x.length>0,v=!!(r&&u&&y);return r?i.jsxs(i.Fragment,{children:[x.map(A=>i.jsx("button",{type:"button",className:ue.menuItem,role:"menuitemradio","aria-checked":S===A,disabled:n,onMouseDown:j=>j.preventDefault(),onClick:()=>h(A),children:b(ku[A])},A)),k?i.jsx("div",{role:"separator",className:ue.menuSeparator}):null,k&&f?i.jsx(yp,{}):null,k&&!f?d.map(A=>i.jsx("button",{type:"button",className:ue.menuItem,role:"menuitem",disabled:n,onMouseDown:j=>j.preventDefault(),onClick:()=>g==null?void 0:g(A.id),children:A.name},A.id)):null,v?i.jsxs(i.Fragment,{children:[k&&(f||d.length>0)?i.jsx("div",{role:"separator",className:ue.menuSeparator}):null,i.jsxs("button",{type:"button",className:ue.menuItem,role:"menuitem","aria-label":b("styleAddNewAria"),disabled:n,onMouseDown:A=>A.preventDefault(),onClick:()=>y==null?void 0:y(),children:[i.jsx(Lx,{className:ue.icon}),b("styleAddNew")]})]}):null]}):i.jsxs("ul",{ref:a,className:Hn.list,role:"listbox",id:o,style:s,"aria-label":b("commandParagraphStyleAria"),"aria-busy":k&&f?!0:void 0,children:[Hr.map(A=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Hn.option,role:"option","aria-selected":S===A,disabled:n,style:Kj[A],onMouseDown:j=>j.preventDefault(),onClick:()=>h(A),children:b(ku[A])})},A)),k&&(f||d.length>0)?i.jsx("li",{role:"separator",className:Hn.separator}):null,k&&f?i.jsx("li",{role:"presentation",children:i.jsx(yp,{})}):null,k&&!f?d.map(A=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Hn.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:j=>j.preventDefault(),onClick:()=>g==null?void 0:g(A.id),children:A.name})},A.id)):null]})}function $j({commands:e,queries:t,disabled:n}){const r=J(),o=l.useId(),a=l.useRef(null),s=l.useRef(null),u=l.useRef(null),[d,f]=l.useState(!1),h=!!(n||!t.isVisualMode()),g=t.isParagraphStyleMixed(),y=g?null:t.getParagraphStyle(),b=y?r(ku[y]):"",w=t.customParagraphStylesEnabled(),x=w?t.getCustomParagraphStyles():[],S=w&&t.isCustomParagraphStylesLoading(),k=Eo(d,s,u,{matchAnchorWidth:!0,deps:[x.length,S]});l.useEffect(()=>{if(!d)return;const A=D=>{var T,E;const R=D.target;(T=a.current)!=null&&T.contains(R)||(E=u.current)!=null&&E.contains(R)||f(!1)},j=D=>{D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),f(!1))};return document.addEventListener("pointerdown",A),document.addEventListener("keydown",j,!0),()=>{document.removeEventListener("pointerdown",A),document.removeEventListener("keydown",j,!0)}},[d]);const v=i.jsxs("div",{className:`${Hn.wrap} ${Hn.wrapToolbar}`,ref:a,children:[i.jsxs("div",{className:Hn.field,ref:s,children:[i.jsx("button",{type:"button",className:Hn.trigger,disabled:h,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?o:void 0,onMouseDown:A=>A.preventDefault(),onClick:()=>f(A=>!A),children:b}),i.jsx("span",{className:Hn.chevron,"aria-hidden":"true"})]}),d?i.jsx(Pe,{children:i.jsx(Zb,{listRef:u,listId:o,value:y,mixed:g,disabled:h,customStylesEnabled:w,customStyles:x,customStylesLoading:S,style:{top:k.top,left:k.left,minWidth:k.width},onSelect:A=>{e.setParagraphStyle(A),f(!1)},onSelectCustom:A=>{e.applyCustomParagraphStyle(A),f(!1)}})}):null]});return i.jsx(pr,{label:r("commandParagraphStyle"),children:v})}function Uj({commands:e,queries:t,disabled:n,onMenuClose:r}){const o=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),s=a?null:t.getParagraphStyle(),u=t.customParagraphStylesEnabled(),d=u?t.getCustomParagraphStyles():[],f=u&&t.isCustomParagraphStylesLoading();return i.jsx(Zb,{menu:!0,value:s,mixed:a,disabled:o,customStylesEnabled:u,customStyles:d,customStylesLoading:f,onSelect:h=>{e.setParagraphStyle(h),r==null||r()},onSelectCustom:h=>{e.openCustomParagraphStyleDialog(h),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const Vj={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:Uj,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:FD,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:PD,icon:yx,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:$j,icon:Nx,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:LD,icon:wx,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:xx,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:gx,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:Hp,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:Bp,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:fD,icon:Np,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:BD,icon:Lp,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:cx,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:Ax,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:Ux,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:$x,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:mx,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:Cx,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:Ts,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:As,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:Rs,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:Ep,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:Px,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:Ex,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:_p,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:Fp,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},Wj={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},submenus:{insertPage:{id:"insertPage",labelKey:"menuInsertPage",ariaKey:"menuInsertPageAria",enabled:"hasSelectedPage"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:Rx,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:ux,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:Bp,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},pageBackgroundImage:{id:"pageBackgroundImage",command:"openPageBackgroundImage",icon:mi,labelKey:"commandPageBackgroundImage",ariaKey:"commandPageBackgroundImageAria",enabled:"canInsertPageBackgroundImage"},paragraphBackgroundImage:{id:"paragraphBackgroundImage",command:"openParagraphBackgroundImage",icon:Hp,labelKey:"commandParagraphBackgroundImage",ariaKey:"commandParagraphBackgroundImageAria",enabled:"canInsertParagraphBackgroundImage"},audio:{id:"audio",command:"openAudioDialog",icon:lx,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:qx,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:kx,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},pageBreak:{id:"pageBreak",command:"insertPageBreak",icon:_x,labelKey:"commandPageBreak",ariaKey:"commandPageBreakAria",enabled:"isVisualMode"},insertPageBefore:{id:"insertPageBefore",command:"insertPageBefore",icon:mi,labelKey:"commandInsertPageBefore",ariaKey:"commandInsertPageBeforeAria",enabled:"hasSelectedPage"},insertPageAfter:{id:"insertPageAfter",command:"insertPageAfter",icon:mi,labelKey:"commandInsertPageAfter",ariaKey:"commandInsertPageAfterAria",enabled:"hasSelectedPage"}}},Gj={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:lf,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:fc,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:fc,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:fc,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:mc,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:mc,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:mc,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:jx,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:Wx,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:lf,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:dx,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:zx,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},qj={menus:{help:{id:"help",labelKey:"menuHelp",ariaKey:"menuHelpAria"}},groups:{},items:{editorHelp:{id:"editorHelp",command:"openHelp",icon:dc,labelKey:"commandEditorHelp",ariaKey:"commandEditorHelpAria"},keyboardShortcuts:{id:"keyboardShortcuts",command:"openKeyboardShortcuts",icon:dc,labelKey:"commandKeyboardShortcuts",ariaKey:"commandKeyboardShortcutsAria"},about:{id:"about",command:"openAbout",icon:dc,labelKey:"commandAbout",ariaKey:"commandAboutAria"}}},Zj=["getStarted","file","edit","insert","format","table","view","keyboard"],Su=[{id:"getStarted",category:"getStarted",titleKey:"helpTopicGetStartedTitle",bodyKey:"helpTopicGetStartedBody",keywordsKey:"helpTopicGetStartedKeywords",related:["switchModes","searchHelp","keyboardShortcuts"]},{id:"switchModes",category:"getStarted",titleKey:"helpTopicSwitchModesTitle",bodyKey:"helpTopicSwitchModesBody",keywordsKey:"helpTopicSwitchModesKeywords",related:["getStarted","preview"]},{id:"searchHelp",category:"getStarted",titleKey:"helpTopicSearchHelpTitle",bodyKey:"helpTopicSearchHelpBody",keywordsKey:"helpTopicSearchHelpKeywords",related:["getStarted","keyboardShortcuts"]},{id:"saveDocument",category:"file",titleKey:"helpTopicSaveDocumentTitle",bodyKey:"helpTopicSaveDocumentBody",keywordsKey:"helpTopicSaveDocumentKeywords",related:["openDocument","printDocument"]},{id:"openDocument",category:"file",titleKey:"helpTopicOpenDocumentTitle",bodyKey:"helpTopicOpenDocumentBody",keywordsKey:"helpTopicOpenDocumentKeywords",related:["saveDocument","printDocument"]},{id:"printDocument",category:"file",titleKey:"helpTopicPrintDocumentTitle",bodyKey:"helpTopicPrintDocumentBody",keywordsKey:"helpTopicPrintDocumentKeywords",related:["saveDocument","preview"]},{id:"undoRedo",category:"edit",titleKey:"helpTopicUndoRedoTitle",bodyKey:"helpTopicUndoRedoBody",keywordsKey:"helpTopicUndoRedoKeywords",related:["keyboardShortcuts","clearFormatting"]},{id:"pageProperties",category:"edit",titleKey:"helpTopicPagePropertiesTitle",bodyKey:"helpTopicPagePropertiesBody",keywordsKey:"helpTopicPagePropertiesKeywords",related:["insertPage","deletePage"]},{id:"deletePage",category:"edit",titleKey:"helpTopicDeletePageTitle",bodyKey:"helpTopicDeletePageBody",keywordsKey:"helpTopicDeletePageKeywords",related:["insertPage","pageProperties"]},{id:"insertTable",category:"insert",titleKey:"helpTopicInsertTableTitle",bodyKey:"helpTopicInsertTableBody",keywordsKey:"helpTopicInsertTableKeywords",related:["tableRowsColumns","mergeCells"]},{id:"insertImage",category:"insert",titleKey:"helpTopicInsertImageTitle",bodyKey:"helpTopicInsertImageBody",keywordsKey:"helpTopicInsertImageKeywords",related:["insertLink","pageProperties"]},{id:"insertLink",category:"insert",titleKey:"helpTopicInsertLinkTitle",bodyKey:"helpTopicInsertLinkBody",keywordsKey:"helpTopicInsertLinkKeywords",related:["insertBookmark","insertImage"]},{id:"insertBookmark",category:"insert",titleKey:"helpTopicInsertBookmarkTitle",bodyKey:"helpTopicInsertBookmarkBody",keywordsKey:"helpTopicInsertBookmarkKeywords",related:["insertLink"]},{id:"insertMedia",category:"insert",titleKey:"helpTopicInsertMediaTitle",bodyKey:"helpTopicInsertMediaBody",keywordsKey:"helpTopicInsertMediaKeywords",related:["insertImage","insertLink"]},{id:"pageBreak",category:"insert",titleKey:"helpTopicPageBreakTitle",bodyKey:"helpTopicPageBreakBody",keywordsKey:"helpTopicPageBreakKeywords",related:["insertPage","printDocument"]},{id:"insertPage",category:"insert",titleKey:"helpTopicInsertPageTitle",bodyKey:"helpTopicInsertPageBody",keywordsKey:"helpTopicInsertPageKeywords",related:["pageBreak","deletePage"]},{id:"insertComment",category:"insert",titleKey:"helpTopicInsertCommentTitle",bodyKey:"helpTopicInsertCommentBody",keywordsKey:"helpTopicInsertCommentKeywords",related:["preview"]},{id:"formatFont",category:"format",titleKey:"helpTopicFormatFontTitle",bodyKey:"helpTopicFormatFontBody",keywordsKey:"helpTopicFormatFontKeywords",related:["paragraphStyles","textColor","keyboardShortcuts"]},{id:"paragraphStyles",category:"format",titleKey:"helpTopicParagraphStylesTitle",bodyKey:"helpTopicParagraphStylesBody",keywordsKey:"helpTopicParagraphStylesKeywords",related:["formatFont","alignLists"]},{id:"textColor",category:"format",titleKey:"helpTopicTextColorTitle",bodyKey:"helpTopicTextColorBody",keywordsKey:"helpTopicTextColorKeywords",related:["formatFont","clearFormatting"]},{id:"alignLists",category:"format",titleKey:"helpTopicAlignListsTitle",bodyKey:"helpTopicAlignListsBody",keywordsKey:"helpTopicAlignListsKeywords",related:["paragraphStyles","formatFont"]},{id:"clearFormatting",category:"format",titleKey:"helpTopicClearFormattingTitle",bodyKey:"helpTopicClearFormattingBody",keywordsKey:"helpTopicClearFormattingKeywords",related:["formatFont","customCss"]},{id:"customCss",category:"format",titleKey:"helpTopicCustomCssTitle",bodyKey:"helpTopicCustomCssBody",keywordsKey:"helpTopicCustomCssKeywords",related:["formatFont","clearFormatting"]},{id:"tableRowsColumns",category:"table",titleKey:"helpTopicTableRowsColumnsTitle",bodyKey:"helpTopicTableRowsColumnsBody",keywordsKey:"helpTopicTableRowsColumnsKeywords",related:["insertTable","mergeCells","keyboardShortcuts"]},{id:"mergeCells",category:"table",titleKey:"helpTopicMergeCellsTitle",bodyKey:"helpTopicMergeCellsBody",keywordsKey:"helpTopicMergeCellsKeywords",related:["insertTable","tableRowsColumns"]},{id:"customizeToolbar",category:"view",titleKey:"helpTopicCustomizeToolbarTitle",bodyKey:"helpTopicCustomizeToolbarBody",keywordsKey:"helpTopicCustomizeToolbarKeywords",related:["zoom","fullscreen"]},{id:"zoom",category:"view",titleKey:"helpTopicZoomTitle",bodyKey:"helpTopicZoomBody",keywordsKey:"helpTopicZoomKeywords",related:["preview","fullscreen"]},{id:"darkMode",category:"view",titleKey:"helpTopicDarkModeTitle",bodyKey:"helpTopicDarkModeBody",keywordsKey:"helpTopicDarkModeKeywords",related:["customizeToolbar"]},{id:"preview",category:"view",titleKey:"helpTopicPreviewTitle",bodyKey:"helpTopicPreviewBody",keywordsKey:"helpTopicPreviewKeywords",related:["printDocument","switchModes"]},{id:"fullscreen",category:"view",titleKey:"helpTopicFullscreenTitle",bodyKey:"helpTopicFullscreenBody",keywordsKey:"helpTopicFullscreenKeywords",related:["zoom","keyboardShortcuts"]},{id:"ruler",category:"view",titleKey:"helpTopicRulerTitle",bodyKey:"helpTopicRulerBody",keywordsKey:"helpTopicRulerKeywords",related:["pageProperties","alignLists"]},{id:"keyboardShortcuts",category:"keyboard",titleKey:"helpTopicKeyboardShortcutsTitle",bodyKey:"helpTopicKeyboardShortcutsBody",keywordsKey:"helpTopicKeyboardShortcutsKeywords",related:["getStarted","undoRedo","formatFont"]}],xp=Object.fromEntries(Su.map(e=>[e.id,e]));function Yb(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function Yj(e,t){const n=Yb(t);if(n.length===0)return 1;const r=e.title.toLowerCase(),o=e.body.toLowerCase(),a=e.keywords.toLowerCase(),s=`${r} ${o} ${a}`;let u=0;for(const d of n)r.includes(d)&&(u+=30),a.includes(d)&&(u+=20),o.includes(d)&&(u+=10),s.includes(d)&&(u+=5);return u}function Xj(e,t){return Yb(t).length===0?e:e.map(r=>({entry:r,score:Yj(r,t)})).filter(({score:r})=>r>0).sort((r,o)=>o.score-r.score||r.entry.title.localeCompare(o.entry.title)).map(({entry:r})=>r)}const Jj={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:Gx,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:Sx,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:hx,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:Tx,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:bx,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:Mx,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},ruler:{id:"ruler",command:"toggleRuler",icon:Ox,labelKey:"commandRuler",ariaKey:"commandRulerAria",active:"isRulerVisible",toggle:!0},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:Fx,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:vx,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function Qj(...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 eI=Qj(uR,_T,Wj,Gj,Jj,Vj,qj),tI={menus:[{id:"file",items:["save","open",ke,"print"]},{id:"edit",items:["undo","redo",ke,{submenu:"page",items:["pageProperties",ke,"deletePage"]}]},{id:"view",items:["visual","html",ke,{submenu:"toolbar",items:["customizeToolbar",ke,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},ke,{submenu:"zoom",items:["pageZoomFitWidth","pageZoomFitPage",ke,"pageZoom50","pageZoom75","pageZoom100","pageZoom125","pageZoom150","pageZoom200"]},ke,"lightMode","darkMode",ke,"toggleCommentsVisible","ruler","preview","readAloud","fullscreen"]},{id:"insert",items:["pageBreak",{submenu:"insertPage",items:["insertPageBefore","insertPageAfter"]},ke,"table",ke,"image","pageBackgroundImage","paragraphBackgroundImage","audio","youtube","horizontalRule",ke,"link","bookmark",ke,"insertComment"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},ke,{submenu:"font",items:["fontProperties","customCss",ke,{submenu:"highlightColor",items:[]},ke,"bold","italic","underline","strikethrough"]},ke,"clearFormatting",ke,{submenu:"paragraph",items:["paragraphProperties",ke,"alignLeft","alignCenter","alignRight","alignJustify",ke,"indent","outdent",ke,"bulletList","numberedList"]},ke,"imageProperties"]},{id:"table",items:["table",ke,{submenu:"insertRow",items:["insertRowBefore","insertRowBelow","deleteRow"]},{submenu:"insertColumn",items:["insertColumnBefore","insertColumnAfter","deleteColumn"]},ke,"mergeCells","unmergeCells",ke,"tableProperties","rowProperties","cellProperties"]},{id:"help",items:["editorHelp","keyboardShortcuts",ke,"about"]}],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"]}]},wp={items:{addComment:{id:"addComment",command:"addComment",icon:sf,labelKey:"commandAddComment",ariaKey:"commandAddCommentAria",enabled:"canAddComment"},insertComment:{id:"insertComment",command:"addComment",icon:sf,labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:"canAddComment"},toggleCommentsVisible:{id:"toggleCommentsVisible",command:"toggleCommentsVisible",icon:fx,labelKey:"showComments",ariaKey:"toggleCommentsVisibleAria",toggle:!0,active:"areCommentsVisible"}}},nI=["addComment","insertComment","toggleCommentsVisible"],rI=new Set(["insert","view"]);function Xb(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!nI.includes(e):!0:!1}function oI(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!rI.has(e):!0:!1}function iI(e,t){const n=t?"hideComments":"showComments",r=wp.items.toggleCommentsVisible;return{...e,items:{...e.items,...wp.items,toggleCommentsVisible:r&&{...r,labelKey:n}}}}function aI(e){return{...e,menus:e.menus.map(t=>{if(t.id==="insert"){const n=[...t.items],r=n.findIndex(a=>zn(a)&&a.submenu==="insertPage"),o=r===-1?n.length:r;return n.includes("insertComment")||n.splice(o,0,"insertComment"),{...t,items:n}}if(t.id==="view"){const n=[...t.items],r=n.indexOf("preview"),o=r===-1?n.length:r;return n.includes("toggleCommentsVisible")||n.splice(o,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 Cp={canUndo:"history",canRedo:"history",isBold:"marks",isItalic:"marks",isUnderline:"marks",isStrikethrough:"marks",getFontSize:"marks",getFontSizeUnit:"marks",isFontSizeMixed:"marks",getFontFamily:"marks",isFontFamilyMixed:"marks",getFontColor:"marks",isFontColorMixed:"marks",getHighlightColor:"marks",isHighlightColorMixed:"marks",getParagraphStyle:"marks",isParagraphStyleMixed:"marks",isAlignLeft:"marks",isAlignCenter:"marks",isAlignRight:"marks",isAlignJustify:"marks",canOutdent:"marks",isBulletList:"marks",isNumberedList:"marks",isFormatBrushActive:"marks",isInTable:"table",canMergeCells:"table",canUnmergeCells:"table",hasTextSelection:"selection",isImageSelected:"selection",isLink:"selection",canReadAloud:"selection",isReadingAloud:"selection"};function Jb(){const e={history:0,marks:0,table:0,selection:0,chrome:0},t=new Map;function n(r,o){let a=t.get(r);return a||(a=new Set,t.set(r,a)),a.add(o),()=>{a==null||a.delete(o)}}return{subscribe:n,getSnapshot:r=>e[r],bump(r){e[r]+=1;const o=t.get(r);if(o)for(const a of o)a()}}}function Qb(e){const t=new Set;return e.active&&t.add(Cp[e.active]??"chrome"),e.enabled&&t.add(Cp[e.enabled]??"chrome"),t.size===0&&t.add("chrome"),[...t]}const ey=l.createContext(null);function sI({value:e,children:t}){return i.jsx(ey.Provider,{value:e,children:t})}function ty(e){const t=l.useContext(ey),n=l.useMemo(()=>e.join("\0"),[e]),r=l.useMemo(()=>e,[n,e]);l.useSyncExternalStore(o=>{if(!t)return()=>{};const a=r.map(s=>t.subscribe(s,o));return()=>{for(const s of a)s()}},()=>{if(!t)return 0;let o=0;for(const a of r)o+=t.getSnapshot(a);return o},()=>{if(!t)return 0;let o=0;for(const a of r)o+=t.getSnapshot(a);return o})}const Za="fullscreen";function lI(e){const t=[];let n=null;for(const r of e){const o=r.items.filter(a=>a!==Za);o.length>0&&t.push({id:r.id,items:o}),r.items.includes(Za)&&(n={id:Za,items:[Za]})}return{main:t,trailing:n}}const cI=l.memo(function({item:t,itemId:n,commands:r,queries:o,disabled:a,chromeLock:s}){const u=J(),d=l.useMemo(()=>Qb(t),[t]);if(ty(d),!t.icon||!t.command)return null;const f=t.icon,h=t.command,g=t.enabled?!o[t.enabled]():!1,y=t.active?o[t.active]():void 0;return i.jsx(pr,{label:t.tooltip??fr(u,t),children:i.jsx("button",{type:"button",className:ue.iconButton,"aria-label":vs(u,t),"aria-pressed":y,disabled:a||(s?Xb(n,s):!1)||g,onPointerDown:b=>b.preventDefault(),onMouseDown:b=>b.preventDefault(),onClick:()=>{Ru(r,h)},children:i.jsx(f,{className:ue.icon})})})});function uI({groups:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a}){const s=J(),{main:u,trailing:d}=lI(e),f=h=>{const g=t.groups[h.id];return i.jsx("div",{className:ue.iconGroup,role:"group","aria-label":g?fr(s,g):void 0,"data-toolbar-group":h.id,children:h.items.map(y=>{const b=t.items[y];if(!b)return null;const w=b.enabled?!r[b.enabled]():!1;if(b.widget){const x=b.widget;return i.jsx(x,{commands:n,queries:r,disabled:o||w},y)}return!b.icon||!b.command?null:i.jsx(cI,{itemId:y,item:b,commands:n,queries:r,disabled:o,chromeLock:a},y)})},h.id)};return i.jsxs("div",{className:ue.iconNav,role:"toolbar","aria-label":s("toolbarAria"),children:[u.length>0?i.jsx("div",{className:ue.iconNavMain,children:u.map(f)}):null,d?i.jsx("div",{className:ue.iconNavEnd,children:f(d)}):null]})}const dI=["--wysiwyg-menu-color","--wysiwyg-menu-background"],vp=["--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function mI(e,t){const n=t?vp:[...dI,...vp],r={};for(const o of n){const a=getComputedStyle(e).getPropertyValue(o).trim();if(a){r[o]=a;continue}let s=e;for(;s;){const u=s.style.getPropertyValue(o).trim();if(u){r[o]=u;break}s=s.parentElement}}return r}function fI({menus:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,compact:s,openMenuId:u,onOpenMenuIdChange:d}){const f=J(),h=Gp(),[g,y]=l.useState(!1),[b,w]=l.useState({}),x=l.useRef(null),S=l.useRef(null),k=l.useRef(null),v=l.useRef(null),A=l.useCallback(()=>{y(!1),d(null)},[d]);l.useLayoutEffect(()=>{!g||!x.current||w(mI(x.current,h))},[h,g]),l.useEffect(()=>{var D;g&&((D=k.current)==null||D.focus())},[g]),l.useEffect(()=>{if(!g)return;const D=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=D}},[g]),l.useEffect(()=>{if(!g)return;const D=T=>{var E;if(T.key==="Escape"){if(T.preventDefault(),T.stopPropagation(),u){d(null);return}A(),(E=S.current)==null||E.focus()}},R=T=>{var E;v.current&&!v.current.contains(T.target)&&(A(),(E=S.current)==null||E.focus())};return document.addEventListener("keydown",D,!0),document.addEventListener("pointerdown",R),()=>{document.removeEventListener("keydown",D,!0),document.removeEventListener("pointerdown",R)}},[g,u,d,A]);const j=D=>e.map(R=>{const T=t.menus[R.id];return T?i.jsx(gI,{def:T,itemIds:R.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:D,open:(D==="overlay"||!g)&&u===R.id,onOpenChange:E=>d(E?R.id:null),onItemRun:D==="overlay"?()=>{var E;A(),(E=S.current)==null||E.focus()}:void 0},`${D}-${R.id}`):null});return i.jsxs("div",{className:ue.menuBar,ref:x,children:[i.jsx(pr,{label:f("brandMarkAria"),children:i.jsx("span",{className:ue.brandMark,role:"img","aria-label":f("brandMarkAria"),children:i.jsx(Mp,{className:ue.brandMarkIcon})})}),i.jsx("div",{className:ue.menuBarCompact,hidden:s===void 0?void 0:!s,children:i.jsx(pr,{label:f("menuHamburgerAria"),children:i.jsx("button",{ref:S,type:"button",className:`${ue.menuButton} ${ue.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":g,"aria-label":f("menuHamburgerAria"),disabled:o||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>{if(g){A();return}d(null),y(!0)},children:i.jsx(Dx,{className:ue.icon})})})}),i.jsx("div",{className:ue.menuBarDesktop,hidden:s===void 0?void 0:s,children:j("dropdown")}),g?i.jsx(Pe,{children:i.jsx("div",{className:ue.toolbar,"data-menu-overlay-portal":"",style:b,children:i.jsxs("div",{ref:v,className:ue.menuOverlay,role:"dialog","aria-modal":"true","aria-label":f("menuOverlayAria"),children:[i.jsxs("div",{className:ue.menuOverlayHeader,children:[i.jsx("span",{className:ue.menuOverlayTitle,children:f("menuOverlayAria")}),i.jsx("button",{ref:k,type:"button",className:ue.iconButton,"aria-label":f("menuCloseAria"),onClick:()=>{var D;A(),(D=S.current)==null||D.focus()},children:i.jsx(Ge,{className:ue.icon})})]}),i.jsx("div",{className:ue.menuOverlayBody,children:j("overlay")})]})})}):null]})}function ks(e,t){var n,r;if(cr(e))return!1;if(zn(e)){const o=(n=t.submenus)==null?void 0:n[e.submenu];return o?o.panel?!0:e.items.some(a=>ks(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function pI(e,t,n){if(!cr(e[t])||!e.slice(t+1).some(a=>ks(a,n)))return!1;let o=!1;for(let a=t-1;a>=0;a--){const s=e[a];if(cr(s)){o=!0;continue}if(ks(s,n))return!o}return!1}function gI({def:e,itemIds:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,open:d,onOpenChange:f,onItemRun:h}){const g=J(),y=l.useRef(null),b=u==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[w,x]=l.useState(null);l.useEffect(()=>{d||x(null)},[d]),l.useEffect(()=>{if(!d||u==="overlay")return;const k=A=>{y.current&&!y.current.contains(A.target)&&f(!1)},v=A=>{if(A.key==="Escape"){if(A.preventDefault(),A.stopPropagation(),w){x(null);return}f(!1)}};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",v,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",v,!0)}},[d,w,f,u]);const S=()=>{f(!1),h==null||h()};return i.jsxs("div",{className:ue.menuWrap,ref:y,children:[i.jsx("button",{type:"button",className:ue.menuButton,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":b,"aria-label":vs(g,e),disabled:a||(s?oI(e.id,s):!1),onClick:()=>f(!d),children:fr(g,e)}),d?i.jsx("div",{className:ue.menu,role:"menu",id:b,onMouseDown:k=>k.preventDefault(),children:i.jsx(ny,{entries:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,onClose:S,openSubmenuId:w,onOpenSubmenuIdChange:x})}):null]})}function ny({entries:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:d,onOpenSubmenuIdChange:f}){return i.jsx(i.Fragment,{children:e.map((h,g)=>{if(cr(h))return pI(e,g,t)?i.jsx("div",{role:"separator",className:ue.menuSeparator},`separator-${g}`):null;if(zn(h))return i.jsx(bI,{entry:h,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d===h.submenu,onOpenChange:b=>f==null?void 0:f(b?h.submenu:null)},`submenu-${h.submenu}-${g}`);const y=t.items[h];return!y||!y.command?null:i.jsx(hI,{item:y,commands:n,queries:r,disabled:o,chromeLock:a,onClose:u},h)})})}function hI({item:e,commands:t,queries:n,disabled:r,chromeLock:o,onClose:a}){const s=J(),u=l.useMemo(()=>Qb(e),[e]);if(ty(u),!e.command)return null;const d=e.icon,f=e.command,h=e.active?n[e.active]():void 0,g=e.enabled?!n[e.enabled]():!1,y=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return i.jsxs("button",{type:"button",role:y,className:ue.menuItem,"aria-checked":h,disabled:r||(o?Xb(e.id,o):!1)||g,onClick:()=>{a(),Ru(t,f)},children:[d?i.jsx(d,{className:ue.icon}):null,fr(s,e)]})}function bI({entry:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d,onOpenChange:f}){var R;const h=J(),g=l.useRef(null),y=l.useRef(null),[b,w]=l.useState(null),x=(R=t.submenus)==null?void 0:R[e.submenu],S=s==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,k=x==null?void 0:x.panel,v=x!=null&&x.enabled?!r[x.enabled]():!1,A=s==="overlay";if(l.useEffect(()=>{d||w(null)},[d]),!x||!k&&!e.items.some(T=>ks(T,t)))return null;const j=T=>{(T.key==="ArrowRight"||T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),f(!0),requestAnimationFrame(()=>{var N;const E=(N=y.current)==null?void 0:N.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');E==null||E.focus()}))},D=T=>{var E;T.key==="ArrowLeft"&&(T.preventDefault(),T.stopPropagation(),f(!1),(E=g.current)==null||E.focus())};return i.jsxs("div",{className:ue.submenuWrap,onMouseEnter:A?void 0:()=>f(!0),onMouseLeave:A?void 0:()=>f(!1),children:[i.jsx("button",{ref:g,type:"button",role:"menuitem",className:`${ue.menuItem} ${ue.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":S,"aria-label":vs(h,x),disabled:o||v||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>f(A?!d:!0),onKeyDown:j,children:fr(h,x)}),d?i.jsx("div",{ref:y,className:`${ue.menu} ${ue.submenu}`,role:"menu",id:S,"aria-label":vs(h,x),onMouseDown:T=>T.preventDefault(),onKeyDown:D,children:k?i.jsx(k,{commands:n,queries:r,disabled:o||v,onMenuClose:u}):i.jsx(ny,{entries:e.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:b,onOpenSubmenuIdChange:w})}):null]})}const Pu=l.memo(function({catalog:t,layout:n,commands:r,queries:o,queryRevisions:a,disabled:s,chromeLock:u,menuVisible:d=!0,toolbarVisible:f=!0,compact:h,position:g="top"}){const[y,b]=l.useState(null);if(!d&&!f)return null;const w=i.jsxs("div",{className:ue.toolbar,"data-compact":h?"":void 0,"data-toolbar-position":g,children:[d?i.jsx(fI,{menus:n.menus,catalog:t,commands:r,queries:o,disabled:s,chromeLock:u,compact:h,openMenuId:y,onOpenMenuIdChange:b}):null,f?i.jsx(uI,{groups:n.iconGroups,catalog:t,commands:r,queries:o,disabled:s,chromeLock:u}):null]});return a?i.jsx(sI,{value:a,children:w}):w});function yI(e,t){return t?e:{...e,menus:e.menus.map(n=>n.id==="insert"?{...n,items:n.items.filter(r=>!(zn(r)&&r.submenu==="insertPage"))}:n.id==="edit"?{...n,items:n.items.map(r=>{if(!zn(r)||r.submenu!=="page")return r;let o=r.items.filter(a=>a!=="deletePage");return o.at(-1)===ke&&(o=o.slice(0,-1)),{...r,items:o}})}:n)}}function Ri(e){return Bg(it(e))}const xI=1.5,Ec=384;function wI(e,t=16){return e>0?xI*t:0}function ry(e,t,n=16){const r=wI(t,n);if(!Ri(e))return Ec+r;const o=it(e),a=jo(o,!1);return a?rr(a.height,Ec)+r:Ec+r}function di(e,t){const n=[0];for(let r=0;r<e;r+=1)n.push(n[r]+t(r));return n}function CI(){const e=new Map;return{get(t,n){return e.get(t)??ry(n,t)},set(t,n){n>0&&e.set(t,n)},clear(){e.clear()},invalidateFrom(t){for(const n of[...e.keys()])n>=t&&e.delete(n)}}}const vI=2;function oy(e,t,n){if(n<=0)return 0;let r=0,o=n-1,a=0;for(;r<=o;){const s=r+o>>1;(t[s+1]??0)>e?(a=s,o=s-1):r=s+1}return a}function iy(e,t,n){if(n<=0)return-1;let r=0,o=n-1,a=n-1;for(;r<=o;){const s=r+o>>1;(t[s]??0)<e?(a=s,r=s+1):o=s-1}return a}function kp(e,t,n,r,o,a,s){if(r<=0)return{startIndex:0,endIndex:-1,topSpacerHeight:0,bottomSpacerHeight:0};const u=n[r]??0;if(u<=t)return{startIndex:0,endIndex:r-1,topSpacerHeight:0,bottomSpacerHeight:0};const d=e+t,f=oy(e,n,r),h=iy(d,n,r);let g=Math.max(0,f-o),y=Math.min(r-1,h+o);s&&(g=Math.min(g,a),y=Math.max(y,a));const b=n[g]??0,w=u-(n[y+1]??u);return{startIndex:g,endIndex:y,topSpacerHeight:b,bottomSpacerHeight:w}}function kI({scrollElementRef:e,pageCount:t,getRowHeight:n,overscan:r=vI,activePageIndex:o,pinActivePage:a=!0}){const s=l.useRef(n);s.current=n;const u=l.useRef(new Map),[d,f]=l.useState(0);l.useLayoutEffect(()=>{u.current.clear()},[t]);const h=l.useCallback(v=>{const A=u.current.get(v),j=s.current(v);return A!==void 0?Math.max(A,j):j},[d]),g=l.useMemo(()=>di(t,h),[t,h]),[y,b]=l.useState(()=>{const v=di(t,A=>s.current(A));return kp(0,300,v,t,r,o,a)}),w=l.useCallback(()=>{const v=e.current;if(!v||t<=0)return;const A=v.clientHeight>0?v.clientHeight:300,j=di(t,h);b(kp(v.scrollTop,A,j,t,r,o,a))},[o,r,t,a,h,e]);l.useLayoutEffect(()=>{w()},[w,g,o,t]),l.useLayoutEffect(()=>{const v=e.current;if(!v)return;const A=()=>w();v.addEventListener("scroll",A,{passive:!0});let j;return typeof ResizeObserver<"u"&&(j=new ResizeObserver(()=>w()),j.observe(v)),w(),()=>{v.removeEventListener("scroll",A),j==null||j.disconnect()}},[e,w]);const x=l.useCallback((v,A)=>{if(A<=0)return;const j=u.current.get(v);j!==void 0&&Math.abs(j-A)<1||(u.current.set(v,A),f(D=>D+1))},[]),S=l.useCallback(v=>{const A=e.current;if(!A||v<0||v>=t)return;const j=di(t,h);A.scrollTop=j[v]??0,w()},[t,h,e,w]),k=l.useMemo(()=>{if(y.endIndex<y.startIndex)return[];const v=[];for(let A=y.startIndex;A<=y.endIndex;A+=1)v.push(A);return v},[y.endIndex,y.startIndex]);return{...y,visibleIndices:k,scrollToIndex:S,notifyRowMeasured:x}}function xd(){return{firstLineIndentPx:0,leftIndentPx:0,rightIndentPx:0,mixed:!1}}function Ss(e){const t=$n(e);if(t.length===0)return xd();let n=null,r=null,o=null,a=!1;for(const s of t){const u=s.style.textIndent,d=s.style.marginLeft,f=s.style.marginRight,h=u?rr(u,0):0,g=d?rr(d,0):0,y=f?rr(f,0):0;n===null?(n=h,r=g,o=y):(Math.abs(n-h)>1||Math.abs((r??0)-g)>1||Math.abs((o??0)-y)>1)&&(a=!0)}return{firstLineIndentPx:n??0,leftIndentPx:r??0,rightIndentPx:o??0,mixed:a}}function SI(e){var r;const t=(r=window.getSelection())==null?void 0:r.getRangeAt(0);if(!t)return null;let n=t.startContainer;for(n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);n&&n!==e&&n!==document.body;){if(n instanceof HTMLElement){const o=n.tagName.toLowerCase();if(["p","h1","h2","h3","h4","h5","h6","li","blockquote","div"].includes(o))return n}n=n.parentNode}return null}function PI(e,t){return yr(e,()=>{let n=Vr(e);if(n.length===0){const a=SI(e);a&&(n=[a])}if(n.length===0)return!1;const r=t.unit??"in";let o=!1;for(const a of n){if(t.firstLineIndentPx!==void 0)if(Math.abs(t.firstLineIndentPx)<.5)a.style.textIndent&&(a.style.removeProperty("text-indent"),o=!0);else{const s=Ie(wc(t.firstLineIndentPx,r));a.style.textIndent!==s&&(a.style.textIndent=s,o=!0)}if(t.leftIndentPx!==void 0)if(t.leftIndentPx<=.5)a.style.marginLeft&&(a.style.removeProperty("margin-left"),o=!0);else{const s=Ie(wc(t.leftIndentPx,r));a.style.marginLeft!==s&&(a.style.marginLeft=s,o=!0)}if(t.rightIndentPx!==void 0)if(t.rightIndentPx<=.5)a.style.marginRight&&(a.style.removeProperty("margin-right"),o=!0);else{const s=Ie(wc(t.rightIndentPx,r));a.style.marginRight!==s&&(a.style.marginRight=s,o=!0)}jt(a)}return o})}const ay=24,bi=48;function sy(e,t){const n=Ei(it(t));return{pageWidthPx:e.offsetWidth,pageHeightPx:e.offsetHeight,marginsPx:{top:rr(n.top,0),right:rr(n.right,0),bottom:rr(n.bottom,0),left:rr(n.left,0)}}}function AI(e,t){const n=Object.keys(t);return Object.keys(e).length!==n.length?!1:n.every(r=>{const o=e[Number(r)],a=t[Number(r)];return(o==null?void 0:o.pageWidthPx)===a.pageWidthPx&&(o==null?void 0:o.pageHeightPx)===a.pageHeightPx&&(o==null?void 0:o.marginsPx.top)===a.marginsPx.top&&(o==null?void 0:o.marginsPx.right)===a.marginsPx.right&&(o==null?void 0:o.marginsPx.bottom)===a.marginsPx.bottom&&(o==null?void 0:o.marginsPx.left)===a.marginsPx.left})}function TI(e,t,n,r,o=!0,a=1){const[s,u]=l.useState({}),[d,f]=l.useState(xd()),h=l.useCallback(y=>s[y]??null,[s]),g=l.useCallback(()=>{const y=e.current;if(!o||!y)return;const b={};for(const x of n){const S=We(y,x);if(!S)continue;const k=t[x]??t[0]??"";b[x]=sy(S,k)}u(x=>{const S={...x,...b};return AI(x,S)?x:S});const w=We(y,r());w&&f(Ss(w))},[e,o,r,n,t]);return l.useLayoutEffect(()=>{if(!o)return;const y=requestAnimationFrame(g);return()=>cancelAnimationFrame(y)},[o,r,n,t,a,g]),l.useLayoutEffect(()=>{if(!o||typeof ResizeObserver>"u")return;const y=e.current;if(!y)return;const b=new ResizeObserver(()=>g());for(const w of n){const x=We(y,w);x&&b.observe(x)}return()=>b.disconnect()},[e,o,n,g]),l.useLayoutEffect(()=>{if(!o)return;const y=()=>{const b=e.current;if(!b)return;const w=We(b,r());w&&f(Ss(w))};return document.addEventListener("selectionchange",y),()=>document.removeEventListener("selectionchange",y)},[e,o,r]),{pageGeometries:s,geometryForPage:h,indentState:d,refresh:g}}const RI="_rulerRoot_j57vt_5",DI="_horizontalRulerGroup_j57vt_22",jI="_horizontalRulerTrack_j57vt_28",II="_horizontalRulerShelf_j57vt_42",EI="_horizontalInner_j57vt_51",_I="_dragEdgeLeft_j57vt_63",MI="_dragEdgeRight_j57vt_73",NI="_dragEdgeActive_j57vt_85",LI="_verticalRuler_j57vt_92",BI="_verticalInner_j57vt_102",FI="_dragEdgeTop_j57vt_114",HI="_dragEdgeBottom_j57vt_124",zI="_dragEdgeActiveV_j57vt_136",OI="_tickH_j57vt_143",KI="_tickV_j57vt_152",$I="_tickLabelH_j57vt_161",UI="_tickLabelV_j57vt_175",VI="_arrowIconWrapper_j57vt_192",WI="_arrowDown_j57vt_203",GI="_arrowGlyph_j57vt_211",qI="_arrowActive_j57vt_220",ZI="_arrowUp_j57vt_225",YI="_rulerTooltip_j57vt_249",je={rulerRoot:RI,horizontalRulerGroup:DI,horizontalRulerTrack:jI,horizontalRulerShelf:II,horizontalInner:EI,dragEdgeLeft:_I,dragEdgeRight:MI,dragEdgeActive:NI,verticalRuler:LI,verticalInner:BI,dragEdgeTop:FI,dragEdgeBottom:HI,dragEdgeActiveV:zI,tickH:OI,tickV:KI,tickLabelH:$I,tickLabelV:UI,arrowIconWrapper:VI,arrowDown:WI,arrowGlyph:GI,arrowActive:qI,arrowUp:ZI,rulerTooltip:YI},_c=({type:e,active:t=!1,className:n="",style:r,title:o,"aria-label":a,onPointerDown:s,"data-testid":u})=>{const d=e==="down"?je.arrowDown:je.arrowUp;return i.jsx("div",{className:`${je.arrowIconWrapper} ${d} ${t?je.arrowActive:""} ${n}`,style:r,title:o,"aria-label":a||o,onPointerDown:s,"data-testid":u,children:i.jsx("div",{className:je.arrowGlyph})})};function ly(){const[e,t]=l.useState(null),[n,r]=l.useState(null),o=l.useCallback((a,s,u)=>{s.preventDefault(),s.stopPropagation(),t(a);const d=Number.isFinite(s.clientX)?s.clientX:0,f=Number.isFinite(s.clientY)?s.clientY:0,h=s.altKey,g=b=>{var k;const w=Number.isFinite(b.clientX)?b.clientX:d,x=Number.isFinite(b.clientY)?b.clientY:f,S=u.updateDragState(w,x,b.altKey);r(S),(k=u.onPreview)==null||k.call(u,S)},y=b=>{const w=Number.isFinite(b.clientX)?b.clientX:d,x=Number.isFinite(b.clientY)?b.clientY:f,S=u.updateDragState(w,x,b.altKey);window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),t(null),r(null),u.onCommit(S)};r(u.updateDragState(d,f,h)),window.addEventListener("pointermove",g),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y)},[]);return{activeTarget:e,dragPreview:n,startPointerDrag:o}}const XI=({geometry:e,indentState:t,unit:n="in",zoomScale:r=1,onMarginChange:o,onMarginPreview:a,onIndentChange:s})=>{const u=J(),{activeTarget:d,dragPreview:f,startPointerDrag:h}=ly(),g=(e==null?void 0:e.pageWidthPx)??816,y=(e==null?void 0:e.marginsPx.left)??96,b=(e==null?void 0:e.marginsPx.right)??96,w=r>0?r:1,x=(f==null?void 0:f.marginLeft)??y,S=(f==null?void 0:f.marginRight)??b,k=(f==null?void 0:f.firstLineIndentPx)??t.firstLineIndentPx,v=(f==null?void 0:f.leftIndentPx)??t.leftIndentPx,A=(f==null?void 0:f.rightIndentPx)??t.rightIndentPx,j=Math.max(0,g-x-S),D=!t.mixed,R=l.useMemo(()=>Eg(g,x,n),[g,x,n]),T=l.useCallback((P,F)=>{const U=Number.isFinite(F.clientX)?F.clientX:0;h(P.type,F,{updateDragState:(G,me,se)=>{const V=(G-U)/w;let re=0;const de={target:P.type,marginLeft:y,marginRight:b,firstLineIndentPx:t.firstLineIndentPx,leftIndentPx:t.leftIndentPx,rightIndentPx:t.rightIndentPx,measurementPx:0,clientX:G,clientY:me};if(P.type==="margin-left"){const oe=Math.max(0,Math.min(g-b-bi,P.startMarginPx+V)),_=Mr(oe,n,se,0);de.marginLeft=_,re=_}else if(P.type==="margin-right"){const oe=Math.max(0,Math.min(g-y-bi,P.startMarginPx-V)),_=Mr(oe,n,se,0);de.marginRight=_,re=_}else if(P.type==="first-line-indent"){const oe=-P.startLeftIndentPx,_=g-y-b-P.startLeftIndentPx-bi,Q=Math.max(oe,Math.min(_,P.startFirstLinePx+V)),xe=Mr(Q,n,se,0);de.firstLineIndentPx=xe,re=xe}else if(P.type==="left-indent"){const oe=Math.max(0,P.startLeftIndentPx+V),_=Mr(oe,n,se,0);de.leftIndentPx=_,de.firstLineIndentPx=P.startFirstLinePx,re=_}else if(P.type==="right-indent"){const oe=Math.max(0,P.startRightIndentPx-V),_=Mr(oe,n,se,0);de.rightIndentPx=_,re=_}return de.measurementPx=re,de},onPreview:G=>{P.type==="margin-left"?a==null||a({left:G.marginLeft}):P.type==="margin-right"&&(a==null||a({right:G.marginRight}))},onCommit:G=>{P.type==="margin-left"?o==null||o({left:G.marginLeft}):P.type==="margin-right"?o==null||o({right:G.marginRight}):P.type==="first-line-indent"?s==null||s({firstLineIndentPx:G.firstLineIndentPx}):P.type==="left-indent"?s==null||s({leftIndentPx:G.leftIndentPx}):P.type==="right-indent"&&(s==null||s({rightIndentPx:G.rightIndentPx}))}})},[y,b,g,n,w,t,o,a,s,h]),E=x+v,N=E+k,K=g-S-A,$=g*w;return i.jsxs("div",{className:`${je.rulerRoot} ${je.horizontalRulerGroup}`,style:{width:`${$}px`},"data-testid":"horizontal-ruler",children:[i.jsxs("div",{className:je.horizontalRulerTrack,children:[i.jsxs("div",{className:je.horizontalInner,style:{left:`${x*w}px`,width:`${j*w}px`},"data-testid":"ruler-printable-area",children:[i.jsx("div",{className:`${je.dragEdgeLeft} ${d==="margin-left"?je.dragEdgeActive:""}`,title:u("rulerMarginLeft"),"aria-label":u("rulerMarginLeft"),"data-testid":"ruler-margin-splitter-left",onPointerDown:P=>T({type:"margin-left",startMarginPx:y},P)}),i.jsx("div",{className:`${je.dragEdgeRight} ${d==="margin-right"?je.dragEdgeActive:""}`,title:u("rulerMarginRight"),"aria-label":u("rulerMarginRight"),"data-testid":"ruler-margin-splitter-right",onPointerDown:P=>T({type:"margin-right",startMarginPx:b},P)})]}),R.map((P,F)=>i.jsxs(l.Fragment,{children:[i.jsx("div",{className:je.tickH,style:{left:`${P.positionPx*w}px`,height:`${P.height}px`}}),P.label?i.jsx("span",{className:je.tickLabelH,style:{left:`${P.positionPx*w}px`},children:P.label}):null]},F)),D?i.jsxs(i.Fragment,{children:[i.jsx(_c,{type:"down",style:{left:`${N*w}px`},active:d==="first-line-indent",title:u("rulerFirstLineIndent"),"aria-label":u("rulerFirstLineIndent"),"data-testid":"ruler-first-line-indent",onPointerDown:P=>T({type:"first-line-indent",startFirstLinePx:t.firstLineIndentPx,startLeftIndentPx:t.leftIndentPx},P)}),i.jsx(_c,{type:"up",style:{left:`${E*w}px`},active:d==="left-indent",title:u("rulerLeftIndent"),"aria-label":u("rulerLeftIndent"),"data-testid":"ruler-left-indent",onPointerDown:P=>T({type:"left-indent",startLeftIndentPx:t.leftIndentPx,startFirstLinePx:t.firstLineIndentPx},P)}),i.jsx(_c,{type:"up",style:{left:`${K*w}px`},active:d==="right-indent",title:u("rulerRightIndent"),"aria-label":u("rulerRightIndent"),"data-testid":"ruler-right-indent",onPointerDown:P=>T({type:"right-indent",startRightIndentPx:t.rightIndentPx},P)})]}):null]}),i.jsx("div",{className:je.horizontalRulerShelf,"aria-hidden":!0}),f?i.jsx("div",{className:je.rulerTooltip,style:{left:f.clientX,top:f.clientY},"data-testid":"ruler-drag-tooltip",children:Ig(f.measurementPx,n)}):null]})},JI=({geometry:e,unit:t="in",zoomScale:n=1,onMarginChange:r,onMarginPreview:o})=>{const a=J(),{activeTarget:s,dragPreview:u,startPointerDrag:d}=ly(),f=(e==null?void 0:e.pageHeightPx)??1056,h=(e==null?void 0:e.marginsPx.top)??96,g=(e==null?void 0:e.marginsPx.bottom)??96,y=n>0?n:1,b=(u==null?void 0:u.marginTop)??h,w=(u==null?void 0:u.marginBottom)??g,x=Math.max(0,f-b-w),S=l.useMemo(()=>Eg(f,b,t),[f,b,t]),k=l.useCallback((v,A)=>{const j=Number.isFinite(A.clientY)?A.clientY:0;d(v.type,A,{updateDragState:(D,R,T)=>{const E=(R-j)/y,N={target:v.type,marginTop:h,marginBottom:g,measurementPx:0,clientX:D,clientY:R};if(v.type==="margin-top"){const K=Math.max(0,Math.min(f-g-bi,v.startMarginPx+E)),$=Mr(K,t,T,0);N.marginTop=$,N.measurementPx=$}else if(v.type==="margin-bottom"){const K=Math.max(0,Math.min(f-h-bi,v.startMarginPx-E)),$=Mr(K,t,T,0);N.marginBottom=$,N.measurementPx=$}return N},onPreview:D=>{v.type==="margin-top"?o==null||o({top:D.marginTop}):v.type==="margin-bottom"&&(o==null||o({bottom:D.marginBottom}))},onCommit:D=>{v.type==="margin-top"?r==null||r({top:D.marginTop}):v.type==="margin-bottom"&&(r==null||r({bottom:D.marginBottom}))}})},[h,g,f,t,y,r,o,d]);return i.jsxs("div",{className:`${je.rulerRoot} ${je.verticalRuler}`,style:{height:`${f}px`},"data-testid":"vertical-ruler",children:[i.jsxs("div",{className:je.verticalInner,style:{top:`${b}px`,height:`${x}px`},"data-testid":"ruler-printable-area-vertical",children:[i.jsx("div",{className:`${je.dragEdgeTop} ${s==="margin-top"?je.dragEdgeActiveV:""}`,title:a("rulerMarginTop"),"aria-label":a("rulerMarginTop"),"data-testid":"ruler-margin-splitter-top",onPointerDown:v=>k({type:"margin-top",startMarginPx:h},v)}),i.jsx("div",{className:`${je.dragEdgeBottom} ${s==="margin-bottom"?je.dragEdgeActiveV:""}`,title:a("rulerMarginBottom"),"aria-label":a("rulerMarginBottom"),"data-testid":"ruler-margin-splitter-bottom",onPointerDown:v=>k({type:"margin-bottom",startMarginPx:g},v)})]}),S.map((v,A)=>i.jsxs(l.Fragment,{children:[i.jsx("div",{className:je.tickV,style:{top:`${v.positionPx}px`,width:`${v.height}px`}}),v.label?i.jsx("span",{className:je.tickLabelV,style:{top:`${v.positionPx}px`},children:v.label}):null]},A)),u?i.jsx("div",{className:je.rulerTooltip,style:{left:u.clientX,top:u.clientY},"data-testid":"ruler-drag-tooltip",children:Ig(u.measurementPx,t)}):null]})},QI="_root_njanr_1",eE="_fullscreen_njanr_36",tE="_exitFullscreen_njanr_48",nE="_exitFullscreenIcon_njanr_79",rE="_menuChrome_njanr_94",oE="_body_njanr_106",iE="_iconChrome_njanr_136",aE="_workspace_njanr_181",sE="_workspacePageSized_njanr_193",lE="_workspaceWithRuler_njanr_197",cE="_pageCanvasViewport_njanr_201",uE="_multiPageRulerLayer_njanr_211",dE="_multiPageContainer_njanr_234",mE="_pageZoomContent_njanr_244",fE="_htmlFileDropOverlay_njanr_262",pE="_surface_njanr_276",gE="_visual_njanr_283",hE="_pageBlock_njanr_341",bE="_pageBlockFluid_njanr_348",yE="_pageSurfaceRulerGutter_njanr_357",xE="_pageSurface_njanr_357",wE="_htmlModeShell_njanr_378",CE="_html_njanr_262",Se={root:QI,fullscreen:eE,exitFullscreen:tE,exitFullscreenIcon:nE,menuChrome:rE,body:oE,iconChrome:iE,workspace:aE,workspacePageSized:sE,workspaceWithRuler:lE,pageCanvasViewport:cE,multiPageRulerLayer:uE,multiPageContainer:dE,pageZoomContent:mE,htmlFileDropOverlay:fE,surface:pE,visual:gE,pageBlock:hE,pageBlockFluid:bE,pageSurfaceRulerGutter:yE,pageSurface:xE,htmlModeShell:wE,html:CE};function cy(e){if(e!==1)return{zoom:e,"--page-zoom":String(e)}}function uy({showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}){if(!e)return null;const d=ay;return i.jsx("div",{className:Se.multiPageRulerLayer,children:i.jsxs("div",{className:Se.pageBlock,children:[i.jsx("div",{className:Se.pageSurfaceRulerGutter,style:{width:`${d}px`,flex:`0 0 ${d}px`},"aria-hidden":!0}),i.jsx(XI,{geometry:t,indentState:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u})]})})}function dy({showVerticalRuler:e=!1,pageSized:t=!1,geometry:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:u,pageBlockStyle:d,pageBlockRef:f}){const h=o>0?o:1,g=e?ay/h:0;return i.jsxs("div",{ref:f,className:`${Se.pageBlock} ${t?"":Se.pageBlockFluid}`,style:d,children:[i.jsx("div",{className:Se.pageSurfaceRulerGutter,style:{width:`${g}px`,flex:`0 0 ${g}px`},children:e?i.jsx(JI,{geometry:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s}):null}),u]})}function vE({showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u,children:d}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:e?"center":"stretch",width:"100%",height:"100%",minHeight:"100%",position:"relative"},children:[i.jsx(uy,{showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}),i.jsx("div",{className:Se.pageZoomContent,style:cy(o),children:i.jsx(dy,{showVerticalRuler:e,pageSized:e,geometry:t,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:d})})]})}const kE=l.memo(function({index:t,pageHtml:n,showVerticalRuler:r,pageSized:o,geometry:a,rulerUnit:s,zoomScale:u,placeholder:d,disabled:f,visualEditorAria:h,onActivate:g,onPointerDown:y,onPageChange:b,onPageFlush:w,suppressPageFlushRef:x,onMeasured:S,onMarginChange:k,onMarginPreview:v,onMouseUp:A,onContextMenu:j,onRulerRefresh:D}){const R=l.useRef(null),T=l.useRef(null),E=l.useRef(""),N=l.useRef(!1),K=l.useRef(w);K.current=w;const $=l.useRef(S);$.current=S,l.useLayoutEffect(()=>{const F=T.current;if(!F||!$.current)return;const U=()=>{var me;return(me=$.current)==null?void 0:me.call($,t,F.offsetHeight)};if(U(),typeof ResizeObserver>"u")return;const G=new ResizeObserver(U);return G.observe(F),()=>G.disconnect()},[t,n,o,r]);const P=l.useCallback(F=>{R.current=F,F&&(E.current=F.innerHTML)},[]);return l.useLayoutEffect(()=>()=>{x!=null&&x.current||!N.current||!K.current||K.current(t,E.current)},[t,x]),i.jsx(dy,{pageBlockRef:T,showVerticalRuler:r,pageSized:o,geometry:a,rulerUnit:s,zoomScale:u,pageBlockStyle:{marginTop:t>0?"1.5rem":"0"},onMarginChange:F=>{k==null||k(t,F)},onMarginPreview:F=>{v==null||v(t,F)},children:i.jsx("div",{ref:P,className:`${Se.surface} ${Se.visual} ${o?Se.pageSurface:""}`,[Kr]:"","data-page-index":t,contentEditable:!f,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":h,"aria-disabled":f||void 0,"data-placeholder":t===0?d:void 0,onFocus:F=>{const U=F.currentTarget;Ai(U),vo(U),g(t)},onPointerDown:F=>y(t,F),onMouseUp:A,onContextMenu:j,onInput:F=>{const U=F.currentTarget;N.current=!0,E.current=U.innerHTML;const{absorbedBlocks:G}=Ai(U);if(E.current=U.innerHTML,b(t,U.innerHTML),G.length>0){const me=G.length;requestAnimationFrame(()=>qg(U,me))}D()}})})},SE);function SE(e,t){return e.index===t.index&&e.pageHtml===t.pageHtml&&e.showVerticalRuler===t.showVerticalRuler&&e.pageSized===t.pageSized&&e.geometry===t.geometry&&e.rulerUnit===t.rulerUnit&&e.zoomScale===t.zoomScale&&e.placeholder===t.placeholder&&e.disabled===t.disabled&&e.visualEditorAria===t.visualEditorAria}const PE=l.forwardRef(function({pages:t,activePageIndex:n,hasSelectedPage:r=!1,scrollRootRef:o,onActivePageIndexChange:a,onPageSelected:s,onPageChange:u,onPageFlush:d,suppressPageFlushRef:f,pendingInsertPageFocusRef:h,placeholder:g,disabled:y,rulerVisible:b=!0,rulerUnit:w="in",zoomScale:x=1,onMarginChange:S,onMarginPreview:k,onIndentChange:v,onBeforeInput:A,resolveEmbeddedImageDataUrl:j,hydrateEmbeddedImages:D,onPointerDown:R,onMouseUp:T,onContextMenu:E,pageLayoutEnabled:N=!0},K){const $=J(),P=l.useRef(null),F=l.useRef(n);F.current=n;const U=l.useRef(A);U.current=A;const G=l.useRef(u);G.current=u;const me=l.useRef(d);me.current=d;const se=l.useRef(s);se.current=s;const V=l.useRef(R);V.current=R;const re=l.useRef(S);re.current=S;const de=l.useRef(k);de.current=k;const oe=l.useRef(null),_=l.useRef([]),Q=l.useRef(CI()),xe=f,ee=l.useCallback(()=>F.current,[]),Z=l.useCallback(q=>Q.current.get(q,t[q]??""),[t]),{visibleIndices:Ee,topSpacerHeight:et,bottomSpacerHeight:qe,scrollToIndex:lt,notifyRowMeasured:ct}=kI({scrollElementRef:o??P,pageCount:t.length,getRowHeight:Z,activePageIndex:n,pinActivePage:r}),{geometryForPage:St,indentState:mn,refresh:ut}=TI(P,t,Ee,ee,N,x),Y=r?n:0,ce=t[Y]??"",we=l.useCallback(q=>N&&Ri(t[q]??""),[N,t]),Be=N&&b&&Ri(ce),en=l.useCallback(q=>{lt(q),requestAnimationFrame(()=>{const te=P.current;if(!te)return;const le=We(te,q);le&&vo(le)})},[lt]),tn=l.useCallback(q=>{if(q<0||q>=t.length)return;const te=(o==null?void 0:o.current)??P.current;if(!te)return;const le=di(t.length,Z),Ce=te.scrollTop,Ye=Ce+te.clientHeight,fn=oy(Ce,le,t.length),nt=iy(Ye,le,t.length);q>=fn&&q<=nt||lt(q)},[Z,t.length,o,lt]),nn=l.useCallback(q=>{tn(q),requestAnimationFrame(()=>{const te=P.current;if(!te)return;const le=We(te,q);le&&hv(le)})},[tn]),dt=l.useRef(tn);dt.current=tn,l.useLayoutEffect(()=>{dt.current(n)},[n,t.length]),l.useLayoutEffect(()=>{const q=h;if(!q)return;const te=q.current;te!=null&&(q.current=null,nn(te))},[n,t.length,h,nn]);const Rn=l.useCallback(q=>{var Ce;if(F.current=q,q!==n&&a(q),(Ce=se.current)==null||Ce.call(se,q),!Ee.includes(q)){en(q);return}ut();const te=P.current;if(!te)return;const le=We(te,q);le&&requestAnimationFrame(()=>vo(le))},[n,a,ut,en,Ee]);l.useImperativeHandle(K,()=>({getContainer:()=>P.current,getActivePageRoot:()=>{const q=P.current;return q?We(q,F.current):null},getActivePageIndex:()=>F.current,flushPageHtml:q=>{var le;const te=P.current;return te?((le=We(te,q))==null?void 0:le.innerHTML)??null:null},ensurePageMounted:q=>{en(q)},focusPageAt:nn,activatePageAt:Rn}));const Dn=l.useCallback((q,te,le,Ce)=>{const Ye=cn(he(le).body),fn=te===document.activeElement;if((Ce!=null&&Ce.forceBodySync||!fn)&&ws(te,Ye,{resolveDataUrl:j,hydrateEmbeddedImages:D}),N){Yu(te),Ai(te);const nt=Bs(te);Ls(te),Io(te,le);const rn=yt(te);if(rn&&Ug(te,rn),nt){const Un=cn(he(le).body);te.innerHTML!==Un&&av(Un,te)&&G.current(q,te.innerHTML)}}},[D,N,j]);l.useLayoutEffect(()=>{Q.current.clear()},[t.length]),l.useLayoutEffect(()=>{const q=P.current;if(!q)return;const te=oe.current,le=te===null||te.length!==t.length;le&&dt.current(n);const Ce=new Set(_.current),Ye=new Set(Ee);le&&Ye.add(n);for(const nt of Ye){const rn=!Ce.has(nt),Un=t[nt]!==(te==null?void 0:te[nt]);if(!le&&!rn&&!Un)continue;const jn=We(q,nt);jn&&Dn(nt,jn,t[nt]??"",{forceBodySync:le})}oe.current=t,_.current=Ee,le&&(xe!=null&&xe.current)&&(xe.current=!1);const fn=requestAnimationFrame(ut);return()=>cancelAnimationFrame(fn)},[n,t,xe,Dn,ut,Ee]),l.useLayoutEffect(()=>{const q=P.current;if(!q)return;const te=le=>{var Ce;(Ce=U.current)==null||Ce.call(U,le)};return q.addEventListener("beforeinput",te),()=>q.removeEventListener("beforeinput",te)},[]);const tt=l.useCallback((q,te)=>{var le;Rn(q),(le=V.current)==null||le.call(V,te)},[Rn]),Gr=l.useCallback((q,te)=>{G.current(q,te)},[]),qr=l.useCallback((q,te)=>{var le;(le=me.current)==null||le.call(me,q,te)},[]),Ze=l.useCallback((q,te)=>{const le=ry(t[q]??"",q),Ce=Math.max(te,le);Q.current.set(q,Ce),ct(q,Ce)},[ct,t]),xr=l.useCallback((q,te)=>{var le;(le=re.current)==null||le.call(re,q,te)},[]),Fe=l.useCallback((q,te)=>{var le;(le=de.current)==null||le.call(de,q,te)},[]),Oe=$("visualEditorAria"),Pt=l.useMemo(()=>Ee.map(q=>i.jsx(kE,{index:q,pageHtml:t[q]??"",showVerticalRuler:Be&&we(q),pageSized:we(q),geometry:St(q),rulerUnit:w,zoomScale:x,placeholder:g,disabled:y,visualEditorAria:Oe,onActivate:Rn,onPointerDown:tt,onPageChange:Gr,onPageFlush:qr,suppressPageFlushRef:xe,onMeasured:Ze,onMarginChange:xr,onMarginPreview:Fe,onMouseUp:T,onContextMenu:E,onRulerRefresh:ut},q)),[Rn,y,St,xr,Fe,Gr,qr,tt,Ze,E,T,we,t,g,ut,w,Be,Ee,Oe,x]);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:Be?"center":"stretch",width:"100%",height:"100%",minHeight:"100%",position:"relative"},children:[i.jsx(uy,{showRulers:Be,geometry:St(Y),indentState:mn,rulerUnit:w,zoomScale:x,onMarginChange:q=>{S==null||S(Y,q)},onMarginPreview:q=>{k==null||k(Y,q)},onIndentChange:q=>{v==null||v(q)}}),i.jsx("div",{className:Se.pageZoomContent,style:cy(x),children:i.jsxs("div",{ref:P,className:Se.multiPageContainer,style:{display:"flex",flexDirection:"column",alignItems:Be?"center":"stretch",width:"100%",minHeight:Be?void 0:"100%",position:"relative"},children:[et>0?i.jsx("div",{"aria-hidden":!0,style:{height:et,flexShrink:0}}):null,Pt,qe>0?i.jsx("div",{"aria-hidden":!0,style:{height:qe,flexShrink:0}}):null]})})]})});function AE(e,t,n){return r=>{const o=e();o&&n(o,t(),r)}}function TE(e,t,n,r){return o=>{const a=e();if(!a)return;const s=n(a,t(),o);r(s.pageHtml)}}function RE(e,t,n){return(r,o)=>{const a=e(r);a&&n(a,t(r),o)}}function DE(e,t,n,r){return(o,a)=>{const s=e(o);if(!s)return;const u=n(s,t(o),a);r(o,u.pageHtml)}}function Sp(e,t,n){return r=>{const o=e();o&&PI(o,{...r,unit:t})&&n(o)}}const jE="_field_1knrr_1",IE="_label_1knrr_8",EE="_button_1knrr_12",_E="_swatch_1knrr_37",ME="_swatchEmpty_1knrr_44",ii={field:jE,label:IE,button:EE,swatch:_E,swatchEmpty:ME};function Qt({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:o,fallbackCustom:a,onChange:s}){const u=l.useId(),d=l.useRef(null),f=l.useRef(null),h=l.useRef(null),[g,y]=l.useState(!1),b=Eo(g,f,h);l.useEffect(()=>{if(!g)return;const S=v=>{var j,D;const A=v.target;(j=d.current)!=null&&j.contains(A)||(D=h.current)!=null&&D.contains(A)||y(!1)},k=v=>{var A;v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),y(!1),(A=f.current)==null||A.focus())};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",k,!0),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",k,!0)}},[g]);const w=`${ii.swatch}${!n||r?` ${ii.swatchEmpty}`:""}`,x=n&&!r?{backgroundColor:n}:void 0;return i.jsxs("div",{className:ii.field,ref:d,children:[i.jsx("span",{className:ii.label,children:e}),i.jsx("button",{ref:f,type:"button",className:ii.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":g,"aria-controls":g?u:void 0,disabled:o,onClick:()=>y(S=>!S),children:i.jsx("span",{className:w,style:x})}),g?i.jsx(Pe,{children:i.jsx("div",{ref:h,id:u,className:_r.popover,style:{top:b.top,left:b.left,zIndex:1400},children:i.jsx(yd,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:o,fallbackCustom:a,onChange:s,onCommit:()=>y(!1)})})}):null]})}const Mc=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],NE={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function wd({tab:e,value:t,fonts:n,disabled:r,onTabChange:o,onChange:a}){const s=J(),u=l.useId(),d=l.useId(),f=n??Xp(),h=Mc.find(g=>g.id===e)??Mc[0];return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":s("fontDialogTitle"),children:Mc.map(g=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":g.id===e,disabled:!g.implemented,onClick:()=>o(g.id),children:s(g.labelKey)},g.id))}),i.jsx("div",{className:p.body,role:"tabpanel",children:h.implemented?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("fontDialogFamily")}),i.jsx(Gb,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:f,disabled:r,triggerId:d,onChange:g=>{a({...t,fontFamily:g,fontFamilyMixed:!1})}})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:s("fontDialogSize")}),i.jsx("div",{className:p.sizeRow,children:i.jsx(qb,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(g,y)=>{a({...t,size:g,unit:y})},onUnitChange:g=>{const y=t.size!==null?rg(t.size,t.unit,g,16,16):t.size;a({...t,size:y,unit:g})}})})]}),i.jsx("div",{className:p.field,children:i.jsx(Qt,{label:s("commandFontColor"),noneLabel:s("colorAutomatic"),value:t.fontColor,mixed:t.fontColorMixed,disabled:r,onChange:g=>{a({...t,fontColor:g,fontColorMixed:!1})}})}),i.jsx("div",{className:p.field,children:i.jsx(Qt,{label:s("commandHighlightColor"),noneLabel:s("colorNone"),value:t.highlightColor,mixed:t.highlightColorMixed,disabled:r,fallbackCustom:"#ffff00",onChange:g=>{a({...t,highlightColor:g,highlightColorMixed:!1})}})}),i.jsxs("fieldset",{className:p.marks,children:[i.jsx("legend",{className:p.label,children:s("fontDialogStyle")}),Jt.map(g=>i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.marks[g],disabled:r,onChange:()=>{a({...t,marks:{...t.marks,[g]:!t.marks[g]}})}}),s(NE[g].label)]},g))]})]}):null})]})}function LE({open:e,tab:t,size:n,unit:r,marks:o,fontFamily:a=null,fontFamilyMixed:s=!1,fontColor:u,fontColorMixed:d=!1,highlightColor:f,highlightColorMixed:h=!1,fonts:g,disabled:y,onTabChange:b,onApply:w,onClose:x}){const S=J(),k=l.useId(),v=l.useRef(null),[A,j]=l.useState({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:f,fontColorMixed:d,highlightColorMixed:h});return l.useEffect(()=>{e&&j({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:f,fontColorMixed:d,highlightColorMixed:h})},[e,n,r,o,a,s,u,d,f,h]),$e(v,{open:e,onClose:x}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:x,children:i.jsxs("div",{ref:v,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":k,onMouseDown:D=>D.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:k,children:S("fontDialogTitle")}),i.jsx(wd,{tab:t,value:A,fonts:g,disabled:y,onTabChange:b,onChange:j}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:x,children:S("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:y,onClick:()=>w(A),children:S("fontDialogOk")})]})]})})}):null}const BE={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Qe({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:o,inputId:a,onChange:s}){const u=J(),d=l.useId(),f=a??d,h=(t==null?void 0:t.unit)??Nu,[g,y]=l.useState(()=>t?be(t.value):""),[b,w]=l.useState(!1);l.useEffect(()=>{b||y(t?be(t.value):"")},[t,b]);const x=S=>{const k=S.trim();if(!k){s(null),y("");return}const v=xi(k,h,r);if(!v){y(t?be(t.value):"");return}s(v),y(be(v.value))};return i.jsxs("div",{className:p.lengthField,children:[i.jsx("label",{className:p.sideLabel,htmlFor:f,children:e}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:f,className:p.lengthInput,value:g,disabled:n,inputMode:"decimal",onFocus:()=>w(!0),onBlur:()=>{w(!1),x(g)},onChange:S=>y(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),x(g),S.currentTarget.blur())}}),i.jsx("select",{className:p.lengthUnit,value:h,disabled:n,"aria-label":o??u("paragraphDialogLengthUnitAria"),onChange:S=>{const k=S.target.value;if(t){s({value:t.value,unit:k});return}if(g.trim()){const v=xi(g,k,r);s(v)}},children:Eu.map(S=>i.jsx("option",{value:S,children:u(BE[S])},S))})]})]})}function Cd({shadow:e,disabled:t,onChange:n}){const r=J();return i.jsxs("div",{className:p.shadowGrid,children:[i.jsx(Qe,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetX:o??{value:0,unit:"px"}})}}),i.jsx(Qe,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetY:o??{value:0,unit:"px"}})}}),i.jsx(Qe,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:o=>{n({...e,blur:o??{value:0,unit:"px"}})}}),i.jsx(Qe,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:o=>{n({...e,spread:o??{value:0,unit:"px"}})}}),i.jsx(Qt,{label:r("paragraphDialogShadowColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:o=>{n({...e,color:o})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:e.inset,disabled:t,onChange:()=>{n({...e,inset:!e.inset})}}),r("paragraphDialogShadowInset")]})]})}const my=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],fy=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],FE={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},HE={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function py({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const o=J(),a=l.useId(),s=l.useId();return i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:o(e)}),i.jsx(zE,{value:t.opacity,disabled:n,onChange:u=>{r({...t,opacity:u})}}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:o("imagePropertiesFit")}),i.jsxs("select",{id:a,className:p.select,value:t.fit??"",disabled:n,onChange:u=>{const d=u.target.value;r({...t,fit:d||null})},children:[i.jsx("option",{value:"",children:o("imagePropertiesFitDefault")}),Ju.map(u=>i.jsx("option",{value:u,children:o(FE[u])},u))]})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:o("imagePropertiesPosition")}),i.jsxs("select",{id:s,className:p.select,value:t.position??"",disabled:n,onChange:u=>{r({...t,position:u.target.value||null})},children:[i.jsx("option",{value:"",children:o("imagePropertiesPositionDefault")}),Qu.map(u=>i.jsx("option",{value:u,children:o(HE[u])},u))]})]})]})}function zE({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=e===null?null:as(e),[s,u]=l.useState(()=>a===null?"":be(a)),[d,f]=l.useState(!1);l.useEffect(()=>{d||u(a===null?"":be(a))},[a,d]);const h=g=>{const y=g.trim();if(!y){n(null),u("");return}const b=Number(y.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":be(a));return}const w=wg(b);n(w),u(be(as(w)))};return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>f(!0),onChange:g=>u(g.target.value),onBlur:()=>{f(!1),h(s)}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const OE={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function Ps({label:e,inputAria:t,value:n,disabled:r,onChange:o}){const a=J(),s=l.useId(),u=l.useId(),d=l.useRef(null),f=l.useRef(null),h=l.useRef(null),g=(n==null?void 0:n.unit)??Wv,[y,b]=l.useState(()=>n?be(n.value):""),[w,x]=l.useState(!1),[S,k]=l.useState(!1),v=Eo(S,f,h,{matchAnchorWidth:!0,minWidth:72});l.useEffect(()=>{w||b(n?be(n.value):"")},[n,w]),l.useEffect(()=>{if(!S)return;const T=N=>{var $,P;const K=N.target;($=d.current)!=null&&$.contains(K)||(P=h.current)!=null&&P.contains(K)||k(!1)},E=N=>{N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",E,!0),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",E,!0)}},[S]);const A=T=>{const E=T.trim();if(!E){o(null),b("");return}const N=Af(E,g);if(!N){b(n?be(n.value):"");return}o(N),b(be(N.value))},j=Gv[g],D=(n==null?void 0:n.value)??null,R=S?i.jsx(Pe,{children:i.jsx("ul",{ref:h,className:Ve.list,role:"listbox",id:s,style:{top:v.top,left:v.left,minWidth:v.width},children:j.map(T=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ve.option,role:"option","aria-selected":D===T,onMouseDown:E=>E.preventDefault(),onClick:()=>{o({value:T,unit:g}),b(be(T)),k(!1)},children:be(T)})},T))})}):null;return i.jsxs("div",{className:p.lengthField,children:[i.jsx("label",{className:p.sideLabel,htmlFor:u,children:e}),i.jsxs("div",{className:`${Ve.wrap} ${p.lengthRow}`,ref:d,children:[i.jsxs("div",{className:Ve.field,ref:f,children:[i.jsx("input",{id:u,className:Ve.input,value:y,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":S,"aria-controls":s,role:"combobox",inputMode:"decimal",onFocus:()=>x(!0),onBlur:()=>{x(!1),A(y)},onChange:T=>b(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.preventDefault(),A(y),k(!1),T.currentTarget.blur()),T.key==="ArrowDown"&&(T.preventDefault(),k(!0))}}),i.jsx("button",{type:"button",className:Ve.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":S,"aria-controls":s,onMouseDown:T=>T.preventDefault(),onClick:()=>k(T=>!T)})]}),i.jsxs("div",{className:Ve.field,children:[i.jsx("select",{className:Ve.unit,value:g,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:T=>{const E=T.target.value;if(n){o({value:n.value,unit:E});return}y.trim()&&o(Af(y,E))},children:eh.map(T=>i.jsx("option",{value:T,children:a(OE[T])},T))}),i.jsx("span",{className:Ve.chevron,"aria-hidden":"true"})]}),R]})]})}const KE={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},$E={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function UE(e,t,n){return t&&n?"custom":e.startsWith("data:")?"file":e.trim()?"url":"file"}function gy({src:e,disabled:t,customImagePicker:n,disableBuiltinSources:r=!1,onSrcChange:o,onCustomPick:a,onSourceChange:s}){const u=J(),d=l.useId(),f=l.useId(),h=l.useRef(null),g=r&&!!n,[y,b]=l.useState(()=>UE(e,r,n)),[w,x]=l.useState(()=>e.startsWith("data:")?"":e),[S,k]=l.useState(""),[v,A]=l.useState(null),[j,D]=l.useState(!1);l.useEffect(()=>{s==null||s(y)},[s,y]),l.useEffect(()=>{g&&b("custom")},[g]);const R=y==="file"&&e.startsWith("data:")?e:y==="url"?w:"",T=y==="custom"?null:Sn(R),E=y==="custom"?null:y==="file"&&v?$E[v]:T&&(y==="file"||w.trim().length>0)?KE[T]:null,N=()=>{t||!n||a==null||a()},K=$=>{var F;const P=(F=$.target.files)==null?void 0:F[0];P&&(D(!0),A(null),Bv(P).then(U=>{k(P.name),b("file"),o(U),D(!1)},U=>{const G=U instanceof Error?U.message:"";k(""),b("file"),A(G==="tooLarge"||G==="type"?G:"type"),D(!1),h.current&&(h.current.value="")}))};return i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:u("imageDialogSource")}),g?null:i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":u("imageDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="file",disabled:t,onClick:()=>b("file"),children:u("imageDialogFile")}),i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>b("url"),children:u("imageDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),y==="file"?i.jsxs("div",{className:p.fileRow,children:[i.jsx("input",{ref:h,type:"file",accept:Iv,hidden:!0,disabled:t,"aria-label":u("imageDialogChooseFile"),onChange:K}),i.jsx("button",{type:"button",className:p.action,disabled:t||j,onClick:()=>{var $;return($=h.current)==null?void 0:$.click()},children:u("imageDialogChooseFile")}),S?i.jsx("span",{className:p.fileName,children:S}):null,e.startsWith("data:")&&!S?i.jsx("span",{className:p.fileName,children:u("pageBackgroundImageCurrent")}):null]}):null,y==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:u("imageDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:w,disabled:t,"aria-invalid":E!==null,"aria-describedby":E?f:void 0,onChange:$=>{const P=$.target.value;x(P),o(P.trim())}})]}):null,(g||y==="custom")&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:N,children:n.buttonCaption})]}):null,E?i.jsx("p",{id:f,className:p.error,children:u(E)}):null]})}function VE(e){return Sn(e.trim())===null}function WE(e){return ah(e)?{width:null,height:null}:e==="fill"?{width:{...yo},height:{...yo}}:{width:{...yo},height:null}}function GE({value:e,disabled:t,customImagePicker:n,disableBuiltinSources:r,onCustomImagePick:o,onChange:a}){const s=J(),u=e.src??"",d=(f,h)=>{a({...e,fit:null,[f]:h})};return i.jsxs(i.Fragment,{children:[u?i.jsxs("div",{className:p.field,children:[i.jsx("span",{className:p.label,children:s("pageBackgroundImagePreview")}),i.jsx("img",{className:p.previewImage,src:u,alt:s("pageBackgroundImagePreviewAlt")}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:()=>{a({...e,src:null})},children:s("pageBackgroundImageClear")})]}):null,i.jsx(gy,{src:u,disabled:t,customImagePicker:n,disableBuiltinSources:r,onCustomPick:o,onSrcChange:f=>{a({...e,src:f.trim()||null})}}),u?i.jsxs(i.Fragment,{children:[i.jsx(Ps,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:f=>d("width",f)}),i.jsx(Ps,{label:s("imagePropertiesHeight"),inputAria:s("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:f=>d("height",f)}),i.jsx(py,{legendKey:"pageDialogTabBackgroundImage",value:{opacity:e.opacity,fit:e.fit,position:e.position},disabled:t,onChange:f=>{const h=f.fit===e.fit?{width:e.width,height:e.height}:WE(f.fit);a({...e,opacity:f.opacity,fit:f.fit,position:f.position,...h})}})]}):null]})}const qE={left:Ts,center:As,right:Rs,justify:Ep},ZE={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},YE={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},XE={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},JE={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},QE={value:1,unit:"pt"},e_={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1},t_={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid"},Pp={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid",page:"paragraphDialogBreakPage"};function ai(e){return{top:e,right:e,bottom:e,left:e}}function Ap(e){for(const t of st)if(e[t])return e[t];return null}function n_(){const e=[...my];for(const t of fy)e.some(n=>n.id===t.id)||e.push(t);return e}function vd({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:o="paragraphDialogTitle",backgroundImage:a,customImagePicker:s,disableBuiltinBackgroundImageSources:u,onCustomImagePick:d,onBackgroundImageChange:f,onTabChange:h,onChange:g}){var K,$;const y=J(),b=pd(),w=new Set([...((K=b==null?void 0:b.hiddenDialogTabs)==null?void 0:K.paragraph)??[],...r?(($=b==null?void 0:b.hiddenDialogTabs)==null?void 0:$.page)??[]:[]]),S=(r?n_().filter(P=>r.includes(P.id)):my).filter(P=>!w.has(P.id)),k=l.useId(),v=l.useId(),A=l.useId(),j=l.useId(),[D,R]=l.useState(()=>On(t.margin,ai(t.margin.top))),[T,E]=l.useState(()=>On(t.padding,ai(t.padding.top))),N=(P,F,U,G)=>{const me=t[P],se=F?ai(G):{...me,[U]:G};g({...t,[P]:se,[`${P}Mixed`]:!1})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":y(o),children:S.map(P=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":P.id===e,disabled:!P.implemented,onClick:()=>h(P.id),children:y(P.labelKey)},P.id))}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[e==="general"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":y("paragraphDialogAlignment"),children:Yh.map(P=>{const F=qE[P],U=!t.alignMixed&&t.align===P;return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":U,"aria-label":y(ZE[P].aria),disabled:n,onClick:()=>{g({...t,align:P,alignMixed:!1})},children:i.jsx(F,{})},P)})})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogLists")}),i.jsxs("div",{className:p.iconRow,children:[i.jsx("button",{type:"button",className:p.iconButton,"aria-pressed":!t.listMixed&&t.list==="ul","aria-label":y("commandBulletListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ul"?null:"ul";g({...t,list:P,listMixed:!1})},children:i.jsx(_p,{})}),i.jsx("button",{type:"button",className:p.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":y("commandNumberedListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ol"?null:"ol";g({...t,list:P,listMixed:!1})},children:i.jsx(Fp,{})})]})]})]}):null,e==="spacing"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogSpacing")}),i.jsx(Tp,{legend:y("paragraphDialogMargin"),sides:t.margin,linked:D,disabled:n,allowNegative:!0,onLinkedChange:P=>{R(P),P&&g({...t,margin:ai(Ap(t.margin)),marginMixed:!1})},onSideChange:(P,F)=>N("margin",D,P,F)}),i.jsx(Tp,{legend:y("paragraphDialogPadding"),sides:t.padding,linked:T,disabled:n,onLinkedChange:P=>{E(P),P&&g({...t,padding:ai(Ap(t.padding)),paddingMixed:!1})},onSideChange:(P,F)=>N("padding",T,P,F)}),i.jsx(o_,{value:t.lineHeight,disabled:n,onChange:P=>{g({...t,lineHeight:P,lineHeightMixed:!1})}}),i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:y("paragraphDialogPageBreaks")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:v,children:y("paragraphDialogBreakInside")}),i.jsx("select",{id:v,className:p.select,value:t.breakInsideMixed?"auto":t.breakInside,disabled:n,onChange:P=>{g({...t,breakInside:P.target.value,breakInsideMixed:!1})},children:mg.map(P=>i.jsx("option",{value:P,children:y(t_[P])},P))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:A,children:y("paragraphDialogBreakAfter")}),i.jsx("select",{id:A,className:p.select,value:t.breakAfterMixed?"auto":t.breakAfter,disabled:n,onChange:P=>{g({...t,breakAfter:P.target.value,breakAfterMixed:!1})},children:Gc.map(P=>i.jsx("option",{value:P,children:y(Pp[P])},P))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:j,children:y("paragraphDialogBreakBefore")}),i.jsx("select",{id:j,className:p.select,value:t.breakBeforeMixed?"auto":t.breakBefore,disabled:n,onChange:P=>{g({...t,breakBefore:P.target.value,breakBeforeMixed:!1})},children:Gc.map(P=>i.jsx("option",{value:P,children:y(Pp[P])},P))})]})]})]}):null,e==="border"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:k,children:y("paragraphDialogBorderStyle")}),i.jsx("select",{id:k,className:p.select,value:t.border.style,disabled:n,onChange:P=>{const F=P.target.value;g({...t,border:{style:F,width:F==="none"?null:t.border.width??QE,color:F==="none"?null:t.border.color},borderMixed:!1})},children:Es.map(P=>i.jsx("option",{value:P,children:y(XE[P])},P))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Qe,{label:y("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:P=>{g({...t,border:{...t.border,width:P},borderMixed:!1})}}),i.jsx(Qt,{label:y("paragraphDialogBorderColor"),noneLabel:y("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:P=>{g({...t,border:{...t.border,color:P},borderMixed:!1})}})]}):null,i.jsx(Qe,{label:y("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:P=>{g({...t,borderRadius:P,radiusMixed:!1})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{g({...t,boxShadow:t.boxShadow?null:e_,shadowMixed:!1})}}),y("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(Cd,{shadow:t.boxShadow,disabled:n,onChange:P=>{g({...t,boxShadow:P,shadowMixed:!1})}}):null]}):null,e==="background"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogTabBackground")}),i.jsx(Qt,{label:y("paragraphDialogBackgroundColor"),noneLabel:y("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:P=>{g({...t,backgroundColor:P,backgroundMixed:!1})}}),i.jsx(r_,{value:t.opacity,disabled:n,onChange:P=>{g({...t,opacity:P,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&f?i.jsx(GE,{value:a,disabled:n,customImagePicker:s,disableBuiltinSources:u,onCustomImagePick:d,onChange:f}):null]})]})}function r_({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=e===null?null:as(e),[s,u]=l.useState(()=>a===null?"":be(a)),[d,f]=l.useState(!1);l.useEffect(()=>{d||u(a===null?"":be(a))},[a,d]);const h=g=>{const y=g.trim();if(!y){n(null),u("");return}const b=Number(y.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":be(a));return}const w=wg(b);n(w),u(be(as(w)))};return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>f(!0),onChange:g=>u(g.target.value),onBlur:()=>{f(!1),h(s)}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function Tp({legend:e,sides:t,linked:n,disabled:r,allowNegative:o=!1,onLinkedChange:a,onSideChange:s}){const u=J(),d=n?["top"]:st;return i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:e}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:()=>a(!n)}),u("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:d.map(f=>i.jsx(Qe,{label:n?e:u(YE[f]),value:t[f],disabled:r,allowNegative:o,onChange:h=>s(f,h)},f))})]})}function o_({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=i_(e),s=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,d]=l.useState(()=>s===null?"":be(s)),f=(e==null?void 0:e.kind)==="length"?e.unit:Nu;return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogLineHeight")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:a==="normal"?"":u,disabled:t||a==="normal",inputMode:"decimal",onChange:h=>d(h.target.value),onBlur:()=>{const h=u.trim();if(!h){n(null);return}if(a==="number"||a==="empty"){const y=Number(h.replace(",","."));if(!Number.isFinite(y)||y<0){d(s===null?"":be(s));return}n({kind:"number",value:y}),d(be(y));return}const g=xi(h,f,!1);if(!g){d(s===null?"":be(s));return}n({kind:"length",value:g.value,unit:g.unit}),d(be(g.value))}}),i.jsxs("select",{className:p.lengthUnit,value:a==="length"?f:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:h=>{const g=h.target.value;if(g==="empty"){n(null),d("");return}if(g==="normal"){n({kind:"normal"}),d("");return}if(g==="number"){const x=Number((u||"1.5").replace(",",".")),S=Number.isFinite(x)&&x>=0?x:1.5;n({kind:"number",value:S}),d(be(S));return}const y=g,b=xi(u||"1",y,!1),w=(b==null?void 0:b.value)??1;n({kind:"length",value:w,unit:y}),d(be(w))},children:[i.jsx("option",{value:"empty"}),i.jsx("option",{value:"normal",children:r("paragraphDialogLineHeightNormal")}),i.jsx("option",{value:"number",children:r("paragraphDialogLineHeightUnitless")}),["pt","px","em","rem","%"].map(h=>i.jsx("option",{value:h,children:r(JE[h])},h))]})]})]})}function i_(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}function a_({open:e,tab:t,value:n,backgroundImage:r,disabled:o,customImagePicker:a,disableBuiltinBackgroundImageSources:s,onCustomImagePick:u,onTabChange:d,onApply:f,onClose:h}){const g=J(),y=l.useId(),b=l.useRef(null),[w,x]=l.useState(n),[S,k]=l.useState(r);return l.useEffect(()=>{e&&(x(n),k(r??vn()))},[e,n,r]),$e(b,{open:e,onClose:h,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:h,children:i.jsxs("div",{ref:b,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":y,onMouseDown:v=>v.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:y,children:g("paragraphDialogTitle")}),i.jsx(vd,{tab:t,value:w,disabled:o,backgroundImage:S,customImagePicker:a,disableBuiltinBackgroundImageSources:s,onCustomImagePick:u,onBackgroundImageChange:k,onTabChange:d,onChange:x}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:h,children:g("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>f({value:w,backgroundImage:S}),children:g("fontDialogOk")})]})]})})}):null}const s_=["auto","A4","letter","legal","custom"],l_={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},c_={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function Rp(e){return e===null?"":be(e.value)}function u_({value:e,disabled:t,onChange:n,onReset:r}){const o=J(),a=l.useId(),[s,u]=l.useState(!0),d=e??or(),f=(h,g)=>{if(s){n({...d,margin:{top:g,right:g,bottom:g,left:g},marginMixed:!1});return}n({...d,margin:{...d.margin,[h]:g},marginMixed:!1})};return i.jsxs("div",{className:p.body,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:o("pageAtRuleSize")}),i.jsx("select",{id:a,className:p.select,disabled:t,value:d.sizePreset,onChange:h=>n({...d,sizePreset:h.target.value}),children:s_.map(h=>i.jsx("option",{value:h,children:o(l_[h])},h))})]}),d.sizePreset==="custom"?i.jsxs("div",{className:p.sideGrid,children:[i.jsx(Nc,{label:o("pageAtRuleWidth"),value:d.customWidth,disabled:t,onChange:h=>n({...d,customWidth:h})}),i.jsx(Nc,{label:o("pageAtRuleHeight"),value:d.customHeight,disabled:t,onChange:h=>n({...d,customHeight:h})})]}):null,i.jsxs("div",{className:p.field,children:[i.jsx("span",{className:p.label,children:o("pageAtRuleOrientation")}),i.jsx("div",{className:p.marks,children:[["none","pageAtRuleOrientationNone"],["portrait","pageAtRuleOrientationPortrait"],["landscape","pageAtRuleOrientationLandscape"]].map(([h,g])=>i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"radio",name:"page-orientation",checked:(d.orientation??"none")===h,disabled:t,onChange:()=>n({...d,orientation:h==="none"?null:h})}),o(g)]},h))})]}),i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:o("pageAtRuleMargins")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:s,disabled:t,onChange:()=>u(!s)}),o("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(s?["top"]:st).map(h=>i.jsx(Nc,{label:o(s?"pageAtRuleMargins":c_[h]),value:d.margin[h],disabled:t,onChange:g=>f(h,g)},h))})]}),i.jsx("div",{className:p.actions,children:i.jsx("button",{type:"button",className:p.action,disabled:t,"aria-label":o("pageAtRuleResetAria"),onClick:r,children:o("pageAtRuleReset")})})]})}function Nc({label:e,value:t,disabled:n,onChange:r}){const o=J(),a=l.useId(),[s,u]=l.useState(()=>Rp(t)),d=(t==null?void 0:t.unit)??Nu;return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:e}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:a,className:p.lengthInput,value:s,disabled:n,inputMode:"decimal",onChange:f=>u(f.target.value),onBlur:()=>{const f=s.trim();if(!f){r(null);return}const h=xi(f,d,!1);if(!h){u(Rp(t));return}r(h),u(be(h.value))}}),i.jsxs("select",{className:p.lengthUnit,disabled:n,value:d,"aria-label":o("paragraphDialogLengthUnitAria"),onChange:f=>{const h=f.target.value;t&&r({...t,unit:h})},children:[i.jsx("option",{value:"pt",children:o("fontSizeUnitPt")}),i.jsx("option",{value:"px",children:o("fontSizeUnitPx")}),i.jsx("option",{value:"em",children:o("fontSizeUnitEm")}),i.jsx("option",{value:"rem",children:o("fontSizeUnitRem")}),i.jsx("option",{value:"%",children:o("fontSizeUnitPercent")})]})]})]})}const d_=fy.map(e=>e.id);function m_(e){return{...Br(),...e}}function f_(e){const{align:t,alignMixed:n,list:r,listMixed:o,...a}=e;return a}function p_({open:e,tab:t,value:n,fonts:r,disabled:o,printTabVisible:a=!1,initialParagraphTab:s="spacing",customImagePicker:u,disableBuiltinBackgroundImageSources:d,onCustomImagePick:f,onTabChange:h,onApply:g,onResetAtRule:y,onClose:b}){const w=J(),x=l.useId(),S=l.useRef(null),[k,v]=l.useState("general"),[A,j]=l.useState("spacing"),[D,R]=l.useState(n.font),[T,E]=l.useState(n.box),[N,K]=l.useState(n.backgroundImage),[$,P]=l.useState(n.atRule??or());if(l.useEffect(()=>{e&&(v("general"),j(s==="general"?"spacing":s),R(n.font),E(n.box),K(n.backgroundImage??vn()),P(n.atRule??or()),t==="print"&&!a&&h("font"))},[e,n,t,a,s,h]),$e(S,{open:e,onClose:b,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const F=w("pageDialogTitle"),U=t==="print"&&!a?"font":t;return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:b,children:i.jsxs("div",{ref:S,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":x,onMouseDown:G=>G.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:x,children:F}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":F,children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":U==="font",onClick:()=>h("font"),children:w("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":U==="paragraph",onClick:()=>h("paragraph"),children:w("customStyleDialogTabParagraph")}),a?i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":U==="print",onClick:()=>h("print"),children:w("pageDialogTabPrint")}):null]}),U==="font"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(wd,{tab:k,value:D,fonts:r,disabled:o,onTabChange:v,onChange:R})}):U==="paragraph"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(vd,{tab:A,value:m_(T),disabled:o,tabs:d_,tablistLabelKey:"pageDialogTitle",backgroundImage:N,customImagePicker:u,disableBuiltinBackgroundImageSources:d,onCustomImagePick:f,onBackgroundImageChange:K,onTabChange:G=>{G!=="general"&&j(G)},onChange:G=>E(f_(G))})}):i.jsx("div",{className:p.nestedPanel,children:i.jsx(u_,{value:$,disabled:o,onChange:P,onReset:()=>{P(or()),y==null||y()}})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:b,children:w("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>g({font:D,box:T,backgroundImage:N,atRule:a?$:n.atRule??or()}),children:w("fontDialogOk")})]})]})})})}function g_({open:e,disabled:t,onClose:n,onConfirm:r}){const o=J(),a=l.useId(),s=l.useRef(null);if(l.useEffect(()=>{if(!e)return;const d=s.current;if(!d)return;const f=d.querySelector('button:not([disabled]):not([tabindex="-1"])');f==null||f.focus();const h=g=>{g.key==="Escape"&&(g.preventDefault(),n())};return document.addEventListener("keydown",h,!0),()=>document.removeEventListener("keydown",h,!0)},[e,n]),!e)return null;const u=!!t;return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:s,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:a,children:o("deletePageDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":o("deletePageDialogCloseAria"),onClick:n,children:i.jsx(Ge,{})})]}),i.jsx("div",{className:p.confirmBody,children:o("deletePageConfirmMessage")}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:u,onClick:n,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:u,onClick:r,children:o("commandDeletePage")})]})]})})})}function h_(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Dp(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 b_(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 y_({open:e,mode:t,styleId:n,name:r="",font:o,paragraph:a,canDelete:s=!1,busy:u,disabled:d,fonts:f,defaultOuterTab:h="font",onSave:g,onDelete:y,onClose:b}){const w=J(),x=l.useId(),S=l.useId(),k=l.useRef(null),[v,A]=l.useState(r),[j,D]=l.useState(h),[R,T]=l.useState("general"),[E,N]=l.useState("general"),[K,$]=l.useState(()=>Dp(o)),[P,F]=l.useState(()=>mu(a)),[U,G]=l.useState(!1);l.useEffect(()=>{e&&(A(r),D(h),T("general"),N("general"),$(Dp(o)),F(mu(a)),G(!1))},[e,r,o,a,h]);const me=l.useCallback(()=>{if(U){G(!1);return}b()},[U,b]);if($e(k,{open:e,onClose:me,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const se=w(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),V=v.trim().length>0,re=!!(d||u),de=()=>{const oe=v.trim();oe&&g({id:n??h_(),name:oe,font:b_(K),paragraph:eb(P)})};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:b,children:i.jsxs("div",{ref:k,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":x,"aria-busy":u||void 0,onMouseDown:oe=>oe.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:x,children:se}),i.jsx("button",{type:"button",className:p.close,"aria-label":w("customStyleDialogCloseAria"),onClick:b,children:i.jsx(Ge,{})})]}),U?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.confirmBody,children:w("customStyleDialogDeleteConfirm")}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:re,onClick:()=>G(!1),children:w("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:re||!n,onClick:()=>{n&&(y==null||y(n))},children:w("customStyleDialogDelete")})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.nameSection,children:i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:S,children:w("customStyleDialogName")}),i.jsx("input",{id:S,className:p.nameInput,value:v,disabled:re,onChange:oe=>A(oe.target.value)})]})}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":se,children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":j==="font",onClick:()=>D("font"),children:w("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":j==="paragraph",onClick:()=>D("paragraph"),children:w("customStyleDialogTabParagraph")})]}),j==="font"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(wd,{tab:R,value:K,fonts:f,disabled:re,onTabChange:T,onChange:$})}):i.jsx("div",{className:p.nestedPanel,children:i.jsx(vd,{tab:E,value:P,disabled:re,onTabChange:N,onChange:F})}),i.jsxs("div",{className:t==="edit"&&s?`${p.actions} ${p.actionsSpread}`:p.actions,children:[t==="edit"&&s?i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:re,onClick:()=>G(!0),children:w("customStyleDialogDelete")}):null,i.jsxs("div",{className:p.actionsEnd,children:[i.jsx("button",{type:"button",className:p.action,onClick:b,children:w("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:re||!V,onClick:de,children:w("fontDialogOk")})]})]})]})]})})})}function x_({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useId(),d=l.useRef(null),f=l.useRef(null),[h,g]=l.useState(t);if(l.useEffect(()=>{e&&g(t)},[e,t]),$e(d,{open:e,onClose:o,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),l.useEffect(()=>{var b;e&&((b=f.current)==null||b.focus())},[e]),!e)return null;const y=()=>{n||r(h)};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:d,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("customCssDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("customCssDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx("div",{className:p.body,children:i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:a("customCssDialogField")}),i.jsx("textarea",{ref:f,id:u,className:p.textarea,value:h,disabled:n,spellCheck:!1,"aria-label":a("customCssDialogFieldAria"),rows:8,onChange:b=>g(b.target.value)})]})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:y,children:a("fontDialogOk")})]})]})})})}const w_={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function C_({open:e,existingIds:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useId(),d=l.useId(),f=l.useRef(null),[h,g]=l.useState(""),[y,b]=l.useState(!1),w=l.useMemo(()=>new Set(t),[t]),x=ab(h,w);if(l.useEffect(()=>{e&&(g(""),b(!1))},[e]),$e(f,{open:e,onClose:o,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const S=y||h.trim().length>0?x:null,k=x===null&&!n,v=()=>{b(!0),!(x||n)&&r(h.trim())};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:f,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:A=>A.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("bookmarkDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx("div",{className:p.body,children:i.jsxs("div",{className:p.field,children:[i.jsxs("div",{className:p.labelRow,children:[i.jsx("label",{className:p.label,htmlFor:u,children:a("bookmarkDialogName")}),i.jsx(pr,{label:a("bookmarkDialogHelp"),elevated:!0,children:i.jsx("button",{type:"button",className:p.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),i.jsx("input",{id:u,className:p.textInput,value:h,disabled:n,"aria-invalid":S!==null,"aria-describedby":S?d:void 0,onChange:A=>g(A.target.value)}),S?i.jsx("p",{id:d,className:p.error,children:a(w_[S])}):null]})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!k,onClick:v,children:a("fontDialogOk")})]})]})})})}const v_={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},k_={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function S_({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=J(),u=l.useId(),d=l.useId(),f=l.useId(),h=l.useId(),g=l.useRef(null),y=l.useRef(null),[b,w]=l.useState("file"),[x,S]=l.useState(""),[k,v]=l.useState(""),[A,j]=l.useState(""),[D,R]=l.useState(""),[T,E]=l.useState(null),[N,K]=l.useState(!1);if(l.useEffect(()=>{e&&(w("file"),S(""),v(""),j(""),R(""),E(null),K(!1),y.current&&(y.current.value=""))},[e]),$e(g,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const $=b==="file"?k:b==="url"?x:"",P=b==="custom"?null:fd($),F=b==="custom"?null:b==="file"&&T?k_[T]:P&&(b==="file"||x.trim().length>0)?v_[P]:null,U=b!=="custom"&&P===null&&!(b==="file"&&T)&&!t&&!N,G=()=>{t||!n||o==null||o()},me=()=>{U&&r({src:$.trim(),title:D.trim()})},se=V=>{var de;const re=(de=V.target.files)==null?void 0:de[0];re&&(K(!0),E(null),l0(re).then(oe=>{v(oe),j(re.name),w("file"),K(!1)},oe=>{const _=oe instanceof Error?oe.message:"";v(""),j(""),w("file"),E(_==="tooLarge"||_==="type"?_:"type"),K(!1),y.current&&(y.current.value="")}))};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:g,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:V=>V.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("audioDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("audioDialogCloseAria"),onClick:a,children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="file",disabled:t,onClick:()=>w("file"),children:s("audioDialogFile")}),i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="url",disabled:t,onClick:()=>w("url"),children:s("audioDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="custom",disabled:t,onClick:()=>w("custom"),children:n.text}):null]}),b==="file"?i.jsxs("div",{className:p.fileRow,children:[i.jsx("input",{ref:y,type:"file",accept:t0,hidden:!0,disabled:t,"aria-label":s("audioDialogChooseFile"),onChange:se}),i.jsx("button",{type:"button",className:p.action,disabled:t||N,onClick:()=>{var V;return(V=y.current)==null?void 0:V.click()},children:s("audioDialogChooseFile")}),A?i.jsx("span",{className:p.fileName,children:A}):null]}):null,b==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("audioDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:x,disabled:t,"aria-invalid":F!==null,"aria-describedby":F?h:void 0,onChange:V=>S(V.target.value)})]}):null,b==="custom"&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:G,children:n.buttonCaption})]}):null]}),b!=="custom"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("audioDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:D,disabled:t,onChange:V=>R(V.target.value)})]}):null,F?i.jsx("p",{id:h,className:p.error,children:s(F)}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),b!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!U,onClick:me,children:s("fontDialogOk")}):null]})]})})})}function P_({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=J(),u=l.useId(),d=l.useId(),f=l.useId(),h=l.useRef(null),[g,y]=l.useState(""),[b,w]=l.useState(""),[x,S]=l.useState(""),[k,v]=l.useState("file");if(l.useEffect(()=>{e&&(y(""),w(""),S(""),v("file"))},[e]),$e(h,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const A=VE(g)&&!t,j=()=>{A&&r({src:g.trim(),alt:b.trim(),title:x.trim()})};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:h,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:D=>D.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("imageDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("imageDialogCloseAria"),onClick:a,children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsx(gy,{src:g,disabled:t,customImagePicker:n,onCustomPick:o,onSourceChange:v,onSrcChange:y}),k!=="custom"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("imageDialogAlt")}),i.jsx("input",{id:d,className:p.textInput,value:b,disabled:t,onChange:D=>w(D.target.value)})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("imageDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:x,disabled:t,onChange:D=>S(D.target.value)})]})]}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),k!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!A,onClick:j,children:s("fontDialogOk")}):null]})]})})})}const A_=[{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}],T_={left:Ts,center:As,right:Rs},R_=["left","center","right"],D_={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},j_=["width","height","lock"],I_={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},E_={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},__={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},M_={value:1,unit:"pt"},N_={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 Lc(e){return{top:e,right:e,bottom:e,left:e}}function L_(e){for(const t of st)if(e[t])return e[t];return null}function B_({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:o,onChange:a}){const s=J(),u=l.useId(),d=l.useId(),f=l.useId(),[h,g]=l.useState(()=>On(t.margin,Lc(t.margin.top))),y=t.align==="center",b=(x,S)=>{if(t.sizeMode==="lock"&&S){const k=gi(x,S,n);a({...t,width:k.width,height:k.height});return}a({...t,[x]:S})},w=x=>{if(x==="width"){a({...t,sizeMode:x,height:null});return}if(x==="height"){a({...t,sizeMode:x,width:null});return}if(t.width){const S=gi("width",t.width,n);a({...t,sizeMode:x,width:S.width,height:S.height});return}if(t.height){const S=gi("height",t.height,n);a({...t,sizeMode:x,width:S.width,height:S.height});return}a({...t,sizeMode:x})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":s("imagePropertiesDialogTitle"),children:A_.map(x=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":x.id===e,disabled:!x.implemented,onClick:()=>o(x.id),children:s(x.labelKey)},x.id))}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[e==="general"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesSize")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":s("imagePropertiesSizeMode"),children:j_.map(x=>i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":t.sizeMode===x,disabled:r,onClick:()=>w(x),children:s(I_[x])},x))}),i.jsx(Ps,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:x=>b("width",x)}),i.jsx(Ps,{label:s("imagePropertiesHeight"),inputAria:s("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:x=>b("height",x)})]}):null,e==="alignment"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":s("paragraphDialogAlignment"),children:R_.map(x=>{const S=T_[x];return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":t.align===x,"aria-label":s(D_[x]),disabled:r,onClick:()=>{a({...t,align:t.align===x?null:x})},children:i.jsx(S,{})},x)})})]}):null,e==="border"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogMargin")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:h,disabled:r||y,onChange:()=>{const x=!h;g(x),x&&a({...t,margin:Lc(L_(t.margin))})}}),s("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(h?["top"]:st).map(x=>i.jsx(Qe,{label:s(h?"paragraphDialogMargin":E_[x]),value:t.margin[x],disabled:r||y&&(x==="left"||x==="right"),allowNegative:!0,onChange:S=>{const k=h?Lc(S):{...t.margin,[x]:S};a({...t,margin:k})}},x))})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:s("paragraphDialogBorderStyle")}),i.jsx("select",{id:u,className:p.select,value:t.border.style,disabled:r,onChange:x=>{const S=x.target.value;a({...t,border:{style:S,width:S==="none"?null:t.border.width??M_,color:S==="none"?null:t.border.color}})},children:Es.map(x=>i.jsx("option",{value:x,children:s(__[x])},x))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Qe,{label:s("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:x=>{a({...t,border:{...t.border,width:x}})}}),i.jsx(Qt,{label:s("paragraphDialogBorderColor"),noneLabel:s("colorNone"),value:t.border.color,disabled:r,onChange:x=>{a({...t,border:{...t.border,color:x}})}})]}):null,i.jsx(Qe,{label:s("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:x=>{a({...t,borderRadius:x})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:r,onChange:()=>{a({...t,boxShadow:t.boxShadow?null:N_})}}),s("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(Cd,{shadow:t.boxShadow,disabled:r,onChange:x=>{a({...t,boxShadow:x})}}):null]})]}):null,e==="advanced"?i.jsxs(i.Fragment,{children:[i.jsx(py,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:x=>{a(r1({...t,opacity:x.opacity,objectFit:x.fit,objectPosition:x.position},n))}}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesRotation")}),i.jsx("div",{className:p.field,children:i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:d,className:p.lengthInput,value:t.rotateDeg===null?"":be(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":s("imagePropertiesRotation"),onChange:x=>{const S=x.target.value.trim();if(!S){a({...t,rotateDeg:null});return}const k=Number(S.replace(",","."));Number.isFinite(k)&&a({...t,rotateDeg:k})}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:s("imagePropertiesRotationUnit")})]})})]})]}):null,e==="hover"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesTabHover")}),i.jsx("p",{className:p.emptyHint,children:s("imagePropertiesHoverHelp")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("imagePropertiesHoverCss")}),i.jsx("textarea",{id:f,className:p.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":s("imagePropertiesHoverCssAria"),onChange:x=>{a({...t,hoverCss:x.target.value})}})]})]}):null]})]})}function F_({open:e,tab:t,value:n,aspectRatio:r=1,disabled:o,onTabChange:a,onApply:s,onClose:u}){const d=J(),f=l.useId(),h=l.useRef(null),[g,y]=l.useState(n);return l.useEffect(()=>{e&&y(n)},[e,n]),$e(h,{open:e,onClose:u,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:u,children:i.jsxs("div",{ref:h,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":f,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:f,children:d("imagePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":d("imagePropertiesDialogCloseAria"),onClick:u,children:i.jsx(Ge,{})})]}),i.jsx(B_,{tab:t,value:g,aspectRatio:r,disabled:o,onTabChange:a,onChange:y}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:u,children:d("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>s(g),children:d("fontDialogOk")})]})]})})}):null}function H_({open:e,tab:t,href:n,title:r,targetBlank:o,textDecorationNone:a,hoverMode:s,hoverColor:u,hoverHtml:d,bookmarks:f,selectedBookmarkId:h,disabled:g,onTabChange:y,onApply:b,onClose:w}){const x=J(),S=l.useId(),k=l.useId(),v=l.useId(),A=l.useId(),j=l.useId(),D=l.useRef(null),[R,T]=l.useState(n),[E,N]=l.useState(r),[K,$]=l.useState(o),[P,F]=l.useState(a),[U,G]=l.useState(s),[me,se]=l.useState(u),[V,re]=l.useState(d),[de,oe]=l.useState(h);if(l.useEffect(()=>{e&&(T(n),N(r),$(o),F(a),G(s),se(u),re(d),oe(h))},[e,n,r,o,a,s,u,d,h]),$e(D,{open:e,onClose:w,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),!e)return null;const _=()=>Os({title:E,targetBlank:K,textDecorationNone:P,hoverMode:U,hoverColor:me,hoverHtml:V}),Q=()=>{const ee=R.trim();!ee||g||b({..._(),href:ee})},xe=()=>{!de||g||b({..._(),href:`#${de}`})};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:w,children:i.jsxs("div",{ref:D,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":S,onMouseDown:ee=>ee.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:S,children:x("linkDialogTitle")}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":x("linkDialogTitle"),children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":t==="link",onClick:()=>y("link"),children:x("linkDialogTabLink")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>y("bookmark"),children:x("linkDialogTabBookmark")})]}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[t==="link"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:k,children:x("linkDialogHref")}),i.jsx("input",{id:k,className:p.textInput,value:R,disabled:g,onChange:ee=>T(ee.target.value)})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:v,children:x("linkDialogHoverTitle")}),i.jsx("input",{id:v,className:p.textInput,value:E,disabled:g,onChange:ee=>N(ee.target.value)})]}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:K,disabled:g,onChange:ee=>$(ee.target.checked)}),x("linkDialogTargetBlank")]})]}):f.length===0?i.jsx("p",{className:p.emptyHint,children:x("linkDialogBookmarkEmpty")}):i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:A,children:x("linkDialogBookmark")}),i.jsxs("select",{id:A,className:`${p.select} ${p.fullSelect}`,value:de,disabled:g,onChange:ee=>oe(ee.target.value),children:[i.jsx("option",{value:""}),f.map(ee=>i.jsx("option",{value:ee.id,children:ee.id},ee.id))]})]}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:P,disabled:g,onChange:ee=>F(ee.target.checked)}),x("linkDialogTextDecorationNone")]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:x("linkDialogHover")}),i.jsxs("div",{className:p.sizeRow,role:"group","aria-label":x("linkDialogHover"),children:[i.jsx("button",{type:"button",className:p.action,"aria-pressed":U==="color",disabled:g,onClick:()=>G("color"),children:x("linkDialogHoverColor")}),i.jsx("button",{type:"button",className:p.action,"aria-pressed":U==="html",disabled:g,onClick:()=>G("html"),children:x("linkDialogHoverHtml")})]}),U==="color"?i.jsx(Qt,{label:x("linkDialogHoverColorField"),noneLabel:x("colorNone"),value:me,disabled:g,onChange:se}):i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:j,children:x("linkDialogHoverHtmlAria")}),i.jsx("textarea",{id:j,className:p.textarea,value:V,disabled:g,spellCheck:!1,onChange:ee=>re(ee.target.value)})]})]})]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:g||!de,onClick:xe,children:x("linkDialogSelect")}),i.jsx("button",{type:"button",className:p.action,onClick:w,children:x("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:g||!R.trim(),onClick:Q,children:x("fontDialogOk")})]})]})})})}const jp={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function z_({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=J(),u=l.useId(),d=l.useId(),f=l.useId(),h=l.useId(),g=l.useRef(null),[y,b]=l.useState("url"),[w,x]=l.useState(""),[S,k]=l.useState("");if(l.useEffect(()=>{e&&(b("url"),x(""),k(""))},[e]),$e(g,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const v=y==="custom"?null:bb(w),A=y==="custom"?null:v&&w.trim().length>0?jp[v]:v==="empty"&&w.trim().length===0?null:v?jp[v]:null,j=y!=="custom"&&v===null&&!t&&w.trim().length>0,D=()=>{t||!n||o==null||o()},R=()=>{j&&r({url:w.trim(),title:S.trim()})};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:g,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:T=>T.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("youtubeDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("youtubeDialogCloseAria"),onClick:a,children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>b("url"),children:s("youtubeDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),y==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("youtubeDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:w,disabled:t,"aria-invalid":A!==null,"aria-describedby":A?h:void 0,onChange:T=>x(T.target.value)})]}):null,y==="custom"&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:D,children:n.buttonCaption})]}):null]}),y!=="custom"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("youtubeDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:S,disabled:t,onChange:T=>k(T.target.value)})]}):null,A?i.jsx("p",{id:h,className:p.error,children:s(A)}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),y!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!j,onClick:R,children:s("fontDialogOk")}):null]})]})})})}const O_="_grid_1bpma_1",K_="_cell_1bpma_8",$_="_sizeLabel_1bpma_27",U_="_sizeFields_1bpma_33",V_="_numberInput_1bpma_37",co={grid:O_,cell:K_,sizeLabel:$_,sizeFields:U_,numberInput:V_},tr={rows:3,cols:3};function W_({open:e,disabled:t,onApply:n,onClose:r}){const o=J(),a=l.useId(),s=l.useId(),u=l.useId(),d=l.useRef(null),[f,h]=l.useState(tr.rows),[g,y]=l.useState(tr.cols),[b,w]=l.useState(String(tr.rows)),[x,S]=l.useState(String(tr.cols)),[k,v]=l.useState(!1);if(l.useEffect(()=>{e&&(h(tr.rows),y(tr.cols),w(String(tr.rows)),S(String(tr.cols)),v(!1))},[e]),$e(d,{open:e,onClose:r,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])'}),!e)return null;const j=Vh(f,g)&&!t,D=(N,K)=>{const $=Math.min(bo,Math.max(ho,N)),P=Math.min(bo,Math.max(ho,K));h($),y(P),w(String($)),S(String(P))},R=(N,K)=>{const $=Number.parseInt(N,10);if(!Number.isFinite($)){K==="rows"?w(String(f)):S(String(g));return}v(!0),K==="rows"?D($,g):D(f,$)},T=(N,K)=>{const $=N.replace(/\D/g,"");if(K==="rows"?w($):S($),$==="")return;const P=Number.parseInt($,10);Number.isFinite(P)&&(v(!0),K==="rows"?D(P,g):D(f,P))},E=N=>{(N.key==="e"||N.key==="E"||N.key==="+"||N.key==="-"||N.key===".")&&N.preventDefault()};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:r,children:i.jsxs("div",{ref:d,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:N=>N.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:a,children:o("tableDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":o("tableDialogCloseAria"),onClick:r,children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsx("div",{className:co.grid,role:"grid","aria-label":o("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:Bf},(N,K)=>Array.from({length:Bf},($,P)=>{const F=K+1,U=P+1,G=F<=f&&U<=g;return i.jsx("button",{type:"button",className:co.cell,role:"gridcell","data-active":G?"true":void 0,"aria-label":`${F} × ${U}`,"aria-pressed":G&&F===f&&U===g,disabled:t,onMouseEnter:()=>{k||D(F,U)},onClick:()=>{v(!0),D(F,U)}},`${F}-${U}`)}))}),i.jsxs("p",{className:co.sizeLabel,children:[o("tableDialogSize"),": ",f," × ",g]}),i.jsxs("div",{className:`${p.sizeRow} ${co.sizeFields}`,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:o("tableDialogRows")}),i.jsx("input",{id:s,className:co.numberInput,type:"number",inputMode:"numeric",min:ho,max:bo,step:1,value:b,disabled:t,onKeyDown:E,onChange:N=>T(N.target.value,"rows"),onBlur:()=>R(b,"rows")})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:o("tableDialogColumns")}),i.jsx("input",{id:u,className:co.numberInput,type:"number",inputMode:"numeric",min:ho,max:bo,step:1,value:x,disabled:t,onKeyDown:E,onChange:N=>T(N.target.value,"cols"),onBlur:()=>R(x,"cols")})]})]})]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:r,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!j,onClick:()=>{j&&n({rows:f,cols:g})},children:o("tableDialogInsert")})]})]})})})}const G_={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},q_={value:1,unit:"pt"},Z_={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 Y_({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=l.useId();return i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("tablePropertiesWidth")}),i.jsx(Qe,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:s=>n({...e,width:s})}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("tablePropertiesCollapse")}),i.jsxs("select",{id:o,className:p.select,value:e.borderCollapse,disabled:t,onChange:s=>{const u=s.target.value==="separate"?"separate":"collapse";n({...e,borderCollapse:u,borderSpacing:u==="separate"?e.borderSpacing:null})},children:[i.jsx("option",{value:"collapse",children:r("tablePropertiesCollapseCollapse")}),i.jsx("option",{value:"separate",children:r("tablePropertiesCollapseSeparate")})]})]}),e.borderCollapse==="separate"?i.jsx(Qe,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:s=>n({...e,borderSpacing:s})}):null]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:r("paragraphDialogBorderStyle")}),i.jsx("select",{id:a,className:p.select,value:e.border.style,disabled:t,onChange:s=>{const u=s.target.value;n({...e,border:{style:u,width:u==="none"?null:e.border.width??q_,color:u==="none"?null:e.border.color}})},children:Es.map(s=>i.jsx("option",{value:s,children:r(G_[s])},s))})]}),e.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Qe,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:s=>n({...e,border:{...e.border,width:s}})}),i.jsx(Qt,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:s=>n({...e,border:{...e.border,color:s}})})]}):null,i.jsx(Qe,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:s=>n({...e,borderRadius:s})}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:e.boxShadow!==null,disabled:t,onChange:()=>{n({...e,boxShadow:e.boxShadow?null:Z_})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?i.jsx(Cd,{shadow:e.boxShadow,disabled:t,onChange:s=>n({...e,boxShadow:s})}):null]})]})}function X_({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),$e(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:h=>h.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("tablePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx(Y_,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const J_=["left","center","right"],Q_={left:Ts,center:As,right:Rs},eM={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},tM={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},nM={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Ya(e){return{top:e,right:e,bottom:e,left:e}}function Bc(e){for(const t of st)if(e[t])return e[t];return null}function rM({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=l.useId(),s=l.useId(),[u,d]=l.useState(()=>On(e.padding,Ya(Bc(e.padding))));return l.useEffect(()=>{d(On(e.padding,Ya(Bc(e.padding))))},[e.padding]),i.jsxs("div",{className:p.body,children:[i.jsx(Qt,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:f=>n({...e,backgroundColor:f})}),i.jsx(Qt,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:f=>n({...e,color:f})}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:u,disabled:t,onChange:()=>{const f=!u;d(f),f&&n({...e,padding:Ya(Bc(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(u?["top"]:st).map(f=>i.jsx(Qe,{label:r(u?"paragraphDialogPadding":tM[f]),value:e.padding[f],disabled:t,onChange:h=>{const g=u?Ya(h):{...e.padding,[f]:h};n({...e,padding:g})}},f))})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":r("paragraphDialogAlignment"),children:J_.map(f=>{const h=Q_[f],g=(e.textAlign??"left")===f;return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":g,"aria-label":r(eM[f]),disabled:t,onClick:()=>{n({...e,textAlign:f==="left"?null:f})},children:i.jsx(h,{})},f)})})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:p.select,value:e.verticalAlign??"",disabled:t,onChange:f=>{const h=f.target.value;n({...e,verticalAlign:h||null})},children:[i.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),$s.map(f=>i.jsx("option",{value:f,children:r(nM[f])},f))]})]}),i.jsx(Qe,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:f=>n({...e,width:f})}),i.jsxs("div",{className:p.sizeRow,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:r("cellPropertiesColSpan")}),i.jsx("input",{id:a,className:p.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.colSpan,disabled:t,onChange:f=>{const h=Number.parseInt(f.target.value,10);n({...e,colSpan:Number.isFinite(h)?Math.max(1,h):1})}})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:r("cellPropertiesRowSpan")}),i.jsx("input",{id:s,className:p.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:f=>{const h=Number.parseInt(f.target.value,10);n({...e,rowSpan:Number.isFinite(h)?Math.max(1,h):1})}})]})]})]})}function oM({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),$e(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:h=>h.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("cellPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx(rM,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const iM={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},aM={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Xa(e){return{top:e,right:e,bottom:e,left:e}}function Fc(e){for(const t of st)if(e[t])return e[t];return null}function sM({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),[a,s]=l.useState(()=>On(e.padding,Xa(Fc(e.padding))));return l.useEffect(()=>{s(On(e.padding,Xa(Fc(e.padding))))},[e.padding]),i.jsxs("div",{className:p.body,children:[i.jsx(Qt,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),i.jsx(Qt,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:u=>n({...e,color:u})}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const u=!a;s(u),u&&n({...e,padding:Xa(Fc(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(a?["top"]:st).map(u=>i.jsx(Qe,{label:r(a?"paragraphDialogPadding":iM[u]),value:e.padding[u],disabled:t,onChange:d=>{const f=a?Xa(d):{...e.padding,[u]:d};n({...e,padding:f})}},u))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:p.select,value:e.verticalAlign??"",disabled:t,onChange:u=>{const d=u.target.value;n({...e,verticalAlign:d||null})},children:[i.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),$s.map(u=>i.jsx("option",{value:u,children:r(aM[u])},u))]})]}),i.jsx(Qe,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}function lM({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),$e(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:h=>h.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("rowPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx(sM,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const cM="_backdrop_9d3gw_1",uM="_dialog_9d3gw_12",dM="_headerRow_9d3gw_29",mM="_header_9d3gw_29",fM="_close_9d3gw_44",pM="_body_9d3gw_66",gM="_frame_9d3gw_75",hM="_actions_9d3gw_83",bM="_action_9d3gw_83",Fn={backdrop:cM,dialog:uM,headerRow:dM,header:mM,close:fM,body:pM,frame:gM,actions:hM,action:bM};function yM(e){const t=ar(e);if(t.length<=1)return e;const n=[],r=[];for(const a of t){const s=he(a);n.push(...s.hrefs),r.push(s.body)}const o=r.map((a,s)=>`<div class="wysiwyg-preview-page" style="${s===r.length-1?"display: block; break-inside: avoid; page-break-inside: avoid;":"display: block; break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid;"}">${a}</div>`).join("");return[...Array.from(new Set(n)).map(a=>`<link rel="stylesheet" href="${a}" />`),o].filter(Boolean).join("")}function xM({open:e,html:t,onClose:n}){const r=J(),o=l.useId(),a=l.useRef(null),s=l.useRef(null),u=l.useMemo(()=>yM(t),[t]);return $e(a,{open:e,onClose:n,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),l.useEffect(()=>{var f;if(!e)return;const d=(f=s.current)==null?void 0:f.contentDocument;d&&nu(d,u,r("previewDialogTitle"))},[e,u,r]),e?i.jsx(Pe,{children:i.jsx("div",{className:Fn.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:a,className:Fn.dialog,role:"dialog","aria-modal":"true","aria-labelledby":o,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:Fn.headerRow,children:[i.jsx("h2",{className:Fn.header,id:o,children:r("previewDialogTitle")}),i.jsx("button",{type:"button",className:Fn.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:i.jsx(Ge,{})})]}),i.jsx("div",{className:Fn.body,children:i.jsx("iframe",{ref:s,className:Fn.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var f;const d=(f=s.current)==null?void 0:f.contentDocument;d&&nu(d,u,r("previewDialogTitle"))}})}),i.jsx("div",{className:Fn.actions,children:i.jsx("button",{type:"button",className:Fn.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const wM="0.1.0",CM="_backdrop_72ox3_1",vM="_dialog_72ox3_12",kM="_headerRow_72ox3_30",SM="_header_72ox3_30",PM="_close_72ox3_46",AM="_body_72ox3_68",TM="_product_72ox3_76",RM="_meta_72ox3_82",DM="_description_72ox3_87",jM="_website_72ox3_92",IM="_cta_72ox3_97",EM="_link_72ox3_102",_M="_actions_72ox3_118",MM="_action_72ox3_118",Rt={backdrop:CM,dialog:vM,headerRow:kM,header:SM,close:PM,body:AM,product:TM,meta:RM,description:DM,website:jM,cta:IM,link:EM,actions:_M,action:MM};function NM({open:e,onClose:t}){const n=J(),r=l.useId(),o=l.useRef(null);return $e(o,{open:e,onClose:t,escapeIgnoreSelectors:!1,focusableSelector:'a[href], button:not([disabled]):not([tabindex="-1"])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:Rt.backdrop,role:"presentation",onMouseDown:t,children:i.jsxs("div",{ref:o,className:Rt.dialog,role:"dialog","aria-modal":"true","aria-labelledby":r,onMouseDown:a=>a.stopPropagation(),children:[i.jsxs("div",{className:Rt.headerRow,children:[i.jsx("h2",{id:r,className:Rt.header,children:n("aboutDialogTitle")}),i.jsx("button",{type:"button",className:Rt.close,onClick:t,"aria-label":n("aboutDialogCloseAria"),children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:Rt.body,children:[i.jsx("p",{className:Rt.product,children:n("brandMarkAria")}),i.jsx("p",{className:Rt.meta,children:n("aboutDialogVersion").replace("{version}",wM)}),i.jsx("p",{className:Rt.description,children:n("aboutDialogDescription")}),i.jsxs("div",{className:Rt.website,children:[i.jsx("p",{className:Rt.cta,children:n("aboutDialogWebsiteCta")}),i.jsx("a",{className:Rt.link,href:"https://commspliant.com/",target:"_blank",rel:"noopener noreferrer","aria-label":n("aboutDialogWebsiteAria"),children:n("aboutDialogWebsite")})]})]}),i.jsx("div",{className:Rt.actions,children:i.jsx("button",{type:"button",className:Rt.action,onClick:t,children:n("aboutDialogClose")})})]})})}):null}const LM="_backdrop_12fkg_1",BM="_dialog_12fkg_12",FM="_headerRow_12fkg_31",HM="_header_12fkg_31",zM="_close_12fkg_47",OM="_searchRow_12fkg_69",KM="_search_12fkg_69",$M="_body_12fkg_91",UM="_sidebar_12fkg_99",VM="_category_12fkg_111",WM="_topicList_12fkg_121",GM="_topicButton_12fkg_127",qM="_topicButtonActive_12fkg_147",ZM="_main_12fkg_157",YM="_articleTitle_12fkg_164",XM="_articleBody_12fkg_171",JM="_noResults_12fkg_176",QM="_related_12fkg_181",eN="_relatedTitle_12fkg_187",tN="_relatedList_12fkg_194",nN="_relatedButton_12fkg_200",rN="_relatedItem_12fkg_223",ze={backdrop:LM,dialog:BM,headerRow:FM,header:HM,close:zM,searchRow:OM,search:KM,body:$M,sidebar:UM,category:VM,topicList:WM,topicButton:GM,topicButtonActive:qM,main:ZM,articleTitle:YM,articleBody:XM,noResults:JM,related:QM,relatedTitle:eN,relatedList:tN,relatedButton:nN,relatedItem:rN};function oN(e){return{getStarted:"helpCategoryGetStarted",file:"helpCategoryFile",edit:"helpCategoryEdit",insert:"helpCategoryInsert",format:"helpCategoryFormat",table:"helpCategoryTable",view:"helpCategoryView",keyboard:"helpCategoryKeyboard"}[e]}function iN({open:e,topicId:t,onTopicChange:n,onClose:r}){const o=J(),a=l.useId(),s=l.useRef(null),[u,d]=l.useState("");$e(s,{open:e,onClose:r,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),l.useEffect(()=>{e||d("")},[e]);const f=l.useMemo(()=>Su.map(b=>({id:b.id,title:o(b.titleKey),body:o(b.bodyKey),keywords:o(b.keywordsKey)})),[o]),h=l.useMemo(()=>{const b=Xj(f,u);return new Set(b.map(w=>w.id))},[u,f]),g=xp[t],y=u.trim().length>0&&h.size===0;return e?i.jsx(Pe,{children:i.jsx("div",{className:ze.backdrop,role:"presentation",onMouseDown:r,children:i.jsxs("div",{ref:s,className:ze.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:ze.headerRow,children:[i.jsx("h2",{id:a,className:ze.header,children:o("helpDialogTitle")}),i.jsx("button",{type:"button",className:ze.close,onClick:r,"aria-label":o("helpDialogCloseAria"),children:i.jsx(Ge,{})})]}),i.jsx("div",{className:ze.searchRow,children:i.jsx("input",{type:"search",className:ze.search,value:u,onChange:b=>d(b.target.value),placeholder:o("helpDialogSearchPlaceholder"),"aria-label":o("helpDialogSearchAria")})}),i.jsxs("div",{className:ze.body,children:[i.jsx("aside",{className:ze.sidebar,"aria-label":o("helpDialogContentsAria"),children:Zj.map(b=>{const w=Su.filter(x=>x.category===b&&h.has(x.id));return w.length===0?null:i.jsxs("div",{children:[i.jsx("h3",{className:ze.category,children:o(oN(b))}),i.jsx("ul",{className:ze.topicList,children:w.map(x=>i.jsx("li",{children:i.jsx("button",{type:"button",className:`${ze.topicButton}${x.id===t?` ${ze.topicButtonActive}`:""}`,onClick:()=>n(x.id),children:o(x.titleKey)})},x.id))})]},b)})}),i.jsx("div",{className:ze.main,children:y?i.jsx("p",{className:ze.noResults,children:o("helpDialogNoResults")}):i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:ze.articleTitle,children:o(g.titleKey)}),i.jsx("p",{className:ze.articleBody,children:o(g.bodyKey)}),g.related.length>0?i.jsxs("div",{className:ze.related,children:[i.jsx("h4",{className:ze.relatedTitle,children:o("helpDialogRelatedTitle")}),i.jsx("ul",{className:ze.relatedList,children:g.related.map(b=>{const w=xp[b];return!w||!h.has(b)?null:i.jsx("li",{className:ze.relatedItem,children:i.jsx("button",{type:"button",className:ze.relatedButton,onClick:()=>n(b),children:o(w.titleKey)})},b)})})]}):null]})})]})]})})}):null}function hy(e){return{catalog:e.catalog,layout:e.layout,commands:e.commands,queries:e.queries,queryRevisions:e.queryRevisions??Jb(),disabled:e.disabled,chromeLock:e.chromeLock}}function aN(e,t){for(const n of Object.keys(e)){const r=e[n],o=t[n];if(!(typeof r=="function"&&typeof o=="function")&&r!==o)return!1}return!0}const sN=l.memo(function({menuVisible:t,captureChromeSelection:n,displayCatalog:r,displayLayout:o,commands:a,queries:s,queryRevisions:u,chromeDisabled:d,chromeLock:f,contentLocked:h,customizeToolbarOpen:g,baseCatalog:y,allowedLayout:b,toolbarSettings:w,toolbarSettingsLoading:x,toolbarSettingsBusy:S,onCustomizeToolbarClose:k,onToolbarSettingsChange:v,onToolbarSettingsReset:A,documentPreview:j,onDocumentPreviewClose:D,helpDialog:R,onHelpDialogClose:T,onHelpTopicChange:E,aboutDialogOpen:N,onAboutDialogClose:K,compatibilityPanelOpen:$=!1,capabilitiesValidation:P=null,onCompatibilityPanelClose:F,isToolbarItemAllowed:U,fontDialog:G,fontSizeState:me,markState:se,fontFamilyState:V,fontColorState:re,highlightColorState:de,fontFaces:oe,onFontDialogTabChange:_,onFontDialogClose:Q,onApplyFontProperties:xe,paragraphDialog:ee,customBackgroundImagePicker:Z,disableBuiltinBackgroundImageSources:Ee,onParagraphCustomImagePick:et,onParagraphDialogTabChange:qe,onParagraphDialogClose:lt,onApplyParagraphProperties:ct,customCssDialog:St,onCustomCssDialogClose:mn,onApplyCustomCss:ut,pageDialog:Y,enablePageProperties:ce,onPageCustomImagePick:we,onPageDialogTabChange:Be,onPageDialogClose:en,onApplyPageProperties:tn,onPageDialogResetAtRule:nn,deletePageConfirmOpen:dt,onDeletePageConfirmClose:Rn,onDeletePageConfirm:Dn,customStyleDialog:tt,canDeleteCustomParagraphStyle:Gr,customStyleBusy:qr,onCustomStyleDialogClose:Ze,onCustomStyleSave:xr,onCustomStyleDelete:Fe,linkDialog:Oe,onLinkDialogTabChange:Pt,onLinkDialogClose:q,onApplyLink:te,bookmarkDialog:le,onBookmarkDialogClose:Ce,onApplyBookmark:Ye,imageDialogOpen:fn,customImagePicker:nt,customAudioPicker:rn,customVideoPicker:Un,onImageDialogClose:jn,onApplyImage:mt,onImageDialogCustomPick:Me,audioDialogOpen:ft,onAudioDialogClose:pn,onApplyAudio:Gs,onAudioDialogCustomPick:Mi,youtubeDialogOpen:qs,onYoutubeDialogClose:pt,onApplyYoutube:Ni,onYoutubeDialogCustomPick:Mt,imageProperties:gn,onImagePropertiesTabChange:Vn,onImagePropertiesClose:Zs,onApplyImageProperties:_o,tableDialogOpen:Ys,onTableDialogClose:Li,onApplyTable:Wn,tableProperties:hn,onTablePropertiesClose:Mo,onApplyTableProperties:wr,cellProperties:B,onCellPropertiesClose:$t,onApplyCellProperties:Bi,rowProperties:Cr,onRowPropertiesClose:xt,onApplyRowProperties:vr}){const Fi=hy({catalog:r,layout:o,commands:a,queries:s,queryRevisions:u,disabled:d,chromeLock:f});return i.jsxs(i.Fragment,{children:[t?i.jsx("div",{className:Se.menuChrome,onPointerDownCapture:n,children:i.jsx(Pu,{...Fi,menuVisible:!0,toolbarVisible:!1})}):null,g?i.jsx(lR,{open:!0,catalog:y,groups:b.iconGroups,settings:w,loading:x,busy:S,disabled:h,isItemAllowed:U,onChange:v,onReset:A,onClose:k}):null,j.open?i.jsx(xM,{open:!0,html:j.html,onClose:D}):null,R.open?i.jsx(iN,{open:!0,topicId:R.topicId,onTopicChange:E,onClose:T}):null,N?i.jsx(NM,{open:!0,onClose:K}):null,$?i.jsx(IT,{open:!0,result:P,onClose:()=>F==null?void 0:F()}):null,G.open?i.jsx(LE,{open:!0,tab:G.tab,size:me.value,unit:me.unit,marks:se,fontFamily:V.value,fontFamilyMixed:V.mixed,fontColor:re.value,fontColorMixed:re.mixed,highlightColor:de.value,highlightColorMixed:de.mixed,fonts:oe,disabled:h,onTabChange:_,onApply:xe,onClose:Q}):null,ee.open?i.jsx(a_,{open:!0,tab:ee.tab,value:ee.value,backgroundImage:ee.backgroundImage,disabled:h,customImagePicker:Z,disableBuiltinBackgroundImageSources:Ee,onCustomImagePick:et,onTabChange:qe,onApply:ct,onClose:lt}):null,St.open?i.jsx(x_,{open:!0,value:St.value,disabled:h,onApply:ut,onClose:mn}):null,Y.open?i.jsx(p_,{open:!0,tab:Y.tab,initialParagraphTab:Y.paragraphTab,value:Y.value,fonts:oe,disabled:h,printTabVisible:ce,customImagePicker:Z,disableBuiltinBackgroundImageSources:Ee,onCustomImagePick:we,onTabChange:Be,onApply:tn,onResetAtRule:nn,onClose:en}):null,dt?i.jsx(g_,{open:!0,disabled:h,onClose:Rn,onConfirm:Dn}):null,tt.open?i.jsx(y_,{open:!0,mode:tt.mode,styleId:tt.mode==="edit"?tt.style.id:void 0,name:tt.mode==="edit"?tt.style.name:"",font:tt.mode==="edit"?tt.style.font:tt.font,paragraph:tt.mode==="edit"?tt.style.paragraph:tt.paragraph,canDelete:Gr,fonts:oe,busy:qr,disabled:h,onSave:xr,onDelete:Fe,onClose:Ze}):null,Oe.open?i.jsx(H_,{open:!0,tab:Oe.tab,href:Oe.href,title:Oe.title,targetBlank:Oe.targetBlank,textDecorationNone:Oe.textDecorationNone,hoverMode:Oe.hoverMode,hoverColor:Oe.hoverColor,hoverHtml:Oe.hoverHtml,bookmarks:Oe.bookmarks,selectedBookmarkId:Oe.selectedBookmarkId,disabled:h,onTabChange:Pt,onApply:te,onClose:q}):null,le.open?i.jsx(C_,{open:!0,existingIds:le.existingIds,disabled:h,onApply:Ye,onClose:Ce}):null,fn?i.jsx(P_,{open:!0,disabled:h,customImagePicker:nt,onApply:mt,onCustomPick:Me,onClose:jn}):null,ft?i.jsx(S_,{open:!0,disabled:h,customAudioPicker:rn,onApply:Gs,onCustomPick:Mi,onClose:pn}):null,qs?i.jsx(z_,{open:!0,disabled:h,customVideoPicker:Un,onApply:Ni,onCustomPick:Mt,onClose:pt}):null,gn.open?i.jsx(F_,{open:!0,tab:gn.tab,value:gn.value,aspectRatio:gn.aspectRatio,disabled:h,onTabChange:Vn,onApply:_o,onClose:Zs}):null,Ys?i.jsx(W_,{open:!0,disabled:h,onApply:Wn,onClose:Li}):null,hn.open?i.jsx(X_,{open:!0,value:hn.value,disabled:h,onApply:wr,onClose:Mo}):null,B.open?i.jsx(oM,{open:!0,value:B.value,disabled:h,onApply:Bi,onClose:$t}):null,Cr.open?i.jsx(lM,{open:!0,value:Cr.value,disabled:h,onApply:vr,onClose:xt}):null]})},aN);function lN({toolbarVisible:e,toolbarPos:t,captureChromeSelection:n,toolbarShellProps:r,children:o}){return i.jsxs("div",{className:Se.body,"data-icon-dock":e?t:void 0,children:[e&&(t==="top"||t==="left")?i.jsx("div",{className:Se.iconChrome,onPointerDownCapture:n,children:i.jsx(Pu,{...r,menuVisible:!1,toolbarVisible:!0,position:t})}):null,o,e&&(t==="bottom"||t==="right")?i.jsx("div",{className:Se.iconChrome,onPointerDownCapture:n,children:i.jsx(Pu,{...r,menuVisible:!1,toolbarVisible:!0,position:t})}):null]})}const by=l.createContext(null);function cN({value:e,children:t}){return i.jsx(by.Provider,{value:e,children:t})}function uN(){const e=l.useContext(by);if(!e)throw new Error("useEditorShellContext must be used within EditorShellProvider");return e}function dN(e,t){const n=l.useRef([]),r=l.useRef([]);return l.useMemo(()=>{const o=n.current,a=r.current,s=[];for(let u=0;u<e.length;u+=1){const d=e[u]??"";o[u]===d&&a[u]!==void 0?s.push(a[u]):s.push(he(d).body)}return n.current=e,r.current=s,s},[e,t,e.length])}const mN="_panel_6xdnw_1",fN="_header_6xdnw_17",pN="_title_6xdnw_26",gN="_close_6xdnw_32",hN="_messages_6xdnw_48",bN="_empty_6xdnw_57",yN="_message_6xdnw_48",xN="_messageHeader_6xdnw_69",wN="_author_6xdnw_77",CN="_time_6xdnw_81",vN="_body_6xdnw_86",kN="_reply_6xdnw_92",SN="_input_6xdnw_100",PN="_post_6xdnw_111",Dt={panel:mN,header:fN,title:pN,close:gN,messages:hN,empty:bN,message:yN,messageHeader:xN,author:wN,time:CN,body:vN,reply:kN,input:SN,post:PN};function AN(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function TN({thread:e,locale:t,disabled:n,commentAuthor:r,panelRef:o,onPost:a,onClose:s}){const u=J(),[d,f]=l.useState(""),h=l.useRef(null);l.useEffect(()=>{var x;(x=h.current)==null||x.focus()},[e==null?void 0:e.id]);const g=!n&&r&&d.trim().length>0,y=l.useMemo(()=>(e==null?void 0:e.messages)??[],[e==null?void 0:e.messages]),b=y.length===0?u("commentPlaceholder"):u("commentReplyPlaceholder");if(!e)return null;const w=()=>{const x=d.trim();!x||!g||(a(x),f(""))};return Au.createPortal(i.jsxs("div",{ref:o,className:Dt.panel,role:"dialog","aria-label":u("commentPanelTitle"),children:[i.jsxs("div",{className:Dt.header,children:[i.jsx("h2",{className:Dt.title,children:u("commentPanelTitle")}),i.jsx("button",{type:"button",className:Dt.close,onClick:s,"aria-label":u("commentPanelCloseAria"),children:i.jsx(Ge,{})})]}),i.jsx("div",{className:Dt.messages,children:y.length===0?i.jsx("p",{className:Dt.empty,children:u("commentEmpty")}):y.map(x=>i.jsxs("article",{className:Dt.message,children:[i.jsxs("header",{className:Dt.messageHeader,children:[i.jsx("span",{className:Dt.author,children:x.userName}),i.jsx("time",{className:Dt.time,dateTime:x.createdAt,children:AN(x.createdAt,t)})]}),i.jsx("p",{className:Dt.body,children:x.message})]},x.id))}),i.jsxs("div",{className:Dt.reply,children:[i.jsx("textarea",{ref:h,className:Dt.input,value:d,onChange:x=>f(x.target.value),placeholder:b,rows:3,disabled:n||!r}),i.jsx("button",{type:"button",className:Dt.post,onClick:w,disabled:!g,children:u("commentPost")})]})]}),document.body)}const RN=l.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:o},a){const s=J();return i.jsx("textarea",{ref:a,className:`${Se.surface} ${Se.html}`,value:t,onChange:u=>n(u.target.value),placeholder:r,disabled:o,"aria-label":s("htmlEditorAria"),spellCheck:!1})}),DN="_shell_yvznc_1",jN="_scrollButton_yvznc_10",IN="_tabList_yvznc_48",EN="_tab_yvznc_48",_N="_tabActive_yvznc_86",uo={shell:DN,scrollButton:jN,tabList:IN,tab:EN,tabActive:_N},MN=5,Ip=120;function NN({pageCount:e,activeIndex:t,onSelect:n}){const r=J(),o=l.useRef(null),[a,s]=l.useState(!1),[u,d]=l.useState(!1),f=e>=MN,h=l.useCallback(()=>{const b=o.current;if(!b)return;const{scrollLeft:w,scrollWidth:x,clientWidth:S}=b;s(w>1),d(w+S<x-1)},[]);l.useEffect(()=>{h()},[e,t,h]),l.useEffect(()=>{var x;const b=o.current;if(!b)return;const w=b.querySelector(`[data-page-tab="${t}"]`);(x=w==null?void 0:w.scrollIntoView)==null||x.call(w,{block:"nearest",inline:"nearest"}),h()},[t,h]),l.useEffect(()=>{const b=o.current;if(!b)return;const w=()=>h();if(b.addEventListener("scroll",w,{passive:!0}),typeof ResizeObserver>"u")return()=>{b.removeEventListener("scroll",w)};const x=new ResizeObserver(()=>h());return x.observe(b),()=>{b.removeEventListener("scroll",w),x.disconnect()}},[h]);const g=b=>{var w;(w=o.current)==null||w.scrollBy({left:b,behavior:"smooth"})},y=b=>r("htmlModePageTab").replace("{n}",String(b+1));return i.jsxs("div",{className:uo.shell,children:[f?i.jsx("button",{type:"button",className:uo.scrollButton,"aria-label":r("htmlModePageTabsScrollLeftAria"),disabled:!a,onClick:()=>g(-Ip),children:"‹"}):null,i.jsx("div",{ref:o,className:uo.tabList,role:"tablist","aria-label":r("htmlModePageTabsAria"),children:Array.from({length:e},(b,w)=>i.jsx("button",{type:"button",role:"tab","data-page-tab":w,className:`${uo.tab} ${w===t?uo.tabActive:""}`,"aria-selected":w===t,tabIndex:w===t?0:-1,onClick:()=>n(w),children:y(w)},w))}),f?i.jsx("button",{type:"button",className:uo.scrollButton,"aria-label":r("htmlModePageTabsScrollRightAria"),disabled:!u,onClick:()=>g(Ip),children:"›"}):null]})}function LN(e,t,n=!0){const[r,o]=l.useState(null),[a,s]=l.useState(xd()),u=l.useCallback(()=>{!n||!e||(o(sy(e,t)),s(Ss(e)))},[n,e,t]);return l.useLayoutEffect(()=>{if(!n)return;const d=requestAnimationFrame(u);return()=>cancelAnimationFrame(d)},[n,u]),l.useLayoutEffect(()=>{if(!n||!e||typeof ResizeObserver>"u")return;const d=new ResizeObserver(()=>u());return d.observe(e),()=>d.disconnect()},[n,e,u]),l.useLayoutEffect(()=>{if(!n||!e)return;const d=()=>{s(Ss(e))};return document.addEventListener("selectionchange",d),()=>document.removeEventListener("selectionchange",d)},[n,e]),{geometry:r,indentState:a,refresh:u}}const BN=l.forwardRef(function({html:t,pageHtml:n,onChange:r,placeholder:o,disabled:a,rulerVisible:s=!0,rulerUnit:u="in",zoomScale:d=1,onMarginChange:f,onMarginPreview:h,onIndentChange:g,onBeforeInput:y,propSyncGuardRef:b,resolveEmbeddedImageDataUrl:w,hydrateEmbeddedImages:x,onPointerDown:S,onMouseUp:k,onContextMenu:v,pageLayoutEnabled:A=!0},j){const D=J(),R=l.useRef(null),T=l.useRef(!1),[E,N]=l.useState(null),K=l.useRef(y);K.current=y;const $=n??t,P=A&&s&&Ri($),{geometry:F,indentState:U,refresh:G}=LN(E,$,P),me=V=>{R.current=V,N(V),typeof j=="function"?j(V):j&&(j.current=V)};l.useLayoutEffect(()=>{const V=R.current;if(!V)return;const re=cn(t),oe=V===document.activeElement&&T.current;if(T.current=!1,oe||ws(V,re,{resolveDataUrl:w,hydrateEmbeddedImages:x}),A&&(yt(V)||Ri($))){Yu(V),Ai(V),Bs(V);const _=yt(V);_&&Ug(V,_)}A&&(Ls(V),Io(V,$))},[t,$,A,w,x]),l.useLayoutEffect(()=>{if(b)return b.current=()=>{T.current=!0},()=>{b.current=null}},[b]),l.useLayoutEffect(()=>{const V=R.current;if(!V)return;const re=de=>{var oe;(oe=K.current)==null||oe.call(K,de)};return V.addEventListener("beforeinput",re),()=>V.removeEventListener("beforeinput",re)},[]);const se=i.jsx("div",{ref:me,className:`${Se.surface} ${Se.visual} ${P?Se.pageSurface:""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":D("visualEditorAria"),"aria-disabled":a||void 0,"data-placeholder":o,onPointerDown:S,onMouseUp:k,onContextMenu:v,onInput:V=>{const re=V.currentTarget;if(T.current=!0,yt(re)){const{absorbedBlocks:de}=Ai(re);if(r(re.innerHTML),de.length>0){const oe=de.length;requestAnimationFrame(()=>qg(re,oe))}}else r(re.innerHTML);P&&G()}});return i.jsx(vE,{showRulers:P,geometry:F,indentState:U,rulerUnit:u,zoomScale:d,onMarginChange:f,onMarginPreview:h,onIndentChange:g,children:se})}),FN="_frame_bwkh8_1",HN="_handle_bwkh8_9",zN="_handleEast_bwkh8_29",ON="_handleSouth_bwkh8_37",KN="_handleSouthEast_bwkh8_45",yi={frame:FN,handle:HN,handleEast:zN,handleSouth:ON,handleSouthEast:KN};function si(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const $N=[{handle:"e",className:yi.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:yi.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:yi.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function Hc(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function UN({img:e,onResize:t,onResizeEnd:n}){const r=J(),o=l.useRef(null),a=l.useRef(e),s=l.useRef(t),u=l.useRef(n),d=l.useRef(null);a.current=e,s.current=t,u.current=n;const f=k=>{const v=o.current;v&&(v.style.left=`${k.left}px`,v.style.top=`${k.top}px`,v.style.width=`${k.width}px`,v.style.height=`${k.height}px`)};l.useLayoutEffect(()=>{f(si(e));const k=()=>{e.isConnected&&f(si(e))};return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[e]);const h=(k,v)=>{const A=d.current,j=a.current;if(!A||!j)return;const D=Y0(A.handle,A.start,{x:k-A.originX,y:v-A.originY});s.current(D.width,D.height),j.isConnected&&f(si(j))},g=()=>{if(!d.current)return;d.current=null;const k=a.current;u.current(),k!=null&&k.isConnected&&f(si(k))};l.useLayoutEffect(()=>{const k=A=>{if(!d.current)return;const j=Hc(A);j&&h(j.x,j.y)},v=()=>{g()};return document.addEventListener("pointermove",k),document.addEventListener("pointerup",v),document.addEventListener("pointercancel",v),document.addEventListener("mousemove",k),document.addEventListener("mouseup",v),()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",v),document.removeEventListener("pointercancel",v),document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",v)}},[]);const y=(k,v)=>{const A=Hc(v);A&&(d.current={handle:k,start:X0(a.current),originX:A.x,originY:A.y})},b=k=>v=>{v.preventDefault(),v.stopPropagation(),y(k,v);try{v.currentTarget.setPointerCapture(v.pointerId)}catch{}},w=k=>v=>{v.preventDefault(),v.stopPropagation(),y(k,v)},x=k=>{const v=Hc(k);v&&h(v.x,v.y)};if(!e.isConnected)return null;const S=si(e);return Au.createPortal(i.jsx("div",{ref:o,className:yi.frame,"data-image-resize-overlay":"",style:{left:S.left,top:S.top,width:S.width,height:S.height},children:$N.map(k=>i.jsx("button",{type:"button",className:`${yi.handle} ${k.className}`,style:{cursor:k.cursor},"aria-label":r(k.ariaKey),"data-resize-handle":k.handle,onPointerDown:b(k.handle),onPointerMove:x,onPointerUp:g,onPointerCancel:g,onMouseDown:w(k.handle),onMouseMove:x,onMouseUp:g},k.handle))}),document.body)}function VN(e,t){for(const n of Object.keys(e)){const r=e[n],o=t[n];if(!(typeof r=="function"&&typeof o=="function")&&r!==o)return!1}return!0}function WN(){const e=J();return i.jsx("div",{className:Se.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}function GN({propsRef:e,pageStore:t,mode:n,enableMultiPages:r,contentLocked:o,activePageIndex:a,hasSelectedPage:s,pageZoomScale:u,rulerVisible:d,rulerUnit:f,optimizeEmbeddedImages:h,placeholder:g,controlledHtml:y,initialHtml:b,initialStorageHtml:w,defaultPages:x,ingestedPagesProp:S,onChange:k,fontFaces:v,enableComments:A,commentsVisible:j,disabled:D,locale:R,commentAuthor:T,activeThreadId:E,contextMenu:N,commentThreads:K,commands:$,htmlFileDropDragging:P,selectedImage:F,hiddenContextMenuCommands:U,pageLayoutEnabled:G=!0}){const{htmlRef:me,pagesRef:se,documentBridgeRef:V}=uN(),[re,de]=l.useState(w),[oe,_]=es({value:h?void 0:y,defaultValue:b,onChange:r||h?void 0:k}),Q=h?re:oe,[xe,ee]=l.useState(()=>r&&(e.current.htmlModePageHtmlRef.current||x[0])||""),Z=e.current;Z.setHtmlModePageHtml=ee,h?r||(me.current=re):me.current=oe,r&&(se.current=t.pages);const Ee=l.useCallback(()=>r?t.getJoinedHtml():h?re:oe,[r,oe,h,t,re]);l.useLayoutEffect(()=>{const Y={pageStore:t,setHtml:_,setStorageHtml:de,getEditorHtml:Ee,replacePagesFromHistory:ce=>t.replacePages([...ce])};return V.current=Y,()=>{V.current===Y&&(V.current=null)}},[V,Ee,t,_,de]);const et=l.useMemo(()=>{if(r){const Y=t.pages[a]??t.pages[0]??"";return uf(Y,v).join(`
317
+ ${N1}`:Nf}function nu(e,t,n="​"){const r=nd(t),{hrefs:o,body:a}=ge(r.html),s=e.createElement("meta");s.setAttribute("charset","utf-8");const u=e.createElement("title");u.textContent=n;const d=e.createElement("style");d.textContent=ph(r.hasBleed);const f=o.map(h=>{const g=e.createElement("link");return g.rel="stylesheet",g.href=h,g});e.head.replaceChildren(s,u,d,...f),e.title=n,e.body.innerHTML=a}function rd(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 F1(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function Va(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 o=0;o<n.length;o++)if(((r=n[o])==null?void 0:r.kind)==="file")return!0}return!1}function H1(e){var r;const t=[],n=e.files;if(n)for(let o=0;o<n.length;o++){const a=((r=n.item)==null?void 0:r.call(n,o))??n[o];a&&t.push(a)}if(t.length===0&&e.items)for(let o=0;o<e.items.length;o++){const a=e.items[o];if((a==null?void 0:a.kind)!=="file")continue;const s=a.getAsFile();s&&t.push(s)}return t}function z1(e){return e?H1(e).find(F1)??null:null}const gh={description:"HTML",accept:{"text/html":[".html",".htm"]}},O1="document.html";function hh(){return window}function bh(e){return e instanceof DOMException&&e.name==="AbortError"}function K1(e,t){const n=new Blob([e],{type:"text/html;charset=utf-8"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=t,o.rel="noopener",document.body.append(o),o.click(),o.remove(),URL.revokeObjectURL(r)}function $1(){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 o;const r=(o=t.files)==null?void 0:o[0];if(!r){n(null);return}rd(r).then(a=>n(fh(a)),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function U1(e,t=O1){const n=hh().showSaveFilePicker;if(typeof n=="function"){try{const o=await(await n({suggestedName:t,types:[gh]})).createWritable();await o.write(e),await o.close()}catch(r){if(bh(r))return;throw r}return}K1(e,t)}async function V1(){const e=hh().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[gh]}),n=await t.getFile();return fh(await rd(n))}catch(t){if(bh(t))return null;throw t}return $1()}const W1=1e3;function G1(e){var t;return e.complete&&e.naturalWidth>0?Promise.resolve((t=e.decode)==null?void 0:t.call(e)).catch(()=>{}):new Promise(n=>{const r=()=>{var o;Promise.resolve((o=e.decode)==null?void 0:o.call(e)).catch(()=>{}).then(()=>n())};e.addEventListener("load",r,{once:!0}),e.addEventListener("error",r,{once:!0})})}function q1(e){const t=[...e.images];return t.length===0?Promise.resolve():Promise.all(t.map(G1)).then(()=>{})}function yh(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.setAttribute("data-wysiwyg-print",""),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.width="1px",e.style.height="1px",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}}async function xh(e,t,n,r){nu(e,r);let o=!1;const a=()=>{o||(o=!0,n.remove())};t.addEventListener("afterprint",a),await q1(e),t.focus(),t.print(),window.setTimeout(a,W1)}function Z1(e){const t=yh();t&&xh(t.doc,t.win,t.iframe,e)}function Y1(e){const t=yh();if(!t)return;const n=e.map(nd),r=n.some(h=>h.hasBleed),o=[],a=[];for(const h of n){const g=ge(h.html);o.push(...g.hrefs),a.push(g.body)}const s=a.map((h,g)=>`<div data-wysiwyg-print-page="" style="${g===a.length-1?"display: block; break-inside: avoid; page-break-inside: avoid;":"display: block; break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid;"}">${h}</div>`).join(""),u=Lg(e),d=r?"@page { margin: 0 !important; }":"",f=[u?`<style>${u}</style>`:"",d?`<style>${d}</style>`:"",...Array.from(new Set(o)).map(h=>`<link rel="stylesheet" href="${h}" />`),s].filter(Boolean).join("");xh(t.doc,t.win,t.iframe,f)}function X1(e){return{save:async()=>{if(e.onSave){const t=e.isMultiPagesEnabled()?e.getAllPagesHtml():e.getHtml();await e.onSave(t);return}await U1(B1(e.getHtml()))},open:async()=>{const t=e.onOpen?await e.onOpen():await V1();if(t!==null){if(Array.isArray(t)){e.setHtml(zt(t));return}if(e.isMultiPagesEnabled()){e.setHtml(zt([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){Y1(ar(e.getHtml()));return}Z1(e.getHtml())}}}function J1(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 Q1(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 ek(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function tk(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function nk(e){return{openLinkDialog:t=>{e.openLinkDialog(t)},applyLink:t=>{e.applyLink(t)},openBookmarkDialog:()=>{e.openBookmarkDialog()},applyBookmark:t=>{e.applyBookmark(t)},openImageDialog:()=>{e.openImageDialog()},openPageBackgroundImage:()=>{e.openPageBackgroundImage()},openParagraphBackgroundImage:()=>{e.openParagraphBackgroundImage()},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()},insertPageBefore:()=>{e.insertPageBefore()},insertPageAfter:()=>{e.insertPageAfter()},deletePage:()=>{e.deletePage()}}}function rk(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),hasSelectedPage:()=>e.hasSelectedPage(),canDeletePage:()=>e.canDeletePage(),canInsertPageBackgroundImage:()=>e.canInsertPageBackgroundImage(),canInsertParagraphBackgroundImage:()=>e.canInsertParagraphBackgroundImage()}}function ok(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 ik(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}function ak(e){return{openHelp:()=>{e.openHelp()},openKeyboardShortcuts:()=>{e.openKeyboardShortcuts()},openAbout:()=>{e.openAbout()}}}const sk=[50,75,100,125,150,200],lk=.1,ck=3;function Ac(e){return!Number.isFinite(e)||e<=0?1:Math.min(ck,Math.max(lk,e))}function uk(e,t,n,r,o){if(e==="fitWidth")return r<=0?1:Ac(t/r);if(e==="fitPage"){if(r<=0||o<=0)return 1;const a=t/r,s=n/o;return Ac(Math.min(a,s))}return Ac(e/100)}function dk(e){let t=null;return{schedule(){t===null&&(t=window.requestAnimationFrame(()=>{t=null,e()}))},cancel(){t!==null&&(window.cancelAnimationFrame(t),t=null)}}}function Qn(e,t){return()=>{e.setPageZoom(t)}}function er(e,t){return()=>e.getPageZoom()===t}function mk(e){return{setVisualMode:()=>{e.setMode("visual")},setHtmlMode:()=>{e.setMode("html")},toggleFullscreen:()=>{e.setFullscreen(!e.getFullscreen())},openCustomizeToolbar:()=>{e.openCustomizeToolbar()},openDocumentPreview:()=>{e.openDocumentPreview()},toggleReadAloud:()=>{e.toggleReadAloud()},toggleRuler:()=>{e.toggleRuler()},setLightMode:()=>{e.setDarkMode(!1)},setDarkMode:()=>{e.setDarkMode(!0)},setPageZoomFitWidth:Qn(e,"fitWidth"),setPageZoomFitPage:Qn(e,"fitPage"),setPageZoom50:Qn(e,50),setPageZoom75:Qn(e,75),setPageZoom100:Qn(e,100),setPageZoom125:Qn(e,125),setPageZoom150:Qn(e,150),setPageZoom200:Qn(e,200),setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function fk(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isPageZoomFitWidth:er(e,"fitWidth"),isPageZoomFitPage:er(e,"fitPage"),isPageZoom50:er(e,50),isPageZoom75:er(e,75),isPageZoom100:er(e,100),isPageZoom125:er(e,125),isPageZoom150:er(e,150),isPageZoom200:er(e,200),isToolbarPositionTop:()=>e.getToolbarPosition()==="top",isToolbarPositionLeft:()=>e.getToolbarPosition()==="left",isToolbarPositionRight:()=>e.getToolbarPosition()==="right",isToolbarPositionBottom:()=>e.getToolbarPosition()==="bottom",isReadingAloud:()=>e.isReadingAloud(),isRulerVisible:()=>e.isRulerVisible(),canReadAloud:()=>e.canReadAloud()}}function pk(e){return{addComment:()=>e.addComment(),toggleCommentsVisible:()=>e.toggleCommentsVisible()}}function gk(e){return{canAddComment:()=>e.canAddComment(),areCommentsVisible:()=>e.areCommentsVisible(),isCommentsEnabled:()=>e.isCommentsEnabled()}}function hk(e){return{openCompatibilityCheck:()=>{e.openCompatibilityCheck()}}}function bk(e){return{...X1(e),...ek(e),...ow(e),...nk(e),...ok(e),...mk(e),...J1(e),...pk(e),...hk(e),...ak(e)}}function yk(e){return{...fk(e),...tk(e),...rk(e),...ik(e),...Q1(e),...gk(e)}}function ps(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function xk(e){const t=e.style.fontSize;if(!t)return null;const n=Mu(t);return!n||!js(n.unit)?null:{value:n.value,unit:n.unit}}function wh(e,t){let n=ps(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=xk(n);if(r)return r;n=n.parentElement}return null}function wk(e,t){const n=ps(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function Ch(e,t){var a;let n=ps(t);for(;n&&n!==e;){if(n.style.fontSize){const u=n.parentElement??e,d=parseFloat(getComputedStyle(u).fontSize);return Number.isFinite(d)&&d>0?d:16}n=n.parentElement}const r=((a=ps(t))==null?void 0:a.parentElement)??e,o=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(o)&&o>0?o:16}function vh(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function Ck(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function Lf(e=xo){return{value:null,unit:e,mixed:!1}}function kh(e,t=xo){const n=window.getSelection();if(!n||n.rangeCount===0)return Lf(t);const r=n.getRangeAt(0);if(!Te(e,r.commonAncestorContainer))return Lf(t);const o=r.collapsed?[]:_t(r).filter(f=>f.data.length>0),a=o.length>0?o:[r.startContainer],s=a.map(f=>wh(e,f)),u=s[0];if(s.every(f=>Ck(f,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(s.every(f=>f===null)){const f=a.map(g=>wk(g,e)),h=f[0];if(f.every(g=>Math.abs(g-h)<.05)){const g=Ch(e,a[0]),y=vh(e);return{value:ng(h,t,g,y),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function vk(e,t){return{parentPx:Ch(e,t),rootPx:vh(e)}}function kk(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function ru(e,t,n){const r=Fr(t,n);if(!r)return!1;const o=kk(e);if(!o||o.collapsed)return!1;const a=_u(r.value,r.unit);kn(o);const s=_t(o).filter(u=>u.data.length>0);for(const u of s){const d=wh(e,u);d&&d.value===r.value&&d.unit===r.unit||Di(u,f=>{f.style.fontSize=a})}return Ur(s),!0}function Sk(e,t){e.style.fontSize=_u(t.value,t.unit)}function Pk(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Ak(e){return e.trim().toLowerCase()}function ou(e){const t={};for(const n of e.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=Ak(r.slice(0,o)),s=r.slice(o+1).trim();a&&(t[a]=s)}return t}function Sh(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function Tk(e,t){const n={...e};for(const[r,o]of Object.entries(t))o.trim()?n[r]=o:delete n[r];return n}function Rk(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(`
318
+ `)}function Fs(e){const t=ou(e);return Sh(t)}function Dk(e,t){let n=Pk(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function Ph(e){const t=An(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:_t(t).filter(d=>d.data.length>0),a=(n.length>0?n:[t.startContainer]).map(d=>Dk(e,d)).map(d=>d.trim()),s=a[0]??"";return a.every(d=>d===s)?{value:s||null,mixed:!1}:{value:null,mixed:!0}}function Ah(e,t){const n=ou(e.style.cssText),r=ou(t),o=Tk(n,r),a=Sh(o);a?e.style.cssText=a:e.removeAttribute("style")}function Th(e,t){const n=Fs(t);if(!n)return!1;const r=An(e);if(!r||r.collapsed)return!1;kn(r);const o=_t(r).filter(a=>a.data.length>0);if(o.length===0)return!1;for(const a of o)Di(a,s=>{Ah(s,n),gr(s)&&Ot(s)});return Ur(o),!0}function Ik(e,t){const n=Fs(t);n&&Ah(e,n)}function jk(e){return!!(e&&Fs(e))}const Jt=["bold","italic","underline","strikethrough"],po={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},Ek=new Set(["underline","line-through","overline"]);function lr(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function _k(e,t){return Jt.every(n=>e[n]===t[n])}function Mk(e){return Jt.some(t=>e[t]!==void 0)}function Rh(e,t){const n={...e};if(!t)return n;for(const r of Jt){const o=t[r];o!==void 0&&(n[r]=o)}return n}function Nk(e,t,n){const r=e[n]??t[n],o={...e,[n]:!r};return o[n]===t[n]&&delete o[n],o}function mr(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>Ek.has(n))}function Po(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 Dh(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(po.bold.has(r))return!0;const s=n.style.fontWeight;if(!s)return null;if(s==="bold"||s==="bolder")return!0;const u=Number(s);return Number.isNaN(u)?s==="normal"||s==="lighter"?!1:null:u>=700}if(t==="italic"){if(po.italic.has(r))return!0;const s=n.style.fontStyle;return s?s==="italic"||s==="oblique"?!0:s==="normal"?!1:null:null}if(t==="underline"){if(po.underline.has(r))return!0;const s=n.style.textDecorationLine||n.style.textDecoration;if(!s)return null;if(s==="none")return!1;const u=mr(n);return u.includes("underline")?!0:u.length>0?!1:null}if(po.strikethrough.has(r))return!0;const o=n.style.textDecorationLine||n.style.textDecoration;if(!o)return null;if(o==="none")return!1;const a=mr(n);return a.includes("line-through")?!0:a.length>0?!1:null}function gs(e,t){return Dh(e,t)===!0}function Ao(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const o=Dh(r,n);if(o!==null)return o;r=r.parentElement}return!1}function Ih(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=mr(e);r.includes("underline")||r.push("underline"),Po(e,r);return}const n=mr(e);n.includes("line-through")||n.push("line-through"),Po(e,n)}function jh(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"){Po(e,mr(e).filter(n=>n!=="underline"));return}Po(e,mr(e).filter(n=>n!=="line-through"))}function Lk(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=mr(e).filter(o=>o!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}Po(e,r);return}const n=mr(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}Po(e,n)}function Bk(e,t){Di(e,n=>Ih(n,t))}function Fk(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!Pn(o)||!gs(o,n)){r=o;continue}if(hr(o,r),gs(o,n)){if(po[n].has(o.tagName.toLowerCase())){Ot(o);continue}if(jh(o,n),gr(o)){Ot(o);continue}}r=o}}function Hk(e,t,n){const r=_t(t).filter(o=>o.data.length>0);return r.length===0?Ao(e,t.startContainer,n):r.every(o=>Ao(e,o,n))}function zk(e,t,n,r){kn(t);const o=_t(t).filter(a=>a.data.length>0);for(const a of o)r?Ao(e,a,n)||Bk(a,n):Fk(e,a,n);Ur(o)}function go(e){const t=window.getSelection();if(!t||t.rangeCount===0)return lr();const n=t.getRangeAt(0);if(!Te(e,n.commonAncestorContainer))return lr();if(n.collapsed)return iu(e,n);const r=_t(n).filter(a=>a.data.length>0);if(r.length===0)return iu(e,n);const o=lr();for(const a of Jt)o[a]=Ao(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const s of Jt)o[s]=o[s]&&Ao(e,r[a],s);return o}function iu(e,t){const n=lr();for(const r of Jt)n[r]=Ao(e,t.startContainer,r);return n}function au(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Te(e,r.commonAncestorContainer)||r.collapsed)return!1;const o=Hk(e,r,t);return zk(e,r,t,!o),!0}function Ok(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 o=r.splitText(n);e.setStart(o,0),e.collapse(!0)}function Kk(e,t,n){var a,s,u;Ok(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 d=document.createTextNode("");(a=t.startContainer.parentNode)==null||a.insertBefore(d,t.startContainer.nextSibling),r=d}else if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0){const d=document.createTextNode("");(s=t.startContainer.parentNode)==null||s.insertBefore(d,t.startContainer),r=d}else{const d=document.createTextNode("");r&&r!==t.startContainer?(u=r.parentNode)==null||u.insertBefore(d,r):t.startContainer.appendChild(d),r=d}let o=r;for(;o.parentElement&&o.parentElement!==e;){const d=o.parentElement;if(!Pn(d)){o=d;continue}if(!n.some(h=>gs(d,h))){o=d;continue}hr(d,o);for(const h of n)if(gs(d,h)){if(po[h].has(d.tagName.toLowerCase())){Ot(d);break}if(jh(d,h),gr(d)){Ot(d);break}}o=d.isConnected?d:r}return r}function $k(e,t,n){for(const r of Jt)n[r]!==t[r]&&(n[r]?Ih(e,r):Lk(e,r))}function Uk(e,t,n,r,o,a,s){var v,A;const u=window.getSelection();if(!u||u.rangeCount===0)return;const d=u.getRangeAt(0);if(!Te(e,d.commonAncestorContainer))return;const f=iu(e,d),h=Rh(f,n),g=Jt.filter(I=>f[I]&&!h[I]),y=gC(e,d.startContainer,o),b=Fw(e,d.startContainer,a);let w=null;g.length>0?(w=Kk(e,d,g),y.length>0&&dg(e,w,y),b&&$c(e,w)):y.length>0?(w=pC(e,d,y),b&&$c(e,w)):b?w=Bw(e,d):d.deleteContents();const x=document.createElement("span");$k(x,f,h),r&&Sk(x,r),o!=null&&o.color&&gf(x,"color",o.color),o!=null&&o.backgroundColor&&gf(x,"backgroundColor",o.backgroundColor),a&&_w(x,a),s&&Ik(x,s),x.textContent=t;const S=x.style.cssText.trim()?x:document.createTextNode(t);w?((v=w.parentNode)==null||v.insertBefore(S,w),w.nodeType===Node.TEXT_NODE&&!w.data&&((A=w.parentNode)==null||A.removeChild(w))):d.insertNode(S);const k=document.createRange();k.selectNodeContents(S),k.collapse(!1),u.removeAllRanges(),u.addRange(k)}const Hr=["p","h1","h2","h3","h4","h5","h6"],Vk=new Set(Hr),Eh=new Set([...Hr,"div"]),Hs=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),Wk=()=>({tag:null,mixed:!1});function _h(e){return Vk.has(e)}function Gk(e){return _h(e)?e:e==="div"?"p":null}function qk(e){return e instanceof Element&&Hs.has(_e(e))}function Mh(e){return e instanceof HTMLElement&&!kt(e)&&Eh.has(_e(e))}function su(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=_e(e);return Eh.has(t)||Hs.has(t)?!1:Pn(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Zk(e,t){let n=ji(t);for(;n&&n!==e;){if(Hs.has(_e(n)))return!0;n=n.parentElement}return!1}function Nh(e,t){let n=ji(t);for(;n&&n!==e;){if(Zg(n,e)){n=n.parentElement;continue}if(Mh(n))return n;if(Hs.has(_e(n)))return null;n=n.parentElement}return null}function Yk(e,t){const n=new Set,r=[];for(const o of Hu(t)){const a=Nh(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Xk(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function Jk(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&su(n[o-1]);)o-=1;for(;a<n.length-1&&su(n[a+1]);)a+=1;return n.slice(o,a+1)}function lu(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t)))return t;return null}function Qk(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&&kt(r)?lu(e):r}return n.startContainer===t&&e!==t?lu(e):Xk(e,n.startContainer)}function eS(e,t,n){const r=Xu(e);if(Zk(e,t.startContainer))return!1;if(!lu(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const o=Qk(r,e,t);if(!o||o instanceof HTMLElement&&kt(o)||qk(o)||Mh(o)||!su(o))return!1;const a=Jk(r,o),s=document.createElement(n);r.insertBefore(s,a[0]);for(const u of a)s.appendChild(u);return!0}function tS(e){const t=An(e);if(!t)return Wk();const n=Hu(t).map(o=>{const a=Nh(e,o);return a?Gk(_e(a)):null}),r=n[0];return n.every(o=>o===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function nS(e,t){if(!_h(t))return!1;const n=An(e);if(!n)return!1;const r=wo(e,n.startContainer,n.startOffset),o=wo(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=Yk(e,n);let d=!1;if(u.length===0)d=eS(e,n,t);else for(const f of u)_e(f)!==t&&(Ou(f,t),d=!0);return zu(e,a,s),d}function od(e){if(!Xt(e))return null;const t=Co(e);if(!t)return null;const n=_e(t);return n==="ul"||n==="ol"?n:null}function Lh(e){const t=$n(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(od),r=n[0];return n.every(o=>o===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function rS(e,t,n){const r=[...e.children].filter(o=>Fu(o));for(const o of r)t.insertBefore(o,n)}function Bh(e){const t=Co(e),n=document.createElement("p");for(const f of[...e.attributes])n.setAttribute(f.name,f.value);for(n.style.marginLeft="",It(n);e.firstChild&&!Fu(e.firstChild);)n.appendChild(e.firstChild);const r=[];let o=e.nextElementSibling;for(;o;)r.push(o),o=o.nextElementSibling;const a=(t==null?void 0:t.parentNode)??e.parentNode;if(!t||!a)return e.replaceWith(n),n;const s=Xt(a)?a.parentNode??a:a,u=Xt(a)?a.nextSibling:t.nextSibling;e.remove();let d=null;if(r.length>0){d=document.createElement(t.tagName);for(const f of r)d.appendChild(f)}return s.insertBefore(n,u),d&&s.insertBefore(d,n.nextSibling),rS(e,s,n.nextSibling),t.childElementCount===0&&t.remove(),n}function oS(e){if(Xt(e))return e;const t=Ou(e,"li");return t.style.marginLeft="",It(t),t}function Fh(e,t){if(e.length===0)return!1;if(e.every(Xt)){const a=Co(e[0]);if(a&&e.every(s=>s.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return _e(a)===t?!1:(Ou(a,t),!0)}const n=e[0],r=n.parentNode;if(!r)return!1;const o=document.createElement(t);r.insertBefore(o,n);for(const a of e){const s=Xt(a)?Co(a):null;o.appendChild(oS(a)),s&&s!==o&&s.childElementCount===0&&s.remove()}return!0}function Hh(e){let t=!1;for(const n of[...e].reverse())Xt(n)&&(Bh(n),t=!0);return t}function iS(e,t){return yr(e,()=>{const n=Vr(e);if(n.length===0)return!1;if(n.every(a=>od(a)===t))return Hh(n);let o=!1;for(const a of sg(n))Fh(a,t)&&(o=!0);return o})}function aS(e,t){return yr(e,()=>{const n=Vr(e);if(n.length===0)return!1;if(t===null)return Hh(n);if(n.every(a=>od(a)===t))return!1;let o=!1;for(const a of sg(n))Fh(a,t)&&(o=!0);return o})}const zh=40;function id(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function Oh(e,t){if(t<=0){e.style.marginLeft="",It(e);return}e.style.marginLeft=`${t}px`}function sS(e){let t=e.previousElementSibling;for(;t;){if(Xt(t))return t;t=t.previousElementSibling}return null}function lS(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(_e(n)==="ul"||_e(n)==="ol"))return n}return null}function cS(e){const t=sS(e);if(!t)return!1;const n=Co(e);if(!n)return!1;const r=_e(n)==="ol"?"ol":"ul";let o=lS(t);return(!o||_e(o)!==r)&&(o=document.createElement(r),t.appendChild(o)),o.appendChild(e),!0}function uS(e){const t=Co(e);if(!t)return!1;const n=t.parentElement;if(n&&Xt(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return Bh(e),!0}function dS(e){return $n(e).some(n=>Xt(n)||id(n)>0)}function mS(e){return yr(e,()=>{const t=Vr(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(Xt(r)){cS(r)&&(n=!0);continue}Oh(r,id(r)+zh),n=!0}return n})}function fS(e){return yr(e,()=>{const t=$n(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(Xt(r)){uS(r)&&(n=!0);continue}const o=id(r);o<=0||(Oh(r,Math.max(0,o-zh)),n=!0)}return n})}function zs(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function $r(e,t,n){const r=Math.max(1,Math.floor(t)),o=Math.max(1,Math.floor(n));r<=1?e.removeAttribute("colspan"):e.colSpan=r,o<=1?e.removeAttribute("rowspan"):e.rowSpan=o}function Kt(e){const t=e.rows.length,n=Array.from({length:t},()=>[]),r=[];let o=0;for(let a=0;a<t;a+=1){const s=e.rows[a];let u=0;for(const d of Array.from(s.cells)){for(;n[a][u];)u+=1;const f=zs(d),h={cell:d,originRow:a,originCol:u,rowSpan:f.rowSpan,colSpan:f.colSpan};r.push(h);for(let g=0;g<f.rowSpan;g+=1){const y=a+g;if(y>=t)break;for(let b=0;b<f.colSpan;b+=1)n[y][u+b]=h}u+=f.colSpan,o=Math.max(o,u)}o=Math.max(o,n[a].length)}return{table:e,slots:n,unique:r,rowCount:t,colCount:o}}function hs(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function dn(e,t){return e.unique.find(n=>n.cell===t)??null}function Kh(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 $h(e){if(e.length===0)return null;let t=1/0,n=-1/0,r=1/0,o=-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),o=Math.max(o,a.originCol+a.colSpan-1);return{minRow:t,maxRow:n,minCol:r,maxCol:o}}function pS(e,t){const n=new Set,r=[];for(let o=t.minRow;o<=t.maxRow;o+=1)for(let a=t.minCol;a<=t.maxCol;a+=1){const s=hs(e,o,a);!s||n.has(s.cell)||(n.add(s.cell),r.push(s.cell))}return r}function Uh(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=hs(e,t.minRow,t.minCol);if(!n||n.originRow!==t.minRow||n.originCol!==t.minCol)return null;const r=new Set,o=[];for(let a=t.minRow;a<=t.maxRow;a+=1)for(let s=t.minCol;s<=t.maxCol;s+=1){const u=hs(e,a,s);if(!u||Kh(u,t))return null;r.has(u.cell)||(r.add(u.cell),o.push(u.cell))}return{origin:n,cells:o,colSpan:t.maxCol-t.minCol+1,rowSpan:t.maxRow-t.minRow+1}}function gS(e,t,n,r){const o={minRow:t.originRow,maxRow:t.originRow+r-1,minCol:t.originCol,maxCol:t.originCol+n-1};if(o.maxRow>=e.rowCount||o.maxCol>=e.colCount)return!1;for(let a=o.minRow;a<=o.maxRow;a+=1)for(let s=o.minCol;s<=o.maxCol;s+=1){const u=hs(e,a,s);if(!u)return!1;if(u.cell!==t.cell&&Kh(u,o))return!1}return!0}const Bf=10,ho=1,bo=50,hS="1px solid #000",bS="0.25em",yS=new Set(["td","th"]);function Vh(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=ho&&t>=ho&&e<=bo&&t<=bo}function Et(e,t){return sd(e,t,n=>n instanceof HTMLTableElement)}function bs(e,t){return sd(e,t,n=>DS(n))}function xS(e,t){return sd(e,t,n=>n instanceof HTMLTableRowElement)}function ad(e){return Et(e,ld(e))}function Tn(e){return bs(e,ld(e))}function Wh(e){return xS(e,ld(e))}function wS(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function _i(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!Te(e,n.commonAncestorContainer))return[];const r=bs(e,n.startContainer),o=bs(e,n.endContainer);if(!r)return[];if(!o||r===o)return[r];const a=Et(e,r);if(!a||Et(e,o)!==a)return[r];const s=Kt(a),u=dn(s,r),d=dn(s,o);if(!u||!d)return[r];const f=$h([u,d]);if(!f)return[r];const h=pS(s,f);return h.length>0?h:[r]}function CS(e,t){if(!Vh(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Te(e,r.commonAncestorContainer))return!1;const o=document.createElement("table");o.style.borderCollapse="collapse",o.style.width="100%";const a=document.createElement("tbody");for(let u=0;u<t.rows;u+=1){const d=document.createElement("tr");for(let f=0;f<t.cols;f+=1)d.appendChild(IS("td"));a.appendChild(d)}o.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(o),MS(e,o);const s=o.querySelector("td, th");return s instanceof HTMLTableCellElement&&jt(s),!0}function cu(e,t){var g,y,b,w;const n=Tn(e);if(!n)return!1;const r=Et(e,n);if(!r)return!1;const o=Kt(r),a=dn(o,n);if(!a)return!1;const s=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const x of o.unique)if(x.originRow<s&&x.originRow+x.rowSpan>s){$r(x.cell,x.colSpan,x.rowSpan+1);for(let S=x.originCol;S<x.originCol+x.colSpan;S+=1)u.add(S)}const d=document.createElement("tr"),f=Math.min(s,o.rowCount-1);for(let x=0;x<o.colCount;x+=1){if(u.has(x))continue;const S=((y=(g=o.slots[f])==null?void 0:g[x])==null?void 0:y.cell)??n;d.appendChild(cd(S))}if(s>=r.rows.length)(b=r.rows[r.rows.length-1].parentNode)==null||b.appendChild(d);else{const x=r.rows[s];(w=x.parentNode)==null||w.insertBefore(d,x)}const h=ES(d,o.colCount,u,a.originCol);return jt(h||n),!0}function Ff(e,t){var f,h,g,y;const n=Tn(e);if(!n)return!1;const r=Et(e,n);if(!r)return!1;const o=Kt(r),a=dn(o,n);if(!a)return!1;const s=t==="before"?a.originCol:a.originCol+a.colSpan,u=new Set;for(const b of o.unique)if(b.originCol<s&&b.originCol+b.colSpan>s){$r(b.cell,b.colSpan+1,b.rowSpan);for(let w=b.originRow;w<b.originRow+b.rowSpan;w+=1)u.add(w)}let d=null;for(let b=0;b<o.rowCount;b+=1){if(u.has(b))continue;const w=((h=(f=o.slots[b])==null?void 0:f[Math.min(s,Math.max(0,o.colCount-1))])==null?void 0:h.cell)??((y=(g=o.slots[b])==null?void 0:g[Math.max(0,s-1)])==null?void 0:y.cell)??n,x=cd(w);ud(r,b,s,x),b===a.originRow&&(d=x)}return d&&jt(d),!0}function vS(e){var y,b;const t=Tn(e);if(!t)return!1;const n=Et(e,t);if(!n)return!1;const r=Kt(n),o=dn(r,t);if(!o)return!1;if(r.rowCount<=1)return uu(e,n);const a=o.originRow,s=a+1,u=[];for(const w of r.unique)w.originRow<=a&&w.originRow+w.rowSpan>a&&(w.originRow<a?$r(w.cell,w.colSpan,w.rowSpan-1):w.originRow===a&&w.rowSpan>1&&u.push(w));u.sort((w,x)=>w.originCol-x.originCol);for(const w of u)$r(w.cell,w.colSpan,w.rowSpan-1),ud(n,s,w.originCol,w.cell);const d=o.originCol;n.rows[a].remove();const f=n.rows[Math.min(a,n.rows.length-1)],h=Kt(n),g=(b=(y=h.slots[Math.min(a,h.rowCount-1)])==null?void 0:y[Math.min(d,Math.max(0,h.colCount-1))])==null?void 0:b.cell;return g?jt(g):f!=null&&f.cells[0]?jt(f.cells[0]):LS(n),!0}function kS(e){var f,h,g;const t=Tn(e);if(!t)return!1;const n=Et(e,t);if(!n)return!1;const r=Kt(n),o=dn(r,t);if(!o)return!1;if(r.colCount<=1)return uu(e,n);const a=o.originCol,s=o.originRow;for(const y of r.unique)a<y.originCol||a>=y.originCol+y.colSpan||(y.colSpan===1?y.cell.remove():$r(y.cell,y.colSpan-1,y.rowSpan));const u=Kt(n);if(u.colCount===0||u.unique.length===0)return uu(e,n);const d=((h=(f=u.slots[Math.min(s,u.rowCount-1)])==null?void 0:f[Math.min(a,u.colCount-1)])==null?void 0:h.cell)??((g=u.unique[0])==null?void 0:g.cell);return d&&jt(d),!0}function SS(e,t){const n=Tn(e);if(!n)return!1;const r=Et(e,n);if(!r)return!1;const o=wS(r),a=o.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(jt(o[a-1]),{changed:!1});if(a<o.length-1)return jt(o[a+1]),{changed:!1};const s=n.parentElement;if(!cu(e,"below"))return!1;const u=s instanceof HTMLTableRowElement?s.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&jt(u.cells[0]),{changed:!0}}function PS(e,t){return!Te(e,t)||t===e?!1:(jt(t),!0)}function Hf(e){return Gh(e)!==null}function zf(e){const t=Tn(e);if(!t)return!1;const n=zs(t);return n.colSpan>1||n.rowSpan>1}function AS(e){const t=Gh(e);if(!t)return!1;const n=Et(e,t.origin.cell);return n?qh(n,t):!1}function TS(e){const t=Tn(e);if(!t)return!1;const n=Et(e,t);return n?Zh(n,t):!1}function RS(e,t,n){const r=Tn(e);if(!r)return!1;const o=Et(e,r);if(!o)return!1;const a=Kt(o),s=dn(a,r);if(!s)return!1;const u=Math.min(a.colCount-s.originCol,Math.max(1,Math.floor(t))),d=Math.min(a.rowCount-s.originRow,Math.max(1,Math.floor(n)));if(u===s.colSpan&&d===s.rowSpan||!gS(a,s,u,d))return!1;if((s.colSpan>1||s.rowSpan>1)&&Zh(o,r),u===1&&d===1)return jt(r),!0;const f=Kt(o),h=Uh(f,{minRow:s.originRow,maxRow:s.originRow+d-1,minCol:s.originCol,maxCol:s.originCol+u-1});return h?qh(o,h):!0}function sd(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function DS(e){return yS.has(e.tagName.toLowerCase())}function ld(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n.startContainer:null}function Gh(e){const t=_i(e);if(t.length<2)return null;const n=Et(e,t[0]);if(!n)return null;const r=Kt(n),o=[];for(const u of t){const d=dn(r,u);if(!d)return null;o.push(d)}const a=$h(o);if(!a)return null;const s=Uh(r,a);return!s||s.cells.length<2?null:s}function qh(e,t){const n=t.origin.cell,r=Kt(e),o=t.cells.map(a=>dn(r,a)).filter(a=>a!==null).sort((a,s)=>a.originRow-s.originRow||a.originCol-s.originCol);for(const a of o)a.cell!==n&&_S(n,a.cell);$r(n,t.colSpan,t.rowSpan);for(const a of o)a.cell!==n&&a.cell.remove();return jt(n),!0}function Zh(e,t){const n=Kt(e),r=dn(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;$r(t,1,1);for(let o=r.originRow;o<r.originRow+r.rowSpan;o+=1)for(let a=r.originCol;a<r.originCol+r.colSpan;a+=1)o===r.originRow&&a===r.originCol||ud(e,o,a,cd(t));return jt(t),!0}function IS(e){const t=document.createElement(e);return t.style.border=hS,t.style.padding=bS,t.appendChild(document.createElement("br")),t}function cd(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 jS(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function ud(e,t,n,r){const o=e.rows[t];if(!o)return;const a=Kt(e);let s=0;for(const u of Array.from(o.cells)){if(u===r)continue;const d=dn(a,u);if(!d||d.originCol>=n)break;s+=1}jS(o,s,r)}function ES(e,t,n,r){let o=0;for(let a=0;a<t;a+=1)if(!n.has(a)){if(a>=r)return e.cells[o]??null;o+=1}return e.cells[e.cells.length-1]??null}function Of(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 _S(e,t){if(!(e===t||Of(t)))for(Of(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function MS(e,t){var o;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))&&((o=n.parentNode)==null||o.insertBefore(t,n.nextSibling),NS(n)&&n.remove())}function NS(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 uu(e,t){if(!t.parentNode||!Te(e,t))return!1;const r=document.createRange();r.setStartBefore(t),r.collapse(!0),t.remove();const o=window.getSelection();return o&&(o.removeAllRanges(),o.addRange(r)),!0}function jt(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function LS(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const Yh=["left","center","right","justify"];function BS(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function ys(e){return BS(e.style.textAlign)}function du(e,t){const n=t??"left";return ys(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 Kf(e){const t=e[0];return e.every(n=>n===t)?{align:t,mixed:!1}:{align:null,mixed:!0}}function Xh(e){const t=_i(e);if(t.length>0)return Kf(t.map(ys));const n=$n(e);return n.length===0?An(e)?{align:"left",mixed:!1}:{align:null,mixed:!1}:Kf(n.map(ys))}function Jh(e,t){return Yh.includes(t)?yr(e,()=>{const n=_i(e);if(n.length>0){let a=!1;for(const s of n)du(s,t)&&(a=!0);return a}const r=Vr(e);if(r.length===0)return!1;let o=!1;for(const a of r)du(a,t)&&(o=!0);return o}):!1}function Br(){return{...Wr(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function Wa(e){const t=OC(e),n=Xh(e),r=Lh(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function Qh(e,t){let n=!1;return!t.alignMixed&&t.align&&Jh(e,t.align)&&(n=!0),t.listMixed||aS(e,t.list)&&(n=!0),KC(e,t)&&(n=!0),n}function FS(e,t){return Qh(e,mu(t))}function eb(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 mu(e){const t=Br();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}}function Ga(e){return e?Lr(e):""}function HS(e,t){return e.src===t.src&&e.opacity===t.opacity&&e.fit===t.fit&&e.position===t.position&&Ga(e.width)===Ga(t.width)&&Ga(e.height)===Ga(t.height)}function Tc(e){const t=$n(e);if(t.length===0)return vn();const n=t.map(uh),r=n[0];return n.some(o=>!HS(o,r))?vn():r}function zS(e,t){return yr(e,()=>{const n=Vr(e);if(n.length===0)return!1;let r=!1;for(const o of n)dh(o,t)&&(r=!0);return r})}function OS(){return{size:null,unit:xo,marks:lr(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function hi(){return{font:OS(),box:Wr(),backgroundImage:vn(),atRule:or()}}function fu(e,t){return t?{top:t.top!==void 0?t.top:e.top,right:t.right!==void 0?t.right:e.right,bottom:t.bottom!==void 0?t.bottom:e.bottom,left:t.left!==void 0?t.left:e.left}:e}function KS(e,t){if(!t)return e;const{margin:n,padding:r,...o}=t;return{...e,...o,margin:n?fu(e.margin,n):e.margin,padding:r?fu(e.padding,r):e.padding}}function $S(e,t){if(!t)return e;const{marks:n,...r}=t;return{...e,...r,marks:n?{...e.marks,...n}:e.marks}}function US(e,t){const{margin:n,...r}=t.atRule??{};return{font:$S(e.font,t.font),box:KS(e.box,t.box),backgroundImage:t.backgroundImage?{...e.backgroundImage,...t.backgroundImage}:e.backgroundImage,atRule:t.atRule?{...e.atRule,...r,margin:n?fu(e.atRule.margin,n):e.atRule.margin}:e.atRule}}function VS(e){return e?!!(e.font||e.box||e.backgroundImage||e.atRule):!1}function $f(e,t){if(!VS(t))return e;const n=document.createElement("div");n.innerHTML=e;const r=US(ui(n),t);return pu(n,r).pageHtml}function WS(e){const t=e.style.fontSize,n=t?Mu(t):null,r=n&&js(n.unit)?{value:n.value,unit:n.unit}:null,o=`${e.style.textDecorationLine} ${e.style.textDecoration}`.toLowerCase(),a=e.style.fontWeight.trim().toLowerCase(),s={bold:a==="bold"||Number(a)>=700,italic:e.style.fontStyle.trim().toLowerCase()==="italic",underline:/\bunderline\b/.test(o),strikethrough:/\bline-through\b/.test(o)},u=e.style.color,d=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??xo,marks:s,fontFamily:d||null,fontFamilyMixed:!1,fontColor:u?Ke(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function GS(e,t){const n=e.style.fontSize,r=t.size===null?null:Fr(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const o=_u(r.value,r.unit);return n===o?!1:(e.style.fontSize=o,!0)}function qS(e,t){var o;if(t.fontFamilyMixed)return!1;const n=(o=t.fontFamily)!=null&&o.trim()?t.fontFamily.trim():null,r=e.style.fontFamily.trim()||null;return Ii(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function ZS(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?Ke(t.fontColor):null;return(e.style.color?Ke(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function YS(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 o=t.italic?"italic":"";e.style.fontStyle!==o&&(o?e.style.fontStyle=o:e.style.removeProperty("font-style"),n=!0);const a=[];t.underline&&a.push("underline"),t.strikethrough&&a.push("line-through");const s=a.join(" ");return(e.style.textDecorationLine||e.style.textDecoration).trim()!==s&&(s?e.style.textDecoration=s:(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),n=!0),n}function XS(e,t){let n=!1;return GS(e,t)&&(n=!0),qS(e,t)&&(n=!0),ZS(e,t)&&(n=!0),YS(e,t.marks)&&(n=!0),n&&It(e),n}function JS(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function ui(e){const t=yt(e);if(!t)return hi();const n=Ro(t);return{font:WS(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,breakInside:n.breakInside,breakInsideMixed:!1,breakAfter:n.breakAfter,breakAfterMixed:!1,breakBefore:n.breakBefore,breakBeforeMixed:!1},backgroundImage:D1(t),atRule:it(e.innerHTML)}}function pu(e,t){const n=An(e),r=n?wo(e,n.startContainer,n.startOffset):null,o=n?wo(e,n.endContainer,n.endOffset):null,a=yt(e),s=Yu(e);pi(s);const u=XS(s,t.font),d=Do(s,JS(t)),f=I1(s,t.backgroundImage);Ls(e);const h=it(e.innerHTML),g=ss(e.innerHTML,t.atRule),y=cn(g);y!==cn(e.innerHTML)&&(e.innerHTML=y),jo(e,g);const b=JSON.stringify(h)!==JSON.stringify(t.atRule);r!==null&&o!==null&&zu(e,Math.min(r,o),Math.max(r,o)),Bs(e);const w=ss(e.innerHTML,t.atRule);return{changed:!a||u||d||f||b,pageHtml:w}}function QS(e,t){const n=t??e.innerHTML,r=Ng(n);return Pi(n)?(e.innerHTML=cn(r),Ls(e),jo(e,r),{changed:!0,pageHtml:r}):{changed:!1,pageHtml:r}}function eP(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function tP(e){return e.body.innerHTML.replace(/\s*data-page=""/g," data-page")}function nP(e){const t=[...e.body.querySelectorAll(`[${dr}]`)];for(const n of t){if(!(n instanceof HTMLElement))continue;const r=n.parentElement;if(r){for(;n.firstChild;)r.insertBefore(n.firstChild,n);n.remove()}}}function rP(e){for(const n of[...e.body.querySelectorAll(`[${Or}]`)])n.remove();const t=e.getElementById("commspliant-background");t==null||t.remove()}function Rc(e){const t=eP(e);for(const n of t.querySelectorAll(`style[${Si}]`))n.remove();rP(t),nP(t);for(const n of t.body.querySelectorAll("*"))n instanceof HTMLElement&&kt(n)&&n.remove();return tP(t)}const oP=/<script\b[^>]*>[\s\S]*?<\/script>/gi,iP=/^\s*javascript\s*:/i;function aP(e){return e.replace(/&(#x[0-9a-f]+|#\d+|amp|lt|gt|quot);/gi,(t,n)=>{const r=n.toLowerCase();if(r==="amp")return"&";if(r==="lt")return"<";if(r==="gt")return">";if(r==="quot")return'"';if(r.startsWith("#x")){const o=Number.parseInt(r.slice(2),16);return Number.isFinite(o)?String.fromCodePoint(o):t}if(r.startsWith("#")){const o=Number.parseInt(r.slice(1),10);return Number.isFinite(o)?String.fromCodePoint(o):t}return t}).replace(/\\([0-7]{1,3})/g,(t,n)=>{const r=Number.parseInt(n,8);return Number.isFinite(r)?String.fromCodePoint(r):t})}function tb(e){const t=aP(e).replace(/[\u0000-\u001F\u007F\s]+/g,"");return iP.test(t)}function sP(e){return e.split(";").map(t=>t.trim()).filter(t=>{if(!t)return!1;const n=t.indexOf(":");if(n<=0)return!0;const r=t.slice(n+1);return!tb(r)&&!/url\s*\(\s*["']?\s*javascript:/i.test(r)}).join("; ")}function lP(e){const t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(const n of t)for(const r of[...n.attributes]){if(tb(r.value)){n.removeAttribute(r.name);continue}if(r.name.toLowerCase()==="style"){const o=sP(r.value);o?o!==r.value&&n.setAttribute(r.name,o):n.removeAttribute(r.name)}}}function cP(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function uP(e){return e.body.innerHTML}function gu(e){if(!e.trim())return e;const n=e.replace(oP,"");if(!/javascript\s*:/i.test(n))return n;const r=cP(n);return lP(r.body),uP(r)}function mo(e){if(!e.trim())return e;const n=ar(e);return n.length===1?gu(e):zt(n.map(gu))}const dd="data-hover-html",dP="noopener noreferrer",mP="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)",fP="this._hoverBox&&this._hoverBox.remove()",pP=/^(#(?:[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 Os(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function gP(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function Ti(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&gP(n))return n;n=n.parentNode}return null}function nb(e){return pP.test(e)}function hP(e){var o;const t=e.getAttribute("onmouseover")??"",n=/this\.style\.color\s*=\s*'([^']+)'/.exec(t),r=((o=n==null?void 0:n[1])==null?void 0:o.trim())??"";return r&&nb(r)?r:null}function rb(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function bP(e){const t=e.getAttribute(dd)??"",n=hP(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:rb(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function ob(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!Te(e,n.commonAncestorContainer))return null;const r=Ti(e,n.commonAncestorContainer);return r?bP(r):null}function yP(e){return ob(e)!==null}function xP(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(dd)}function wP(e,t){var r;if(xP(e),t.hoverMode==="html"){const o=t.hoverHtml.trim();if(!o)return;e.setAttribute(dd,o),e.setAttribute("onmouseover",mP),e.setAttribute("onmouseout",fP);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!nb(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function md(e,t){const n=Os(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",dP)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":rb(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),wP(e,n)}function CP(e,t){const n=new Set;for(const r of t){const o=Ti(e,r);o&&!n.has(o)&&n.add(o)}for(const r of n)Ot(r)}function vP(e,t,n){kn(t);const r=_t(t).filter(u=>u.data.length>0);CP(e,r),r.length>0&&Ur(r);const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);kn(a);const s=document.createElement("a");md(s,n);try{return a.surroundContents(s),!0}catch{const u=a.extractContents();return u.hasChildNodes()?(s.appendChild(u),a.insertNode(s),!0):!1}}function kP(e,t){const n=document.createElement("a");md(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 SP(e,t){const n=t.href.trim();if(!n)return!1;const r=Os({...t,href:n}),o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!Te(e,a.commonAncestorContainer))return!1;const s=Ti(e,a.startContainer),u=Ti(e,a.endContainer);return s&&s===u?(md(s,r),!0):a.collapsed?kP(a,r):vP(e,a,r)}const PP=/^[A-Za-z][A-Za-z0-9_-]*$/,ib="​";function hu(e){var r;const t=Xu(e),n=new Set;for(const o of t.querySelectorAll("[id]")){if(o===t)continue;const a=o.id.trim();a&&n.add(a)}for(const o of t.querySelectorAll("a[name]")){const a=(r=o.getAttribute("name"))==null?void 0:r.trim();a&&n.add(a)}return[...n].sort((o,a)=>o.localeCompare(a)).map(o=>({id:o}))}function AP(e){return new Set(hu(e).map(t=>t.id))}function ab(e,t){const n=e.trim();return n?PP.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function Uf(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ib)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function TP(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ib)),(r=e.parentNode)==null||r.insertBefore(n,e)}function RP(e,t){const n=t.trim();if(ab(n,AP(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Te(e,o.commonAncestorContainer))return!1;const a=Ti(e,o.startContainer);if(a)return TP(a,n),!0;if(o.collapsed)return Uf(o,n),!0;kn(o);const s=document.createElement("span");s.id=n;try{return o.surroundContents(s),!0}catch{return Uf(o,n),!0}}const bt="data-comment-thread",Vf="wysiwyg-comment-anchor";function DP(){return`cmt_${crypto.randomUUID()}`}function IP(){return crypto.randomUUID()}const xs=20;function Wf(e,t){if(!e)return null;const n=e instanceof Element?e:e.parentElement;if(!n)return null;const r=n.closest(`[${bt}]`);return r instanceof HTMLElement&&Te(t,r)?r:null}function Gf(e,t,n){var y;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=Math.max(0,t),a=Math.max(t,n),s=null,u=0,d=null,f=0,h;for(;h=r.nextNode();){const b=h,w=((y=b.textContent)==null?void 0:y.length)??0;if(!s&&o<=w&&(s=b,u=o),!d&&a<=w){d=b,f=a;break}o-=w,a-=w}if(!s||!d)return null;const g=document.createRange();return g.setStart(s,u),g.setEnd(d,f),g}function jP(e,t,n){const r=e.textContent??"",o=r.slice(Math.max(0,t-xs),t),a=r.slice(n,n+xs);return{prefix:o,suffix:a}}function EP(e,t){if(t.mode!=="visual")return null;const n=sr(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:o}=jP(e,t.start,t.end);return{type:"text",text:t.text,start:t.start,end:t.end,prefix:r,suffix:o}}function qf(e,t){if(t.mode!=="visual")return null;const n=sr(e);if(n!=null&&n.hasAttribute(bt))return n.getAttribute(bt)??null;if(t.visualRange){const r=Wf(t.visualRange.startContainer,e);if(r)return r.getAttribute(bt)??null;const o=Wf(t.visualRange.endContainer,e);if(o)return o.getAttribute(bt)??null}return null}function bu(e,t,n){if(!Te(e,n.commonAncestorContainer))return!1;kn(n);const r=document.createElement("span");r.setAttribute(bt,t);try{return n.surroundContents(r),!0}catch{const o=n.toString();if(!o)return!1;const a=document.createElement("span");return a.setAttribute(bt,t),a.textContent=o,n.deleteContents(),n.insertNode(a),!0}}function sb(e,t){e.setAttribute(bt,t)}function _P(e,t,n){const r=sr(e);return r?(sb(r,t),!0):n.visualRange?bu(e,t,n.visualRange):!1}function MP(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 NP(e,t,n){if(n.type!=="text")return!1;if(n.start!==void 0&&n.end!==void 0){const s=Gf(e,n.start,n.end);if(s&&s.toString()===n.text)return bu(e,t,s)}const r=e.textContent??"",o=n.text;if(!o)return!1;let a=0;for(;a<=r.length;){const s=r.indexOf(o,a);if(s===-1)return!1;const u=s+o.length,d=r.slice(Math.max(0,s-xs),s),f=r.slice(u,u+xs);if(n.prefix!==void 0&&d!==n.prefix){a=s+1;continue}if(n.suffix!==void 0&&f!==n.suffix){a=s+1;continue}const h=Gf(e,s,u);return h?bu(e,t,h):!1}return!1}function LP(e,t){for(const n of t)if(!e.querySelector(`[${bt}="${n.id}"]`)){if(n.anchor.type==="image"){const o=MP(e,n.anchor);o&&sb(o,n.id);continue}NP(e,n.id,n.anchor)}}function lb(e,t){for(const n of e.querySelectorAll(`[${bt}]`))n instanceof HTMLElement&&(t?n.classList.add(Vf):n.classList.remove(Vf))}function cb(e,t){if(!t)return null;const n=t instanceof Element?t:t.parentElement;if(!n)return null;const r=n.closest(`[${bt}]`);return r instanceof HTMLElement&&Te(e,r)?r:null}function Zf(e,t){const n=e.querySelector(`[${bt}="${t}"]`);if(!(n instanceof HTMLElement))return!1;const r=window.getSelection();if(!r)return!1;const o=document.createRange();if(n instanceof HTMLImageElement)o.selectNode(n);else{const s=document.createTreeWalker(n,NodeFilter.SHOW_TEXT).nextNode();s instanceof Text?(o.setStart(s,0),o.collapse(!0)):(o.selectNodeContents(n),o.collapse(!0))}return r.removeAllRanges(),r.addRange(o),!0}function BP(e,t=[]){return{id:DP(),anchor:e,messages:t,createdAt:new Date().toISOString(),resolvedAt:null,resolvedBy:null}}function FP(e,t){return{id:IP(),userId:e.userId,userName:e.userName,message:t.trim(),createdAt:new Date().toISOString()}}function HP(e,t,n){return e.map(r=>r.id===t?{...r,messages:[...r.messages,n]}:r)}function zP(e,t){return e.find(n=>n.id===t)}function ub(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Te(e,n.commonAncestorContainer)?n:null}function OP(e){const t=ub(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 o=t.toString();if(!o){const a=n.querySelector("img");o=(a==null?void 0:a.getAttribute("alt"))??(a==null?void 0:a.getAttribute("src"))??""}return{html:r,text:o}}function db(e){const t=ub(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 KP(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 mb(e){const t=OP(e);return t?KP(t):!1}async function $P(e){return await mb(e)?db(e):!1}const UP=new Set(["strong","b","em","i","u","s","strike","del"]),VP=["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 WP(e){for(const t of VP)e.style.removeProperty(t)}function GP(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Pn(r)){n=r;continue}if(hr(r,n),UP.has(r.tagName.toLowerCase())){Ot(r);continue}if(WP(r),gr(r)){Ot(r);continue}n=r.isConnected?r:t}}function qP(e){const t=An(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;kn(t);const r=_t(t).filter(o=>o.data.length>0);if(r.length===0)return!1;for(const o of r)GP(e,o);return Ur(r),e.innerHTML!==n}function ZP(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function YP(e){const t=go(e),n=kh(e),r=tg(e),o=os(e,"color"),a=os(e,"backgroundColor"),s=Ph(e);return{size:n.mixed?null:n.value,unit:n.unit,marks:t,fontFamily:r.mixed?null:r.value,fontFamilyMixed:r.mixed,fontColor:o.mixed?null:o.value,fontColorMixed:o.mixed,highlightColor:a.mixed?null:a.value,highlightColorMixed:a.mixed,customCss:s.mixed?null:s.value,customCssMixed:s.mixed}}function XP(e,t){t.size!==null&&ru(e,t.size,t.unit);const n=go(e);for(const r of Jt)t.marks[r]!==n[r]&&au(e,r);return t.fontFamilyMixed||Kc(e,t.fontFamily),t.fontColorMixed||fi(e,"color",t.fontColor),t.highlightColorMixed||fi(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&Th(e,t.customCss),!0}function Qa(){return typeof window<"u"&&"speechSynthesis"in window}function JP(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function Yf(e,t){const n=e.text.trim();return n||JP(t)||null}function QP(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!Qa())return;if(t.speaking){t.cancel(),n();return}const o=new SpeechSynthesisUtterance(r);o.onend=n,o.onerror=n,t.speak(o),n()},isSpeaking(){return Qa()&&t.speaking},cancel(){Qa()&&t.speaking&&(t.cancel(),n())}}}const e0=5*1024*1024,t0="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",n0=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),r0=new Set(["mp3","wav","ogg","aac","webm","m4a"]),o0=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,i0=/^(javascript|vbscript|file|blob):/i;function a0(e={}){return{src:"",title:"",...e}}function fd(e){const t=e.trim();if(!t)return"empty";if(i0.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return o0.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 s0(e){return e.size>e0?"tooLarge":m0(e)?null:"type"}function l0(e){const t=s0(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const a=String(o.result??"");if(fd(a)){r(new Error("invalid"));return}n(a)},o.onerror=()=>r(o.error??new Error("Failed to read file")),o.readAsDataURL(e)})}function c0(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%",u0(e,t.css)}function u0(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim(),s=r.slice(o+1).trim();a&&s&&e.style.setProperty(a,s)}}function d0(e,t){const n=a0(t);if(fd(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Te(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=document.createElement("audio");return c0(a,n),o.insertNode(a),o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}function m0(e){const t=e.type.trim().toLowerCase();if(t&&n0.has(t))return!0;const n=f0(e.name);return!!(!t&&n&&r0.has(n))}function f0(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}function Xf(e,t){const r=(t?t(e):e).trim();if(!r)return"";if(!r.includes("<"))return r;const o=new DOMParser().parseFromString(`<body>${r}</body>`,"text/html");for(const a of o.querySelectorAll("img"))a.removeAttribute(Ft);return o.body.innerHTML}function fb(e,t,n){return Xf(e,n)===Xf(t,n)}const p0=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i;function Jf(e,t){var o,a;const n=(o=e.getAttribute(Ft))==null?void 0:o.trim();if(n&&t){const s=t(n);if(s)return`embedded:${s}`}const r=((a=e.getAttribute("src"))==null?void 0:a.trim())??"";return p0.test(r)?`embedded:${r}`:r.startsWith("blob:")&&n?`registry:${n}`:r?`url:${r}`:"empty"}function pb(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}const Qf=/<tr(\s[^>]*)?>([\s\S]*?)<\/tr>/gi;function g0(e){const t=[];let n;for(Qf.lastIndex=0;(n=Qf.exec(e))!==null;)t.push(n[2]??"");return t}function h0(e,t){const n=document.createRange();n.selectNodeContents(e);const r=n.createContextualFragment(t);e.replaceChildren(...r.childNodes)}function b0(e,t){const n=g0(t);if(n.length===0)return;let r=0;e.querySelectorAll("tr").forEach(o=>{r>=n.length||(h0(o,n[r]),r+=1)})}function y0(e){const t=[e,...e.querySelectorAll("table, tbody, thead, tfoot")];for(const n of t)for(const r of[...n.childNodes])r instanceof Element&&Gu(r)&&r.remove()}function x0(e,t){const n=pb(t);e.replaceChildren(...n.childNodes),/<tr[\s>]/i.test(t)&&(y0(e),b0(e,t))}function w0(e,t){for(const n of[...e.attributes])t.hasAttribute(n.name)||e.removeAttribute(n.name);for(const n of[...t.attributes])e.setAttribute(n.name,n.value)}function C0(e,t){e.querySelectorAll("img").forEach((n,r)=>{const o=document.createElement("span");o.setAttribute(t,String(r)),n.replaceWith(o)})}function ep(e,t){const n=e.cloneNode(!0);return C0(n,t),n.innerHTML}function v0(e,t,n){const r=pb(t),o=[...e.querySelectorAll("img")],a=[...r.querySelectorAll("img")];if(o.length===0||o.length!==a.length)return!1;const s=o.map(g=>Jf(g,n)),u=a.map(g=>Jf(g,n));if(!s.every((g,y)=>g===u[y]))return!1;const d="data-wysiwyg-img-marker",f=ep(e,d),h=ep(r,d);if(f!==h)return!1;for(let g=0;g<o.length;g+=1)w0(o[g],a[g]);return!0}function ws(e,t,n={}){const{resolveDataUrl:r,hydrateEmbeddedImages:o}=n;return Kg(t)?e.innerHTML===t?{changed:!1}:(x0(e,t),{changed:!0}):fb(e.innerHTML,t,o)?{changed:!1}:e.innerHTML===t?{changed:!1}:v0(e,t,r)?{changed:!0}:(e.innerHTML=t,{changed:!0})}const gb=/^(javascript|vbscript|file|blob):/i,k0=[/(?: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 S0(e={}){return{url:"",title:"",...e}}function P0(e={}){return{src:"",title:"",...e}}function Ks(e){const t=e.trim();if(!t)return null;for(const n of k0){const r=t.match(n);if(r!=null&&r[1])return r[1]}return null}function hb(e){return`https://www.youtube.com/embed/${e}`}function bb(e){const t=e.trim();return t?gb.test(t)?"invalid":Ks(t)?null:"invalid":"empty"}function A0(e){const t=e.trim();if(!t)return"empty";if(gb.test(t))return"invalid";if(Ks(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 yb(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim(),s=r.slice(o+1).trim();a&&s&&e.style.setProperty(a,s)}}function xb(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",yb(e,n.css)}function T0(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%",yb(e,t.css)}function R0(e,t){const n=S0(t);if(bb(n.url))return!1;const r=Ks(n.url);if(!r)return!1;const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!Te(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const s=document.createElement("iframe");return xb(s,hb(r),n),a.insertNode(s),a.setStartAfter(s),a.collapse(!0),o.removeAllRanges(),o.addRange(a),!0}function D0(e,t){const n=P0(t);if(A0(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Te(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=Ks(n.src);if(a){const s=document.createElement("iframe");xb(s,hb(a),{title:n.title,css:n.css}),o.insertNode(s),o.setStartAfter(s)}else{const s=document.createElement("video");T0(s,n),o.insertNode(s),o.setStartAfter(s)}return o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}const I0=new Set(["p","h1","h2","h3","h4","h5","h6"]),j0=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function wb(e,t){var a;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Te(e,r.commonAncestorContainer))return!1;r.collapsed||r.deleteContents();const o=E0(e,r.startContainer);if(o){const s=_0(o,r);return(a=o.parentNode)==null||a.insertBefore(t,s),np(t),!0}return r.insertNode(t),M0(e,t),B0(t),np(t),!0}function E0(e,t){let n=ji(t);for(;n&&n!==e;){const r=_e(n);if(I0.has(r)&&n instanceof HTMLElement)return n;if(j0.has(r))return null;n=n.parentElement}return null}function _0(e,t){var a;const n=document.createRange();n.setStart(t.startContainer,t.startOffset),n.setEnd(e,e.childNodes.length);const r=n.extractContents(),o=e.cloneNode(!1);return o.appendChild(r),tp(e),tp(o),(a=e.parentNode)==null||a.insertBefore(o,e.nextSibling),o}function M0(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!N0(n))return;hr(n,t),Ot(n)}}function N0(e){const t=_e(e);return Pn(e)||t==="a"}function tp(e){L0(e)&&e.appendChild(document.createElement("br"))}function L0(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 B0(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 np(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 F0="1em 0",H0="1px solid #d0d0d0";function z0(){const e=document.createElement("hr");return e.style.margin=F0,e.style.border="0",e.style.borderTop=H0,e}function O0(e){return wb(e,z0())}const K0="1.5em 0",$0="2px dashed #bbb",U0="data-wysiwyg-page-break";function V0(){const e=document.createElement("div");return e.setAttribute(U0,""),e.style.display="block",e.style.clear="both",e.style.breakAfter="page",e.style.pageBreakAfter="always",e.style.margin=K0,e.style.border="0",e.style.borderTop=$0,e.style.height="0",e}function W0(e){return wb(e,V0())}const Kn=16;function rp(e){return Math.min(ko.px.max,Math.max(Kn,e))}function G0(e){return e.width>0&&e.height>0?e.width/e.height:1}function q0(e,t){const n=Math.max(Kn,Kn*t),r=Math.min(ko.px.max,ko.px.max*t),o=Math.min(r,Math.max(n,e));return{width:o,height:o/t}}function Z0(e,t){const n=Math.max(Kn,Kn/t),r=Math.min(ko.px.max,ko.px.max/t),o=Math.min(r,Math.max(n,e));return{width:o*t,height:o}}function Y0(e,t,n){const r=G0(t);return e==="e"?q0(t.width+n.x,r):e==="s"?Z0(t.height+n.y,r):{width:rp(t.width+n.x),height:rp(t.height+n.y)}}function X0(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:Kn,height:r>0?r:Kn}}function J0(e,t,n){const r=So(Math.max(Kn,t),"px"),o=So(Math.max(Kn,n),"px");return!r||!o?!1:rh(e,{...nh(e),sizeMode:"lock",width:r,height:o})}function Q0(e={}){return{border:{...$u},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function eA(e){const t=Ro(e);return{border:t.border,borderCollapse:oA(e),borderSpacing:Cb(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:vt(e.style.width)}}function tA(e,t){let n=Do(e,{...Wr(),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 iA(e,t.borderCollapse)&&(n=!0),aA(e,t.borderCollapse,t.borderSpacing)&&(n=!0),sA(e,t.width)&&(n=!0),n&&It(e),n}function nA(e){const t=ad(e);return t?eA(t):null}function rA(e,t){const n=ad(e);return n?tA(n,t):!1}function oA(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function iA(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function Cb(e){const t=e.style.borderSpacing.trim();return t?vt(t.split(/\s+/)[0]??""):null}function aA(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?br(n):null,o=Cb(e);return Yt(o,r)?!1:(r?e.style.borderSpacing=je(r):e.style.removeProperty("border-spacing"),!0)}function sA(e,t){const n=t?br(t):null,r=vt(e.style.width);return Yt(r,n)?!1:(n?e.style.width=je(n):e.style.removeProperty("width"),!0)}const $s=["top","middle","bottom","baseline"],lA=new Set($s);function cA(e={}){return{backgroundColor:null,color:null,padding:{...un},textAlign:null,verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function uA(e){const t=Ro(e);return{backgroundColor:t.backgroundColor,color:vb(e),padding:t.padding,textAlign:gA(e),verticalAlign:kb(e),width:vt(e.style.width),...zs(e)}}function dA(e,t){let n=Do(e,{...Wr(),margin:{...un},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 pA(e,t.color)&&(n=!0),du(e,t.textAlign)&&(n=!0),hA(e,t.verticalAlign)&&(n=!0),bA(e,t.width)&&(n=!0),n&&It(e),n}function mA(e){const t=Tn(e);return t?uA(t):null}function fA(e,t){const n=_i(e);if(n.length===0)return!1;let r=!1;for(const a of n)dA(a,t)&&(r=!0);const o=Tn(e);if(o){const a=zs(o);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&RS(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function vb(e){const t=e.style.color;return t?Ke(t):null}function pA(e,t){const n=t?Ke(t):null;return vb(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function gA(e){const t=ys(e);return t==="left"?null:t}function kb(e){const t=e.style.verticalAlign.trim().toLowerCase();return lA.has(t)?t:null}function hA(e,t){return kb(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function bA(e,t){const n=t?br(t):null,r=vt(e.style.width);return Yt(r,n)?!1:(n?e.style.width=je(n):e.style.removeProperty("width"),!0)}const yA=new Set($s);function xA(e={}){return{backgroundColor:null,color:null,padding:{...un},height:null,verticalAlign:null,...e}}function wA(e){const t=e.cells[0],n=t?Ro(t).padding:{...un};return{backgroundColor:Sb(e),color:Pb(e),padding:n,height:vt(e.style.height),verticalAlign:Ab(e)}}function CA(e,t){let n=!1;SA(e,t.backgroundColor)&&(n=!0),PA(e,t.color)&&(n=!0),TA(e,t.height)&&(n=!0),AA(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))Do(r,{...Wr(),margin:{...un},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 vA(e){const t=Wh(e);return t?wA(t):null}function kA(e,t){const n=Wh(e);return n?CA(n,t):!1}function Sb(e){const t=e.style.backgroundColor;return t?Ke(t):null}function SA(e,t){const n=t?Ke(t):null;return Sb(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Pb(e){const t=e.style.color;return t?Ke(t):null}function PA(e,t){const n=t?Ke(t):null;return Pb(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function Ab(e){const t=e.style.verticalAlign.trim().toLowerCase();return yA.has(t)?t:null}function AA(e,t){return Ab(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function TA(e,t){const n=t?br(t):null,r=vt(e.style.height);return Yt(r,n)?!1:(n?e.style.height=je(n):e.style.removeProperty("height"),!0)}const RA=1e3;function DA(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function IA({onAutoSave:e,getHtml:t}){const n=l.useRef(e);n.current=e;const r=l.useRef(t);r.current=t;const o=l.useRef(null),a=e!=null;l.useEffect(()=>{if(!a){o.current=null;return}o.current=r.current();const s=window.setInterval(()=>{const u=n.current;if(!u)return;const d=r.current();d!==o.current&&(o.current=d,queueMicrotask(()=>DA(u,d)))},RA);return()=>{window.clearInterval(s)}},[a])}function jA(){const[e,t]=l.useState({open:!1,tab:"general"}),[n,r]=l.useState(!1),[o,a]=l.useState({open:!1,html:""}),[s,u]=l.useState(null),[d,f]=l.useState(!1),[h,g]=l.useState(!1),[y,b]=l.useState({open:!1,tab:"general",value:Br(),backgroundImage:vn()}),[w,x]=l.useState({open:!1,value:""}),[S,k]=l.useState({open:!1,tab:"font",paragraphTab:"spacing",value:hi()}),[v,A]=l.useState(!1),[I,D]=l.useState({open:!1}),[R,T]=l.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[E,N]=l.useState({open:!1,existingIds:[]}),[K,$]=l.useState({open:!1}),[P,F]=l.useState({open:!1}),[U,G]=l.useState({open:!1}),[me,se]=l.useState({open:!1,tab:"general",value:th(),aspectRatio:1}),[V,re]=l.useState({open:!1}),[de,oe]=l.useState({open:!1,value:Q0()}),[_,Q]=l.useState({open:!1,value:cA()}),[ye,ee]=l.useState({open:!1,value:xA()}),[Z,Ee]=l.useState({open:!1,topicId:"getStarted"}),[et,qe]=l.useState(!1);return{fontDialog:e,setFontDialog:t,customizeToolbarOpen:n,setCustomizeToolbarOpen:r,documentPreview:o,setDocumentPreview:a,toolbarSettings:s,setToolbarSettings:u,toolbarSettingsLoading:d,setToolbarSettingsLoading:f,toolbarSettingsBusy:h,setToolbarSettingsBusy:g,paragraphDialog:y,setParagraphDialog:b,customCssDialog:w,setCustomCssDialog:x,pageDialog:S,setPageDialog:k,deletePageConfirmOpen:v,setDeletePageConfirmOpen:A,customStyleDialog:I,setCustomStyleDialog:D,linkDialog:R,setLinkDialog:T,bookmarkDialog:E,setBookmarkDialog:N,imageDialog:K,setImageDialog:$,audioDialog:P,setAudioDialog:F,youtubeDialog:U,setYoutubeDialog:G,imageProperties:me,setImageProperties:se,tableDialog:V,setTableDialog:re,tableProperties:de,setTableProperties:oe,cellProperties:_,setCellProperties:Q,rowProperties:ye,setRowProperties:ee,helpDialog:Z,setHelpDialog:Ee,aboutDialogOpen:et,setAboutDialogOpen:qe}}const op={changed:!1,pages:[],joined:"",changedIndices:[]};function ip(e){return{changed:e.changed,pages:e.pages,joined:zt(e.pages),changedIndices:e.changedIndices}}function ap(e,t,n){return n.size===0?t:t.map((r,o)=>n.has(o)&&e[o]!==void 0&&e[o]!==r?e[o]:r)}function EA({enabled:e,pagesProp:t,defaultPages:n}){const r=e&&t!==void 0,o=l.useMemo(()=>t!==void 0?ir(t):void 0,[t]),[a,s]=l.useState(()=>({pages:ir(n),revision:0})),u=l.useRef(o??ir(n)),d=l.useRef(new Set),f=l.useRef(t);l.useEffect(()=>{if(!e||!r||o===void 0||f.current===t&&Nr(u.current,o))return;f.current=t;const k=ap(u.current,o,d.current),v=vc(u.current,k);if(u.current=v.pages,!!v.changed){for(const A of v.changedIndices)d.current.add(A);s(A=>({pages:v.pages,revision:A.revision+1}))}},[e,r,o,t]);const h=l.useMemo(()=>{if(!e)return[];if(r&&o!==void 0){const k=ap(u.current,o,d.current),v=vc(u.current,k);return u.current=v.pages,v.pages}return a.pages},[e,r,o,a.pages,a.revision]),g=l.useCallback((k,v)=>{if(!e)return op;const A=r?u.current:a.pages,I=vc(A,k);if(!I.changed)return ip(I);for(const D of I.changedIndices)d.current.add(D);return v!==void 0&&d.current.add(v),r?u.current=I.pages:s(D=>({pages:I.pages,revision:D.revision+1})),ip(I)},[e,a.pages,r]),y=l.useCallback((k,v)=>g(k,v==null?void 0:v.editedIndex),[g]),b=l.useCallback((k,v,A)=>{if(!e)return op;const I=r?u.current:a.pages,D=Xc(I,k,v);return D.changed?g(D.pages,(A==null?void 0:A.editedIndex)??k):{changed:!1,pages:I,joined:zt(I),changedIndices:[]}},[g,e,a.pages,r]),w=l.useCallback(k=>g(ir(k)),[g]),x=l.useCallback(k=>{if(k===void 0){d.current.clear();return}for(const v of k)d.current.delete(v)},[]),S=l.useCallback(()=>zt(h),[h]);return l.useMemo(()=>({pages:h,revision:a.revision,dirtyPagesRef:d,setPages:y,updatePage:b,replacePages:w,markPagesClean:x,getJoinedHtml:S}),[h,a.revision,y,b,w,x,S])}function es({value:e,defaultValue:t,onChange:n}){const[r,o]=l.useState(t),a=e!==void 0,s=a?e:r,u=l.useCallback(d=>{a||o(d),n==null||n(d)},[a,n]);return[s,u]}const Tb="commspliant-html-editor.darkMode";function _A(e){return typeof e=="boolean"?e:null}function sp(){try{const e=localStorage.getItem(Tb);return e?_A(JSON.parse(e)):null}catch{return null}}function MA(e){try{localStorage.setItem(Tb,JSON.stringify(e))}catch{}}const Rb="commspliant-html-editor.pageZoom",NA=new Set(["fitWidth","fitPage"]);function LA(e){return typeof e=="string"&&NA.has(e)||typeof e=="number"&&sk.includes(e)?e:null}function BA(){try{const e=localStorage.getItem(Rb);return e?LA(JSON.parse(e)):null}catch{return null}}function FA(e){try{localStorage.setItem(Rb,JSON.stringify(e))}catch{}}const Db="commspliant-html-editor.toolbarPosition",HA=["top","left","right","bottom"];function Ib(e){return typeof e=="string"&&HA.includes(e)?e:null}function lp(){try{const e=localStorage.getItem(Db);return e?Ib(JSON.parse(e)):null}catch{return null}}function zA(e){try{localStorage.setItem(Db,JSON.stringify(e))}catch{}}const jb=l.createContext({profile:void 0,validation:null,refreshValidation:()=>{}});function OA({value:e,children:t}){return i.jsx(jb.Provider,{value:e,children:t})}function pd(){return l.useContext(jb).profile}function Eb(e){const t=new Map;for(const n of e.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim().toLowerCase(),s=r.slice(o+1).trim();a&&t.set(a,s)}return t}function cp(e,t){const n=e.toLowerCase();switch(t){case"hex":return/#([0-9a-f]{3}|[0-9a-f]{6})\b/i.test(n);case"rgb":return/\brgb\s*\(/i.test(n);case"rgba":return/\brgba\s*\(/i.test(n);case"hsl":return/\bhsl\s*\(/i.test(n)&&!/\bhsla\s*\(/i.test(n);case"hsla":return/\bhsla\s*\(/i.test(n);case"flex":return/\bflex\b/i.test(n);case"inline-flex":return/\binline-flex\b/i.test(n);case"grid":return/\bgrid\b/i.test(n)&&!/\binline-grid\b/i.test(n);case"inline-grid":return/\binline-grid\b/i.test(n);case"contents":return/\bcontents\b/i.test(n);case"block":return/\bblock\b/i.test(n);case"inline-block":return/\binline-block\b/i.test(n);case"none":return/\bnone\b/i.test(n);default:return n.includes(t.toLowerCase())}}function KA(e){if(!e)return null;const t=[...e.matchAll(/<([a-z][a-z0-9]*)\s*>/gi)];return t.length===0?null:t.map(n=>n[1].toLowerCase())}function $A(e){return{tag:e.tag.toLowerCase(),requiredAttributes:{...e.required_attributes??{}},allowedAttributes:e.allowed_attributes?e.allowed_attributes.map(t=>t.toLowerCase()):null,disallowedCss:(e.disallowed_css??[]).map(t=>t.toLowerCase()),forcedCss:Object.fromEntries(Object.entries(e.forced_css??{}).map(([t,n])=>[t.toLowerCase(),n])),defaultAttributes:{...e.default_attributes??{}},status:e.status,notes:e.notes}}function UA(e){var n;const t=((n=e.allowed_on_tags)==null?void 0:n.map(r=>r.toLowerCase()))??KA(e.restrictions);return{property:e.property.toLowerCase(),status:e.status,allowedValues:e.allowed_values??null,disallowedValues:e.disallowed_values??null,allowedOnTags:t,restrictions:e.restrictions,fallback:e.fallback??null}}function Us(e){var u,d;const t=((u=e.html_elements)==null?void 0:u.allowed_tags)??[],n=t.length>0?new Set(t.map(f=>f.tag.toLowerCase())):null,r=new Set((((d=e.html_elements)==null?void 0:d.disallowed_tags)??[]).map(f=>f.toLowerCase())),o=new Map;for(const f of t)o.set(f.tag.toLowerCase(),$A(f));const a=new Map;for(const f of e.css_properties??[])a.set(f.property.toLowerCase(),UA(f));const s=e.global_rules??{};return{allowedTagSet:n,disallowedTagSet:r,tagRules:o,cssPropertyRules:a,globalRules:{layoutMode:s.layout_mode,requireInlining:s.require_inlining,maxContainerWidthPx:s.max_container_width_px,stripUnknownTags:s.strip_unknown_tags??!1,stripUnknownAttributes:s.strip_unknown_attributes??!1}}}const ts={audio:{tags:["audio"]},youtube:{tags:["video","iframe"]},horizontalRule:{tags:["hr"]},bookmark:{tags:["a"],attributes:[{tag:"a",names:["name","id"]}]},bulletList:{tags:["ul","ol","li"]},numberedList:{tags:["ul","ol","li"]},customCss:{cssProperties:["*"]},formatBrush:{cssProperties:["*"]},pageBackgroundImage:{cssProperties:["background-image"],dialogTabs:[{dialog:"page",tabs:["backgroundImage"]}]},paragraphBackgroundImage:{cssProperties:["background-image"],dialogTabs:[{dialog:"paragraph",tabs:["backgroundImage"]}]},pageBreak:{tags:["div"],cssProperties:["page-break-after","break-after"]},indent:{cssProperties:["margin-left","margin-right","margin"]},outdent:{cssProperties:["margin-left","margin-right","margin"]},paragraphStyle:{tags:["h1","h2","h3","h4","h5","h6","p"]},fontFamily:{cssProperties:["font-family"]},openCustomParagraphStyleDialog:{tags:["h1","h2","h3","h4","h5","h6","p","div"]},paragraphProperties:{dialogTabs:[{dialog:"paragraph",tabs:["spacing","border","background","backgroundImage"]}]},pageProperties:{dialogTabs:[{dialog:"page",tabs:["spacing","border","background","backgroundImage"]}]},openPageBackgroundImage:{cssProperties:["background-image"]},openParagraphBackgroundImage:{cssProperties:["background-image"]},openParagraphProperties:{dialogTabs:[{dialog:"paragraph",tabs:["spacing","border","background","backgroundImage"]}]},openPageProperties:{dialogTabs:[{dialog:"page",tabs:["spacing","border","background","backgroundImage"]}]}},up={paragraph:{general:{cssProperties:["font-family","font-size","color"]},spacing:{cssProperties:["margin","margin-top","margin-right","margin-bottom","margin-left","padding"]},border:{cssProperties:["border","border-width","border-style","border-color"]},background:{cssProperties:["background-color"]},backgroundImage:{cssProperties:["background-image"]}},page:{font:{cssProperties:["font-family","font-size","color"]},paragraph:{cssProperties:["margin","padding"]},print:{cssProperties:["page-break-after","break-after"]},spacing:{cssProperties:["margin","padding"]},border:{cssProperties:["border"]},background:{cssProperties:["background-color"]},backgroundImage:{cssProperties:["background-image"]}}},VA={openPageBackgroundImage:ts.openPageBackgroundImage,openPageProperties:ts.openPageProperties,openParagraphProperties:ts.openParagraphProperties};function dp(e,t){const n=e.toLowerCase();return!(t.disallowedTagSet.has(n)||t.globalRules.stripUnknownTags&&t.allowedTagSet&&!t.allowedTagSet.has(n))}function WA(e,t,n){if(!n.globalRules.stripUnknownAttributes)return!0;const r=n.tagRules.get(e.toLowerCase());if(!(r!=null&&r.allowedAttributes))return!0;const o=new Set(r.allowedAttributes);return t.every(a=>o.has(a.toLowerCase()))}function GA(e,t,n){const r=e.toLowerCase(),o=t.cssPropertyRules.get(r);return o?!(o.status==="disallowed"||(o.allowedOnTags,o.status==="restricted")):!0}function qA(e){for(const t of e.cssPropertyRules.values())if(t.status==="disallowed")return!1;return!0}function Vs(e,t){if(!e)return!0;if(e.tags){for(const n of e.tags)if(!dp(n,t))return!1}if(e.attributes){for(const n of e.attributes)if(!dp(n.tag,t)||!WA(n.tag,n.names,t))return!1}if(e.cssProperties){if(e.cssProperties.includes("*")){if(!qA(t))return!1}else for(const n of e.cssProperties)if(!GA(n,t))return!1}return!0}function ZA(e,t,n,r){const o=r[t];return o?Vs(o,n):!0}function YA(e){const t="style";return!(e.disallowedTagSet.has(t)||e.globalRules.stripUnknownTags&&e.allowedTagSet&&!e.allowedTagSet.has(t))}function gd(e){const t=Us(e);return t.globalRules.layoutMode==="table-based"?!1:YA(t)}function XA(e){const t=new Set;for(const[n,r]of Object.entries(ts))Vs(r,e)||t.add(n);return t}function JA(e){const t=new Set;for(const[n,r]of Object.entries(VA))Vs(r,e)||t.add(n);return t}function QA(e){return e.allowedTagSet?Hr.filter(t=>e.allowedTagSet.has(t)):[...Hr]}function eT(e){const t=e.cssPropertyRules.get("font-family");return!(t!=null&&t.allowedValues)||t.allowedValues.length===0?null:[...t.allowedValues]}function tT(e){const t={};for(const n of["paragraph","page"]){const r=[];for(const[o,a]of Object.entries(up[n]))ZA(n,o,e,up[n])&&Vs(a,e)||r.push(o);r.length>0&&(t[n]=r)}return t}function _b(e){const t=Us(e);return{normalized:t,hiddenToolbarItemIds:XA(t),hiddenContextMenuCommands:JA(t),allowedParagraphTags:QA(t),allowedFontFamilies:eT(t),hiddenDialogTabs:tT(t),maxContainerWidthPx:t.globalRules.maxContainerWidthPx,pageLayoutAllowed:gd(e)}}function Mb(e,t){const n=[];let r=!1;for(const o of e){if(o===ke){r=!0;continue}if(zn(o)){const a=Mb(o.items,t);if(a.length===0)continue;r&&n.length>0&&(n.push(ke),r=!1),n.push({submenu:o.submenu,items:a});continue}t.has(o)||(r&&n.length>0&&(n.push(ke),r=!1),n.push(o))}return n}function nT(e,t){if(!t)return e;const n=t.hiddenToolbarItemIds,r=e.menus.map(a=>({...a,items:Mb(a.items,n)})).filter(a=>a.items.length>0),o=e.iconGroups.map(a=>({...a,items:a.items.filter(s=>!n.has(s))})).filter(a=>a.items.length>0);return{menus:r,iconGroups:o}}function rT(e,t){return t?!t.hiddenToolbarItemIds.has(e):!0}function Ws(e){const t=[];let n=e;for(;n&&n.tagName.toLowerCase()!=="body";){const r=n.tagName.toLowerCase(),o=n.parentElement;if(!o){t.unshift(r);break}const s=[...o.children].filter(u=>u.tagName===n.tagName).indexOf(n);t.unshift(`${r}:nth-of-type(${s+1})`),n=o}return t.join(" > ")}function Ht(e,t){e.push(t)}function oT(e,t,n,r){const o=e.tagName.toLowerCase(),a=Ws(e);if(t.disallowedTagSet.has(o)){Ht(n,{code:"disallowed-tag",severity:"error",messageKey:"capabilitiesViolationDisallowedTag",messageParams:{tag:o},selector:a,tag:o,pageIndex:r});return}t.globalRules.stripUnknownTags&&t.allowedTagSet&&!t.allowedTagSet.has(o)&&Ht(n,{code:"unknown-tag",severity:"error",messageKey:"capabilitiesViolationUnknownTag",messageParams:{tag:o},selector:a,tag:o,pageIndex:r});const s=t.tagRules.get(o);(s==null?void 0:s.status)==="restricted"&&Ht(n,{code:"restricted-tag",severity:"warning",messageKey:"capabilitiesViolationRestrictedTag",messageParams:{tag:o},selector:a,tag:o,pageIndex:r})}function iT(e,t,n,r){const o=e.tagName.toLowerCase(),a=t.tagRules.get(o),s=Ws(e);if(a!=null&&a.requiredAttributes)for(const[d,f]of Object.entries(a.requiredAttributes)){const h=e.getAttribute(d);(h===null||h!==f)&&Ht(n,{code:"missing-required-attribute",severity:"error",messageKey:"capabilitiesViolationMissingRequiredAttribute",messageParams:{tag:o,attribute:d,expected:f},selector:s,tag:o,attribute:d,pageIndex:r})}if(!t.globalRules.stripUnknownAttributes||!(a!=null&&a.allowedAttributes))return;const u=new Set(a.allowedAttributes);for(const d of[...e.attributes]){const f=d.name.toLowerCase();f!=="style"&&(u.has(f)||Ht(n,{code:"unknown-attribute",severity:"error",messageKey:"capabilitiesViolationUnknownAttribute",messageParams:{tag:o,attribute:f},selector:s,tag:o,attribute:f,pageIndex:r}))}}function aT(e,t,n){if(n.disallowedValues){for(const r of n.disallowedValues)if(cp(t,r))return!1}return!(n.allowedValues&&n.allowedValues.length>0&&!n.allowedValues.some(o=>cp(t,o))&&!n.allowedValues.includes(t)&&!n.allowedValues.some(a=>t.toLowerCase().includes(a.toLowerCase())))}function sT(e,t,n,r){const o=e.tagName.toLowerCase(),a=t.tagRules.get(o),s=Ws(e),u=e.getAttribute("style");if(!u){if(a!=null&&a.forcedCss)for(const f of Object.keys(a.forcedCss))Ht(n,{code:"missing-forced-css",severity:"warning",messageKey:"capabilitiesViolationMissingForcedCss",messageParams:{tag:o,property:f,expected:a.forcedCss[f]},selector:s,tag:o,cssProperty:f,pageIndex:r});return}const d=Eb(u);if(a!=null&&a.disallowedCss)for(const f of a.disallowedCss)d.has(f)&&Ht(n,{code:"tag-disallowed-css",severity:"error",messageKey:"capabilitiesViolationTagDisallowedCss",messageParams:{tag:o,property:f},selector:s,tag:o,cssProperty:f,pageIndex:r});if(a!=null&&a.forcedCss)for(const[f,h]of Object.entries(a.forcedCss)){const g=d.get(f);(!g||g.replace(/\s+/g,"").toLowerCase()!==h.replace(/\s+/g,"").toLowerCase())&&Ht(n,{code:"missing-forced-css",severity:"warning",messageKey:"capabilitiesViolationMissingForcedCss",messageParams:{tag:o,property:f,expected:h},selector:s,tag:o,cssProperty:f,pageIndex:r})}for(const[f,h]of d.entries()){const g=t.cssPropertyRules.get(f);if(g){if(g.allowedOnTags&&!g.allowedOnTags.includes(o)){Ht(n,{code:"css-wrong-tag",severity:g.status==="disallowed"?"error":"warning",messageKey:"capabilitiesViolationCssWrongTag",messageParams:{property:f,tag:o,allowedTags:g.allowedOnTags.join(", ")},selector:s,tag:o,cssProperty:f,pageIndex:r});continue}if(g.status==="disallowed"){Ht(n,{code:"css-disallowed",severity:"error",messageKey:"capabilitiesViolationCssDisallowed",messageParams:{property:f},selector:s,tag:o,cssProperty:f,pageIndex:r});continue}if(!aT(f,h,g)){Ht(n,{code:"css-value-not-allowed",severity:"error",messageKey:"capabilitiesViolationCssValueNotAllowed",messageParams:{property:f,value:h},selector:s,tag:o,cssProperty:f,pageIndex:r});continue}(g.status==="restricted"||g.status==="allowed_with_degradation")&&Ht(n,{code:"css-restricted",severity:"warning",messageKey:"capabilitiesViolationCssRestricted",messageParams:{property:f},selector:s,tag:o,cssProperty:f,pageIndex:r})}}}function lT(e,t,n,r){const o=t.globalRules.maxContainerWidthPx;if(!o)return;const a=[...e.body.querySelectorAll('table[width], table[style*="width"]'),...e.body.querySelectorAll('div[style*="max-width"], div[style*="width"]')];for(const s of a){const u=s.getAttribute("width"),d=Eb(s.getAttribute("style")??""),f=u??d.get("width")??d.get("max-width");if(!f)continue;const h=Number.parseInt(f,10);Number.isFinite(h)&&h>o&&Ht(n,{code:"container-width-exceeded",severity:"warning",messageKey:"capabilitiesViolationContainerWidthExceeded",messageParams:{width:String(h),max:String(o)},selector:Ws(s),tag:s.tagName.toLowerCase(),pageIndex:r})}}function cT(e,t,n,r){const o=e instanceof Element?e.tagName.toLowerCase()==="body"?[...e.children]:[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(const a of o)a instanceof Element&&(oT(a,t,n,r),iT(a,t,n,r),sT(a,t,n,r))}function Nb(e){const t=e.filter(r=>r.severity==="error").length,n=e.filter(r=>r.severity==="warning").length;return{valid:t===0,errorCount:t,warningCount:n,violations:e}}function Lb(e,t,n){const r=Us(t),o=e.trim();if(!o)return{valid:!0,errorCount:0,warningCount:0,violations:[]};const a=new DOMParser().parseFromString(`<body>${o}</body>`,"text/html"),s=[];return cT(a.body,r,s,n==null?void 0:n.pageIndex),lT(a,r,s,n==null?void 0:n.pageIndex),Nb(s)}function yu(e,t){const n=[];return e.forEach((r,o)=>{const a=Lb(r,t,{pageIndex:o});n.push(...a.violations)}),Nb(n)}const Bb={en:To,es:qp};function Fb(e,t){return Object.entries(t).reduce((n,[r,o])=>n.replaceAll(`{${r}}`,o),e)}function Hb(e,t="en"){const r=(Bb[t]??To)[e.messageKey]??e.messageKey;return Fb(r,e.messageParams)}function zb(e,t="en"){const r=(Bb[t]??To).capabilitiesViolationPage;return e.selector?e.pageIndex!==void 0?`${e.selector} (${r} ${e.pageIndex+1})`:e.selector:e.pageIndex!==void 0?`${r} ${e.pageIndex+1}`:""}const uT={items:{compatibilityCheck:{id:"compatibilityCheck",command:"openCompatibilityCheck",icon:Mp,labelKey:"commandCompatibilityCheck",ariaKey:"commandCompatibilityCheckAria",enabled:"isVisualMode"}}};function dT(e){return{...e,items:{...e.items,...uT.items}}}function mT(e){return{...e,menus:e.menus.map(t=>{if(t.id!=="view")return t;const n=[...t.items];if(!n.includes("compatibilityCheck")){const r=n.indexOf("preview"),o=r===-1?n.length:r;n.splice(o,0,"compatibilityCheck")}return{...t,items:n}}),iconGroups:e.iconGroups.map(t=>t.id!=="view"||t.items.includes("compatibilityCheck")?t:{...t,items:[...t.items,"compatibilityCheck"]})}}const fT='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',pT='[role="listbox"], [data-color-picker]';function $e(e,{open:t,onClose:n,focusableSelector:r=fT,escapeIgnoreSelectors:o=pT}){l.useEffect(()=>{if(!t)return;const a=e.current,s=a==null?void 0:a.querySelector(r);s==null||s.focus();const u=d=>{if(d.key==="Escape"){if(o&&document.querySelector(o))return;d.preventDefault(),d.stopPropagation(),n();return}if(d.key!=="Tab"||!a)return;const f=[...a.querySelectorAll(r)];if(f.length===0)return;const h=f[0],g=f[f.length-1];d.shiftKey&&document.activeElement===h?(d.preventDefault(),g.focus()):!d.shiftKey&&document.activeElement===g&&(d.preventDefault(),h.focus())};return document.addEventListener("keydown",u,!0),()=>document.removeEventListener("keydown",u,!0)},[e,o,r,n,t])}const gT="_backdrop_nnwu2_1",hT="_dialog_nnwu2_12",bT="_headerRow_nnwu2_25",yT="_header_nnwu2_25",xT="_close_nnwu2_40",wT="_body_nnwu2_53",CT="_empty_nnwu2_60",vT="_summary_nnwu2_66",kT="_section_nnwu2_71",ST="_sectionTitle_nnwu2_75",PT="_list_nnwu2_81",AT="_violation_nnwu2_87",TT="_severity_error_nnwu2_97",RT="_severity_warning_nnwu2_101",DT="_violationMessage_nnwu2_105",IT="_violationLocation_nnwu2_109",Je={backdrop:gT,dialog:hT,headerRow:bT,header:yT,close:xT,body:wT,empty:CT,summary:vT,section:kT,sectionTitle:ST,list:PT,violation:AT,severity_error:TT,severity_warning:RT,violationMessage:DT,violationLocation:IT};function mp({violation:e}){const t=uw(),n=Hb(e,t),r=zb(e,t);return i.jsxs("li",{className:`${Je.violation} ${Je[`severity_${e.severity}`]}`,children:[i.jsx("span",{className:Je.violationMessage,children:n}),r?i.jsx("span",{className:Je.violationLocation,children:r}):null]})}function jT({open:e,result:t,onClose:n}){const r=J(),o=l.useId(),a=l.useRef(null);if($e(a,{open:e,onClose:n,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const s=(t==null?void 0:t.violations)??[],u=s.filter(f=>f.severity==="error"),d=s.filter(f=>f.severity==="warning");return i.jsx(Pe,{children:i.jsx("div",{className:Je.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:a,className:Je.dialog,role:"dialog","aria-modal":"true","aria-labelledby":o,onMouseDown:f=>f.stopPropagation(),children:[i.jsxs("div",{className:Je.headerRow,children:[i.jsx("h2",{className:Je.header,id:o,children:r("capabilitiesPanelTitle")}),i.jsx("button",{type:"button",className:Je.close,"aria-label":r("capabilitiesPanelCloseAria"),onClick:n,children:i.jsx(Ge,{})})]}),s.length===0?i.jsx("p",{className:Je.empty,children:r("capabilitiesPanelEmpty")}):i.jsxs("div",{className:Je.body,children:[i.jsx("p",{className:Je.summary,children:Fb(r("capabilitiesPanelSummary"),{errors:String((t==null?void 0:t.errorCount)??0),warnings:String((t==null?void 0:t.warningCount)??0)})}),u.length>0?i.jsxs("section",{className:Je.section,children:[i.jsx("h3",{className:Je.sectionTitle,children:r("capabilitiesPanelErrors")}),i.jsx("ul",{className:Je.list,children:u.map((f,h)=>i.jsx(mp,{violation:f},`error-${h}`))})]}):null,d.length>0?i.jsxs("section",{className:Je.section,children:[i.jsx("h3",{className:Je.sectionTitle,children:r("capabilitiesPanelWarnings")}),i.jsx("ul",{className:Je.list,children:d.map((f,h)=>i.jsx(mp,{violation:f},`warning-${h}`))})]}):null]})]})})})}function ET({enabled:e,onHtml:t}){const[n,r]=l.useState(!1),o=l.useRef(0),a=l.useRef(e),s=l.useRef(t);a.current=e,s.current=t;const u=l.useCallback(()=>{o.current=0,r(!1)},[]);l.useEffect(()=>{e||u()},[e,u]);const d=l.useCallback(y=>{!a.current||!Va(y.dataTransfer)||(y.preventDefault(),o.current+=1,r(!0))},[]),f=l.useCallback(y=>{!a.current||!Va(y.dataTransfer)||(y.preventDefault(),y.dataTransfer&&(y.dataTransfer.dropEffect="copy"))},[]),h=l.useCallback(y=>{if(!a.current||!Va(y.dataTransfer))return;const b=y.relatedTarget;b instanceof Node&&y.currentTarget.contains(b)||(o.current=Math.max(0,o.current-1),o.current===0&&r(!1))},[]),g=l.useCallback(y=>{if(!a.current||!Va(y.dataTransfer))return;y.preventDefault(),u();const b=z1(y.dataTransfer);b&&rd(b).then(w=>{a.current&&s.current(w)},()=>{})},[u]);return{dragging:n,onDragEnter:d,onDragOver:f,onDragLeave:h,onDrop:g}}const _T={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:Vx,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:Hx,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:mi,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"},deletePage:{id:"deletePage",command:"deletePage",icon:mi,labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:"canDeletePage"}}},Ob=400,Cs=100,Kb=2e7;function MT(e){let t=[],n=0,r=e,o=[],a=0,s=!1,u=!1,d=0;function f(){if(t.length>Cs){const S=t.splice(0,t.length-Cs);for(const k of S)n-=k.length}for(;t.length>1&&n+a>Kb;){const S=t.shift();S&&(n-=S.length)}}function h(S){t.push(S),n+=S.length,f()}function g(){o=[],a=0}function y(S,k){if(s){r=S,s=!1;return}if(S===r)return;const v=Date.now(),A=(k==null?void 0:k.coalesce)===!0;if(A&&u&&v-d<Ob){r=S,d=v,o.length>0&&g();return}h(r),r=S,g(),d=v,u=A}function b(){if(t.length===0)return null;u=!1,o.push(r),a+=r.length;const S=t.pop();return n-=S.length,r=S,f(),r}function w(){if(o.length===0)return null;u=!1,h(r);const S=o.pop();return a-=S.length,r=S,r}function x(S){if(s){r=S,s=!1;return}S!==r&&(h(r),r=S,g(),u=!1)}return{record:y,undo:b,redo:w,canUndo:()=>t.length>0,canRedo:()=>o.length>0,syncExternal:x,markApplying:()=>{s=!0},finishApplying:()=>{s=!1}}}function Xe(e){return e.map(t=>t)}function jr(e){switch(e.type){case"pageEdit":return e.before.length;case"insertPage":return e.page.length;case"deletePage":return e.page.length;case"replaceAll":return e.beforePages.reduce((t,n)=>t+n.length,0)}}function NT(e){let t=[],n=0,r=Xe(e),o=[],a=0,s=!1,u=!1,d=null,f=0;function h(){if(t.length>Cs){const R=t.splice(0,t.length-Cs);for(const T of R)n-=jr(T)}for(;t.length>1&&n+a>Kb;){const R=t.shift();R&&(n-=jr(R))}}function g(R){t.push(R),n+=jr(R),h()}function y(R){o.push(R),a+=jr(R)}function b(){for(const R of o)a-=jr(R);o=[],a=0}function w(){u=!1,d=null}function x(R,T,E){if(s){const F=Xe(r);F[R]=T,r=F,s=!1;return}if(r[R]===T)return;const N=Date.now(),K=(E==null?void 0:E.coalesce)===!0,$=K&&u&&d===R&&N-f<Ob,P=Xe(r);if(P[R]=T,$){r=P,f=N;return}g({type:"pageEdit",pageIndex:R,before:r[R]??""}),r=P,b(),f=N,u=K,d=R}function S(R,T){if(s){r=Xe(T),s=!1;return}Nr(r,T)||(g({type:"insertPage",index:R,page:T[R]??""}),r=Xe(T),b(),w())}function k(R,T,E){if(s){r=Xe(E),s=!1;return}Nr(r,E)||(g({type:"deletePage",index:R,page:T}),r=Xe(E),b(),w())}function v(R){if(s){r=Xe(R),s=!1;return}Nr(r,R)||(g({type:"replaceAll",beforePages:Xe(r)}),r=Xe(R),b(),w())}function A(R){if(s){r=Xe(R),s=!1;return}Nr(r,R)||(r=Xe(R))}function I(){if(t.length===0)return null;w();const R=t.pop();switch(n-=jr(R),R.type){case"pageEdit":{const T=r[R.pageIndex]??"";y({type:"pageEdit",pageIndex:R.pageIndex,before:T}),r[R.pageIndex]=R.before;break}case"insertPage":{const T=r[R.index]??"";y({type:"insertPage",index:R.index,page:T}),r.splice(R.index,1);break}case"deletePage":{y({type:"deletePage",index:R.index,page:R.page}),r.splice(R.index,0,R.page);break}case"replaceAll":{y({type:"replaceAll",beforePages:Xe(r)}),r=Xe(R.beforePages);break}}return h(),Xe(r)}function D(){if(o.length===0)return null;w();const R=o.pop();switch(a-=jr(R),R.type){case"pageEdit":{const T=r[R.pageIndex]??"";g({type:"pageEdit",pageIndex:R.pageIndex,before:T}),r[R.pageIndex]=R.before;break}case"insertPage":{g({type:"insertPage",index:R.index,page:R.page}),r.splice(R.index,0,R.page);break}case"deletePage":{const T=r[R.index]??"";g({type:"deletePage",index:R.index,page:T}),r.splice(R.index,1);break}case"replaceAll":{g({type:"replaceAll",beforePages:Xe(r)}),r=Xe(R.beforePages);break}}return Xe(r)}return{getPresent:()=>r,recordPageEdit:x,recordInsertPage:S,recordDeletePage:k,recordReplaceAll:v,undo:I,redo:D,canUndo:()=>t.length>0,canRedo:()=>o.length>0,syncPages:R=>v(R),applyPresent:A,markApplying:()=>{s=!0}}}function qt(e){return typeof e=="object"&&e!==null&&"recordPageEdit"in e&&typeof e.recordPageEdit=="function"}function fr(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function vs(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):fr(e,t):""}const Cn="fullscreen",xu="commspliant-html-editor.toolbarCustomization";function wu(e){const t=e.filter(n=>n!==Cn);return e.includes(Cn)?[...t,Cn]:t}function hd(e,t){if(!t||t.length===0)return wu(e);const n=new Set(e),r=t.filter(s=>n.has(s)),o=new Set(r),a=[...r];for(let s=0;s<e.length;s++){const u=e[s];if(o.has(u))continue;let d=0;for(let f=s-1;f>=0;f--){const h=e[f],g=a.indexOf(h);if(g>=0){d=g+1;break}}a.splice(d,0,u),o.add(u)}return wu(a)}function LT(e,t){const n=new Map(e.map(s=>[s.id,s])),r=hd(e.map(s=>s.id),t==null?void 0:t.groupOrder),o=new Set((t==null?void 0:t.hiddenItemIds)??[]),a=[];for(const s of r){const u=n.get(s);if(!u)continue;const d=u.items.filter(f=>!o.has(f));d.length!==0&&a.push({id:s,items:d})}return a}function BT(e){if(e==null||typeof e!="object")return null;const t=e,n=Array.isArray(t.groupOrder)?t.groupOrder.filter(o=>typeof o=="string"):[],r=Array.isArray(t.hiddenItemIds)?[...new Set(t.hiddenItemIds.filter(o=>typeof o=="string"))]:[];return n.length===0&&r.length===0?null:{groupOrder:n,hiddenItemIds:r}}function FT(){try{const e=localStorage.getItem(xu);return e?BT(JSON.parse(e)):null}catch{return null}}function HT(e){try{if(!e){localStorage.removeItem(xu);return}localStorage.setItem(xu,JSON.stringify(e))}catch{}}function bd(e,t){return hd(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function zT(e,t,n,r){const o=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?o.delete(n):o.add(n),{groupOrder:bd(e,t),hiddenItemIds:[...o]}}function $b(e,t,n,r){const o=bd(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===Cn||r===Cn)return{groupOrder:o,hiddenItemIds:a};const s=o.indexOf(n),u=o.indexOf(r);if(s<0||u<0||s===u)return{groupOrder:o,hiddenItemIds:a};const d=[...o],[f]=d.splice(s,1);return d.splice(u,0,f),{groupOrder:wu(d),hiddenItemIds:a}}function fp(e,t,n,r){const o=bd(e,t),a=o.filter(d=>d!==Cn),s=a.indexOf(n),u=s+r;return s<0||u<0||u>=a.length?{groupOrder:o,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:$b(e,t,n,a[u])}const OT="_backdrop_11w4e_1",KT="_dialog_11w4e_12",$T="_header_11w4e_31",UT="_body_11w4e_39",VT="_group_11w4e_49",WT="_groupDragging_11w4e_55",GT="_groupDropTarget_11w4e_59",qT="_groupHeader_11w4e_64",ZT="_groupTitle_11w4e_72",YT="_dragHandle_11w4e_77",XT="_moveButton_11w4e_78",JT="_items_11w4e_119",QT="_item_11w4e_119",eR="_itemIcon_11w4e_135",tR="_itemTitle_11w4e_144",nR="_itemCheckbox_11w4e_151",rR="_actions_11w4e_155",oR="_action_11w4e_155",iR="_spinnerWrap_11w4e_191",aR="_spinner_11w4e_191",He={backdrop:OT,dialog:KT,header:$T,body:UT,group:VT,groupDragging:WT,groupDropTarget:GT,groupHeader:qT,groupTitle:ZT,dragHandle:YT,moveButton:XT,items:JT,item:QT,itemIcon:eR,itemTitle:tR,itemCheckbox:nR,actions:rR,action:oR,spinnerWrap:iR,spinner:aR};function sR(){return i.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"currentColor",children:[i.jsx("circle",{cx:"5",cy:"4",r:"1.2"}),i.jsx("circle",{cx:"11",cy:"4",r:"1.2"}),i.jsx("circle",{cx:"5",cy:"8",r:"1.2"}),i.jsx("circle",{cx:"11",cy:"8",r:"1.2"}),i.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),i.jsx("circle",{cx:"11",cy:"12",r:"1.2"})]})}function lR({open:e,catalog:t,groups:n,settings:r,loading:o=!1,busy:a=!1,disabled:s,isItemAllowed:u,onChange:d,onReset:f,onClose:h}){const g=J(),y=l.useId(),b=l.useRef(null),[w,x]=l.useState(null),[S,k]=l.useState(null),v=hd(n.map(P=>P.id),r==null?void 0:r.groupOrder),A=new Set((r==null?void 0:r.hiddenItemIds)??[]),I=new Map(n.map(P=>[P.id,P])),D=v.map(P=>I.get(P)).filter(P=>!!P),R=s||a||o;if(l.useEffect(()=>{e||(x(null),k(null))},[e]),$e(b,{open:e,onClose:h,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const T=D.map(P=>P.id).filter(P=>P!==Cn),E=(P,F)=>{if(R||F===Cn){P.preventDefault();return}P.dataTransfer.setData("text/plain",F),P.dataTransfer.effectAllowed="move",x(F)},N=(P,F)=>{R||F===Cn||!w||w===F||(P.preventDefault(),P.dataTransfer&&(P.dataTransfer.dropEffect="move"),k(F))},K=(P,F)=>{var G;P.preventDefault();const U=((G=P.dataTransfer)==null?void 0:G.getData("text/plain"))||w;x(null),k(null),!(!U||U===F||R)&&d($b(r,n,U,F))},$=()=>{x(null),k(null)};return i.jsx(Pe,{children:i.jsx("div",{className:He.backdrop,role:"presentation",onMouseDown:h,children:i.jsxs("div",{ref:b,className:He.dialog,role:"dialog","aria-modal":"true","aria-labelledby":y,"aria-busy":o||a?!0:void 0,onMouseDown:P=>P.stopPropagation(),children:[i.jsx("h2",{className:He.header,id:y,children:g("customizeToolbarDialogTitle")}),i.jsx("div",{className:He.body,children:o?i.jsx("div",{className:He.spinnerWrap,role:"status","aria-live":"polite","aria-label":g("customizeToolbarDialogLoading"),children:i.jsx("span",{className:He.spinner,"aria-hidden":"true"})}):D.map(P=>{const F=t.groups[P.id],U=F?fr(g,F):P.id,G=P.id===Cn,me=T.indexOf(P.id);return i.jsxs("section",{className:[He.group,w===P.id?He.groupDragging:"",S===P.id?He.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":P.id,"aria-label":U,onDragOver:se=>N(se,P.id),onDrop:se=>K(se,P.id),onDragLeave:()=>{S===P.id&&k(null)},children:[i.jsxs("div",{className:He.groupHeader,children:[i.jsx("button",{type:"button",className:He.dragHandle,draggable:!R&&!G,disabled:R||G,"aria-label":g("customizeToolbarDragHandle"),onDragStart:se=>E(se,P.id),onDragEnd:$,children:i.jsx(sR,{})}),i.jsx("span",{className:He.groupTitle,children:U}),i.jsx("button",{type:"button",className:He.moveButton,disabled:R||G||me<=0,"aria-label":g("customizeToolbarMoveUp"),onClick:()=>d(fp(r,n,P.id,-1)),children:"↑"}),i.jsx("button",{type:"button",className:He.moveButton,disabled:R||G||me<0||me>=T.length-1,"aria-label":g("customizeToolbarMoveDown"),onClick:()=>d(fp(r,n,P.id,1)),children:"↓"})]}),i.jsx("div",{className:He.items,children:P.items.map(se=>{if(u&&!u(se))return null;const V=t.items[se];if(!V)return null;const re=V.icon,de=fr(g,V),oe=`${y}-${P.id}-${se}`,_=!A.has(se);return i.jsxs("label",{className:He.item,htmlFor:oe,children:[i.jsx("span",{className:He.itemIcon,"aria-hidden":"true",children:re?i.jsx(re,{}):de.slice(0,2)}),i.jsx("span",{className:He.itemTitle,children:de}),i.jsx("input",{id:oe,className:He.itemCheckbox,type:"checkbox",checked:_,disabled:R,"aria-label":`${de}: ${g("customizeToolbarItemVisible")}`,onChange:Q=>d(zT(r,n,se,Q.target.checked))})]},se)})})]},P.id)})}),i.jsxs("div",{className:He.actions,children:[i.jsx("button",{type:"button",className:He.action,disabled:R,onClick:f,children:g("customizeToolbarDialogReset")}),i.jsx("button",{type:"button",className:He.action,"aria-label":g("customizeToolbarDialogCloseAria"),onClick:h,children:g("customizeToolbarDialogClose")})]})]})})})}function cR(e,t){if(!t)return e;const n=t.menus,r=t.toolbar;if(n===void 0&&r===void 0)return e;const o=n===void 0?e.menus:e.menus.filter(s=>n.includes(s.id)),a=r===void 0?e.iconGroups:e.iconGroups.map(s=>({id:s.id,items:s.items.filter(u=>r.includes(u))})).filter(s=>s.items.length>0);return{menus:o,iconGroups:a}}const uR={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:Kx,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:jx,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:Bx,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},Ub=4;function dR({anchorRect:e,floatingWidth:t,floatingHeight:n,pad:r=Ub,minWidth:o=0,matchAnchorWidth:a=!1}){const s=a?Math.max(e.width,t,o):t;let u=e.bottom;u+n>window.innerHeight-r&&(u=Math.max(r,e.top-n));const d=Math.min(Math.max(e.left,r),window.innerWidth-s-r);return a?{top:u,left:d,width:s}:{top:u,left:d}}function Eo(e,t,n,{pad:r=Ub,minWidth:o=0,matchAnchorWidth:a=!1,deps:s=[]}={}){const[u,d]=l.useState({top:0,left:0}),f=l.useCallback(()=>{const h=t.current,g=n.current;if(!h)return;const y=h.getBoundingClientRect(),b=Math.max(a?y.width:0,(g==null?void 0:g.offsetWidth)??0,o),w=(g==null?void 0:g.offsetHeight)??0;d(dR({anchorRect:y,floatingWidth:b,floatingHeight:w,pad:r,minWidth:o,matchAnchorWidth:a}))},[t,n,a,o,r]);return l.useLayoutEffect(()=>{if(!e)return;f();const h=()=>f();return window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[e,f,...s]),u}const mR="_toolbar_a9bu4_1",fR="_menuBar_a9bu4_35",pR="_menuBarDesktop_a9bu4_43",gR="_brandMark_a9bu4_49",hR="_brandMarkIcon_a9bu4_56",bR="_menuBarCompact_a9bu4_68",yR="_menuWrap_a9bu4_91",xR="_menuButton_a9bu4_97",wR="_iconButton_a9bu4_98",CR="_menuItem_a9bu4_99",vR="_hamburgerButton_a9bu4_144",kR="_iconNav_a9bu4_151",SR="_iconNavMain_a9bu4_162",PR="_iconNavEnd_a9bu4_171",AR="_iconGroup_a9bu4_187",TR="_tooltipTrigger_a9bu4_281",RR="_menu_a9bu4_35",DR="_submenuWrap_a9bu4_311",IR="_submenu_a9bu4_311",jR="_submenuTrigger_a9bu4_321",ER="_menuOverlay_a9bu4_336",_R="_menuOverlayHeader_a9bu4_348",MR="_menuOverlayTitle_a9bu4_358",NR="_menuOverlayBody_a9bu4_364",LR="_menuSeparator_a9bu4_415",BR="_icon_a9bu4_98",FR="_tooltip_a9bu4_281",HR="_tooltipElevated_a9bu4_510",ue={toolbar:mR,menuBar:fR,menuBarDesktop:pR,brandMark:gR,brandMarkIcon:hR,menuBarCompact:bR,menuWrap:yR,menuButton:xR,iconButton:wR,menuItem:CR,hamburgerButton:vR,iconNav:kR,iconNavMain:SR,iconNavEnd:PR,iconGroup:AR,tooltipTrigger:TR,menu:RR,submenuWrap:DR,submenu:IR,submenuTrigger:jR,menuOverlay:ER,menuOverlayHeader:_R,menuOverlayTitle:MR,menuOverlayBody:NR,menuSeparator:LR,icon:BR,tooltip:FR,tooltipElevated:HR},zR=400,pp=6,Dc=4;function pr({label:e,children:t,className:n,elevated:r}){const o=l.useRef(null),a=l.useRef(null),s=l.useRef(null),u=l.useRef(!1),d=l.useRef(!1),[f,h]=l.useState(!1),[g,y]=l.useState({top:0,left:0}),b=l.useCallback(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),w=l.useCallback(k=>{if(!(u.current||d.current)){b(),h(!1);return}if(k||d.current){b(),h(!0);return}b(),s.current=setTimeout(()=>{s.current=null,h(!0)},zR)},[b]),x=l.useCallback(()=>{const k=o.current,v=a.current;if(!k||!v)return;const A=k.getBoundingClientRect(),I=v.offsetWidth,D=v.offsetHeight;let R=A.bottom+pp;R+D>window.innerHeight-Dc&&(R=A.top-pp-D);let T=A.left+A.width/2-I/2;T=Math.min(Math.max(T,Dc),window.innerWidth-I-Dc),y({top:R,left:T})},[]);l.useEffect(()=>()=>b(),[b]),l.useEffect(()=>{const k=o.current;if(!k)return;const v=()=>{d.current=!0,w(!0)},A=()=>{d.current=!1,w(!1)};return k.addEventListener("focusin",v),k.addEventListener("focusout",A),()=>{k.removeEventListener("focusin",v),k.removeEventListener("focusout",A)}},[w]),l.useLayoutEffect(()=>{if(!f)return;x();const k=()=>x();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[f,e,x]);const S=n?`${ue.tooltipTrigger} ${n}`:ue.tooltipTrigger;return i.jsxs(i.Fragment,{children:[i.jsx("span",{ref:o,className:S,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,w(!1)},onMouseLeave:()=>{u.current=!1,w(!1)},children:t}),f?i.jsx(Pe,{children:i.jsx("span",{ref:a,className:r?`${ue.tooltip} ${ue.tooltipElevated}`:ue.tooltip,"data-toolbar-tooltip":"",style:{top:g.top,left:g.left},"aria-hidden":"true",children:e})}):null]})}const gp=8,hp=["#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"],OR=8;let Cu=[];const vu=new Set;function bp(){return Cu}function KR(e){const t=Ke(e);t&&(Cu=[t,...Cu.filter(n=>n!==t)].slice(0,OR),vu.forEach(n=>n()))}function $R(e){return vu.add(e),()=>{vu.delete(e)}}function qa(e){const t=Ke(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 Er(e,t,n){const r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Ic({r:e,g:t,b:n}){const r=e/255,o=t/255,a=n/255,s=Math.max(r,o,a),u=Math.min(r,o,a),d=s-u;let f=0;return d!==0&&(s===r?f=(o-a)/d%6:s===o?f=(a-r)/d+2:f=(r-o)/d+4,f*=60,f<0&&(f+=360)),{h:f,s:s===0?0:d/s,v:s}}function jc({h:e,s:t,v:n}){const r=(e%360+360)%360,o=n*t,a=o*(1-Math.abs(r/60%2-1)),s=n-o;let u=0,d=0,f=0;return r<60?(u=o,d=a):r<120?(u=a,d=o):r<180?(d=o,f=a):r<240?(d=a,f=o):r<300?(u=a,f=o):(u=o,f=a),{r:Math.round((u+s)*255),g:Math.round((d+s)*255),b:Math.round((f+s)*255)}}function Vb(){return typeof window<"u"&&"EyeDropper"in window}async function UR(){if(!Vb())return null;const e=window.EyeDropper;try{const t=await new e().open();return Ke(t.sRGBHex)}catch{return null}}const VR="_picker_ag1yo_1",WR="_none_ag1yo_12",GR="_customToggle_ag1yo_13",qR="_eyedrop_ag1yo_14",ZR="_swatch_ag1yo_48",YR="_field_ag1yo_49",XR="_grid_ag1yo_54",JR="_recents_ag1yo_55",QR="_sectionLabel_ag1yo_84",eD="_custom_ag1yo_13",tD="_sv_ag1yo_95",nD="_svThumb_ag1yo_105",rD="_hue_ag1yo_116",oD="_rgbRow_ag1yo_155",iD="_hexRow_ag1yo_156",ot={picker:VR,none:WR,customToggle:GR,eyedrop:qR,swatch:ZR,field:YR,grid:XR,recents:JR,sectionLabel:QR,custom:eD,sv:tD,svThumb:nD,hue:rD,rgbRow:oD,hexRow:iD};function aD(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 yd({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:o,menu:a=!1,fallbackCustom:s="#000000",onChange:u,onCommit:d}){const f=J(),h=l.useId(),g=a?"menuitemradio":"option",y=t?null:e,b=qa(y??s)??{r:0,g:0,b:0},[w,x]=l.useState(!1),[S,k]=l.useState(()=>Ic(b)),[v,A]=l.useState(()=>({r:String(b.r),g:String(b.g),b:String(b.b)})),[I,D]=l.useState(()=>Er(b.r,b.g,b.b)),[R,T]=l.useState(()=>[...bp()]),E=l.useRef(null),N=l.useRef(Er(b.r,b.g,b.b));l.useEffect(()=>$R(()=>T([...bp()])),[]),l.useEffect(()=>{const _=qa(y??s);if(!_)return;const Q=Ic(_);k(Q),A({r:String(_.r),g:String(_.g),b:String(_.b)}),D(Er(_.r,_.g,_.b))},[y,s]);const K=(_,Q,ye)=>{_&&(N.current=_),ye&&_&&KR(_),u(_),Q&&(d==null||d(_))},$=(_,Q,ye)=>{const ee=Er(_.r,_.g,_.b);k(Ic(_)),A({r:String(_.r),g:String(_.g),b:String(_.b)}),D(ee),K(ee,Q,ye)},P=(_,Q,ye)=>{const ee=jc(_),Z=Er(ee.r,ee.g,ee.b);k(_),A({r:String(ee.r),g:String(ee.g),b:String(ee.b)}),D(Z),K(Z,Q,ye)},F=_=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(_.key))return;const ye=[..._.currentTarget.querySelectorAll("button")],ee=ye.findIndex(et=>et===document.activeElement);if(ee<0)return;_.preventDefault();const Z=_.key==="ArrowLeft"?-1:_.key==="ArrowRight"?1:_.key==="ArrowUp"?-gp:gp,Ee=ye[Math.max(0,Math.min(ye.length-1,ee+Z))];Ee==null||Ee.focus()},U=(_,Q)=>{const ye=E.current;if(!ye||o)return;const ee=ye.getBoundingClientRect(),Z=Math.max(0,Math.min(1,(_.clientX-ee.left)/ee.width)),Ee=Math.max(0,Math.min(1,1-(_.clientY-ee.top)/ee.height));P({h:S.h,s:Z,v:Ee},Q,Q)},G=_=>{o||(_.currentTarget.setPointerCapture(_.pointerId),U(_,!1))},me=jc({h:S.h,s:1,v:1}),se=Er(me.r,me.g,me.b),V=jc(S),re=Er(V.r,V.g,V.b),de=new Set(hp),oe=R.filter(_=>!de.has(_));return i.jsxs("div",{className:ot.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[i.jsx("button",{type:"button",className:ot.none,role:g,"aria-checked":a?y===null&&!t:void 0,"aria-selected":a?void 0:y===null&&!t,disabled:o,onClick:()=>K(null,!0,!1),children:n}),i.jsx("div",{className:ot.grid,role:a?"group":"none",onKeyDown:F,children:hp.map(_=>{const Q=y===_;return i.jsx("button",{type:"button",className:ot.swatch,role:g,"aria-label":_,"aria-checked":a?Q:void 0,"aria-selected":a?void 0:Q,disabled:o,style:{backgroundColor:_},onMouseDown:ye=>ye.preventDefault(),onClick:()=>K(_,!0,!1)},_)})}),oe.length>0?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:ot.sectionLabel,children:f("colorRecent")}),i.jsx("div",{className:ot.recents,role:a?"group":"none","aria-label":f("colorRecent"),children:oe.map(_=>i.jsx("button",{type:"button",className:ot.swatch,role:g,"aria-label":_,"aria-checked":a?y===_:void 0,"aria-selected":a?void 0:y===_,disabled:o,style:{backgroundColor:_},onMouseDown:Q=>Q.preventDefault(),onClick:()=>K(_,!0,!1)},_))})]}):null,i.jsx("button",{type:"button",className:ot.customToggle,disabled:o,"aria-expanded":w,onClick:()=>x(_=>!_),children:f("colorCustom")}),w?i.jsxs("div",{className:ot.custom,children:[i.jsx("div",{ref:E,className:ot.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${se})`},onPointerDown:G,onPointerMove:_=>{_.currentTarget.hasPointerCapture(_.pointerId)&&U(_,!1)},onPointerUp:_=>{U(_,!0)},children:i.jsx("span",{className:ot.svThumb,style:{left:`${S.s*100}%`,top:`${(1-S.v)*100}%`}})}),i.jsx("input",{className:ot.hue,type:"range",min:0,max:360,value:Math.round(S.h),disabled:o,"aria-label":f("colorCustom"),onChange:_=>P({...S,h:Number(_.target.value)},!1,!1),onPointerUp:()=>K(N.current,!0,!0)}),i.jsx("div",{className:ot.rgbRow,children:["r","g","b"].map(_=>i.jsxs("div",{className:ot.field,children:[i.jsx("label",{htmlFor:`${h}-${_}`,children:f(_==="r"?"colorRgbR":_==="g"?"colorRgbG":"colorRgbB")}),i.jsx("input",{id:`${h}-${_}`,inputMode:"numeric",value:v[_],disabled:o,onChange:Q=>{A(ye=>({...ye,[_]:Q.target.value}))},onBlur:()=>{const Q=aD(v[_]);if(Q===null){A({r:String(V.r),g:String(V.g),b:String(V.b)});return}$({...V,[_]:Q},!0,!0)},onKeyDown:Q=>{Q.key==="Enter"&&Q.currentTarget.blur()}})]},_))}),i.jsx("div",{className:ot.hexRow,children:i.jsxs("div",{className:ot.field,children:[i.jsx("label",{htmlFor:`${h}-hex`,children:f("colorHex")}),i.jsx("input",{id:`${h}-hex`,value:I,disabled:o,onChange:_=>D(_.target.value),onBlur:()=>{const _=Ke(I);if(!_){D(re);return}const Q=qa(_);Q&&$(Q,!0,!0)},onKeyDown:_=>{_.key==="Enter"&&_.currentTarget.blur()}})]})}),Vb()?i.jsx("button",{type:"button",className:ot.eyedrop,disabled:o,onClick:()=>{UR().then(_=>{if(!_)return;const Q=qa(_);Q&&$(Q,!0,!0)})},children:f("colorPickFromScreen")}):null]}):null]})}const sD="_wrap_hfz5s_1",lD="_button_hfz5s_8",cD="_icon_hfz5s_18",uD="_bar_hfz5s_24",dD="_barEmpty_hfz5s_33",mD="_popover_hfz5s_43",_r={wrap:sD,button:lD,icon:cD,bar:uD,barEmpty:dD,popover:mD};function Wb({icon:e,value:t,mixed:n,noneKey:r,labelKey:o,ariaKey:a,fallbackCustom:s,disabled:u,onChange:d}){const f=J(),h=l.useId(),g=l.useRef(null),y=l.useRef(null),b=l.useRef(null),[w,x]=l.useState(!1),S=Eo(w,y,b);l.useEffect(()=>{if(!w)return;const D=T=>{var N,K;const E=T.target;(N=g.current)!=null&&N.contains(E)||(K=b.current)!=null&&K.contains(E)||x(!1)},R=T=>{var E;T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),x(!1),(E=y.current)==null||E.focus())};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",R,!0)}},[w]);const k=D=>{d(D)},v=`${_r.bar}${!t||n?` ${_r.barEmpty}`:""}`,A=t&&!n?{backgroundColor:t}:void 0,I=i.jsxs("div",{className:_r.wrap,ref:g,children:[i.jsxs("button",{ref:y,type:"button",className:`${ue.iconButton} ${_r.button}`,"aria-label":f(a),"aria-expanded":w,"aria-haspopup":"listbox","aria-controls":w?h:void 0,disabled:u,onMouseDown:D=>D.preventDefault(),onClick:()=>x(D=>!D),children:[i.jsx(e,{className:`${ue.icon} ${_r.icon}`}),i.jsx("span",{className:v,style:A})]}),w?i.jsx(Pe,{children:i.jsx("div",{ref:b,id:h,className:_r.popover,style:{top:S.top,left:S.left},children:i.jsx(yd,{value:t,mixed:n,noneLabel:f(r),ariaLabel:f(a),disabled:u,fallbackCustom:s,onChange:k,onCommit:()=>x(!1)})})}):null]});return i.jsx(pr,{label:f(o),children:I})}function fD({commands:e,queries:t,disabled:n}){return i.jsx(Wb,{icon:Np,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}const pD="_wrap_1vjt0_1",gD="_wrapToolbar_1vjt0_7",hD="_field_1vjt0_12",bD="_trigger_1vjt0_20",yD="_chevron_1vjt0_50",xD="_list_1vjt0_73",wD="_listInline_1vjt0_88",CD="_option_1vjt0_96",vD="_separator_1vjt0_125",ln={wrap:pD,wrapToolbar:gD,field:hD,trigger:bD,chevron:yD,list:xD,listInline:wD,option:CD,separator:vD};function kD({value:e,mixed:t=!1,fonts:n,disabled:r,listId:o,listRef:a,inline:s,style:u,onSelect:d}){const f=J(),h=!t&&e===null;return i.jsxs("ul",{ref:a,id:o,className:s?`${ln.list} ${ln.listInline}`:ln.list,role:"listbox","aria-label":f("commandFontFamilyAria"),style:u,children:[i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:ln.option,role:"option","aria-checked":h,disabled:r,onMouseDown:g=>g.preventDefault(),onClick:()=>d(null),children:f("fontFamilyDefault")})}),i.jsx("li",{className:ln.separator,role:"separator"}),n.map(g=>{const y=!t&&Ii(e,g.family);return i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:ln.option,role:"option","aria-checked":y,disabled:r,style:{fontFamily:g.family},onMouseDown:b=>b.preventDefault(),onClick:()=>d(g.family),children:g.name})},g.family)})]})}function SD(e,t,n,r){var o;return t?"":e===null?r:((o=vw(e,n))==null?void 0:o.name)??e}function Gb({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:o,toolbar:a=!1,triggerId:s,onChange:u}){const d=J(),f=l.useId(),h=l.useRef(null),g=l.useRef(null),y=l.useRef(null),[b,w]=l.useState(!1),x=SD(e,t,n,d("fontFamilyDefault")),S=Eo(b,g,y,{matchAnchorWidth:!0,deps:[n.length]});l.useEffect(()=>{if(!b)return;const v=I=>{var R,T;const D=I.target;(R=h.current)!=null&&R.contains(D)||(T=y.current)!=null&&T.contains(D)||w(!1)},A=I=>{I.key==="Escape"&&(I.preventDefault(),I.stopPropagation(),w(!1))};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",A,!0)}},[b]);const k=i.jsxs("div",{className:`${ln.wrap}${a?` ${ln.wrapToolbar}`:""}`,ref:h,children:[i.jsxs("div",{className:ln.field,ref:g,children:[i.jsx("button",{type:"button",id:s,className:ln.trigger,disabled:r,"aria-label":a?d("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":b,"aria-controls":b?f:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:v=>v.preventDefault(),onClick:()=>w(v=>!v),children:x}),i.jsx("span",{className:ln.chevron,"aria-hidden":"true"})]}),b?i.jsx(Pe,{children:i.jsx(kD,{listRef:y,listId:f,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:S.top,left:S.left,minWidth:S.width},onSelect:v=>{u(v),w(!1)}})}):null]});return o?i.jsx(pr,{label:o,children:k}):k}function PD({commands:e,queries:t,disabled:n}){const r=J(),o=pd(),a=!!(n||!t.isVisualMode()),s=(()=>{const u=t.getFontFaces(),d=o==null?void 0:o.allowedFontFamilies;if(!d)return u;const f=new Set(d.map(h=>h.toLowerCase()));return u.filter(h=>f.has(h.family.toLowerCase())||d.some(g=>h.family.toLowerCase().includes(g.toLowerCase())))})();return i.jsx(Gb,{family:t.isFontFamilyMixed()?null:t.getFontFamily(),mixed:t.isFontFamilyMixed(),fonts:s,disabled:a,tooltip:r("commandFontFamily"),toolbar:!0,onChange:u=>{e.setFontFamily(u)}})}const AD="_wrap_58i0x_1",TD="_wrapToolbar_58i0x_9",RD="_field_58i0x_14",DD="_input_58i0x_22",ID="_toggle_58i0x_41",jD="_chevron_58i0x_42",ED="_unit_58i0x_80",_D="_list_58i0x_110",MD="_option_58i0x_125",Ve={wrap:AD,wrapToolbar:TD,field:RD,input:DD,toggle:ID,chevron:jD,unit:ED,list:_D,option:MD},ND={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function qb({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:o,tooltip:a,sizeInputId:s,toolbar:u=!1}){const d=J(),f=l.useId(),h=l.useRef(null),g=l.useRef(null),y=l.useRef(null),[b,w]=l.useState(()=>e===null?"":he(e)),[x,S]=l.useState(!1),[k,v]=l.useState(!1),A=Eo(k,g,y,{matchAnchorWidth:!0,minWidth:72});l.useEffect(()=>{x||w(e===null?"":he(e))},[e,x]),l.useEffect(()=>{if(!k)return;const E=K=>{var P,F;const $=K.target;(P=h.current)!=null&&P.contains($)||(F=y.current)!=null&&F.contains($)||v(!1)},N=K=>{K.key==="Escape"&&(K.preventDefault(),K.stopPropagation(),v(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",N,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",N,!0)}},[k]);const I=E=>{const N=$w(E,t);if(!N){w(e===null?"":he(e));return}n(N.value,N.unit),w(he(N.value))},D=Hw[t],R=k?i.jsx(Pe,{children:i.jsx("ul",{ref:y,className:Ve.list,role:"listbox",id:f,style:{top:A.top,left:A.left,minWidth:A.width},children:D.map(E=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ve.option,role:"option","aria-selected":e===E,onMouseDown:N=>N.preventDefault(),onClick:()=>{n(E,t),w(he(E)),v(!1)},children:he(E)})},E))})}):null,T=i.jsxs("div",{className:`${Ve.wrap}${u?` ${Ve.wrapToolbar}`:""}`,ref:h,children:[i.jsxs("div",{className:Ve.field,ref:g,children:[i.jsx("input",{id:s,className:Ve.input,value:b,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":k,"aria-controls":f,role:"combobox",inputMode:"decimal",onFocus:()=>S(!0),onBlur:()=>{S(!1),I(b)},onChange:E=>w(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),I(b),v(!1),E.currentTarget.blur()),E.key==="ArrowDown"&&(E.preventDefault(),v(!0))}}),i.jsx("button",{type:"button",className:Ve.toggle,tabIndex:-1,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-expanded":k,"aria-controls":f,onMouseDown:E=>E.preventDefault(),onClick:()=>v(E=>!E)})]}),i.jsxs("div",{className:Ve.field,children:[i.jsx("select",{className:Ve.unit,value:t,disabled:o,"aria-label":d("commandFontSizeUnitAria"),onChange:E=>{r(E.target.value)},children:Eu.map(E=>i.jsx("option",{value:E,children:d(ND[E])},E))}),i.jsx("span",{className:Ve.chevron,"aria-hidden":"true"})]}),R]});return a?i.jsx(pr,{label:a,children:T}):T}function LD({commands:e,queries:t,disabled:n}){const r=J(),o=!!(n||!t.isVisualMode());return i.jsx(qb,{size:t.getFontSize(),unit:t.getFontSizeUnit(),disabled:o,tooltip:r("commandFontSize"),toolbar:!0,onSizeChange:(a,s)=>{e.setFontSize(a,s)},onUnitChange:a=>{e.setFontSizeUnit(a)}})}function BD({commands:e,queries:t,disabled:n}){return i.jsx(Wb,{icon:Lp,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function FD({commands:e,queries:t,disabled:n,onMenuClose:r}){const o=J(),a=!!(n||!t.isVisualMode());return i.jsx(yd,{value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneLabel:o("colorNone"),ariaLabel:o("commandHighlightColorAria"),disabled:a,menu:!0,fallbackCustom:"#ffff00",onChange:s=>e.setHighlightColor(s),onCommit:()=>r==null?void 0:r()})}const HD="_wrap_1gtdc_1",zD="_wrapToolbar_1gtdc_7",OD="_field_1gtdc_12",KD="_trigger_1gtdc_20",$D="_chevron_1gtdc_46",UD="_list_1gtdc_69",VD="_option_1gtdc_84",WD="_separator_1gtdc_113",Hn={wrap:HD,wrapToolbar:zD,field:OD,trigger:KD,chevron:$D,list:UD,option:VD,separator:WD},GD="_backdrop_1p9zk_1",qD="_dialog_1p9zk_12",ZD="_dialogWide_1p9zk_31",YD="_header_1p9zk_35",XD="_tabs_1p9zk_43",JD="_tab_1p9zk_43",QD="_body_1p9zk_76",eI="_field_1p9zk_86",tI="_label_1p9zk_92",nI="_sizeRow_1p9zk_96",rI="_fileRow_1p9zk_102",oI="_fileName_1p9zk_108",iI="_previewImage_1p9zk_115",aI="_marks_1p9zk_125",sI="_mark_1p9zk_125",lI="_actions_1p9zk_140",cI="_actionsSpread_1p9zk_148",uI="_actionsEnd_1p9zk_152",dI="_headerRow_1p9zk_157",mI="_close_1p9zk_170",fI="_nameSection_1p9zk_187",pI="_nameInput_1p9zk_192",gI="_labelRow_1p9zk_209",hI="_help_1p9zk_215",bI="_textInput_1p9zk_233",yI="_fullSelect_1p9zk_245",xI="_error_1p9zk_249",wI="_emptyHint_1p9zk_254",CI="_action_1p9zk_140",vI="_textarea_1p9zk_265",kI="_actionDanger_1p9zk_279",SI="_confirmBody_1p9zk_285",PI="_nestedPanel_1p9zk_294",AI="_spinnerWrap_1p9zk_309",TI="_spinner_1p9zk_309",RI="_actionPrimary_1p9zk_344",DI="_iconButton_1p9zk_358",II="_select_1p9zk_359",jI="_lengthInput_1p9zk_360",EI="_lengthUnit_1p9zk_361",_I="_group_1p9zk_369",MI="_nestedGroup_1p9zk_379",NI="_subLabel_1p9zk_389",LI="_iconRow_1p9zk_393",BI="_lengthField_1p9zk_425",FI="_sideLabel_1p9zk_431",HI="_lengthRow_1p9zk_435",zI="_sideGrid_1p9zk_463",OI="_shadowGrid_1p9zk_464",p={backdrop:GD,dialog:qD,dialogWide:ZD,header:YD,tabs:XD,tab:JD,body:QD,field:eI,label:tI,sizeRow:nI,fileRow:rI,fileName:oI,previewImage:iI,marks:aI,mark:sI,actions:lI,actionsSpread:cI,actionsEnd:uI,headerRow:dI,close:mI,nameSection:fI,nameInput:pI,labelRow:gI,help:hI,textInput:bI,fullSelect:yI,error:xI,emptyHint:wI,action:CI,textarea:vI,actionDanger:kI,confirmBody:SI,nestedPanel:PI,spinnerWrap:AI,spinner:TI,actionPrimary:RI,iconButton:DI,select:II,lengthInput:jI,lengthUnit:EI,group:_I,nestedGroup:MI,subLabel:NI,iconRow:LI,lengthField:BI,sideLabel:FI,lengthRow:HI,sideGrid:zI,shadowGrid:OI},ku={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},KI={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 yp(){const e=J();return i.jsx("div",{className:p.spinnerWrap,role:"status","aria-live":"polite","aria-label":e("customStyleLoading"),children:i.jsx("span",{className:p.spinner,"aria-hidden":"true"})})}function Zb({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:o,listRef:a,style:s,customStylesEnabled:u=!1,customStyles:d=[],customStylesLoading:f=!1,onSelect:h,onSelectCustom:g,onAddNew:y}){const b=J(),w=pd(),x=w?Hr.filter(A=>w.allowedParagraphTags.includes(A)):Hr,S=t?null:e,k=u&&x.length>0,v=!!(r&&u&&y);return r?i.jsxs(i.Fragment,{children:[x.map(A=>i.jsx("button",{type:"button",className:ue.menuItem,role:"menuitemradio","aria-checked":S===A,disabled:n,onMouseDown:I=>I.preventDefault(),onClick:()=>h(A),children:b(ku[A])},A)),k?i.jsx("div",{role:"separator",className:ue.menuSeparator}):null,k&&f?i.jsx(yp,{}):null,k&&!f?d.map(A=>i.jsx("button",{type:"button",className:ue.menuItem,role:"menuitem",disabled:n,onMouseDown:I=>I.preventDefault(),onClick:()=>g==null?void 0:g(A.id),children:A.name},A.id)):null,v?i.jsxs(i.Fragment,{children:[k&&(f||d.length>0)?i.jsx("div",{role:"separator",className:ue.menuSeparator}):null,i.jsxs("button",{type:"button",className:ue.menuItem,role:"menuitem","aria-label":b("styleAddNewAria"),disabled:n,onMouseDown:A=>A.preventDefault(),onClick:()=>y==null?void 0:y(),children:[i.jsx(Lx,{className:ue.icon}),b("styleAddNew")]})]}):null]}):i.jsxs("ul",{ref:a,className:Hn.list,role:"listbox",id:o,style:s,"aria-label":b("commandParagraphStyleAria"),"aria-busy":k&&f?!0:void 0,children:[Hr.map(A=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Hn.option,role:"option","aria-selected":S===A,disabled:n,style:KI[A],onMouseDown:I=>I.preventDefault(),onClick:()=>h(A),children:b(ku[A])})},A)),k&&(f||d.length>0)?i.jsx("li",{role:"separator",className:Hn.separator}):null,k&&f?i.jsx("li",{role:"presentation",children:i.jsx(yp,{})}):null,k&&!f?d.map(A=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Hn.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:I=>I.preventDefault(),onClick:()=>g==null?void 0:g(A.id),children:A.name})},A.id)):null]})}function $I({commands:e,queries:t,disabled:n}){const r=J(),o=l.useId(),a=l.useRef(null),s=l.useRef(null),u=l.useRef(null),[d,f]=l.useState(!1),h=!!(n||!t.isVisualMode()),g=t.isParagraphStyleMixed(),y=g?null:t.getParagraphStyle(),b=y?r(ku[y]):"",w=t.customParagraphStylesEnabled(),x=w?t.getCustomParagraphStyles():[],S=w&&t.isCustomParagraphStylesLoading(),k=Eo(d,s,u,{matchAnchorWidth:!0,deps:[x.length,S]});l.useEffect(()=>{if(!d)return;const A=D=>{var T,E;const R=D.target;(T=a.current)!=null&&T.contains(R)||(E=u.current)!=null&&E.contains(R)||f(!1)},I=D=>{D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),f(!1))};return document.addEventListener("pointerdown",A),document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("pointerdown",A),document.removeEventListener("keydown",I,!0)}},[d]);const v=i.jsxs("div",{className:`${Hn.wrap} ${Hn.wrapToolbar}`,ref:a,children:[i.jsxs("div",{className:Hn.field,ref:s,children:[i.jsx("button",{type:"button",className:Hn.trigger,disabled:h,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?o:void 0,onMouseDown:A=>A.preventDefault(),onClick:()=>f(A=>!A),children:b}),i.jsx("span",{className:Hn.chevron,"aria-hidden":"true"})]}),d?i.jsx(Pe,{children:i.jsx(Zb,{listRef:u,listId:o,value:y,mixed:g,disabled:h,customStylesEnabled:w,customStyles:x,customStylesLoading:S,style:{top:k.top,left:k.left,minWidth:k.width},onSelect:A=>{e.setParagraphStyle(A),f(!1)},onSelectCustom:A=>{e.applyCustomParagraphStyle(A),f(!1)}})}):null]});return i.jsx(pr,{label:r("commandParagraphStyle"),children:v})}function UI({commands:e,queries:t,disabled:n,onMenuClose:r}){const o=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),s=a?null:t.getParagraphStyle(),u=t.customParagraphStylesEnabled(),d=u?t.getCustomParagraphStyles():[],f=u&&t.isCustomParagraphStylesLoading();return i.jsx(Zb,{menu:!0,value:s,mixed:a,disabled:o,customStylesEnabled:u,customStyles:d,customStylesLoading:f,onSelect:h=>{e.setParagraphStyle(h),r==null||r()},onSelectCustom:h=>{e.openCustomParagraphStyleDialog(h),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const VI={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:UI,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:FD,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:PD,icon:yx,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:$I,icon:Nx,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:LD,icon:wx,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:xx,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:gx,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:Hp,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:Bp,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:fD,icon:Np,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:BD,icon:Lp,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:cx,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:Ax,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:Ux,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:$x,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:mx,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:Cx,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:Ts,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:As,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:Rs,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:Ep,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:Px,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:Ex,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:_p,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:Fp,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},WI={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},submenus:{insertPage:{id:"insertPage",labelKey:"menuInsertPage",ariaKey:"menuInsertPageAria",enabled:"hasSelectedPage"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:Rx,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:ux,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:Bp,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},pageBackgroundImage:{id:"pageBackgroundImage",command:"openPageBackgroundImage",icon:mi,labelKey:"commandPageBackgroundImage",ariaKey:"commandPageBackgroundImageAria",enabled:"canInsertPageBackgroundImage"},paragraphBackgroundImage:{id:"paragraphBackgroundImage",command:"openParagraphBackgroundImage",icon:Hp,labelKey:"commandParagraphBackgroundImage",ariaKey:"commandParagraphBackgroundImageAria",enabled:"canInsertParagraphBackgroundImage"},audio:{id:"audio",command:"openAudioDialog",icon:lx,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:qx,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:kx,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},pageBreak:{id:"pageBreak",command:"insertPageBreak",icon:_x,labelKey:"commandPageBreak",ariaKey:"commandPageBreakAria",enabled:"isVisualMode"},insertPageBefore:{id:"insertPageBefore",command:"insertPageBefore",icon:mi,labelKey:"commandInsertPageBefore",ariaKey:"commandInsertPageBeforeAria",enabled:"hasSelectedPage"},insertPageAfter:{id:"insertPageAfter",command:"insertPageAfter",icon:mi,labelKey:"commandInsertPageAfter",ariaKey:"commandInsertPageAfterAria",enabled:"hasSelectedPage"}}},GI={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:lf,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:fc,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:fc,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:fc,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:mc,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:mc,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:mc,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:Ix,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:Wx,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:lf,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:dx,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:zx,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},qI={menus:{help:{id:"help",labelKey:"menuHelp",ariaKey:"menuHelpAria"}},groups:{},items:{editorHelp:{id:"editorHelp",command:"openHelp",icon:dc,labelKey:"commandEditorHelp",ariaKey:"commandEditorHelpAria"},keyboardShortcuts:{id:"keyboardShortcuts",command:"openKeyboardShortcuts",icon:dc,labelKey:"commandKeyboardShortcuts",ariaKey:"commandKeyboardShortcutsAria"},about:{id:"about",command:"openAbout",icon:dc,labelKey:"commandAbout",ariaKey:"commandAboutAria"}}},ZI=["getStarted","file","edit","insert","format","table","view","keyboard"],Su=[{id:"getStarted",category:"getStarted",titleKey:"helpTopicGetStartedTitle",bodyKey:"helpTopicGetStartedBody",keywordsKey:"helpTopicGetStartedKeywords",related:["switchModes","searchHelp","keyboardShortcuts"]},{id:"switchModes",category:"getStarted",titleKey:"helpTopicSwitchModesTitle",bodyKey:"helpTopicSwitchModesBody",keywordsKey:"helpTopicSwitchModesKeywords",related:["getStarted","preview"]},{id:"searchHelp",category:"getStarted",titleKey:"helpTopicSearchHelpTitle",bodyKey:"helpTopicSearchHelpBody",keywordsKey:"helpTopicSearchHelpKeywords",related:["getStarted","keyboardShortcuts"]},{id:"saveDocument",category:"file",titleKey:"helpTopicSaveDocumentTitle",bodyKey:"helpTopicSaveDocumentBody",keywordsKey:"helpTopicSaveDocumentKeywords",related:["openDocument","printDocument"]},{id:"openDocument",category:"file",titleKey:"helpTopicOpenDocumentTitle",bodyKey:"helpTopicOpenDocumentBody",keywordsKey:"helpTopicOpenDocumentKeywords",related:["saveDocument","printDocument"]},{id:"printDocument",category:"file",titleKey:"helpTopicPrintDocumentTitle",bodyKey:"helpTopicPrintDocumentBody",keywordsKey:"helpTopicPrintDocumentKeywords",related:["saveDocument","preview"]},{id:"undoRedo",category:"edit",titleKey:"helpTopicUndoRedoTitle",bodyKey:"helpTopicUndoRedoBody",keywordsKey:"helpTopicUndoRedoKeywords",related:["keyboardShortcuts","clearFormatting"]},{id:"pageProperties",category:"edit",titleKey:"helpTopicPagePropertiesTitle",bodyKey:"helpTopicPagePropertiesBody",keywordsKey:"helpTopicPagePropertiesKeywords",related:["insertPage","deletePage"]},{id:"deletePage",category:"edit",titleKey:"helpTopicDeletePageTitle",bodyKey:"helpTopicDeletePageBody",keywordsKey:"helpTopicDeletePageKeywords",related:["insertPage","pageProperties"]},{id:"insertTable",category:"insert",titleKey:"helpTopicInsertTableTitle",bodyKey:"helpTopicInsertTableBody",keywordsKey:"helpTopicInsertTableKeywords",related:["tableRowsColumns","mergeCells"]},{id:"insertImage",category:"insert",titleKey:"helpTopicInsertImageTitle",bodyKey:"helpTopicInsertImageBody",keywordsKey:"helpTopicInsertImageKeywords",related:["insertLink","pageProperties"]},{id:"insertLink",category:"insert",titleKey:"helpTopicInsertLinkTitle",bodyKey:"helpTopicInsertLinkBody",keywordsKey:"helpTopicInsertLinkKeywords",related:["insertBookmark","insertImage"]},{id:"insertBookmark",category:"insert",titleKey:"helpTopicInsertBookmarkTitle",bodyKey:"helpTopicInsertBookmarkBody",keywordsKey:"helpTopicInsertBookmarkKeywords",related:["insertLink"]},{id:"insertMedia",category:"insert",titleKey:"helpTopicInsertMediaTitle",bodyKey:"helpTopicInsertMediaBody",keywordsKey:"helpTopicInsertMediaKeywords",related:["insertImage","insertLink"]},{id:"pageBreak",category:"insert",titleKey:"helpTopicPageBreakTitle",bodyKey:"helpTopicPageBreakBody",keywordsKey:"helpTopicPageBreakKeywords",related:["insertPage","printDocument"]},{id:"insertPage",category:"insert",titleKey:"helpTopicInsertPageTitle",bodyKey:"helpTopicInsertPageBody",keywordsKey:"helpTopicInsertPageKeywords",related:["pageBreak","deletePage"]},{id:"insertComment",category:"insert",titleKey:"helpTopicInsertCommentTitle",bodyKey:"helpTopicInsertCommentBody",keywordsKey:"helpTopicInsertCommentKeywords",related:["preview"]},{id:"formatFont",category:"format",titleKey:"helpTopicFormatFontTitle",bodyKey:"helpTopicFormatFontBody",keywordsKey:"helpTopicFormatFontKeywords",related:["paragraphStyles","textColor","keyboardShortcuts"]},{id:"paragraphStyles",category:"format",titleKey:"helpTopicParagraphStylesTitle",bodyKey:"helpTopicParagraphStylesBody",keywordsKey:"helpTopicParagraphStylesKeywords",related:["formatFont","alignLists"]},{id:"textColor",category:"format",titleKey:"helpTopicTextColorTitle",bodyKey:"helpTopicTextColorBody",keywordsKey:"helpTopicTextColorKeywords",related:["formatFont","clearFormatting"]},{id:"alignLists",category:"format",titleKey:"helpTopicAlignListsTitle",bodyKey:"helpTopicAlignListsBody",keywordsKey:"helpTopicAlignListsKeywords",related:["paragraphStyles","formatFont"]},{id:"clearFormatting",category:"format",titleKey:"helpTopicClearFormattingTitle",bodyKey:"helpTopicClearFormattingBody",keywordsKey:"helpTopicClearFormattingKeywords",related:["formatFont","customCss"]},{id:"customCss",category:"format",titleKey:"helpTopicCustomCssTitle",bodyKey:"helpTopicCustomCssBody",keywordsKey:"helpTopicCustomCssKeywords",related:["formatFont","clearFormatting"]},{id:"tableRowsColumns",category:"table",titleKey:"helpTopicTableRowsColumnsTitle",bodyKey:"helpTopicTableRowsColumnsBody",keywordsKey:"helpTopicTableRowsColumnsKeywords",related:["insertTable","mergeCells","keyboardShortcuts"]},{id:"mergeCells",category:"table",titleKey:"helpTopicMergeCellsTitle",bodyKey:"helpTopicMergeCellsBody",keywordsKey:"helpTopicMergeCellsKeywords",related:["insertTable","tableRowsColumns"]},{id:"customizeToolbar",category:"view",titleKey:"helpTopicCustomizeToolbarTitle",bodyKey:"helpTopicCustomizeToolbarBody",keywordsKey:"helpTopicCustomizeToolbarKeywords",related:["zoom","fullscreen"]},{id:"zoom",category:"view",titleKey:"helpTopicZoomTitle",bodyKey:"helpTopicZoomBody",keywordsKey:"helpTopicZoomKeywords",related:["preview","fullscreen"]},{id:"darkMode",category:"view",titleKey:"helpTopicDarkModeTitle",bodyKey:"helpTopicDarkModeBody",keywordsKey:"helpTopicDarkModeKeywords",related:["customizeToolbar"]},{id:"preview",category:"view",titleKey:"helpTopicPreviewTitle",bodyKey:"helpTopicPreviewBody",keywordsKey:"helpTopicPreviewKeywords",related:["printDocument","switchModes"]},{id:"fullscreen",category:"view",titleKey:"helpTopicFullscreenTitle",bodyKey:"helpTopicFullscreenBody",keywordsKey:"helpTopicFullscreenKeywords",related:["zoom","keyboardShortcuts"]},{id:"ruler",category:"view",titleKey:"helpTopicRulerTitle",bodyKey:"helpTopicRulerBody",keywordsKey:"helpTopicRulerKeywords",related:["pageProperties","alignLists"]},{id:"keyboardShortcuts",category:"keyboard",titleKey:"helpTopicKeyboardShortcutsTitle",bodyKey:"helpTopicKeyboardShortcutsBody",keywordsKey:"helpTopicKeyboardShortcutsKeywords",related:["getStarted","undoRedo","formatFont"]}],xp=Object.fromEntries(Su.map(e=>[e.id,e]));function Yb(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function YI(e,t){const n=Yb(t);if(n.length===0)return 1;const r=e.title.toLowerCase(),o=e.body.toLowerCase(),a=e.keywords.toLowerCase(),s=`${r} ${o} ${a}`;let u=0;for(const d of n)r.includes(d)&&(u+=30),a.includes(d)&&(u+=20),o.includes(d)&&(u+=10),s.includes(d)&&(u+=5);return u}function XI(e,t){return Yb(t).length===0?e:e.map(r=>({entry:r,score:YI(r,t)})).filter(({score:r})=>r>0).sort((r,o)=>o.score-r.score||r.entry.title.localeCompare(o.entry.title)).map(({entry:r})=>r)}const JI={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:Gx,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:Sx,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:hx,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:Tx,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:bx,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:Mx,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},ruler:{id:"ruler",command:"toggleRuler",icon:Ox,labelKey:"commandRuler",ariaKey:"commandRulerAria",active:"isRulerVisible",toggle:!0},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:Fx,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:vx,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function QI(...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 ej=QI(uR,_T,WI,GI,JI,VI,qI),tj={menus:[{id:"file",items:["save","open",ke,"print"]},{id:"edit",items:["undo","redo",ke,{submenu:"page",items:["pageProperties",ke,"deletePage"]}]},{id:"view",items:["visual","html",ke,{submenu:"toolbar",items:["customizeToolbar",ke,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},ke,{submenu:"zoom",items:["pageZoomFitWidth","pageZoomFitPage",ke,"pageZoom50","pageZoom75","pageZoom100","pageZoom125","pageZoom150","pageZoom200"]},ke,"lightMode","darkMode",ke,"toggleCommentsVisible","ruler","preview","readAloud","fullscreen"]},{id:"insert",items:["pageBreak",{submenu:"insertPage",items:["insertPageBefore","insertPageAfter"]},ke,"table",ke,"image","pageBackgroundImage","paragraphBackgroundImage","audio","youtube","horizontalRule",ke,"link","bookmark",ke,"insertComment"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},ke,{submenu:"font",items:["fontProperties","customCss",ke,{submenu:"highlightColor",items:[]},ke,"bold","italic","underline","strikethrough"]},ke,"clearFormatting",ke,{submenu:"paragraph",items:["paragraphProperties",ke,"alignLeft","alignCenter","alignRight","alignJustify",ke,"indent","outdent",ke,"bulletList","numberedList"]},ke,"imageProperties"]},{id:"table",items:["table",ke,{submenu:"insertRow",items:["insertRowBefore","insertRowBelow","deleteRow"]},{submenu:"insertColumn",items:["insertColumnBefore","insertColumnAfter","deleteColumn"]},ke,"mergeCells","unmergeCells",ke,"tableProperties","rowProperties","cellProperties"]},{id:"help",items:["editorHelp","keyboardShortcuts",ke,"about"]}],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"]}]},wp={items:{addComment:{id:"addComment",command:"addComment",icon:sf,labelKey:"commandAddComment",ariaKey:"commandAddCommentAria",enabled:"canAddComment"},insertComment:{id:"insertComment",command:"addComment",icon:sf,labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:"canAddComment"},toggleCommentsVisible:{id:"toggleCommentsVisible",command:"toggleCommentsVisible",icon:fx,labelKey:"showComments",ariaKey:"toggleCommentsVisibleAria",toggle:!0,active:"areCommentsVisible"}}},nj=["addComment","insertComment","toggleCommentsVisible"],rj=new Set(["insert","view"]);function Xb(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!nj.includes(e):!0:!1}function oj(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!rj.has(e):!0:!1}function ij(e,t){const n=t?"hideComments":"showComments",r=wp.items.toggleCommentsVisible;return{...e,items:{...e.items,...wp.items,toggleCommentsVisible:r&&{...r,labelKey:n}}}}function aj(e){return{...e,menus:e.menus.map(t=>{if(t.id==="insert"){const n=[...t.items],r=n.findIndex(a=>zn(a)&&a.submenu==="insertPage"),o=r===-1?n.length:r;return n.includes("insertComment")||n.splice(o,0,"insertComment"),{...t,items:n}}if(t.id==="view"){const n=[...t.items],r=n.indexOf("preview"),o=r===-1?n.length:r;return n.includes("toggleCommentsVisible")||n.splice(o,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 Cp={canUndo:"history",canRedo:"history",isBold:"marks",isItalic:"marks",isUnderline:"marks",isStrikethrough:"marks",getFontSize:"marks",getFontSizeUnit:"marks",isFontSizeMixed:"marks",getFontFamily:"marks",isFontFamilyMixed:"marks",getFontColor:"marks",isFontColorMixed:"marks",getHighlightColor:"marks",isHighlightColorMixed:"marks",getParagraphStyle:"marks",isParagraphStyleMixed:"marks",isAlignLeft:"marks",isAlignCenter:"marks",isAlignRight:"marks",isAlignJustify:"marks",canOutdent:"marks",isBulletList:"marks",isNumberedList:"marks",isFormatBrushActive:"marks",isInTable:"table",canMergeCells:"table",canUnmergeCells:"table",hasTextSelection:"selection",isImageSelected:"selection",isLink:"selection",canReadAloud:"selection",isReadingAloud:"selection"};function Jb(){const e={history:0,marks:0,table:0,selection:0,chrome:0},t=new Map;function n(r,o){let a=t.get(r);return a||(a=new Set,t.set(r,a)),a.add(o),()=>{a==null||a.delete(o)}}return{subscribe:n,getSnapshot:r=>e[r],bump(r){e[r]+=1;const o=t.get(r);if(o)for(const a of o)a()}}}function Qb(e){const t=new Set;return e.active&&t.add(Cp[e.active]??"chrome"),e.enabled&&t.add(Cp[e.enabled]??"chrome"),t.size===0&&t.add("chrome"),[...t]}const ey=l.createContext(null);function sj({value:e,children:t}){return i.jsx(ey.Provider,{value:e,children:t})}function ty(e){const t=l.useContext(ey),n=l.useMemo(()=>e.join("\0"),[e]),r=l.useMemo(()=>e,[n,e]);l.useSyncExternalStore(o=>{if(!t)return()=>{};const a=r.map(s=>t.subscribe(s,o));return()=>{for(const s of a)s()}},()=>{if(!t)return 0;let o=0;for(const a of r)o+=t.getSnapshot(a);return o},()=>{if(!t)return 0;let o=0;for(const a of r)o+=t.getSnapshot(a);return o})}const Za="fullscreen";function lj(e){const t=[];let n=null;for(const r of e){const o=r.items.filter(a=>a!==Za);o.length>0&&t.push({id:r.id,items:o}),r.items.includes(Za)&&(n={id:Za,items:[Za]})}return{main:t,trailing:n}}const cj=l.memo(function({item:t,itemId:n,commands:r,queries:o,disabled:a,chromeLock:s}){const u=J(),d=l.useMemo(()=>Qb(t),[t]);if(ty(d),!t.icon||!t.command)return null;const f=t.icon,h=t.command,g=t.enabled?!o[t.enabled]():!1,y=t.active?o[t.active]():void 0;return i.jsx(pr,{label:t.tooltip??fr(u,t),children:i.jsx("button",{type:"button",className:ue.iconButton,"aria-label":vs(u,t),"aria-pressed":y,disabled:a||(s?Xb(n,s):!1)||g,onPointerDown:b=>b.preventDefault(),onMouseDown:b=>b.preventDefault(),onClick:()=>{Ru(r,h)},children:i.jsx(f,{className:ue.icon})})})});function uj({groups:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a}){const s=J(),{main:u,trailing:d}=lj(e),f=h=>{const g=t.groups[h.id];return i.jsx("div",{className:ue.iconGroup,role:"group","aria-label":g?fr(s,g):void 0,"data-toolbar-group":h.id,children:h.items.map(y=>{const b=t.items[y];if(!b)return null;const w=b.enabled?!r[b.enabled]():!1;if(b.widget){const x=b.widget;return i.jsx(x,{commands:n,queries:r,disabled:o||w},y)}return!b.icon||!b.command?null:i.jsx(cj,{itemId:y,item:b,commands:n,queries:r,disabled:o,chromeLock:a},y)})},h.id)};return i.jsxs("div",{className:ue.iconNav,role:"toolbar","aria-label":s("toolbarAria"),children:[u.length>0?i.jsx("div",{className:ue.iconNavMain,children:u.map(f)}):null,d?i.jsx("div",{className:ue.iconNavEnd,children:f(d)}):null]})}const dj=["--wysiwyg-menu-color","--wysiwyg-menu-background"],vp=["--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function mj(e,t){const n=t?vp:[...dj,...vp],r={};for(const o of n){const a=getComputedStyle(e).getPropertyValue(o).trim();if(a){r[o]=a;continue}let s=e;for(;s;){const u=s.style.getPropertyValue(o).trim();if(u){r[o]=u;break}s=s.parentElement}}return r}function fj({menus:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,compact:s,openMenuId:u,onOpenMenuIdChange:d}){const f=J(),h=Gp(),[g,y]=l.useState(!1),[b,w]=l.useState({}),x=l.useRef(null),S=l.useRef(null),k=l.useRef(null),v=l.useRef(null),A=l.useCallback(()=>{y(!1),d(null)},[d]);l.useLayoutEffect(()=>{!g||!x.current||w(mj(x.current,h))},[h,g]),l.useEffect(()=>{var D;g&&((D=k.current)==null||D.focus())},[g]),l.useEffect(()=>{if(!g)return;const D=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=D}},[g]),l.useEffect(()=>{if(!g)return;const D=T=>{var E;if(T.key==="Escape"){if(T.preventDefault(),T.stopPropagation(),u){d(null);return}A(),(E=S.current)==null||E.focus()}},R=T=>{var E;v.current&&!v.current.contains(T.target)&&(A(),(E=S.current)==null||E.focus())};return document.addEventListener("keydown",D,!0),document.addEventListener("pointerdown",R),()=>{document.removeEventListener("keydown",D,!0),document.removeEventListener("pointerdown",R)}},[g,u,d,A]);const I=D=>e.map(R=>{const T=t.menus[R.id];return T?i.jsx(gj,{def:T,itemIds:R.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:D,open:(D==="overlay"||!g)&&u===R.id,onOpenChange:E=>d(E?R.id:null),onItemRun:D==="overlay"?()=>{var E;A(),(E=S.current)==null||E.focus()}:void 0},`${D}-${R.id}`):null});return i.jsxs("div",{className:ue.menuBar,ref:x,children:[i.jsx(pr,{label:f("brandMarkAria"),children:i.jsx("span",{className:ue.brandMark,role:"img","aria-label":f("brandMarkAria"),children:i.jsx(Mp,{className:ue.brandMarkIcon})})}),i.jsx("div",{className:ue.menuBarCompact,hidden:s===void 0?void 0:!s,children:i.jsx(pr,{label:f("menuHamburgerAria"),children:i.jsx("button",{ref:S,type:"button",className:`${ue.menuButton} ${ue.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":g,"aria-label":f("menuHamburgerAria"),disabled:o||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>{if(g){A();return}d(null),y(!0)},children:i.jsx(Dx,{className:ue.icon})})})}),i.jsx("div",{className:ue.menuBarDesktop,hidden:s===void 0?void 0:s,children:I("dropdown")}),g?i.jsx(Pe,{children:i.jsx("div",{className:ue.toolbar,"data-menu-overlay-portal":"",style:b,children:i.jsxs("div",{ref:v,className:ue.menuOverlay,role:"dialog","aria-modal":"true","aria-label":f("menuOverlayAria"),children:[i.jsxs("div",{className:ue.menuOverlayHeader,children:[i.jsx("span",{className:ue.menuOverlayTitle,children:f("menuOverlayAria")}),i.jsx("button",{ref:k,type:"button",className:ue.iconButton,"aria-label":f("menuCloseAria"),onClick:()=>{var D;A(),(D=S.current)==null||D.focus()},children:i.jsx(Ge,{className:ue.icon})})]}),i.jsx("div",{className:ue.menuOverlayBody,children:I("overlay")})]})})}):null]})}function ks(e,t){var n,r;if(cr(e))return!1;if(zn(e)){const o=(n=t.submenus)==null?void 0:n[e.submenu];return o?o.panel?!0:e.items.some(a=>ks(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function pj(e,t,n){if(!cr(e[t])||!e.slice(t+1).some(a=>ks(a,n)))return!1;let o=!1;for(let a=t-1;a>=0;a--){const s=e[a];if(cr(s)){o=!0;continue}if(ks(s,n))return!o}return!1}function gj({def:e,itemIds:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,open:d,onOpenChange:f,onItemRun:h}){const g=J(),y=l.useRef(null),b=u==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[w,x]=l.useState(null);l.useEffect(()=>{d||x(null)},[d]),l.useEffect(()=>{if(!d||u==="overlay")return;const k=A=>{y.current&&!y.current.contains(A.target)&&f(!1)},v=A=>{if(A.key==="Escape"){if(A.preventDefault(),A.stopPropagation(),w){x(null);return}f(!1)}};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",v,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",v,!0)}},[d,w,f,u]);const S=()=>{f(!1),h==null||h()};return i.jsxs("div",{className:ue.menuWrap,ref:y,children:[i.jsx("button",{type:"button",className:ue.menuButton,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":b,"aria-label":vs(g,e),disabled:a||(s?oj(e.id,s):!1),onClick:()=>f(!d),children:fr(g,e)}),d?i.jsx("div",{className:ue.menu,role:"menu",id:b,onMouseDown:k=>k.preventDefault(),children:i.jsx(ny,{entries:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,onClose:S,openSubmenuId:w,onOpenSubmenuIdChange:x})}):null]})}function ny({entries:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:d,onOpenSubmenuIdChange:f}){return i.jsx(i.Fragment,{children:e.map((h,g)=>{if(cr(h))return pj(e,g,t)?i.jsx("div",{role:"separator",className:ue.menuSeparator},`separator-${g}`):null;if(zn(h))return i.jsx(bj,{entry:h,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d===h.submenu,onOpenChange:b=>f==null?void 0:f(b?h.submenu:null)},`submenu-${h.submenu}-${g}`);const y=t.items[h];return!y||!y.command?null:i.jsx(hj,{item:y,commands:n,queries:r,disabled:o,chromeLock:a,onClose:u},h)})})}function hj({item:e,commands:t,queries:n,disabled:r,chromeLock:o,onClose:a}){const s=J(),u=l.useMemo(()=>Qb(e),[e]);if(ty(u),!e.command)return null;const d=e.icon,f=e.command,h=e.active?n[e.active]():void 0,g=e.enabled?!n[e.enabled]():!1,y=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return i.jsxs("button",{type:"button",role:y,className:ue.menuItem,"aria-checked":h,disabled:r||(o?Xb(e.id,o):!1)||g,onClick:()=>{a(),Ru(t,f)},children:[d?i.jsx(d,{className:ue.icon}):null,fr(s,e)]})}function bj({entry:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d,onOpenChange:f}){var R;const h=J(),g=l.useRef(null),y=l.useRef(null),[b,w]=l.useState(null),x=(R=t.submenus)==null?void 0:R[e.submenu],S=s==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,k=x==null?void 0:x.panel,v=x!=null&&x.enabled?!r[x.enabled]():!1,A=s==="overlay";if(l.useEffect(()=>{d||w(null)},[d]),!x||!k&&!e.items.some(T=>ks(T,t)))return null;const I=T=>{(T.key==="ArrowRight"||T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),f(!0),requestAnimationFrame(()=>{var N;const E=(N=y.current)==null?void 0:N.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');E==null||E.focus()}))},D=T=>{var E;T.key==="ArrowLeft"&&(T.preventDefault(),T.stopPropagation(),f(!1),(E=g.current)==null||E.focus())};return i.jsxs("div",{className:ue.submenuWrap,onMouseEnter:A?void 0:()=>f(!0),onMouseLeave:A?void 0:()=>f(!1),children:[i.jsx("button",{ref:g,type:"button",role:"menuitem",className:`${ue.menuItem} ${ue.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":S,"aria-label":vs(h,x),disabled:o||v||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>f(A?!d:!0),onKeyDown:I,children:fr(h,x)}),d?i.jsx("div",{ref:y,className:`${ue.menu} ${ue.submenu}`,role:"menu",id:S,"aria-label":vs(h,x),onMouseDown:T=>T.preventDefault(),onKeyDown:D,children:k?i.jsx(k,{commands:n,queries:r,disabled:o||v,onMenuClose:u}):i.jsx(ny,{entries:e.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:b,onOpenSubmenuIdChange:w})}):null]})}const Pu=l.memo(function({catalog:t,layout:n,commands:r,queries:o,queryRevisions:a,disabled:s,chromeLock:u,menuVisible:d=!0,toolbarVisible:f=!0,compact:h,position:g="top"}){const[y,b]=l.useState(null);if(!d&&!f)return null;const w=i.jsxs("div",{className:ue.toolbar,"data-compact":h?"":void 0,"data-toolbar-position":g,children:[d?i.jsx(fj,{menus:n.menus,catalog:t,commands:r,queries:o,disabled:s,chromeLock:u,compact:h,openMenuId:y,onOpenMenuIdChange:b}):null,f?i.jsx(uj,{groups:n.iconGroups,catalog:t,commands:r,queries:o,disabled:s,chromeLock:u}):null]});return a?i.jsx(sj,{value:a,children:w}):w});function yj(e,t){return t?e:{...e,menus:e.menus.map(n=>n.id==="insert"?{...n,items:n.items.filter(r=>!(zn(r)&&r.submenu==="insertPage"))}:n.id==="edit"?{...n,items:n.items.map(r=>{if(!zn(r)||r.submenu!=="page")return r;let o=r.items.filter(a=>a!=="deletePage");return o.at(-1)===ke&&(o=o.slice(0,-1)),{...r,items:o}})}:n)}}function Ri(e){return Bg(it(e))}const xj=1.5,Ec=384;function wj(e,t=16){return e>0?xj*t:0}function ry(e,t,n=16){const r=wj(t,n);if(!Ri(e))return Ec+r;const o=it(e),a=Io(o,!1);return a?rr(a.height,Ec)+r:Ec+r}function di(e,t){const n=[0];for(let r=0;r<e;r+=1)n.push(n[r]+t(r));return n}function Cj(){const e=new Map;return{get(t,n){return e.get(t)??ry(n,t)},set(t,n){n>0&&e.set(t,n)},clear(){e.clear()},invalidateFrom(t){for(const n of[...e.keys()])n>=t&&e.delete(n)}}}const vj=2;function oy(e,t,n){if(n<=0)return 0;let r=0,o=n-1,a=0;for(;r<=o;){const s=r+o>>1;(t[s+1]??0)>e?(a=s,o=s-1):r=s+1}return a}function iy(e,t,n){if(n<=0)return-1;let r=0,o=n-1,a=n-1;for(;r<=o;){const s=r+o>>1;(t[s]??0)<e?(a=s,r=s+1):o=s-1}return a}function kp(e,t,n,r,o,a,s){if(r<=0)return{startIndex:0,endIndex:-1,topSpacerHeight:0,bottomSpacerHeight:0};const u=n[r]??0;if(u<=t)return{startIndex:0,endIndex:r-1,topSpacerHeight:0,bottomSpacerHeight:0};const d=e+t,f=oy(e,n,r),h=iy(d,n,r);let g=Math.max(0,f-o),y=Math.min(r-1,h+o);s&&(g=Math.min(g,a),y=Math.max(y,a));const b=n[g]??0,w=u-(n[y+1]??u);return{startIndex:g,endIndex:y,topSpacerHeight:b,bottomSpacerHeight:w}}function kj({scrollElementRef:e,pageCount:t,getRowHeight:n,overscan:r=vj,activePageIndex:o,pinActivePage:a=!0}){const s=l.useRef(n);s.current=n;const u=l.useRef(new Map),[d,f]=l.useState(0);l.useLayoutEffect(()=>{u.current.clear()},[t]);const h=l.useCallback(v=>{const A=u.current.get(v),I=s.current(v);return A!==void 0?Math.max(A,I):I},[d]),g=l.useMemo(()=>di(t,h),[t,h]),[y,b]=l.useState(()=>{const v=di(t,A=>s.current(A));return kp(0,300,v,t,r,o,a)}),w=l.useCallback(()=>{const v=e.current;if(!v||t<=0)return;const A=v.clientHeight>0?v.clientHeight:300,I=di(t,h);b(kp(v.scrollTop,A,I,t,r,o,a))},[o,r,t,a,h,e]);l.useLayoutEffect(()=>{w()},[w,g,o,t]),l.useLayoutEffect(()=>{const v=e.current;if(!v)return;const A=()=>w();v.addEventListener("scroll",A,{passive:!0});let I;return typeof ResizeObserver<"u"&&(I=new ResizeObserver(()=>w()),I.observe(v)),w(),()=>{v.removeEventListener("scroll",A),I==null||I.disconnect()}},[e,w]);const x=l.useCallback((v,A)=>{if(A<=0)return;const I=u.current.get(v);I!==void 0&&Math.abs(I-A)<1||(u.current.set(v,A),f(D=>D+1))},[]),S=l.useCallback(v=>{const A=e.current;if(!A||v<0||v>=t)return;const I=di(t,h);A.scrollTop=I[v]??0,w()},[t,h,e,w]),k=l.useMemo(()=>{if(y.endIndex<y.startIndex)return[];const v=[];for(let A=y.startIndex;A<=y.endIndex;A+=1)v.push(A);return v},[y.endIndex,y.startIndex]);return{...y,visibleIndices:k,scrollToIndex:S,notifyRowMeasured:x}}function xd(){return{firstLineIndentPx:0,leftIndentPx:0,rightIndentPx:0,mixed:!1}}function Ss(e){const t=$n(e);if(t.length===0)return xd();let n=null,r=null,o=null,a=!1;for(const s of t){const u=s.style.textIndent,d=s.style.marginLeft,f=s.style.marginRight,h=u?rr(u,0):0,g=d?rr(d,0):0,y=f?rr(f,0):0;n===null?(n=h,r=g,o=y):(Math.abs(n-h)>1||Math.abs((r??0)-g)>1||Math.abs((o??0)-y)>1)&&(a=!0)}return{firstLineIndentPx:n??0,leftIndentPx:r??0,rightIndentPx:o??0,mixed:a}}function Sj(e){var r;const t=(r=window.getSelection())==null?void 0:r.getRangeAt(0);if(!t)return null;let n=t.startContainer;for(n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);n&&n!==e&&n!==document.body;){if(n instanceof HTMLElement){const o=n.tagName.toLowerCase();if(["p","h1","h2","h3","h4","h5","h6","li","blockquote","div"].includes(o))return n}n=n.parentNode}return null}function Pj(e,t){return yr(e,()=>{let n=Vr(e);if(n.length===0){const a=Sj(e);a&&(n=[a])}if(n.length===0)return!1;const r=t.unit??"in";let o=!1;for(const a of n){if(t.firstLineIndentPx!==void 0)if(Math.abs(t.firstLineIndentPx)<.5)a.style.textIndent&&(a.style.removeProperty("text-indent"),o=!0);else{const s=je(wc(t.firstLineIndentPx,r));a.style.textIndent!==s&&(a.style.textIndent=s,o=!0)}if(t.leftIndentPx!==void 0)if(t.leftIndentPx<=.5)a.style.marginLeft&&(a.style.removeProperty("margin-left"),o=!0);else{const s=je(wc(t.leftIndentPx,r));a.style.marginLeft!==s&&(a.style.marginLeft=s,o=!0)}if(t.rightIndentPx!==void 0)if(t.rightIndentPx<=.5)a.style.marginRight&&(a.style.removeProperty("margin-right"),o=!0);else{const s=je(wc(t.rightIndentPx,r));a.style.marginRight!==s&&(a.style.marginRight=s,o=!0)}It(a)}return o})}const ay=24,bi=48;function sy(e,t){const n=Ei(it(t));return{pageWidthPx:e.offsetWidth,pageHeightPx:e.offsetHeight,marginsPx:{top:rr(n.top,0),right:rr(n.right,0),bottom:rr(n.bottom,0),left:rr(n.left,0)}}}function Aj(e,t){const n=Object.keys(t);return Object.keys(e).length!==n.length?!1:n.every(r=>{const o=e[Number(r)],a=t[Number(r)];return(o==null?void 0:o.pageWidthPx)===a.pageWidthPx&&(o==null?void 0:o.pageHeightPx)===a.pageHeightPx&&(o==null?void 0:o.marginsPx.top)===a.marginsPx.top&&(o==null?void 0:o.marginsPx.right)===a.marginsPx.right&&(o==null?void 0:o.marginsPx.bottom)===a.marginsPx.bottom&&(o==null?void 0:o.marginsPx.left)===a.marginsPx.left})}function Tj(e,t,n,r,o=!0,a=1){const[s,u]=l.useState({}),[d,f]=l.useState(xd()),h=l.useCallback(y=>s[y]??null,[s]),g=l.useCallback(()=>{const y=e.current;if(!o||!y)return;const b={};for(const x of n){const S=We(y,x);if(!S)continue;const k=t[x]??t[0]??"";b[x]=sy(S,k)}u(x=>{const S={...x,...b};return Aj(x,S)?x:S});const w=We(y,r());w&&f(Ss(w))},[e,o,r,n,t]);return l.useLayoutEffect(()=>{if(!o)return;const y=requestAnimationFrame(g);return()=>cancelAnimationFrame(y)},[o,r,n,t,a,g]),l.useLayoutEffect(()=>{if(!o||typeof ResizeObserver>"u")return;const y=e.current;if(!y)return;const b=new ResizeObserver(()=>g());for(const w of n){const x=We(y,w);x&&b.observe(x)}return()=>b.disconnect()},[e,o,n,g]),l.useLayoutEffect(()=>{if(!o)return;const y=()=>{const b=e.current;if(!b)return;const w=We(b,r());w&&f(Ss(w))};return document.addEventListener("selectionchange",y),()=>document.removeEventListener("selectionchange",y)},[e,o,r]),{pageGeometries:s,geometryForPage:h,indentState:d,refresh:g}}const Rj="_rulerRoot_j57vt_5",Dj="_horizontalRulerGroup_j57vt_22",Ij="_horizontalRulerTrack_j57vt_28",jj="_horizontalRulerShelf_j57vt_42",Ej="_horizontalInner_j57vt_51",_j="_dragEdgeLeft_j57vt_63",Mj="_dragEdgeRight_j57vt_73",Nj="_dragEdgeActive_j57vt_85",Lj="_verticalRuler_j57vt_92",Bj="_verticalInner_j57vt_102",Fj="_dragEdgeTop_j57vt_114",Hj="_dragEdgeBottom_j57vt_124",zj="_dragEdgeActiveV_j57vt_136",Oj="_tickH_j57vt_143",Kj="_tickV_j57vt_152",$j="_tickLabelH_j57vt_161",Uj="_tickLabelV_j57vt_175",Vj="_arrowIconWrapper_j57vt_192",Wj="_arrowDown_j57vt_203",Gj="_arrowGlyph_j57vt_211",qj="_arrowActive_j57vt_220",Zj="_arrowUp_j57vt_225",Yj="_rulerTooltip_j57vt_249",Ie={rulerRoot:Rj,horizontalRulerGroup:Dj,horizontalRulerTrack:Ij,horizontalRulerShelf:jj,horizontalInner:Ej,dragEdgeLeft:_j,dragEdgeRight:Mj,dragEdgeActive:Nj,verticalRuler:Lj,verticalInner:Bj,dragEdgeTop:Fj,dragEdgeBottom:Hj,dragEdgeActiveV:zj,tickH:Oj,tickV:Kj,tickLabelH:$j,tickLabelV:Uj,arrowIconWrapper:Vj,arrowDown:Wj,arrowGlyph:Gj,arrowActive:qj,arrowUp:Zj,rulerTooltip:Yj},_c=({type:e,active:t=!1,className:n="",style:r,title:o,"aria-label":a,onPointerDown:s,"data-testid":u})=>{const d=e==="down"?Ie.arrowDown:Ie.arrowUp;return i.jsx("div",{className:`${Ie.arrowIconWrapper} ${d} ${t?Ie.arrowActive:""} ${n}`,style:r,title:o,"aria-label":a||o,onPointerDown:s,"data-testid":u,children:i.jsx("div",{className:Ie.arrowGlyph})})};function ly(){const[e,t]=l.useState(null),[n,r]=l.useState(null),o=l.useCallback((a,s,u)=>{s.preventDefault(),s.stopPropagation(),t(a);const d=Number.isFinite(s.clientX)?s.clientX:0,f=Number.isFinite(s.clientY)?s.clientY:0,h=s.altKey,g=b=>{var k;const w=Number.isFinite(b.clientX)?b.clientX:d,x=Number.isFinite(b.clientY)?b.clientY:f,S=u.updateDragState(w,x,b.altKey);r(S),(k=u.onPreview)==null||k.call(u,S)},y=b=>{const w=Number.isFinite(b.clientX)?b.clientX:d,x=Number.isFinite(b.clientY)?b.clientY:f,S=u.updateDragState(w,x,b.altKey);window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),t(null),r(null),u.onCommit(S)};r(u.updateDragState(d,f,h)),window.addEventListener("pointermove",g),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y)},[]);return{activeTarget:e,dragPreview:n,startPointerDrag:o}}const Xj=({geometry:e,indentState:t,unit:n="in",zoomScale:r=1,onMarginChange:o,onMarginPreview:a,onIndentChange:s})=>{const u=J(),{activeTarget:d,dragPreview:f,startPointerDrag:h}=ly(),g=(e==null?void 0:e.pageWidthPx)??816,y=(e==null?void 0:e.marginsPx.left)??96,b=(e==null?void 0:e.marginsPx.right)??96,w=r>0?r:1,x=(f==null?void 0:f.marginLeft)??y,S=(f==null?void 0:f.marginRight)??b,k=(f==null?void 0:f.firstLineIndentPx)??t.firstLineIndentPx,v=(f==null?void 0:f.leftIndentPx)??t.leftIndentPx,A=(f==null?void 0:f.rightIndentPx)??t.rightIndentPx,I=Math.max(0,g-x-S),D=!t.mixed,R=l.useMemo(()=>Eg(g,x,n),[g,x,n]),T=l.useCallback((P,F)=>{const U=Number.isFinite(F.clientX)?F.clientX:0;h(P.type,F,{updateDragState:(G,me,se)=>{const V=(G-U)/w;let re=0;const de={target:P.type,marginLeft:y,marginRight:b,firstLineIndentPx:t.firstLineIndentPx,leftIndentPx:t.leftIndentPx,rightIndentPx:t.rightIndentPx,measurementPx:0,clientX:G,clientY:me};if(P.type==="margin-left"){const oe=Math.max(0,Math.min(g-b-bi,P.startMarginPx+V)),_=Mr(oe,n,se,0);de.marginLeft=_,re=_}else if(P.type==="margin-right"){const oe=Math.max(0,Math.min(g-y-bi,P.startMarginPx-V)),_=Mr(oe,n,se,0);de.marginRight=_,re=_}else if(P.type==="first-line-indent"){const oe=-P.startLeftIndentPx,_=g-y-b-P.startLeftIndentPx-bi,Q=Math.max(oe,Math.min(_,P.startFirstLinePx+V)),ye=Mr(Q,n,se,0);de.firstLineIndentPx=ye,re=ye}else if(P.type==="left-indent"){const oe=Math.max(0,P.startLeftIndentPx+V),_=Mr(oe,n,se,0);de.leftIndentPx=_,de.firstLineIndentPx=P.startFirstLinePx,re=_}else if(P.type==="right-indent"){const oe=Math.max(0,P.startRightIndentPx-V),_=Mr(oe,n,se,0);de.rightIndentPx=_,re=_}return de.measurementPx=re,de},onPreview:G=>{P.type==="margin-left"?a==null||a({left:G.marginLeft}):P.type==="margin-right"&&(a==null||a({right:G.marginRight}))},onCommit:G=>{P.type==="margin-left"?o==null||o({left:G.marginLeft}):P.type==="margin-right"?o==null||o({right:G.marginRight}):P.type==="first-line-indent"?s==null||s({firstLineIndentPx:G.firstLineIndentPx}):P.type==="left-indent"?s==null||s({leftIndentPx:G.leftIndentPx}):P.type==="right-indent"&&(s==null||s({rightIndentPx:G.rightIndentPx}))}})},[y,b,g,n,w,t,o,a,s,h]),E=x+v,N=E+k,K=g-S-A,$=g*w;return i.jsxs("div",{className:`${Ie.rulerRoot} ${Ie.horizontalRulerGroup}`,style:{width:`${$}px`},"data-testid":"horizontal-ruler",children:[i.jsxs("div",{className:Ie.horizontalRulerTrack,children:[i.jsxs("div",{className:Ie.horizontalInner,style:{left:`${x*w}px`,width:`${I*w}px`},"data-testid":"ruler-printable-area",children:[i.jsx("div",{className:`${Ie.dragEdgeLeft} ${d==="margin-left"?Ie.dragEdgeActive:""}`,title:u("rulerMarginLeft"),"aria-label":u("rulerMarginLeft"),"data-testid":"ruler-margin-splitter-left",onPointerDown:P=>T({type:"margin-left",startMarginPx:y},P)}),i.jsx("div",{className:`${Ie.dragEdgeRight} ${d==="margin-right"?Ie.dragEdgeActive:""}`,title:u("rulerMarginRight"),"aria-label":u("rulerMarginRight"),"data-testid":"ruler-margin-splitter-right",onPointerDown:P=>T({type:"margin-right",startMarginPx:b},P)})]}),R.map((P,F)=>i.jsxs(l.Fragment,{children:[i.jsx("div",{className:Ie.tickH,style:{left:`${P.positionPx*w}px`,height:`${P.height}px`}}),P.label?i.jsx("span",{className:Ie.tickLabelH,style:{left:`${P.positionPx*w}px`},children:P.label}):null]},F)),D?i.jsxs(i.Fragment,{children:[i.jsx(_c,{type:"down",style:{left:`${N*w}px`},active:d==="first-line-indent",title:u("rulerFirstLineIndent"),"aria-label":u("rulerFirstLineIndent"),"data-testid":"ruler-first-line-indent",onPointerDown:P=>T({type:"first-line-indent",startFirstLinePx:t.firstLineIndentPx,startLeftIndentPx:t.leftIndentPx},P)}),i.jsx(_c,{type:"up",style:{left:`${E*w}px`},active:d==="left-indent",title:u("rulerLeftIndent"),"aria-label":u("rulerLeftIndent"),"data-testid":"ruler-left-indent",onPointerDown:P=>T({type:"left-indent",startLeftIndentPx:t.leftIndentPx,startFirstLinePx:t.firstLineIndentPx},P)}),i.jsx(_c,{type:"up",style:{left:`${K*w}px`},active:d==="right-indent",title:u("rulerRightIndent"),"aria-label":u("rulerRightIndent"),"data-testid":"ruler-right-indent",onPointerDown:P=>T({type:"right-indent",startRightIndentPx:t.rightIndentPx},P)})]}):null]}),i.jsx("div",{className:Ie.horizontalRulerShelf,"aria-hidden":!0}),f?i.jsx("div",{className:Ie.rulerTooltip,style:{left:f.clientX,top:f.clientY},"data-testid":"ruler-drag-tooltip",children:jg(f.measurementPx,n)}):null]})},Jj=({geometry:e,unit:t="in",zoomScale:n=1,onMarginChange:r,onMarginPreview:o})=>{const a=J(),{activeTarget:s,dragPreview:u,startPointerDrag:d}=ly(),f=(e==null?void 0:e.pageHeightPx)??1056,h=(e==null?void 0:e.marginsPx.top)??96,g=(e==null?void 0:e.marginsPx.bottom)??96,y=n>0?n:1,b=(u==null?void 0:u.marginTop)??h,w=(u==null?void 0:u.marginBottom)??g,x=Math.max(0,f-b-w),S=l.useMemo(()=>Eg(f,b,t),[f,b,t]),k=l.useCallback((v,A)=>{const I=Number.isFinite(A.clientY)?A.clientY:0;d(v.type,A,{updateDragState:(D,R,T)=>{const E=(R-I)/y,N={target:v.type,marginTop:h,marginBottom:g,measurementPx:0,clientX:D,clientY:R};if(v.type==="margin-top"){const K=Math.max(0,Math.min(f-g-bi,v.startMarginPx+E)),$=Mr(K,t,T,0);N.marginTop=$,N.measurementPx=$}else if(v.type==="margin-bottom"){const K=Math.max(0,Math.min(f-h-bi,v.startMarginPx-E)),$=Mr(K,t,T,0);N.marginBottom=$,N.measurementPx=$}return N},onPreview:D=>{v.type==="margin-top"?o==null||o({top:D.marginTop}):v.type==="margin-bottom"&&(o==null||o({bottom:D.marginBottom}))},onCommit:D=>{v.type==="margin-top"?r==null||r({top:D.marginTop}):v.type==="margin-bottom"&&(r==null||r({bottom:D.marginBottom}))}})},[h,g,f,t,y,r,o,d]);return i.jsxs("div",{className:`${Ie.rulerRoot} ${Ie.verticalRuler}`,style:{height:`${f}px`},"data-testid":"vertical-ruler",children:[i.jsxs("div",{className:Ie.verticalInner,style:{top:`${b}px`,height:`${x}px`},"data-testid":"ruler-printable-area-vertical",children:[i.jsx("div",{className:`${Ie.dragEdgeTop} ${s==="margin-top"?Ie.dragEdgeActiveV:""}`,title:a("rulerMarginTop"),"aria-label":a("rulerMarginTop"),"data-testid":"ruler-margin-splitter-top",onPointerDown:v=>k({type:"margin-top",startMarginPx:h},v)}),i.jsx("div",{className:`${Ie.dragEdgeBottom} ${s==="margin-bottom"?Ie.dragEdgeActiveV:""}`,title:a("rulerMarginBottom"),"aria-label":a("rulerMarginBottom"),"data-testid":"ruler-margin-splitter-bottom",onPointerDown:v=>k({type:"margin-bottom",startMarginPx:g},v)})]}),S.map((v,A)=>i.jsxs(l.Fragment,{children:[i.jsx("div",{className:Ie.tickV,style:{top:`${v.positionPx}px`,width:`${v.height}px`}}),v.label?i.jsx("span",{className:Ie.tickLabelV,style:{top:`${v.positionPx}px`},children:v.label}):null]},A)),u?i.jsx("div",{className:Ie.rulerTooltip,style:{left:u.clientX,top:u.clientY},"data-testid":"ruler-drag-tooltip",children:jg(u.measurementPx,t)}):null]})},Qj="_root_d9lon_1",eE="_fullscreen_d9lon_36",tE="_exitFullscreen_d9lon_48",nE="_exitFullscreenIcon_d9lon_79",rE="_menuChrome_d9lon_94",oE="_body_d9lon_106",iE="_iconChrome_d9lon_136",aE="_workspace_d9lon_181",sE="_workspacePageSized_d9lon_193",lE="_workspaceWithRuler_d9lon_197",cE="_pageCanvasViewport_d9lon_201",uE="_multiPageRulerLayer_d9lon_211",dE="_multiPageContainer_d9lon_234",mE="_pageZoomContent_d9lon_244",fE="_htmlFileDropOverlay_d9lon_262",pE="_surface_d9lon_276",gE="_visual_d9lon_283",hE="_pageBlock_d9lon_350",bE="_pageBlockFluid_d9lon_357",yE="_pageSurfaceRulerGutter_d9lon_365",xE="_pageSurface_d9lon_365",wE="_htmlModeShell_d9lon_386",CE="_html_d9lon_262",Se={root:Qj,fullscreen:eE,exitFullscreen:tE,exitFullscreenIcon:nE,menuChrome:rE,body:oE,iconChrome:iE,workspace:aE,workspacePageSized:sE,workspaceWithRuler:lE,pageCanvasViewport:cE,multiPageRulerLayer:uE,multiPageContainer:dE,pageZoomContent:mE,htmlFileDropOverlay:fE,surface:pE,visual:gE,pageBlock:hE,pageBlockFluid:bE,pageSurfaceRulerGutter:yE,pageSurface:xE,htmlModeShell:wE,html:CE};function cy(e){if(e!==1)return{zoom:e,"--page-zoom":String(e)}}function uy({showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}){if(!e)return null;const d=ay;return i.jsx("div",{className:Se.multiPageRulerLayer,children:i.jsxs("div",{className:Se.pageBlock,children:[i.jsx("div",{className:Se.pageSurfaceRulerGutter,style:{width:`${d}px`,flex:`0 0 ${d}px`},"aria-hidden":!0}),i.jsx(Xj,{geometry:t,indentState:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u})]})})}function dy({showVerticalRuler:e=!1,pageSized:t=!1,geometry:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:u,pageBlockStyle:d,pageBlockRef:f}){const h=o>0?o:1,g=e?ay/h:0;return i.jsxs("div",{ref:f,className:`${Se.pageBlock} ${t?"":Se.pageBlockFluid}`,style:d,children:[i.jsx("div",{className:Se.pageSurfaceRulerGutter,style:{width:`${g}px`,flex:`0 0 ${g}px`},children:e?i.jsx(Jj,{geometry:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s}):null}),u]})}function vE({showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u,children:d}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:e?"center":"stretch",width:"100%",minHeight:"100%",position:"relative"},children:[i.jsx(uy,{showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}),i.jsx("div",{className:Se.pageZoomContent,style:cy(o),children:i.jsx(dy,{showVerticalRuler:e,pageSized:e,geometry:t,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:d})})]})}const kE=l.memo(function({index:t,pageHtml:n,showVerticalRuler:r,pageSized:o,geometry:a,rulerUnit:s,zoomScale:u,placeholder:d,disabled:f,visualEditorAria:h,onActivate:g,onPointerDown:y,onPageChange:b,onPageFlush:w,suppressPageFlushRef:x,onMeasured:S,onMarginChange:k,onMarginPreview:v,onMouseUp:A,onContextMenu:I,onRulerRefresh:D}){const R=l.useRef(null),T=l.useRef(null),E=l.useRef(""),N=l.useRef(!1),K=l.useRef(w);K.current=w;const $=l.useRef(S);$.current=S,l.useLayoutEffect(()=>{const F=T.current;if(!F||!$.current)return;const U=()=>{var me;return(me=$.current)==null?void 0:me.call($,t,F.offsetHeight)};if(U(),typeof ResizeObserver>"u")return;const G=new ResizeObserver(U);return G.observe(F),()=>G.disconnect()},[t,n,o,r]);const P=l.useCallback(F=>{R.current=F,F&&(E.current=F.innerHTML)},[]);return l.useLayoutEffect(()=>()=>{x!=null&&x.current||!N.current||!K.current||K.current(t,E.current)},[t,x]),i.jsx(dy,{pageBlockRef:T,showVerticalRuler:r,pageSized:o,geometry:a,rulerUnit:s,zoomScale:u,pageBlockStyle:{marginTop:t>0?"1.5rem":"0"},onMarginChange:F=>{k==null||k(t,F)},onMarginPreview:F=>{v==null||v(t,F)},children:i.jsx("div",{ref:P,className:`${Se.surface} ${Se.visual} ${o?Se.pageSurface:""}`,[Kr]:"","data-page-index":t,contentEditable:!f,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":h,"aria-disabled":f||void 0,"data-placeholder":t===0?d:void 0,onFocus:F=>{const U=F.currentTarget;Ai(U),vo(U),g(t)},onPointerDown:F=>y(t,F),onMouseUp:A,onContextMenu:I,onInput:F=>{const U=F.currentTarget;N.current=!0,E.current=U.innerHTML;const{absorbedBlocks:G}=Ai(U);if(E.current=U.innerHTML,b(t,U.innerHTML),G.length>0){const me=G.length;requestAnimationFrame(()=>qg(U,me))}D()}})})},SE);function SE(e,t){return e.index===t.index&&e.pageHtml===t.pageHtml&&e.showVerticalRuler===t.showVerticalRuler&&e.pageSized===t.pageSized&&e.geometry===t.geometry&&e.rulerUnit===t.rulerUnit&&e.zoomScale===t.zoomScale&&e.placeholder===t.placeholder&&e.disabled===t.disabled&&e.visualEditorAria===t.visualEditorAria}const PE=l.forwardRef(function({pages:t,activePageIndex:n,hasSelectedPage:r=!1,scrollRootRef:o,onActivePageIndexChange:a,onPageSelected:s,onPageChange:u,onPageFlush:d,suppressPageFlushRef:f,pendingInsertPageFocusRef:h,placeholder:g,disabled:y,rulerVisible:b=!0,rulerUnit:w="in",zoomScale:x=1,onMarginChange:S,onMarginPreview:k,onIndentChange:v,onBeforeInput:A,resolveEmbeddedImageDataUrl:I,hydrateEmbeddedImages:D,onPointerDown:R,onMouseUp:T,onContextMenu:E,pageLayoutEnabled:N=!0},K){const $=J(),P=l.useRef(null),F=l.useRef(n);F.current=n;const U=l.useRef(A);U.current=A;const G=l.useRef(u);G.current=u;const me=l.useRef(d);me.current=d;const se=l.useRef(s);se.current=s;const V=l.useRef(R);V.current=R;const re=l.useRef(S);re.current=S;const de=l.useRef(k);de.current=k;const oe=l.useRef(null),_=l.useRef([]),Q=l.useRef(Cj()),ye=f,ee=l.useCallback(()=>F.current,[]),Z=l.useCallback(q=>Q.current.get(q,t[q]??""),[t]),{visibleIndices:Ee,topSpacerHeight:et,bottomSpacerHeight:qe,scrollToIndex:lt,notifyRowMeasured:ct}=kj({scrollElementRef:o??P,pageCount:t.length,getRowHeight:Z,activePageIndex:n,pinActivePage:r}),{geometryForPage:St,indentState:mn,refresh:ut}=Tj(P,t,Ee,ee,N,x),Y=r?n:0,ce=t[Y]??"",we=l.useCallback(q=>N&&Ri(t[q]??""),[N,t]),Le=N&&b&&Ri(ce),en=l.useCallback(q=>{lt(q),requestAnimationFrame(()=>{const te=P.current;if(!te)return;const le=We(te,q);le&&vo(le)})},[lt]),tn=l.useCallback(q=>{if(q<0||q>=t.length)return;const te=(o==null?void 0:o.current)??P.current;if(!te)return;const le=di(t.length,Z),Ce=te.scrollTop,Ye=Ce+te.clientHeight,fn=oy(Ce,le,t.length),nt=iy(Ye,le,t.length);q>=fn&&q<=nt||lt(q)},[Z,t.length,o,lt]),nn=l.useCallback(q=>{tn(q),requestAnimationFrame(()=>{const te=P.current;if(!te)return;const le=We(te,q);le&&hv(le)})},[tn]),dt=l.useRef(tn);dt.current=tn,l.useLayoutEffect(()=>{dt.current(n)},[n,t.length]),l.useLayoutEffect(()=>{const q=h;if(!q)return;const te=q.current;te!=null&&(q.current=null,nn(te))},[n,t.length,h,nn]);const Rn=l.useCallback(q=>{var Ce;if(F.current=q,q!==n&&a(q),(Ce=se.current)==null||Ce.call(se,q),!Ee.includes(q)){en(q);return}ut();const te=P.current;if(!te)return;const le=We(te,q);le&&requestAnimationFrame(()=>vo(le))},[n,a,ut,en,Ee]);l.useImperativeHandle(K,()=>({getContainer:()=>P.current,getActivePageRoot:()=>{const q=P.current;return q?We(q,F.current):null},getActivePageIndex:()=>F.current,flushPageHtml:q=>{var le;const te=P.current;return te?((le=We(te,q))==null?void 0:le.innerHTML)??null:null},ensurePageMounted:q=>{en(q)},focusPageAt:nn,activatePageAt:Rn}));const Dn=l.useCallback((q,te,le,Ce)=>{const Ye=cn(ge(le).body),fn=te===document.activeElement;if((Ce!=null&&Ce.forceBodySync||!fn)&&ws(te,Ye,{resolveDataUrl:I,hydrateEmbeddedImages:D}),N){Yu(te),Ai(te);const nt=Bs(te);Ls(te),jo(te,le);const rn=yt(te);if(rn&&Ug(te,rn),nt){const Un=cn(ge(le).body);te.innerHTML!==Un&&av(Un,te)&&G.current(q,te.innerHTML)}}},[D,N,I]);l.useLayoutEffect(()=>{Q.current.clear()},[t.length]),l.useLayoutEffect(()=>{const q=P.current;if(!q)return;const te=oe.current,le=te===null||te.length!==t.length;le&&dt.current(n);const Ce=new Set(_.current),Ye=new Set(Ee);le&&Ye.add(n);for(const nt of Ye){const rn=!Ce.has(nt),Un=t[nt]!==(te==null?void 0:te[nt]);if(!le&&!rn&&!Un)continue;const In=We(q,nt);In&&Dn(nt,In,t[nt]??"",{forceBodySync:le})}oe.current=t,_.current=Ee,le&&(ye!=null&&ye.current)&&(ye.current=!1);const fn=requestAnimationFrame(ut);return()=>cancelAnimationFrame(fn)},[n,t,ye,Dn,ut,Ee]),l.useLayoutEffect(()=>{const q=P.current;if(!q)return;const te=le=>{var Ce;(Ce=U.current)==null||Ce.call(U,le)};return q.addEventListener("beforeinput",te),()=>q.removeEventListener("beforeinput",te)},[]);const tt=l.useCallback((q,te)=>{var le;Rn(q),(le=V.current)==null||le.call(V,te)},[Rn]),Gr=l.useCallback((q,te)=>{G.current(q,te)},[]),qr=l.useCallback((q,te)=>{var le;(le=me.current)==null||le.call(me,q,te)},[]),Ze=l.useCallback((q,te)=>{const le=ry(t[q]??"",q),Ce=Math.max(te,le);Q.current.set(q,Ce),ct(q,Ce)},[ct,t]),xr=l.useCallback((q,te)=>{var le;(le=re.current)==null||le.call(re,q,te)},[]),Be=l.useCallback((q,te)=>{var le;(le=de.current)==null||le.call(de,q,te)},[]),Oe=$("visualEditorAria"),Pt=l.useMemo(()=>Ee.map(q=>i.jsx(kE,{index:q,pageHtml:t[q]??"",showVerticalRuler:Le&&we(q),pageSized:we(q),geometry:St(q),rulerUnit:w,zoomScale:x,placeholder:g,disabled:y,visualEditorAria:Oe,onActivate:Rn,onPointerDown:tt,onPageChange:Gr,onPageFlush:qr,suppressPageFlushRef:ye,onMeasured:Ze,onMarginChange:xr,onMarginPreview:Be,onMouseUp:T,onContextMenu:E,onRulerRefresh:ut},q)),[Rn,y,St,xr,Be,Gr,qr,tt,Ze,E,T,we,t,g,ut,w,Le,Ee,Oe,x]);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:Le?"center":"stretch",width:"100%",minHeight:"100%",position:"relative"},children:[i.jsx(uy,{showRulers:Le,geometry:St(Y),indentState:mn,rulerUnit:w,zoomScale:x,onMarginChange:q=>{S==null||S(Y,q)},onMarginPreview:q=>{k==null||k(Y,q)},onIndentChange:q=>{v==null||v(q)}}),i.jsx("div",{className:Se.pageZoomContent,style:cy(x),children:i.jsxs("div",{ref:P,className:Se.multiPageContainer,style:{display:"flex",flexDirection:"column",alignItems:Le?"center":"stretch",width:"100%",minHeight:Le?void 0:"100%",position:"relative"},children:[et>0?i.jsx("div",{"aria-hidden":!0,style:{height:et,flexShrink:0}}):null,Pt,qe>0?i.jsx("div",{"aria-hidden":!0,style:{height:qe,flexShrink:0}}):null]})})]})});function AE(e,t,n){return r=>{const o=e();o&&n(o,t(),r)}}function TE(e,t,n,r){return o=>{const a=e();if(!a)return;const s=n(a,t(),o);r(s.pageHtml)}}function RE(e,t,n){return(r,o)=>{const a=e(r);a&&n(a,t(r),o)}}function DE(e,t,n,r){return(o,a)=>{const s=e(o);if(!s)return;const u=n(s,t(o),a);r(o,u.pageHtml)}}function Sp(e,t,n){return r=>{const o=e();o&&Pj(o,{...r,unit:t})&&n(o)}}const IE="_field_1knrr_1",jE="_label_1knrr_8",EE="_button_1knrr_12",_E="_swatch_1knrr_37",ME="_swatchEmpty_1knrr_44",ii={field:IE,label:jE,button:EE,swatch:_E,swatchEmpty:ME};function Qt({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:o,fallbackCustom:a,onChange:s}){const u=l.useId(),d=l.useRef(null),f=l.useRef(null),h=l.useRef(null),[g,y]=l.useState(!1),b=Eo(g,f,h);l.useEffect(()=>{if(!g)return;const S=v=>{var I,D;const A=v.target;(I=d.current)!=null&&I.contains(A)||(D=h.current)!=null&&D.contains(A)||y(!1)},k=v=>{var A;v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),y(!1),(A=f.current)==null||A.focus())};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",k,!0),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",k,!0)}},[g]);const w=`${ii.swatch}${!n||r?` ${ii.swatchEmpty}`:""}`,x=n&&!r?{backgroundColor:n}:void 0;return i.jsxs("div",{className:ii.field,ref:d,children:[i.jsx("span",{className:ii.label,children:e}),i.jsx("button",{ref:f,type:"button",className:ii.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":g,"aria-controls":g?u:void 0,disabled:o,onClick:()=>y(S=>!S),children:i.jsx("span",{className:w,style:x})}),g?i.jsx(Pe,{children:i.jsx("div",{ref:h,id:u,className:_r.popover,style:{top:b.top,left:b.left,zIndex:1400},children:i.jsx(yd,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:o,fallbackCustom:a,onChange:s,onCommit:()=>y(!1)})})}):null]})}const Mc=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],NE={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function wd({tab:e,value:t,fonts:n,disabled:r,onTabChange:o,onChange:a}){const s=J(),u=l.useId(),d=l.useId(),f=n??Xp(),h=Mc.find(g=>g.id===e)??Mc[0];return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":s("fontDialogTitle"),children:Mc.map(g=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":g.id===e,disabled:!g.implemented,onClick:()=>o(g.id),children:s(g.labelKey)},g.id))}),i.jsx("div",{className:p.body,role:"tabpanel",children:h.implemented?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("fontDialogFamily")}),i.jsx(Gb,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:f,disabled:r,triggerId:d,onChange:g=>{a({...t,fontFamily:g,fontFamilyMixed:!1})}})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:s("fontDialogSize")}),i.jsx("div",{className:p.sizeRow,children:i.jsx(qb,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(g,y)=>{a({...t,size:g,unit:y})},onUnitChange:g=>{const y=t.size!==null?rg(t.size,t.unit,g,16,16):t.size;a({...t,size:y,unit:g})}})})]}),i.jsx("div",{className:p.field,children:i.jsx(Qt,{label:s("commandFontColor"),noneLabel:s("colorAutomatic"),value:t.fontColor,mixed:t.fontColorMixed,disabled:r,onChange:g=>{a({...t,fontColor:g,fontColorMixed:!1})}})}),i.jsx("div",{className:p.field,children:i.jsx(Qt,{label:s("commandHighlightColor"),noneLabel:s("colorNone"),value:t.highlightColor,mixed:t.highlightColorMixed,disabled:r,fallbackCustom:"#ffff00",onChange:g=>{a({...t,highlightColor:g,highlightColorMixed:!1})}})}),i.jsxs("fieldset",{className:p.marks,children:[i.jsx("legend",{className:p.label,children:s("fontDialogStyle")}),Jt.map(g=>i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.marks[g],disabled:r,onChange:()=>{a({...t,marks:{...t.marks,[g]:!t.marks[g]}})}}),s(NE[g].label)]},g))]})]}):null})]})}function LE({open:e,tab:t,size:n,unit:r,marks:o,fontFamily:a=null,fontFamilyMixed:s=!1,fontColor:u,fontColorMixed:d=!1,highlightColor:f,highlightColorMixed:h=!1,fonts:g,disabled:y,onTabChange:b,onApply:w,onClose:x}){const S=J(),k=l.useId(),v=l.useRef(null),[A,I]=l.useState({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:f,fontColorMixed:d,highlightColorMixed:h});return l.useEffect(()=>{e&&I({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:f,fontColorMixed:d,highlightColorMixed:h})},[e,n,r,o,a,s,u,d,f,h]),$e(v,{open:e,onClose:x}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:x,children:i.jsxs("div",{ref:v,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":k,onMouseDown:D=>D.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:k,children:S("fontDialogTitle")}),i.jsx(wd,{tab:t,value:A,fonts:g,disabled:y,onTabChange:b,onChange:I}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:x,children:S("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:y,onClick:()=>w(A),children:S("fontDialogOk")})]})]})})}):null}const BE={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Qe({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:o,inputId:a,onChange:s}){const u=J(),d=l.useId(),f=a??d,h=(t==null?void 0:t.unit)??Nu,[g,y]=l.useState(()=>t?he(t.value):""),[b,w]=l.useState(!1);l.useEffect(()=>{b||y(t?he(t.value):"")},[t,b]);const x=S=>{const k=S.trim();if(!k){s(null),y("");return}const v=xi(k,h,r);if(!v){y(t?he(t.value):"");return}s(v),y(he(v.value))};return i.jsxs("div",{className:p.lengthField,children:[i.jsx("label",{className:p.sideLabel,htmlFor:f,children:e}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:f,className:p.lengthInput,value:g,disabled:n,inputMode:"decimal",onFocus:()=>w(!0),onBlur:()=>{w(!1),x(g)},onChange:S=>y(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),x(g),S.currentTarget.blur())}}),i.jsx("select",{className:p.lengthUnit,value:h,disabled:n,"aria-label":o??u("paragraphDialogLengthUnitAria"),onChange:S=>{const k=S.target.value;if(t){s({value:t.value,unit:k});return}if(g.trim()){const v=xi(g,k,r);s(v)}},children:Eu.map(S=>i.jsx("option",{value:S,children:u(BE[S])},S))})]})]})}function Cd({shadow:e,disabled:t,onChange:n}){const r=J();return i.jsxs("div",{className:p.shadowGrid,children:[i.jsx(Qe,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetX:o??{value:0,unit:"px"}})}}),i.jsx(Qe,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetY:o??{value:0,unit:"px"}})}}),i.jsx(Qe,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:o=>{n({...e,blur:o??{value:0,unit:"px"}})}}),i.jsx(Qe,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:o=>{n({...e,spread:o??{value:0,unit:"px"}})}}),i.jsx(Qt,{label:r("paragraphDialogShadowColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:o=>{n({...e,color:o})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:e.inset,disabled:t,onChange:()=>{n({...e,inset:!e.inset})}}),r("paragraphDialogShadowInset")]})]})}const my=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],fy=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],FE={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},HE={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function py({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const o=J(),a=l.useId(),s=l.useId();return i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:o(e)}),i.jsx(zE,{value:t.opacity,disabled:n,onChange:u=>{r({...t,opacity:u})}}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:o("imagePropertiesFit")}),i.jsxs("select",{id:a,className:p.select,value:t.fit??"",disabled:n,onChange:u=>{const d=u.target.value;r({...t,fit:d||null})},children:[i.jsx("option",{value:"",children:o("imagePropertiesFitDefault")}),Ju.map(u=>i.jsx("option",{value:u,children:o(FE[u])},u))]})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:o("imagePropertiesPosition")}),i.jsxs("select",{id:s,className:p.select,value:t.position??"",disabled:n,onChange:u=>{r({...t,position:u.target.value||null})},children:[i.jsx("option",{value:"",children:o("imagePropertiesPositionDefault")}),Qu.map(u=>i.jsx("option",{value:u,children:o(HE[u])},u))]})]})]})}function zE({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=e===null?null:as(e),[s,u]=l.useState(()=>a===null?"":he(a)),[d,f]=l.useState(!1);l.useEffect(()=>{d||u(a===null?"":he(a))},[a,d]);const h=g=>{const y=g.trim();if(!y){n(null),u("");return}const b=Number(y.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":he(a));return}const w=wg(b);n(w),u(he(as(w)))};return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>f(!0),onChange:g=>u(g.target.value),onBlur:()=>{f(!1),h(s)}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const OE={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function Ps({label:e,inputAria:t,value:n,disabled:r,onChange:o}){const a=J(),s=l.useId(),u=l.useId(),d=l.useRef(null),f=l.useRef(null),h=l.useRef(null),g=(n==null?void 0:n.unit)??Wv,[y,b]=l.useState(()=>n?he(n.value):""),[w,x]=l.useState(!1),[S,k]=l.useState(!1),v=Eo(S,f,h,{matchAnchorWidth:!0,minWidth:72});l.useEffect(()=>{w||b(n?he(n.value):"")},[n,w]),l.useEffect(()=>{if(!S)return;const T=N=>{var $,P;const K=N.target;($=d.current)!=null&&$.contains(K)||(P=h.current)!=null&&P.contains(K)||k(!1)},E=N=>{N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",E,!0),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",E,!0)}},[S]);const A=T=>{const E=T.trim();if(!E){o(null),b("");return}const N=Af(E,g);if(!N){b(n?he(n.value):"");return}o(N),b(he(N.value))},I=Gv[g],D=(n==null?void 0:n.value)??null,R=S?i.jsx(Pe,{children:i.jsx("ul",{ref:h,className:Ve.list,role:"listbox",id:s,style:{top:v.top,left:v.left,minWidth:v.width},children:I.map(T=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ve.option,role:"option","aria-selected":D===T,onMouseDown:E=>E.preventDefault(),onClick:()=>{o({value:T,unit:g}),b(he(T)),k(!1)},children:he(T)})},T))})}):null;return i.jsxs("div",{className:p.lengthField,children:[i.jsx("label",{className:p.sideLabel,htmlFor:u,children:e}),i.jsxs("div",{className:`${Ve.wrap} ${p.lengthRow}`,ref:d,children:[i.jsxs("div",{className:Ve.field,ref:f,children:[i.jsx("input",{id:u,className:Ve.input,value:y,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":S,"aria-controls":s,role:"combobox",inputMode:"decimal",onFocus:()=>x(!0),onBlur:()=>{x(!1),A(y)},onChange:T=>b(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.preventDefault(),A(y),k(!1),T.currentTarget.blur()),T.key==="ArrowDown"&&(T.preventDefault(),k(!0))}}),i.jsx("button",{type:"button",className:Ve.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":S,"aria-controls":s,onMouseDown:T=>T.preventDefault(),onClick:()=>k(T=>!T)})]}),i.jsxs("div",{className:Ve.field,children:[i.jsx("select",{className:Ve.unit,value:g,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:T=>{const E=T.target.value;if(n){o({value:n.value,unit:E});return}y.trim()&&o(Af(y,E))},children:eh.map(T=>i.jsx("option",{value:T,children:a(OE[T])},T))}),i.jsx("span",{className:Ve.chevron,"aria-hidden":"true"})]}),R]})]})}const KE={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},$E={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function UE(e,t,n){return t&&n?"custom":e.startsWith("data:")?"file":e.trim()?"url":"file"}function gy({src:e,disabled:t,customImagePicker:n,disableBuiltinSources:r=!1,onSrcChange:o,onCustomPick:a,onSourceChange:s}){const u=J(),d=l.useId(),f=l.useId(),h=l.useRef(null),g=r&&!!n,[y,b]=l.useState(()=>UE(e,r,n)),[w,x]=l.useState(()=>e.startsWith("data:")?"":e),[S,k]=l.useState(""),[v,A]=l.useState(null),[I,D]=l.useState(!1);l.useEffect(()=>{s==null||s(y)},[s,y]),l.useEffect(()=>{g&&b("custom")},[g]);const R=y==="file"&&e.startsWith("data:")?e:y==="url"?w:"",T=y==="custom"?null:Sn(R),E=y==="custom"?null:y==="file"&&v?$E[v]:T&&(y==="file"||w.trim().length>0)?KE[T]:null,N=()=>{t||!n||a==null||a()},K=$=>{var F;const P=(F=$.target.files)==null?void 0:F[0];P&&(D(!0),A(null),Bv(P).then(U=>{k(P.name),b("file"),o(U),D(!1)},U=>{const G=U instanceof Error?U.message:"";k(""),b("file"),A(G==="tooLarge"||G==="type"?G:"type"),D(!1),h.current&&(h.current.value="")}))};return i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:u("imageDialogSource")}),g?null:i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":u("imageDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="file",disabled:t,onClick:()=>b("file"),children:u("imageDialogFile")}),i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>b("url"),children:u("imageDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),y==="file"?i.jsxs("div",{className:p.fileRow,children:[i.jsx("input",{ref:h,type:"file",accept:jv,hidden:!0,disabled:t,"aria-label":u("imageDialogChooseFile"),onChange:K}),i.jsx("button",{type:"button",className:p.action,disabled:t||I,onClick:()=>{var $;return($=h.current)==null?void 0:$.click()},children:u("imageDialogChooseFile")}),S?i.jsx("span",{className:p.fileName,children:S}):null,e.startsWith("data:")&&!S?i.jsx("span",{className:p.fileName,children:u("pageBackgroundImageCurrent")}):null]}):null,y==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:u("imageDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:w,disabled:t,"aria-invalid":E!==null,"aria-describedby":E?f:void 0,onChange:$=>{const P=$.target.value;x(P),o(P.trim())}})]}):null,(g||y==="custom")&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:N,children:n.buttonCaption})]}):null,E?i.jsx("p",{id:f,className:p.error,children:u(E)}):null]})}function VE(e){return Sn(e.trim())===null}function WE(e){return ah(e)?{width:null,height:null}:e==="fill"?{width:{...yo},height:{...yo}}:{width:{...yo},height:null}}function GE({value:e,disabled:t,customImagePicker:n,disableBuiltinSources:r,onCustomImagePick:o,onChange:a}){const s=J(),u=e.src??"",d=(f,h)=>{a({...e,fit:null,[f]:h})};return i.jsxs(i.Fragment,{children:[u?i.jsxs("div",{className:p.field,children:[i.jsx("span",{className:p.label,children:s("pageBackgroundImagePreview")}),i.jsx("img",{className:p.previewImage,src:u,alt:s("pageBackgroundImagePreviewAlt")}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:()=>{a({...e,src:null})},children:s("pageBackgroundImageClear")})]}):null,i.jsx(gy,{src:u,disabled:t,customImagePicker:n,disableBuiltinSources:r,onCustomPick:o,onSrcChange:f=>{a({...e,src:f.trim()||null})}}),u?i.jsxs(i.Fragment,{children:[i.jsx(Ps,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:f=>d("width",f)}),i.jsx(Ps,{label:s("imagePropertiesHeight"),inputAria:s("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:f=>d("height",f)}),i.jsx(py,{legendKey:"pageDialogTabBackgroundImage",value:{opacity:e.opacity,fit:e.fit,position:e.position},disabled:t,onChange:f=>{const h=f.fit===e.fit?{width:e.width,height:e.height}:WE(f.fit);a({...e,opacity:f.opacity,fit:f.fit,position:f.position,...h})}})]}):null]})}const qE={left:Ts,center:As,right:Rs,justify:Ep},ZE={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},YE={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},XE={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},JE={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},QE={value:1,unit:"pt"},e_={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1},t_={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid"},Pp={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid",page:"paragraphDialogBreakPage"};function ai(e){return{top:e,right:e,bottom:e,left:e}}function Ap(e){for(const t of st)if(e[t])return e[t];return null}function n_(){const e=[...my];for(const t of fy)e.some(n=>n.id===t.id)||e.push(t);return e}function vd({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:o="paragraphDialogTitle",backgroundImage:a,customImagePicker:s,disableBuiltinBackgroundImageSources:u,onCustomImagePick:d,onBackgroundImageChange:f,onTabChange:h,onChange:g}){var K,$;const y=J(),b=pd(),w=new Set([...((K=b==null?void 0:b.hiddenDialogTabs)==null?void 0:K.paragraph)??[],...r?(($=b==null?void 0:b.hiddenDialogTabs)==null?void 0:$.page)??[]:[]]),S=(r?n_().filter(P=>r.includes(P.id)):my).filter(P=>!w.has(P.id)),k=l.useId(),v=l.useId(),A=l.useId(),I=l.useId(),[D,R]=l.useState(()=>On(t.margin,ai(t.margin.top))),[T,E]=l.useState(()=>On(t.padding,ai(t.padding.top))),N=(P,F,U,G)=>{const me=t[P],se=F?ai(G):{...me,[U]:G};g({...t,[P]:se,[`${P}Mixed`]:!1})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":y(o),children:S.map(P=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":P.id===e,disabled:!P.implemented,onClick:()=>h(P.id),children:y(P.labelKey)},P.id))}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[e==="general"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":y("paragraphDialogAlignment"),children:Yh.map(P=>{const F=qE[P],U=!t.alignMixed&&t.align===P;return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":U,"aria-label":y(ZE[P].aria),disabled:n,onClick:()=>{g({...t,align:P,alignMixed:!1})},children:i.jsx(F,{})},P)})})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogLists")}),i.jsxs("div",{className:p.iconRow,children:[i.jsx("button",{type:"button",className:p.iconButton,"aria-pressed":!t.listMixed&&t.list==="ul","aria-label":y("commandBulletListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ul"?null:"ul";g({...t,list:P,listMixed:!1})},children:i.jsx(_p,{})}),i.jsx("button",{type:"button",className:p.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":y("commandNumberedListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ol"?null:"ol";g({...t,list:P,listMixed:!1})},children:i.jsx(Fp,{})})]})]})]}):null,e==="spacing"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogSpacing")}),i.jsx(Tp,{legend:y("paragraphDialogMargin"),sides:t.margin,linked:D,disabled:n,allowNegative:!0,onLinkedChange:P=>{R(P),P&&g({...t,margin:ai(Ap(t.margin)),marginMixed:!1})},onSideChange:(P,F)=>N("margin",D,P,F)}),i.jsx(Tp,{legend:y("paragraphDialogPadding"),sides:t.padding,linked:T,disabled:n,onLinkedChange:P=>{E(P),P&&g({...t,padding:ai(Ap(t.padding)),paddingMixed:!1})},onSideChange:(P,F)=>N("padding",T,P,F)}),i.jsx(o_,{value:t.lineHeight,disabled:n,onChange:P=>{g({...t,lineHeight:P,lineHeightMixed:!1})}}),i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:y("paragraphDialogPageBreaks")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:v,children:y("paragraphDialogBreakInside")}),i.jsx("select",{id:v,className:p.select,value:t.breakInsideMixed?"auto":t.breakInside,disabled:n,onChange:P=>{g({...t,breakInside:P.target.value,breakInsideMixed:!1})},children:mg.map(P=>i.jsx("option",{value:P,children:y(t_[P])},P))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:A,children:y("paragraphDialogBreakAfter")}),i.jsx("select",{id:A,className:p.select,value:t.breakAfterMixed?"auto":t.breakAfter,disabled:n,onChange:P=>{g({...t,breakAfter:P.target.value,breakAfterMixed:!1})},children:Gc.map(P=>i.jsx("option",{value:P,children:y(Pp[P])},P))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:I,children:y("paragraphDialogBreakBefore")}),i.jsx("select",{id:I,className:p.select,value:t.breakBeforeMixed?"auto":t.breakBefore,disabled:n,onChange:P=>{g({...t,breakBefore:P.target.value,breakBeforeMixed:!1})},children:Gc.map(P=>i.jsx("option",{value:P,children:y(Pp[P])},P))})]})]})]}):null,e==="border"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:k,children:y("paragraphDialogBorderStyle")}),i.jsx("select",{id:k,className:p.select,value:t.border.style,disabled:n,onChange:P=>{const F=P.target.value;g({...t,border:{style:F,width:F==="none"?null:t.border.width??QE,color:F==="none"?null:t.border.color},borderMixed:!1})},children:Es.map(P=>i.jsx("option",{value:P,children:y(XE[P])},P))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Qe,{label:y("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:P=>{g({...t,border:{...t.border,width:P},borderMixed:!1})}}),i.jsx(Qt,{label:y("paragraphDialogBorderColor"),noneLabel:y("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:P=>{g({...t,border:{...t.border,color:P},borderMixed:!1})}})]}):null,i.jsx(Qe,{label:y("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:P=>{g({...t,borderRadius:P,radiusMixed:!1})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{g({...t,boxShadow:t.boxShadow?null:e_,shadowMixed:!1})}}),y("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(Cd,{shadow:t.boxShadow,disabled:n,onChange:P=>{g({...t,boxShadow:P,shadowMixed:!1})}}):null]}):null,e==="background"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogTabBackground")}),i.jsx(Qt,{label:y("paragraphDialogBackgroundColor"),noneLabel:y("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:P=>{g({...t,backgroundColor:P,backgroundMixed:!1})}}),i.jsx(r_,{value:t.opacity,disabled:n,onChange:P=>{g({...t,opacity:P,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&f?i.jsx(GE,{value:a,disabled:n,customImagePicker:s,disableBuiltinSources:u,onCustomImagePick:d,onChange:f}):null]})]})}function r_({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=e===null?null:as(e),[s,u]=l.useState(()=>a===null?"":he(a)),[d,f]=l.useState(!1);l.useEffect(()=>{d||u(a===null?"":he(a))},[a,d]);const h=g=>{const y=g.trim();if(!y){n(null),u("");return}const b=Number(y.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":he(a));return}const w=wg(b);n(w),u(he(as(w)))};return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>f(!0),onChange:g=>u(g.target.value),onBlur:()=>{f(!1),h(s)}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function Tp({legend:e,sides:t,linked:n,disabled:r,allowNegative:o=!1,onLinkedChange:a,onSideChange:s}){const u=J(),d=n?["top"]:st;return i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:e}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:()=>a(!n)}),u("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:d.map(f=>i.jsx(Qe,{label:n?e:u(YE[f]),value:t[f],disabled:r,allowNegative:o,onChange:h=>s(f,h)},f))})]})}function o_({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=i_(e),s=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,d]=l.useState(()=>s===null?"":he(s)),f=(e==null?void 0:e.kind)==="length"?e.unit:Nu;return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogLineHeight")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:a==="normal"?"":u,disabled:t||a==="normal",inputMode:"decimal",onChange:h=>d(h.target.value),onBlur:()=>{const h=u.trim();if(!h){n(null);return}if(a==="number"||a==="empty"){const y=Number(h.replace(",","."));if(!Number.isFinite(y)||y<0){d(s===null?"":he(s));return}n({kind:"number",value:y}),d(he(y));return}const g=xi(h,f,!1);if(!g){d(s===null?"":he(s));return}n({kind:"length",value:g.value,unit:g.unit}),d(he(g.value))}}),i.jsxs("select",{className:p.lengthUnit,value:a==="length"?f:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:h=>{const g=h.target.value;if(g==="empty"){n(null),d("");return}if(g==="normal"){n({kind:"normal"}),d("");return}if(g==="number"){const x=Number((u||"1.5").replace(",",".")),S=Number.isFinite(x)&&x>=0?x:1.5;n({kind:"number",value:S}),d(he(S));return}const y=g,b=xi(u||"1",y,!1),w=(b==null?void 0:b.value)??1;n({kind:"length",value:w,unit:y}),d(he(w))},children:[i.jsx("option",{value:"empty"}),i.jsx("option",{value:"normal",children:r("paragraphDialogLineHeightNormal")}),i.jsx("option",{value:"number",children:r("paragraphDialogLineHeightUnitless")}),["pt","px","em","rem","%"].map(h=>i.jsx("option",{value:h,children:r(JE[h])},h))]})]})]})}function i_(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}function a_({open:e,tab:t,value:n,backgroundImage:r,disabled:o,customImagePicker:a,disableBuiltinBackgroundImageSources:s,onCustomImagePick:u,onTabChange:d,onApply:f,onClose:h}){const g=J(),y=l.useId(),b=l.useRef(null),[w,x]=l.useState(n),[S,k]=l.useState(r);return l.useEffect(()=>{e&&(x(n),k(r??vn()))},[e,n,r]),$e(b,{open:e,onClose:h,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:h,children:i.jsxs("div",{ref:b,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":y,onMouseDown:v=>v.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:y,children:g("paragraphDialogTitle")}),i.jsx(vd,{tab:t,value:w,disabled:o,backgroundImage:S,customImagePicker:a,disableBuiltinBackgroundImageSources:s,onCustomImagePick:u,onBackgroundImageChange:k,onTabChange:d,onChange:x}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:h,children:g("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>f({value:w,backgroundImage:S}),children:g("fontDialogOk")})]})]})})}):null}const s_=["auto","A4","letter","legal","custom"],l_={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},c_={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function Rp(e){return e===null?"":he(e.value)}function u_({value:e,disabled:t,onChange:n,onReset:r}){const o=J(),a=l.useId(),[s,u]=l.useState(!0),d=e??or(),f=(h,g)=>{if(s){n({...d,margin:{top:g,right:g,bottom:g,left:g},marginMixed:!1});return}n({...d,margin:{...d.margin,[h]:g},marginMixed:!1})};return i.jsxs("div",{className:p.body,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:o("pageAtRuleSize")}),i.jsx("select",{id:a,className:p.select,disabled:t,value:d.sizePreset,onChange:h=>n({...d,sizePreset:h.target.value}),children:s_.map(h=>i.jsx("option",{value:h,children:o(l_[h])},h))})]}),d.sizePreset==="custom"?i.jsxs("div",{className:p.sideGrid,children:[i.jsx(Nc,{label:o("pageAtRuleWidth"),value:d.customWidth,disabled:t,onChange:h=>n({...d,customWidth:h})}),i.jsx(Nc,{label:o("pageAtRuleHeight"),value:d.customHeight,disabled:t,onChange:h=>n({...d,customHeight:h})})]}):null,i.jsxs("div",{className:p.field,children:[i.jsx("span",{className:p.label,children:o("pageAtRuleOrientation")}),i.jsx("div",{className:p.marks,children:[["none","pageAtRuleOrientationNone"],["portrait","pageAtRuleOrientationPortrait"],["landscape","pageAtRuleOrientationLandscape"]].map(([h,g])=>i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"radio",name:"page-orientation",checked:(d.orientation??"none")===h,disabled:t,onChange:()=>n({...d,orientation:h==="none"?null:h})}),o(g)]},h))})]}),i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:o("pageAtRuleMargins")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:s,disabled:t,onChange:()=>u(!s)}),o("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(s?["top"]:st).map(h=>i.jsx(Nc,{label:o(s?"pageAtRuleMargins":c_[h]),value:d.margin[h],disabled:t,onChange:g=>f(h,g)},h))})]}),i.jsx("div",{className:p.actions,children:i.jsx("button",{type:"button",className:p.action,disabled:t,"aria-label":o("pageAtRuleResetAria"),onClick:r,children:o("pageAtRuleReset")})})]})}function Nc({label:e,value:t,disabled:n,onChange:r}){const o=J(),a=l.useId(),[s,u]=l.useState(()=>Rp(t)),d=(t==null?void 0:t.unit)??Nu;return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:e}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:a,className:p.lengthInput,value:s,disabled:n,inputMode:"decimal",onChange:f=>u(f.target.value),onBlur:()=>{const f=s.trim();if(!f){r(null);return}const h=xi(f,d,!1);if(!h){u(Rp(t));return}r(h),u(he(h.value))}}),i.jsxs("select",{className:p.lengthUnit,disabled:n,value:d,"aria-label":o("paragraphDialogLengthUnitAria"),onChange:f=>{const h=f.target.value;t&&r({...t,unit:h})},children:[i.jsx("option",{value:"pt",children:o("fontSizeUnitPt")}),i.jsx("option",{value:"px",children:o("fontSizeUnitPx")}),i.jsx("option",{value:"em",children:o("fontSizeUnitEm")}),i.jsx("option",{value:"rem",children:o("fontSizeUnitRem")}),i.jsx("option",{value:"%",children:o("fontSizeUnitPercent")})]})]})]})}const d_=fy.map(e=>e.id);function m_(e){return{...Br(),...e}}function f_(e){const{align:t,alignMixed:n,list:r,listMixed:o,...a}=e;return a}function p_({open:e,tab:t,value:n,fonts:r,disabled:o,printTabVisible:a=!1,initialParagraphTab:s="spacing",customImagePicker:u,disableBuiltinBackgroundImageSources:d,onCustomImagePick:f,onTabChange:h,onApply:g,onResetAtRule:y,onClose:b}){const w=J(),x=l.useId(),S=l.useRef(null),[k,v]=l.useState("general"),[A,I]=l.useState("spacing"),[D,R]=l.useState(n.font),[T,E]=l.useState(n.box),[N,K]=l.useState(n.backgroundImage),[$,P]=l.useState(n.atRule??or());if(l.useEffect(()=>{e&&(v("general"),I(s==="general"?"spacing":s),R(n.font),E(n.box),K(n.backgroundImage??vn()),P(n.atRule??or()),t==="print"&&!a&&h("font"))},[e,n,t,a,s,h]),$e(S,{open:e,onClose:b,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const F=w("pageDialogTitle"),U=t==="print"&&!a?"font":t;return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:b,children:i.jsxs("div",{ref:S,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":x,onMouseDown:G=>G.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:x,children:F}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":F,children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":U==="font",onClick:()=>h("font"),children:w("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":U==="paragraph",onClick:()=>h("paragraph"),children:w("customStyleDialogTabParagraph")}),a?i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":U==="print",onClick:()=>h("print"),children:w("pageDialogTabPrint")}):null]}),U==="font"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(wd,{tab:k,value:D,fonts:r,disabled:o,onTabChange:v,onChange:R})}):U==="paragraph"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(vd,{tab:A,value:m_(T),disabled:o,tabs:d_,tablistLabelKey:"pageDialogTitle",backgroundImage:N,customImagePicker:u,disableBuiltinBackgroundImageSources:d,onCustomImagePick:f,onBackgroundImageChange:K,onTabChange:G=>{G!=="general"&&I(G)},onChange:G=>E(f_(G))})}):i.jsx("div",{className:p.nestedPanel,children:i.jsx(u_,{value:$,disabled:o,onChange:P,onReset:()=>{P(or()),y==null||y()}})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:b,children:w("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>g({font:D,box:T,backgroundImage:N,atRule:a?$:n.atRule??or()}),children:w("fontDialogOk")})]})]})})})}function g_({open:e,disabled:t,onClose:n,onConfirm:r}){const o=J(),a=l.useId(),s=l.useRef(null);if(l.useEffect(()=>{if(!e)return;const d=s.current;if(!d)return;const f=d.querySelector('button:not([disabled]):not([tabindex="-1"])');f==null||f.focus();const h=g=>{g.key==="Escape"&&(g.preventDefault(),n())};return document.addEventListener("keydown",h,!0),()=>document.removeEventListener("keydown",h,!0)},[e,n]),!e)return null;const u=!!t;return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:s,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:a,children:o("deletePageDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":o("deletePageDialogCloseAria"),onClick:n,children:i.jsx(Ge,{})})]}),i.jsx("div",{className:p.confirmBody,children:o("deletePageConfirmMessage")}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:u,onClick:n,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:u,onClick:r,children:o("commandDeletePage")})]})]})})})}function h_(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Dp(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 b_(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 y_({open:e,mode:t,styleId:n,name:r="",font:o,paragraph:a,canDelete:s=!1,busy:u,disabled:d,fonts:f,defaultOuterTab:h="font",onSave:g,onDelete:y,onClose:b}){const w=J(),x=l.useId(),S=l.useId(),k=l.useRef(null),[v,A]=l.useState(r),[I,D]=l.useState(h),[R,T]=l.useState("general"),[E,N]=l.useState("general"),[K,$]=l.useState(()=>Dp(o)),[P,F]=l.useState(()=>mu(a)),[U,G]=l.useState(!1);l.useEffect(()=>{e&&(A(r),D(h),T("general"),N("general"),$(Dp(o)),F(mu(a)),G(!1))},[e,r,o,a,h]);const me=l.useCallback(()=>{if(U){G(!1);return}b()},[U,b]);if($e(k,{open:e,onClose:me,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const se=w(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),V=v.trim().length>0,re=!!(d||u),de=()=>{const oe=v.trim();oe&&g({id:n??h_(),name:oe,font:b_(K),paragraph:eb(P)})};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:b,children:i.jsxs("div",{ref:k,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":x,"aria-busy":u||void 0,onMouseDown:oe=>oe.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:x,children:se}),i.jsx("button",{type:"button",className:p.close,"aria-label":w("customStyleDialogCloseAria"),onClick:b,children:i.jsx(Ge,{})})]}),U?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.confirmBody,children:w("customStyleDialogDeleteConfirm")}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:re,onClick:()=>G(!1),children:w("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:re||!n,onClick:()=>{n&&(y==null||y(n))},children:w("customStyleDialogDelete")})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.nameSection,children:i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:S,children:w("customStyleDialogName")}),i.jsx("input",{id:S,className:p.nameInput,value:v,disabled:re,onChange:oe=>A(oe.target.value)})]})}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":se,children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":I==="font",onClick:()=>D("font"),children:w("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":I==="paragraph",onClick:()=>D("paragraph"),children:w("customStyleDialogTabParagraph")})]}),I==="font"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(wd,{tab:R,value:K,fonts:f,disabled:re,onTabChange:T,onChange:$})}):i.jsx("div",{className:p.nestedPanel,children:i.jsx(vd,{tab:E,value:P,disabled:re,onTabChange:N,onChange:F})}),i.jsxs("div",{className:t==="edit"&&s?`${p.actions} ${p.actionsSpread}`:p.actions,children:[t==="edit"&&s?i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:re,onClick:()=>G(!0),children:w("customStyleDialogDelete")}):null,i.jsxs("div",{className:p.actionsEnd,children:[i.jsx("button",{type:"button",className:p.action,onClick:b,children:w("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:re||!V,onClick:de,children:w("fontDialogOk")})]})]})]})]})})})}function x_({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useId(),d=l.useRef(null),f=l.useRef(null),[h,g]=l.useState(t);if(l.useEffect(()=>{e&&g(t)},[e,t]),$e(d,{open:e,onClose:o,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),l.useEffect(()=>{var b;e&&((b=f.current)==null||b.focus())},[e]),!e)return null;const y=()=>{n||r(h)};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:d,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("customCssDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("customCssDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx("div",{className:p.body,children:i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:a("customCssDialogField")}),i.jsx("textarea",{ref:f,id:u,className:p.textarea,value:h,disabled:n,spellCheck:!1,"aria-label":a("customCssDialogFieldAria"),rows:8,onChange:b=>g(b.target.value)})]})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:y,children:a("fontDialogOk")})]})]})})})}const w_={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function C_({open:e,existingIds:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useId(),d=l.useId(),f=l.useRef(null),[h,g]=l.useState(""),[y,b]=l.useState(!1),w=l.useMemo(()=>new Set(t),[t]),x=ab(h,w);if(l.useEffect(()=>{e&&(g(""),b(!1))},[e]),$e(f,{open:e,onClose:o,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const S=y||h.trim().length>0?x:null,k=x===null&&!n,v=()=>{b(!0),!(x||n)&&r(h.trim())};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:f,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:A=>A.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("bookmarkDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx("div",{className:p.body,children:i.jsxs("div",{className:p.field,children:[i.jsxs("div",{className:p.labelRow,children:[i.jsx("label",{className:p.label,htmlFor:u,children:a("bookmarkDialogName")}),i.jsx(pr,{label:a("bookmarkDialogHelp"),elevated:!0,children:i.jsx("button",{type:"button",className:p.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),i.jsx("input",{id:u,className:p.textInput,value:h,disabled:n,"aria-invalid":S!==null,"aria-describedby":S?d:void 0,onChange:A=>g(A.target.value)}),S?i.jsx("p",{id:d,className:p.error,children:a(w_[S])}):null]})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!k,onClick:v,children:a("fontDialogOk")})]})]})})})}const v_={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},k_={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function S_({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=J(),u=l.useId(),d=l.useId(),f=l.useId(),h=l.useId(),g=l.useRef(null),y=l.useRef(null),[b,w]=l.useState("file"),[x,S]=l.useState(""),[k,v]=l.useState(""),[A,I]=l.useState(""),[D,R]=l.useState(""),[T,E]=l.useState(null),[N,K]=l.useState(!1);if(l.useEffect(()=>{e&&(w("file"),S(""),v(""),I(""),R(""),E(null),K(!1),y.current&&(y.current.value=""))},[e]),$e(g,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const $=b==="file"?k:b==="url"?x:"",P=b==="custom"?null:fd($),F=b==="custom"?null:b==="file"&&T?k_[T]:P&&(b==="file"||x.trim().length>0)?v_[P]:null,U=b!=="custom"&&P===null&&!(b==="file"&&T)&&!t&&!N,G=()=>{t||!n||o==null||o()},me=()=>{U&&r({src:$.trim(),title:D.trim()})},se=V=>{var de;const re=(de=V.target.files)==null?void 0:de[0];re&&(K(!0),E(null),l0(re).then(oe=>{v(oe),I(re.name),w("file"),K(!1)},oe=>{const _=oe instanceof Error?oe.message:"";v(""),I(""),w("file"),E(_==="tooLarge"||_==="type"?_:"type"),K(!1),y.current&&(y.current.value="")}))};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:g,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:V=>V.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("audioDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("audioDialogCloseAria"),onClick:a,children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="file",disabled:t,onClick:()=>w("file"),children:s("audioDialogFile")}),i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="url",disabled:t,onClick:()=>w("url"),children:s("audioDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="custom",disabled:t,onClick:()=>w("custom"),children:n.text}):null]}),b==="file"?i.jsxs("div",{className:p.fileRow,children:[i.jsx("input",{ref:y,type:"file",accept:t0,hidden:!0,disabled:t,"aria-label":s("audioDialogChooseFile"),onChange:se}),i.jsx("button",{type:"button",className:p.action,disabled:t||N,onClick:()=>{var V;return(V=y.current)==null?void 0:V.click()},children:s("audioDialogChooseFile")}),A?i.jsx("span",{className:p.fileName,children:A}):null]}):null,b==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("audioDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:x,disabled:t,"aria-invalid":F!==null,"aria-describedby":F?h:void 0,onChange:V=>S(V.target.value)})]}):null,b==="custom"&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:G,children:n.buttonCaption})]}):null]}),b!=="custom"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("audioDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:D,disabled:t,onChange:V=>R(V.target.value)})]}):null,F?i.jsx("p",{id:h,className:p.error,children:s(F)}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),b!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!U,onClick:me,children:s("fontDialogOk")}):null]})]})})})}function P_({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=J(),u=l.useId(),d=l.useId(),f=l.useId(),h=l.useRef(null),[g,y]=l.useState(""),[b,w]=l.useState(""),[x,S]=l.useState(""),[k,v]=l.useState("file");if(l.useEffect(()=>{e&&(y(""),w(""),S(""),v("file"))},[e]),$e(h,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const A=VE(g)&&!t,I=()=>{A&&r({src:g.trim(),alt:b.trim(),title:x.trim()})};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:h,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:D=>D.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("imageDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("imageDialogCloseAria"),onClick:a,children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsx(gy,{src:g,disabled:t,customImagePicker:n,onCustomPick:o,onSourceChange:v,onSrcChange:y}),k!=="custom"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("imageDialogAlt")}),i.jsx("input",{id:d,className:p.textInput,value:b,disabled:t,onChange:D=>w(D.target.value)})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("imageDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:x,disabled:t,onChange:D=>S(D.target.value)})]})]}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),k!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!A,onClick:I,children:s("fontDialogOk")}):null]})]})})})}const A_=[{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}],T_={left:Ts,center:As,right:Rs},R_=["left","center","right"],D_={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},I_=["width","height","lock"],j_={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},E_={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},__={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},M_={value:1,unit:"pt"},N_={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 Lc(e){return{top:e,right:e,bottom:e,left:e}}function L_(e){for(const t of st)if(e[t])return e[t];return null}function B_({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:o,onChange:a}){const s=J(),u=l.useId(),d=l.useId(),f=l.useId(),[h,g]=l.useState(()=>On(t.margin,Lc(t.margin.top))),y=t.align==="center",b=(x,S)=>{if(t.sizeMode==="lock"&&S){const k=gi(x,S,n);a({...t,width:k.width,height:k.height});return}a({...t,[x]:S})},w=x=>{if(x==="width"){a({...t,sizeMode:x,height:null});return}if(x==="height"){a({...t,sizeMode:x,width:null});return}if(t.width){const S=gi("width",t.width,n);a({...t,sizeMode:x,width:S.width,height:S.height});return}if(t.height){const S=gi("height",t.height,n);a({...t,sizeMode:x,width:S.width,height:S.height});return}a({...t,sizeMode:x})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":s("imagePropertiesDialogTitle"),children:A_.map(x=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":x.id===e,disabled:!x.implemented,onClick:()=>o(x.id),children:s(x.labelKey)},x.id))}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[e==="general"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesSize")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":s("imagePropertiesSizeMode"),children:I_.map(x=>i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":t.sizeMode===x,disabled:r,onClick:()=>w(x),children:s(j_[x])},x))}),i.jsx(Ps,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:x=>b("width",x)}),i.jsx(Ps,{label:s("imagePropertiesHeight"),inputAria:s("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:x=>b("height",x)})]}):null,e==="alignment"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":s("paragraphDialogAlignment"),children:R_.map(x=>{const S=T_[x];return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":t.align===x,"aria-label":s(D_[x]),disabled:r,onClick:()=>{a({...t,align:t.align===x?null:x})},children:i.jsx(S,{})},x)})})]}):null,e==="border"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogMargin")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:h,disabled:r||y,onChange:()=>{const x=!h;g(x),x&&a({...t,margin:Lc(L_(t.margin))})}}),s("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(h?["top"]:st).map(x=>i.jsx(Qe,{label:s(h?"paragraphDialogMargin":E_[x]),value:t.margin[x],disabled:r||y&&(x==="left"||x==="right"),allowNegative:!0,onChange:S=>{const k=h?Lc(S):{...t.margin,[x]:S};a({...t,margin:k})}},x))})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:s("paragraphDialogBorderStyle")}),i.jsx("select",{id:u,className:p.select,value:t.border.style,disabled:r,onChange:x=>{const S=x.target.value;a({...t,border:{style:S,width:S==="none"?null:t.border.width??M_,color:S==="none"?null:t.border.color}})},children:Es.map(x=>i.jsx("option",{value:x,children:s(__[x])},x))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Qe,{label:s("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:x=>{a({...t,border:{...t.border,width:x}})}}),i.jsx(Qt,{label:s("paragraphDialogBorderColor"),noneLabel:s("colorNone"),value:t.border.color,disabled:r,onChange:x=>{a({...t,border:{...t.border,color:x}})}})]}):null,i.jsx(Qe,{label:s("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:x=>{a({...t,borderRadius:x})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:r,onChange:()=>{a({...t,boxShadow:t.boxShadow?null:N_})}}),s("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(Cd,{shadow:t.boxShadow,disabled:r,onChange:x=>{a({...t,boxShadow:x})}}):null]})]}):null,e==="advanced"?i.jsxs(i.Fragment,{children:[i.jsx(py,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:x=>{a(r1({...t,opacity:x.opacity,objectFit:x.fit,objectPosition:x.position},n))}}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesRotation")}),i.jsx("div",{className:p.field,children:i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:d,className:p.lengthInput,value:t.rotateDeg===null?"":he(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":s("imagePropertiesRotation"),onChange:x=>{const S=x.target.value.trim();if(!S){a({...t,rotateDeg:null});return}const k=Number(S.replace(",","."));Number.isFinite(k)&&a({...t,rotateDeg:k})}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:s("imagePropertiesRotationUnit")})]})})]})]}):null,e==="hover"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesTabHover")}),i.jsx("p",{className:p.emptyHint,children:s("imagePropertiesHoverHelp")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("imagePropertiesHoverCss")}),i.jsx("textarea",{id:f,className:p.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":s("imagePropertiesHoverCssAria"),onChange:x=>{a({...t,hoverCss:x.target.value})}})]})]}):null]})]})}function F_({open:e,tab:t,value:n,aspectRatio:r=1,disabled:o,onTabChange:a,onApply:s,onClose:u}){const d=J(),f=l.useId(),h=l.useRef(null),[g,y]=l.useState(n);return l.useEffect(()=>{e&&y(n)},[e,n]),$e(h,{open:e,onClose:u,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:u,children:i.jsxs("div",{ref:h,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":f,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:f,children:d("imagePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":d("imagePropertiesDialogCloseAria"),onClick:u,children:i.jsx(Ge,{})})]}),i.jsx(B_,{tab:t,value:g,aspectRatio:r,disabled:o,onTabChange:a,onChange:y}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:u,children:d("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>s(g),children:d("fontDialogOk")})]})]})})}):null}function H_({open:e,tab:t,href:n,title:r,targetBlank:o,textDecorationNone:a,hoverMode:s,hoverColor:u,hoverHtml:d,bookmarks:f,selectedBookmarkId:h,disabled:g,onTabChange:y,onApply:b,onClose:w}){const x=J(),S=l.useId(),k=l.useId(),v=l.useId(),A=l.useId(),I=l.useId(),D=l.useRef(null),[R,T]=l.useState(n),[E,N]=l.useState(r),[K,$]=l.useState(o),[P,F]=l.useState(a),[U,G]=l.useState(s),[me,se]=l.useState(u),[V,re]=l.useState(d),[de,oe]=l.useState(h);if(l.useEffect(()=>{e&&(T(n),N(r),$(o),F(a),G(s),se(u),re(d),oe(h))},[e,n,r,o,a,s,u,d,h]),$e(D,{open:e,onClose:w,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),!e)return null;const _=()=>Os({title:E,targetBlank:K,textDecorationNone:P,hoverMode:U,hoverColor:me,hoverHtml:V}),Q=()=>{const ee=R.trim();!ee||g||b({..._(),href:ee})},ye=()=>{!de||g||b({..._(),href:`#${de}`})};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:w,children:i.jsxs("div",{ref:D,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":S,onMouseDown:ee=>ee.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:S,children:x("linkDialogTitle")}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":x("linkDialogTitle"),children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":t==="link",onClick:()=>y("link"),children:x("linkDialogTabLink")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>y("bookmark"),children:x("linkDialogTabBookmark")})]}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[t==="link"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:k,children:x("linkDialogHref")}),i.jsx("input",{id:k,className:p.textInput,value:R,disabled:g,onChange:ee=>T(ee.target.value)})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:v,children:x("linkDialogHoverTitle")}),i.jsx("input",{id:v,className:p.textInput,value:E,disabled:g,onChange:ee=>N(ee.target.value)})]}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:K,disabled:g,onChange:ee=>$(ee.target.checked)}),x("linkDialogTargetBlank")]})]}):f.length===0?i.jsx("p",{className:p.emptyHint,children:x("linkDialogBookmarkEmpty")}):i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:A,children:x("linkDialogBookmark")}),i.jsxs("select",{id:A,className:`${p.select} ${p.fullSelect}`,value:de,disabled:g,onChange:ee=>oe(ee.target.value),children:[i.jsx("option",{value:""}),f.map(ee=>i.jsx("option",{value:ee.id,children:ee.id},ee.id))]})]}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:P,disabled:g,onChange:ee=>F(ee.target.checked)}),x("linkDialogTextDecorationNone")]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:x("linkDialogHover")}),i.jsxs("div",{className:p.sizeRow,role:"group","aria-label":x("linkDialogHover"),children:[i.jsx("button",{type:"button",className:p.action,"aria-pressed":U==="color",disabled:g,onClick:()=>G("color"),children:x("linkDialogHoverColor")}),i.jsx("button",{type:"button",className:p.action,"aria-pressed":U==="html",disabled:g,onClick:()=>G("html"),children:x("linkDialogHoverHtml")})]}),U==="color"?i.jsx(Qt,{label:x("linkDialogHoverColorField"),noneLabel:x("colorNone"),value:me,disabled:g,onChange:se}):i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:I,children:x("linkDialogHoverHtmlAria")}),i.jsx("textarea",{id:I,className:p.textarea,value:V,disabled:g,spellCheck:!1,onChange:ee=>re(ee.target.value)})]})]})]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:g||!de,onClick:ye,children:x("linkDialogSelect")}),i.jsx("button",{type:"button",className:p.action,onClick:w,children:x("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:g||!R.trim(),onClick:Q,children:x("fontDialogOk")})]})]})})})}const Ip={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function z_({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=J(),u=l.useId(),d=l.useId(),f=l.useId(),h=l.useId(),g=l.useRef(null),[y,b]=l.useState("url"),[w,x]=l.useState(""),[S,k]=l.useState("");if(l.useEffect(()=>{e&&(b("url"),x(""),k(""))},[e]),$e(g,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const v=y==="custom"?null:bb(w),A=y==="custom"?null:v&&w.trim().length>0?Ip[v]:v==="empty"&&w.trim().length===0?null:v?Ip[v]:null,I=y!=="custom"&&v===null&&!t&&w.trim().length>0,D=()=>{t||!n||o==null||o()},R=()=>{I&&r({url:w.trim(),title:S.trim()})};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:g,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:T=>T.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("youtubeDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("youtubeDialogCloseAria"),onClick:a,children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>b("url"),children:s("youtubeDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),y==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("youtubeDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:w,disabled:t,"aria-invalid":A!==null,"aria-describedby":A?h:void 0,onChange:T=>x(T.target.value)})]}):null,y==="custom"&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:D,children:n.buttonCaption})]}):null]}),y!=="custom"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("youtubeDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:S,disabled:t,onChange:T=>k(T.target.value)})]}):null,A?i.jsx("p",{id:h,className:p.error,children:s(A)}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),y!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!I,onClick:R,children:s("fontDialogOk")}):null]})]})})})}const O_="_grid_1bpma_1",K_="_cell_1bpma_8",$_="_sizeLabel_1bpma_27",U_="_sizeFields_1bpma_33",V_="_numberInput_1bpma_37",co={grid:O_,cell:K_,sizeLabel:$_,sizeFields:U_,numberInput:V_},tr={rows:3,cols:3};function W_({open:e,disabled:t,onApply:n,onClose:r}){const o=J(),a=l.useId(),s=l.useId(),u=l.useId(),d=l.useRef(null),[f,h]=l.useState(tr.rows),[g,y]=l.useState(tr.cols),[b,w]=l.useState(String(tr.rows)),[x,S]=l.useState(String(tr.cols)),[k,v]=l.useState(!1);if(l.useEffect(()=>{e&&(h(tr.rows),y(tr.cols),w(String(tr.rows)),S(String(tr.cols)),v(!1))},[e]),$e(d,{open:e,onClose:r,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])'}),!e)return null;const I=Vh(f,g)&&!t,D=(N,K)=>{const $=Math.min(bo,Math.max(ho,N)),P=Math.min(bo,Math.max(ho,K));h($),y(P),w(String($)),S(String(P))},R=(N,K)=>{const $=Number.parseInt(N,10);if(!Number.isFinite($)){K==="rows"?w(String(f)):S(String(g));return}v(!0),K==="rows"?D($,g):D(f,$)},T=(N,K)=>{const $=N.replace(/\D/g,"");if(K==="rows"?w($):S($),$==="")return;const P=Number.parseInt($,10);Number.isFinite(P)&&(v(!0),K==="rows"?D(P,g):D(f,P))},E=N=>{(N.key==="e"||N.key==="E"||N.key==="+"||N.key==="-"||N.key===".")&&N.preventDefault()};return i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:r,children:i.jsxs("div",{ref:d,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:N=>N.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:a,children:o("tableDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":o("tableDialogCloseAria"),onClick:r,children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsx("div",{className:co.grid,role:"grid","aria-label":o("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:Bf},(N,K)=>Array.from({length:Bf},($,P)=>{const F=K+1,U=P+1,G=F<=f&&U<=g;return i.jsx("button",{type:"button",className:co.cell,role:"gridcell","data-active":G?"true":void 0,"aria-label":`${F} × ${U}`,"aria-pressed":G&&F===f&&U===g,disabled:t,onMouseEnter:()=>{k||D(F,U)},onClick:()=>{v(!0),D(F,U)}},`${F}-${U}`)}))}),i.jsxs("p",{className:co.sizeLabel,children:[o("tableDialogSize"),": ",f," × ",g]}),i.jsxs("div",{className:`${p.sizeRow} ${co.sizeFields}`,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:o("tableDialogRows")}),i.jsx("input",{id:s,className:co.numberInput,type:"number",inputMode:"numeric",min:ho,max:bo,step:1,value:b,disabled:t,onKeyDown:E,onChange:N=>T(N.target.value,"rows"),onBlur:()=>R(b,"rows")})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:o("tableDialogColumns")}),i.jsx("input",{id:u,className:co.numberInput,type:"number",inputMode:"numeric",min:ho,max:bo,step:1,value:x,disabled:t,onKeyDown:E,onChange:N=>T(N.target.value,"cols"),onBlur:()=>R(x,"cols")})]})]})]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:r,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!I,onClick:()=>{I&&n({rows:f,cols:g})},children:o("tableDialogInsert")})]})]})})})}const G_={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},q_={value:1,unit:"pt"},Z_={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 Y_({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=l.useId();return i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("tablePropertiesWidth")}),i.jsx(Qe,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:s=>n({...e,width:s})}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("tablePropertiesCollapse")}),i.jsxs("select",{id:o,className:p.select,value:e.borderCollapse,disabled:t,onChange:s=>{const u=s.target.value==="separate"?"separate":"collapse";n({...e,borderCollapse:u,borderSpacing:u==="separate"?e.borderSpacing:null})},children:[i.jsx("option",{value:"collapse",children:r("tablePropertiesCollapseCollapse")}),i.jsx("option",{value:"separate",children:r("tablePropertiesCollapseSeparate")})]})]}),e.borderCollapse==="separate"?i.jsx(Qe,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:s=>n({...e,borderSpacing:s})}):null]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:r("paragraphDialogBorderStyle")}),i.jsx("select",{id:a,className:p.select,value:e.border.style,disabled:t,onChange:s=>{const u=s.target.value;n({...e,border:{style:u,width:u==="none"?null:e.border.width??q_,color:u==="none"?null:e.border.color}})},children:Es.map(s=>i.jsx("option",{value:s,children:r(G_[s])},s))})]}),e.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Qe,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:s=>n({...e,border:{...e.border,width:s}})}),i.jsx(Qt,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:s=>n({...e,border:{...e.border,color:s}})})]}):null,i.jsx(Qe,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:s=>n({...e,borderRadius:s})}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:e.boxShadow!==null,disabled:t,onChange:()=>{n({...e,boxShadow:e.boxShadow?null:Z_})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?i.jsx(Cd,{shadow:e.boxShadow,disabled:t,onChange:s=>n({...e,boxShadow:s})}):null]})]})}function X_({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),$e(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:h=>h.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("tablePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx(Y_,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const J_=["left","center","right"],Q_={left:Ts,center:As,right:Rs},eM={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},tM={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},nM={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Ya(e){return{top:e,right:e,bottom:e,left:e}}function Bc(e){for(const t of st)if(e[t])return e[t];return null}function rM({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),a=l.useId(),s=l.useId(),[u,d]=l.useState(()=>On(e.padding,Ya(Bc(e.padding))));return l.useEffect(()=>{d(On(e.padding,Ya(Bc(e.padding))))},[e.padding]),i.jsxs("div",{className:p.body,children:[i.jsx(Qt,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:f=>n({...e,backgroundColor:f})}),i.jsx(Qt,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:f=>n({...e,color:f})}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:u,disabled:t,onChange:()=>{const f=!u;d(f),f&&n({...e,padding:Ya(Bc(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(u?["top"]:st).map(f=>i.jsx(Qe,{label:r(u?"paragraphDialogPadding":tM[f]),value:e.padding[f],disabled:t,onChange:h=>{const g=u?Ya(h):{...e.padding,[f]:h};n({...e,padding:g})}},f))})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":r("paragraphDialogAlignment"),children:J_.map(f=>{const h=Q_[f],g=(e.textAlign??"left")===f;return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":g,"aria-label":r(eM[f]),disabled:t,onClick:()=>{n({...e,textAlign:f==="left"?null:f})},children:i.jsx(h,{})},f)})})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:p.select,value:e.verticalAlign??"",disabled:t,onChange:f=>{const h=f.target.value;n({...e,verticalAlign:h||null})},children:[i.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),$s.map(f=>i.jsx("option",{value:f,children:r(nM[f])},f))]})]}),i.jsx(Qe,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:f=>n({...e,width:f})}),i.jsxs("div",{className:p.sizeRow,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:r("cellPropertiesColSpan")}),i.jsx("input",{id:a,className:p.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.colSpan,disabled:t,onChange:f=>{const h=Number.parseInt(f.target.value,10);n({...e,colSpan:Number.isFinite(h)?Math.max(1,h):1})}})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:r("cellPropertiesRowSpan")}),i.jsx("input",{id:s,className:p.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:f=>{const h=Number.parseInt(f.target.value,10);n({...e,rowSpan:Number.isFinite(h)?Math.max(1,h):1})}})]})]})]})}function oM({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),$e(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:h=>h.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("cellPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx(rM,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const iM={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},aM={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Xa(e){return{top:e,right:e,bottom:e,left:e}}function Fc(e){for(const t of st)if(e[t])return e[t];return null}function sM({value:e,disabled:t,onChange:n}){const r=J(),o=l.useId(),[a,s]=l.useState(()=>On(e.padding,Xa(Fc(e.padding))));return l.useEffect(()=>{s(On(e.padding,Xa(Fc(e.padding))))},[e.padding]),i.jsxs("div",{className:p.body,children:[i.jsx(Qt,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),i.jsx(Qt,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:u=>n({...e,color:u})}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const u=!a;s(u),u&&n({...e,padding:Xa(Fc(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(a?["top"]:st).map(u=>i.jsx(Qe,{label:r(a?"paragraphDialogPadding":iM[u]),value:e.padding[u],disabled:t,onChange:d=>{const f=a?Xa(d):{...e.padding,[u]:d};n({...e,padding:f})}},u))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:p.select,value:e.verticalAlign??"",disabled:t,onChange:u=>{const d=u.target.value;n({...e,verticalAlign:d||null})},children:[i.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),$s.map(u=>i.jsx("option",{value:u,children:r(aM[u])},u))]})]}),i.jsx(Qe,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}function lM({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=J(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),$e(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:h=>h.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("rowPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Ge,{})})]}),i.jsx(sM,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const cM="_backdrop_9d3gw_1",uM="_dialog_9d3gw_12",dM="_headerRow_9d3gw_29",mM="_header_9d3gw_29",fM="_close_9d3gw_44",pM="_body_9d3gw_66",gM="_frame_9d3gw_75",hM="_actions_9d3gw_83",bM="_action_9d3gw_83",Fn={backdrop:cM,dialog:uM,headerRow:dM,header:mM,close:fM,body:pM,frame:gM,actions:hM,action:bM};function yM(e){const t=ar(e);if(t.length<=1)return e;const n=[],r=[];for(const a of t){const s=ge(a);n.push(...s.hrefs),r.push(s.body)}const o=r.map((a,s)=>`<div class="wysiwyg-preview-page" style="${s===r.length-1?"display: block; break-inside: avoid; page-break-inside: avoid;":"display: block; break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid;"}">${a}</div>`).join("");return[...Array.from(new Set(n)).map(a=>`<link rel="stylesheet" href="${a}" />`),o].filter(Boolean).join("")}function xM({open:e,html:t,onClose:n}){const r=J(),o=l.useId(),a=l.useRef(null),s=l.useRef(null),u=l.useMemo(()=>yM(t),[t]);return $e(a,{open:e,onClose:n,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),l.useEffect(()=>{var f;if(!e)return;const d=(f=s.current)==null?void 0:f.contentDocument;d&&nu(d,u,r("previewDialogTitle"))},[e,u,r]),e?i.jsx(Pe,{children:i.jsx("div",{className:Fn.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:a,className:Fn.dialog,role:"dialog","aria-modal":"true","aria-labelledby":o,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:Fn.headerRow,children:[i.jsx("h2",{className:Fn.header,id:o,children:r("previewDialogTitle")}),i.jsx("button",{type:"button",className:Fn.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:i.jsx(Ge,{})})]}),i.jsx("div",{className:Fn.body,children:i.jsx("iframe",{ref:s,className:Fn.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var f;const d=(f=s.current)==null?void 0:f.contentDocument;d&&nu(d,u,r("previewDialogTitle"))}})}),i.jsx("div",{className:Fn.actions,children:i.jsx("button",{type:"button",className:Fn.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const wM="0.1.1",CM="_backdrop_72ox3_1",vM="_dialog_72ox3_12",kM="_headerRow_72ox3_30",SM="_header_72ox3_30",PM="_close_72ox3_46",AM="_body_72ox3_68",TM="_product_72ox3_76",RM="_meta_72ox3_82",DM="_description_72ox3_87",IM="_website_72ox3_92",jM="_cta_72ox3_97",EM="_link_72ox3_102",_M="_actions_72ox3_118",MM="_action_72ox3_118",Rt={backdrop:CM,dialog:vM,headerRow:kM,header:SM,close:PM,body:AM,product:TM,meta:RM,description:DM,website:IM,cta:jM,link:EM,actions:_M,action:MM};function NM({open:e,onClose:t}){const n=J(),r=l.useId(),o=l.useRef(null);return $e(o,{open:e,onClose:t,escapeIgnoreSelectors:!1,focusableSelector:'a[href], button:not([disabled]):not([tabindex="-1"])'}),e?i.jsx(Pe,{children:i.jsx("div",{className:Rt.backdrop,role:"presentation",onMouseDown:t,children:i.jsxs("div",{ref:o,className:Rt.dialog,role:"dialog","aria-modal":"true","aria-labelledby":r,onMouseDown:a=>a.stopPropagation(),children:[i.jsxs("div",{className:Rt.headerRow,children:[i.jsx("h2",{id:r,className:Rt.header,children:n("aboutDialogTitle")}),i.jsx("button",{type:"button",className:Rt.close,onClick:t,"aria-label":n("aboutDialogCloseAria"),children:i.jsx(Ge,{})})]}),i.jsxs("div",{className:Rt.body,children:[i.jsx("p",{className:Rt.product,children:n("brandMarkAria")}),i.jsx("p",{className:Rt.meta,children:n("aboutDialogVersion").replace("{version}",wM)}),i.jsx("p",{className:Rt.description,children:n("aboutDialogDescription")}),i.jsxs("div",{className:Rt.website,children:[i.jsx("p",{className:Rt.cta,children:n("aboutDialogWebsiteCta")}),i.jsx("a",{className:Rt.link,href:"https://commspliant.com/",target:"_blank",rel:"noopener noreferrer","aria-label":n("aboutDialogWebsiteAria"),children:n("aboutDialogWebsite")})]})]}),i.jsx("div",{className:Rt.actions,children:i.jsx("button",{type:"button",className:Rt.action,onClick:t,children:n("aboutDialogClose")})})]})})}):null}const LM="_backdrop_12fkg_1",BM="_dialog_12fkg_12",FM="_headerRow_12fkg_31",HM="_header_12fkg_31",zM="_close_12fkg_47",OM="_searchRow_12fkg_69",KM="_search_12fkg_69",$M="_body_12fkg_91",UM="_sidebar_12fkg_99",VM="_category_12fkg_111",WM="_topicList_12fkg_121",GM="_topicButton_12fkg_127",qM="_topicButtonActive_12fkg_147",ZM="_main_12fkg_157",YM="_articleTitle_12fkg_164",XM="_articleBody_12fkg_171",JM="_noResults_12fkg_176",QM="_related_12fkg_181",eN="_relatedTitle_12fkg_187",tN="_relatedList_12fkg_194",nN="_relatedButton_12fkg_200",rN="_relatedItem_12fkg_223",ze={backdrop:LM,dialog:BM,headerRow:FM,header:HM,close:zM,searchRow:OM,search:KM,body:$M,sidebar:UM,category:VM,topicList:WM,topicButton:GM,topicButtonActive:qM,main:ZM,articleTitle:YM,articleBody:XM,noResults:JM,related:QM,relatedTitle:eN,relatedList:tN,relatedButton:nN,relatedItem:rN};function oN(e){return{getStarted:"helpCategoryGetStarted",file:"helpCategoryFile",edit:"helpCategoryEdit",insert:"helpCategoryInsert",format:"helpCategoryFormat",table:"helpCategoryTable",view:"helpCategoryView",keyboard:"helpCategoryKeyboard"}[e]}function iN({open:e,topicId:t,onTopicChange:n,onClose:r}){const o=J(),a=l.useId(),s=l.useRef(null),[u,d]=l.useState("");$e(s,{open:e,onClose:r,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),l.useEffect(()=>{e||d("")},[e]);const f=l.useMemo(()=>Su.map(b=>({id:b.id,title:o(b.titleKey),body:o(b.bodyKey),keywords:o(b.keywordsKey)})),[o]),h=l.useMemo(()=>{const b=XI(f,u);return new Set(b.map(w=>w.id))},[u,f]),g=xp[t],y=u.trim().length>0&&h.size===0;return e?i.jsx(Pe,{children:i.jsx("div",{className:ze.backdrop,role:"presentation",onMouseDown:r,children:i.jsxs("div",{ref:s,className:ze.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:ze.headerRow,children:[i.jsx("h2",{id:a,className:ze.header,children:o("helpDialogTitle")}),i.jsx("button",{type:"button",className:ze.close,onClick:r,"aria-label":o("helpDialogCloseAria"),children:i.jsx(Ge,{})})]}),i.jsx("div",{className:ze.searchRow,children:i.jsx("input",{type:"search",className:ze.search,value:u,onChange:b=>d(b.target.value),placeholder:o("helpDialogSearchPlaceholder"),"aria-label":o("helpDialogSearchAria")})}),i.jsxs("div",{className:ze.body,children:[i.jsx("aside",{className:ze.sidebar,"aria-label":o("helpDialogContentsAria"),children:ZI.map(b=>{const w=Su.filter(x=>x.category===b&&h.has(x.id));return w.length===0?null:i.jsxs("div",{children:[i.jsx("h3",{className:ze.category,children:o(oN(b))}),i.jsx("ul",{className:ze.topicList,children:w.map(x=>i.jsx("li",{children:i.jsx("button",{type:"button",className:`${ze.topicButton}${x.id===t?` ${ze.topicButtonActive}`:""}`,onClick:()=>n(x.id),children:o(x.titleKey)})},x.id))})]},b)})}),i.jsx("div",{className:ze.main,children:y?i.jsx("p",{className:ze.noResults,children:o("helpDialogNoResults")}):i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:ze.articleTitle,children:o(g.titleKey)}),i.jsx("p",{className:ze.articleBody,children:o(g.bodyKey)}),g.related.length>0?i.jsxs("div",{className:ze.related,children:[i.jsx("h4",{className:ze.relatedTitle,children:o("helpDialogRelatedTitle")}),i.jsx("ul",{className:ze.relatedList,children:g.related.map(b=>{const w=xp[b];return!w||!h.has(b)?null:i.jsx("li",{className:ze.relatedItem,children:i.jsx("button",{type:"button",className:ze.relatedButton,onClick:()=>n(b),children:o(w.titleKey)})},b)})})]}):null]})})]})]})})}):null}function hy(e){return{catalog:e.catalog,layout:e.layout,commands:e.commands,queries:e.queries,queryRevisions:e.queryRevisions??Jb(),disabled:e.disabled,chromeLock:e.chromeLock}}function aN(e,t){for(const n of Object.keys(e)){const r=e[n],o=t[n];if(!(typeof r=="function"&&typeof o=="function")&&r!==o)return!1}return!0}const sN=l.memo(function({menuVisible:t,captureChromeSelection:n,displayCatalog:r,displayLayout:o,commands:a,queries:s,queryRevisions:u,chromeDisabled:d,chromeLock:f,contentLocked:h,customizeToolbarOpen:g,baseCatalog:y,allowedLayout:b,toolbarSettings:w,toolbarSettingsLoading:x,toolbarSettingsBusy:S,onCustomizeToolbarClose:k,onToolbarSettingsChange:v,onToolbarSettingsReset:A,documentPreview:I,onDocumentPreviewClose:D,helpDialog:R,onHelpDialogClose:T,onHelpTopicChange:E,aboutDialogOpen:N,onAboutDialogClose:K,compatibilityPanelOpen:$=!1,capabilitiesValidation:P=null,onCompatibilityPanelClose:F,isToolbarItemAllowed:U,fontDialog:G,fontSizeState:me,markState:se,fontFamilyState:V,fontColorState:re,highlightColorState:de,fontFaces:oe,onFontDialogTabChange:_,onFontDialogClose:Q,onApplyFontProperties:ye,paragraphDialog:ee,customBackgroundImagePicker:Z,disableBuiltinBackgroundImageSources:Ee,onParagraphCustomImagePick:et,onParagraphDialogTabChange:qe,onParagraphDialogClose:lt,onApplyParagraphProperties:ct,customCssDialog:St,onCustomCssDialogClose:mn,onApplyCustomCss:ut,pageDialog:Y,enablePageProperties:ce,onPageCustomImagePick:we,onPageDialogTabChange:Le,onPageDialogClose:en,onApplyPageProperties:tn,onPageDialogResetAtRule:nn,deletePageConfirmOpen:dt,onDeletePageConfirmClose:Rn,onDeletePageConfirm:Dn,customStyleDialog:tt,canDeleteCustomParagraphStyle:Gr,customStyleBusy:qr,onCustomStyleDialogClose:Ze,onCustomStyleSave:xr,onCustomStyleDelete:Be,linkDialog:Oe,onLinkDialogTabChange:Pt,onLinkDialogClose:q,onApplyLink:te,bookmarkDialog:le,onBookmarkDialogClose:Ce,onApplyBookmark:Ye,imageDialogOpen:fn,customImagePicker:nt,customAudioPicker:rn,customVideoPicker:Un,onImageDialogClose:In,onApplyImage:mt,onImageDialogCustomPick:Me,audioDialogOpen:ft,onAudioDialogClose:pn,onApplyAudio:Gs,onAudioDialogCustomPick:Mi,youtubeDialogOpen:qs,onYoutubeDialogClose:pt,onApplyYoutube:Ni,onYoutubeDialogCustomPick:Mt,imageProperties:gn,onImagePropertiesTabChange:Vn,onImagePropertiesClose:Zs,onApplyImageProperties:_o,tableDialogOpen:Ys,onTableDialogClose:Li,onApplyTable:Wn,tableProperties:hn,onTablePropertiesClose:Mo,onApplyTableProperties:wr,cellProperties:B,onCellPropertiesClose:$t,onApplyCellProperties:Bi,rowProperties:Cr,onRowPropertiesClose:xt,onApplyRowProperties:vr}){const Fi=hy({catalog:r,layout:o,commands:a,queries:s,queryRevisions:u,disabled:d,chromeLock:f});return i.jsxs(i.Fragment,{children:[t?i.jsx("div",{className:Se.menuChrome,onPointerDownCapture:n,children:i.jsx(Pu,{...Fi,menuVisible:!0,toolbarVisible:!1})}):null,g?i.jsx(lR,{open:!0,catalog:y,groups:b.iconGroups,settings:w,loading:x,busy:S,disabled:h,isItemAllowed:U,onChange:v,onReset:A,onClose:k}):null,I.open?i.jsx(xM,{open:!0,html:I.html,onClose:D}):null,R.open?i.jsx(iN,{open:!0,topicId:R.topicId,onTopicChange:E,onClose:T}):null,N?i.jsx(NM,{open:!0,onClose:K}):null,$?i.jsx(jT,{open:!0,result:P,onClose:()=>F==null?void 0:F()}):null,G.open?i.jsx(LE,{open:!0,tab:G.tab,size:me.value,unit:me.unit,marks:se,fontFamily:V.value,fontFamilyMixed:V.mixed,fontColor:re.value,fontColorMixed:re.mixed,highlightColor:de.value,highlightColorMixed:de.mixed,fonts:oe,disabled:h,onTabChange:_,onApply:ye,onClose:Q}):null,ee.open?i.jsx(a_,{open:!0,tab:ee.tab,value:ee.value,backgroundImage:ee.backgroundImage,disabled:h,customImagePicker:Z,disableBuiltinBackgroundImageSources:Ee,onCustomImagePick:et,onTabChange:qe,onApply:ct,onClose:lt}):null,St.open?i.jsx(x_,{open:!0,value:St.value,disabled:h,onApply:ut,onClose:mn}):null,Y.open?i.jsx(p_,{open:!0,tab:Y.tab,initialParagraphTab:Y.paragraphTab,value:Y.value,fonts:oe,disabled:h,printTabVisible:ce,customImagePicker:Z,disableBuiltinBackgroundImageSources:Ee,onCustomImagePick:we,onTabChange:Le,onApply:tn,onResetAtRule:nn,onClose:en}):null,dt?i.jsx(g_,{open:!0,disabled:h,onClose:Rn,onConfirm:Dn}):null,tt.open?i.jsx(y_,{open:!0,mode:tt.mode,styleId:tt.mode==="edit"?tt.style.id:void 0,name:tt.mode==="edit"?tt.style.name:"",font:tt.mode==="edit"?tt.style.font:tt.font,paragraph:tt.mode==="edit"?tt.style.paragraph:tt.paragraph,canDelete:Gr,fonts:oe,busy:qr,disabled:h,onSave:xr,onDelete:Be,onClose:Ze}):null,Oe.open?i.jsx(H_,{open:!0,tab:Oe.tab,href:Oe.href,title:Oe.title,targetBlank:Oe.targetBlank,textDecorationNone:Oe.textDecorationNone,hoverMode:Oe.hoverMode,hoverColor:Oe.hoverColor,hoverHtml:Oe.hoverHtml,bookmarks:Oe.bookmarks,selectedBookmarkId:Oe.selectedBookmarkId,disabled:h,onTabChange:Pt,onApply:te,onClose:q}):null,le.open?i.jsx(C_,{open:!0,existingIds:le.existingIds,disabled:h,onApply:Ye,onClose:Ce}):null,fn?i.jsx(P_,{open:!0,disabled:h,customImagePicker:nt,onApply:mt,onCustomPick:Me,onClose:In}):null,ft?i.jsx(S_,{open:!0,disabled:h,customAudioPicker:rn,onApply:Gs,onCustomPick:Mi,onClose:pn}):null,qs?i.jsx(z_,{open:!0,disabled:h,customVideoPicker:Un,onApply:Ni,onCustomPick:Mt,onClose:pt}):null,gn.open?i.jsx(F_,{open:!0,tab:gn.tab,value:gn.value,aspectRatio:gn.aspectRatio,disabled:h,onTabChange:Vn,onApply:_o,onClose:Zs}):null,Ys?i.jsx(W_,{open:!0,disabled:h,onApply:Wn,onClose:Li}):null,hn.open?i.jsx(X_,{open:!0,value:hn.value,disabled:h,onApply:wr,onClose:Mo}):null,B.open?i.jsx(oM,{open:!0,value:B.value,disabled:h,onApply:Bi,onClose:$t}):null,Cr.open?i.jsx(lM,{open:!0,value:Cr.value,disabled:h,onApply:vr,onClose:xt}):null]})},aN);function lN({toolbarVisible:e,toolbarPos:t,captureChromeSelection:n,toolbarShellProps:r,children:o}){return i.jsxs("div",{className:Se.body,"data-icon-dock":e?t:void 0,children:[e&&(t==="top"||t==="left")?i.jsx("div",{className:Se.iconChrome,onPointerDownCapture:n,children:i.jsx(Pu,{...r,menuVisible:!1,toolbarVisible:!0,position:t})}):null,o,e&&(t==="bottom"||t==="right")?i.jsx("div",{className:Se.iconChrome,onPointerDownCapture:n,children:i.jsx(Pu,{...r,menuVisible:!1,toolbarVisible:!0,position:t})}):null]})}const by=l.createContext(null);function cN({value:e,children:t}){return i.jsx(by.Provider,{value:e,children:t})}function uN(){const e=l.useContext(by);if(!e)throw new Error("useEditorShellContext must be used within EditorShellProvider");return e}function dN(e,t){const n=l.useRef([]),r=l.useRef([]);return l.useMemo(()=>{const o=n.current,a=r.current,s=[];for(let u=0;u<e.length;u+=1){const d=e[u]??"";o[u]===d&&a[u]!==void 0?s.push(a[u]):s.push(ge(d).body)}return n.current=e,r.current=s,s},[e,t,e.length])}const mN="_panel_6xdnw_1",fN="_header_6xdnw_17",pN="_title_6xdnw_26",gN="_close_6xdnw_32",hN="_messages_6xdnw_48",bN="_empty_6xdnw_57",yN="_message_6xdnw_48",xN="_messageHeader_6xdnw_69",wN="_author_6xdnw_77",CN="_time_6xdnw_81",vN="_body_6xdnw_86",kN="_reply_6xdnw_92",SN="_input_6xdnw_100",PN="_post_6xdnw_111",Dt={panel:mN,header:fN,title:pN,close:gN,messages:hN,empty:bN,message:yN,messageHeader:xN,author:wN,time:CN,body:vN,reply:kN,input:SN,post:PN};function AN(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function TN({thread:e,locale:t,disabled:n,commentAuthor:r,panelRef:o,onPost:a,onClose:s}){const u=J(),[d,f]=l.useState(""),h=l.useRef(null);l.useEffect(()=>{var x;(x=h.current)==null||x.focus()},[e==null?void 0:e.id]);const g=!n&&r&&d.trim().length>0,y=l.useMemo(()=>(e==null?void 0:e.messages)??[],[e==null?void 0:e.messages]),b=y.length===0?u("commentPlaceholder"):u("commentReplyPlaceholder");if(!e)return null;const w=()=>{const x=d.trim();!x||!g||(a(x),f(""))};return Au.createPortal(i.jsxs("div",{ref:o,className:Dt.panel,role:"dialog","aria-label":u("commentPanelTitle"),children:[i.jsxs("div",{className:Dt.header,children:[i.jsx("h2",{className:Dt.title,children:u("commentPanelTitle")}),i.jsx("button",{type:"button",className:Dt.close,onClick:s,"aria-label":u("commentPanelCloseAria"),children:i.jsx(Ge,{})})]}),i.jsx("div",{className:Dt.messages,children:y.length===0?i.jsx("p",{className:Dt.empty,children:u("commentEmpty")}):y.map(x=>i.jsxs("article",{className:Dt.message,children:[i.jsxs("header",{className:Dt.messageHeader,children:[i.jsx("span",{className:Dt.author,children:x.userName}),i.jsx("time",{className:Dt.time,dateTime:x.createdAt,children:AN(x.createdAt,t)})]}),i.jsx("p",{className:Dt.body,children:x.message})]},x.id))}),i.jsxs("div",{className:Dt.reply,children:[i.jsx("textarea",{ref:h,className:Dt.input,value:d,onChange:x=>f(x.target.value),placeholder:b,rows:3,disabled:n||!r}),i.jsx("button",{type:"button",className:Dt.post,onClick:w,disabled:!g,children:u("commentPost")})]})]}),document.body)}const RN=l.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:o},a){const s=J();return i.jsx("textarea",{ref:a,className:`${Se.surface} ${Se.html}`,value:t,onChange:u=>n(u.target.value),placeholder:r,disabled:o,"aria-label":s("htmlEditorAria"),spellCheck:!1})}),DN="_shell_yvznc_1",IN="_scrollButton_yvznc_10",jN="_tabList_yvznc_48",EN="_tab_yvznc_48",_N="_tabActive_yvznc_86",uo={shell:DN,scrollButton:IN,tabList:jN,tab:EN,tabActive:_N},MN=5,jp=120;function NN({pageCount:e,activeIndex:t,onSelect:n}){const r=J(),o=l.useRef(null),[a,s]=l.useState(!1),[u,d]=l.useState(!1),f=e>=MN,h=l.useCallback(()=>{const b=o.current;if(!b)return;const{scrollLeft:w,scrollWidth:x,clientWidth:S}=b;s(w>1),d(w+S<x-1)},[]);l.useEffect(()=>{h()},[e,t,h]),l.useEffect(()=>{var x;const b=o.current;if(!b)return;const w=b.querySelector(`[data-page-tab="${t}"]`);(x=w==null?void 0:w.scrollIntoView)==null||x.call(w,{block:"nearest",inline:"nearest"}),h()},[t,h]),l.useEffect(()=>{const b=o.current;if(!b)return;const w=()=>h();if(b.addEventListener("scroll",w,{passive:!0}),typeof ResizeObserver>"u")return()=>{b.removeEventListener("scroll",w)};const x=new ResizeObserver(()=>h());return x.observe(b),()=>{b.removeEventListener("scroll",w),x.disconnect()}},[h]);const g=b=>{var w;(w=o.current)==null||w.scrollBy({left:b,behavior:"smooth"})},y=b=>r("htmlModePageTab").replace("{n}",String(b+1));return i.jsxs("div",{className:uo.shell,children:[f?i.jsx("button",{type:"button",className:uo.scrollButton,"aria-label":r("htmlModePageTabsScrollLeftAria"),disabled:!a,onClick:()=>g(-jp),children:"‹"}):null,i.jsx("div",{ref:o,className:uo.tabList,role:"tablist","aria-label":r("htmlModePageTabsAria"),children:Array.from({length:e},(b,w)=>i.jsx("button",{type:"button",role:"tab","data-page-tab":w,className:`${uo.tab} ${w===t?uo.tabActive:""}`,"aria-selected":w===t,tabIndex:w===t?0:-1,onClick:()=>n(w),children:y(w)},w))}),f?i.jsx("button",{type:"button",className:uo.scrollButton,"aria-label":r("htmlModePageTabsScrollRightAria"),disabled:!u,onClick:()=>g(jp),children:"›"}):null]})}function LN(e,t,n=!0){const[r,o]=l.useState(null),[a,s]=l.useState(xd()),u=l.useCallback(()=>{!n||!e||(o(sy(e,t)),s(Ss(e)))},[n,e,t]);return l.useLayoutEffect(()=>{if(!n)return;const d=requestAnimationFrame(u);return()=>cancelAnimationFrame(d)},[n,u]),l.useLayoutEffect(()=>{if(!n||!e||typeof ResizeObserver>"u")return;const d=new ResizeObserver(()=>u());return d.observe(e),()=>d.disconnect()},[n,e,u]),l.useLayoutEffect(()=>{if(!n||!e)return;const d=()=>{s(Ss(e))};return document.addEventListener("selectionchange",d),()=>document.removeEventListener("selectionchange",d)},[n,e]),{geometry:r,indentState:a,refresh:u}}const BN=l.forwardRef(function({html:t,pageHtml:n,onChange:r,placeholder:o,disabled:a,rulerVisible:s=!0,rulerUnit:u="in",zoomScale:d=1,onMarginChange:f,onMarginPreview:h,onIndentChange:g,onBeforeInput:y,propSyncGuardRef:b,resolveEmbeddedImageDataUrl:w,hydrateEmbeddedImages:x,onPointerDown:S,onMouseUp:k,onContextMenu:v,pageLayoutEnabled:A=!0},I){const D=J(),R=l.useRef(null),T=l.useRef(!1),[E,N]=l.useState(null),K=l.useRef(y);K.current=y;const $=n??t,P=A&&s&&Ri($),{geometry:F,indentState:U,refresh:G}=LN(E,$,P),me=V=>{R.current=V,N(V),typeof I=="function"?I(V):I&&(I.current=V)};l.useLayoutEffect(()=>{const V=R.current;if(!V)return;const re=cn(t),oe=V===document.activeElement&&T.current;if(T.current=!1,oe||ws(V,re,{resolveDataUrl:w,hydrateEmbeddedImages:x}),A&&(yt(V)||Ri($))){Yu(V),Ai(V),Bs(V);const _=yt(V);_&&Ug(V,_)}A&&(Ls(V),jo(V,$))},[t,$,A,w,x]),l.useLayoutEffect(()=>{if(b)return b.current=()=>{T.current=!0},()=>{b.current=null}},[b]),l.useLayoutEffect(()=>{const V=R.current;if(!V)return;const re=de=>{var oe;(oe=K.current)==null||oe.call(K,de)};return V.addEventListener("beforeinput",re),()=>V.removeEventListener("beforeinput",re)},[]);const se=i.jsx("div",{ref:me,className:`${Se.surface} ${Se.visual} ${P?Se.pageSurface:""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":D("visualEditorAria"),"aria-disabled":a||void 0,"data-placeholder":o,onPointerDown:S,onMouseUp:k,onContextMenu:v,onInput:V=>{const re=V.currentTarget;if(T.current=!0,yt(re)){const{absorbedBlocks:de}=Ai(re);if(r(re.innerHTML),de.length>0){const oe=de.length;requestAnimationFrame(()=>qg(re,oe))}}else r(re.innerHTML);P&&G()}});return i.jsx(vE,{showRulers:P,geometry:F,indentState:U,rulerUnit:u,zoomScale:d,onMarginChange:f,onMarginPreview:h,onIndentChange:g,children:se})}),FN="_frame_bwkh8_1",HN="_handle_bwkh8_9",zN="_handleEast_bwkh8_29",ON="_handleSouth_bwkh8_37",KN="_handleSouthEast_bwkh8_45",yi={frame:FN,handle:HN,handleEast:zN,handleSouth:ON,handleSouthEast:KN};function si(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const $N=[{handle:"e",className:yi.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:yi.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:yi.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function Hc(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function UN({img:e,onResize:t,onResizeEnd:n}){const r=J(),o=l.useRef(null),a=l.useRef(e),s=l.useRef(t),u=l.useRef(n),d=l.useRef(null);a.current=e,s.current=t,u.current=n;const f=k=>{const v=o.current;v&&(v.style.left=`${k.left}px`,v.style.top=`${k.top}px`,v.style.width=`${k.width}px`,v.style.height=`${k.height}px`)};l.useLayoutEffect(()=>{f(si(e));const k=()=>{e.isConnected&&f(si(e))};return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[e]);const h=(k,v)=>{const A=d.current,I=a.current;if(!A||!I)return;const D=Y0(A.handle,A.start,{x:k-A.originX,y:v-A.originY});s.current(D.width,D.height),I.isConnected&&f(si(I))},g=()=>{if(!d.current)return;d.current=null;const k=a.current;u.current(),k!=null&&k.isConnected&&f(si(k))};l.useLayoutEffect(()=>{const k=A=>{if(!d.current)return;const I=Hc(A);I&&h(I.x,I.y)},v=()=>{g()};return document.addEventListener("pointermove",k),document.addEventListener("pointerup",v),document.addEventListener("pointercancel",v),document.addEventListener("mousemove",k),document.addEventListener("mouseup",v),()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",v),document.removeEventListener("pointercancel",v),document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",v)}},[]);const y=(k,v)=>{const A=Hc(v);A&&(d.current={handle:k,start:X0(a.current),originX:A.x,originY:A.y})},b=k=>v=>{v.preventDefault(),v.stopPropagation(),y(k,v);try{v.currentTarget.setPointerCapture(v.pointerId)}catch{}},w=k=>v=>{v.preventDefault(),v.stopPropagation(),y(k,v)},x=k=>{const v=Hc(k);v&&h(v.x,v.y)};if(!e.isConnected)return null;const S=si(e);return Au.createPortal(i.jsx("div",{ref:o,className:yi.frame,"data-image-resize-overlay":"",style:{left:S.left,top:S.top,width:S.width,height:S.height},children:$N.map(k=>i.jsx("button",{type:"button",className:`${yi.handle} ${k.className}`,style:{cursor:k.cursor},"aria-label":r(k.ariaKey),"data-resize-handle":k.handle,onPointerDown:b(k.handle),onPointerMove:x,onPointerUp:g,onPointerCancel:g,onMouseDown:w(k.handle),onMouseMove:x,onMouseUp:g},k.handle))}),document.body)}function VN(e,t){for(const n of Object.keys(e)){const r=e[n],o=t[n];if(!(typeof r=="function"&&typeof o=="function")&&r!==o)return!1}return!0}function WN(){const e=J();return i.jsx("div",{className:Se.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}function GN({propsRef:e,pageStore:t,mode:n,enableMultiPages:r,contentLocked:o,activePageIndex:a,hasSelectedPage:s,pageZoomScale:u,rulerVisible:d,rulerUnit:f,optimizeEmbeddedImages:h,placeholder:g,controlledHtml:y,initialHtml:b,initialStorageHtml:w,defaultPages:x,ingestedPagesProp:S,onChange:k,fontFaces:v,enableComments:A,commentsVisible:I,disabled:D,locale:R,commentAuthor:T,activeThreadId:E,contextMenu:N,commentThreads:K,commands:$,htmlFileDropDragging:P,selectedImage:F,hiddenContextMenuCommands:U,pageLayoutEnabled:G=!0}){const{htmlRef:me,pagesRef:se,documentBridgeRef:V}=uN(),[re,de]=l.useState(w),[oe,_]=es({value:h?void 0:y,defaultValue:b,onChange:r||h?void 0:k}),Q=h?re:oe,[ye,ee]=l.useState(()=>r&&(e.current.htmlModePageHtmlRef.current||x[0])||""),Z=e.current;Z.setHtmlModePageHtml=ee,h?r||(me.current=re):me.current=oe,r&&(se.current=t.pages);const Ee=l.useCallback(()=>r?t.getJoinedHtml():h?re:oe,[r,oe,h,t,re]);l.useLayoutEffect(()=>{const Y={pageStore:t,setHtml:_,setStorageHtml:de,getEditorHtml:Ee,replacePagesFromHistory:ce=>t.replacePages([...ce])};return V.current=Y,()=>{V.current===Y&&(V.current=null)}},[V,Ee,t,_,de]);const et=l.useMemo(()=>{if(r){const Y=t.pages[a]??t.pages[0]??"";return uf(Y,v).join(`
319
319
  `)}return uf(Q,v).join(`
320
- `)},[r,t.pages,t.revision,a,Q,v]),qe=dN(r?t.pages:[],r?t.revision:0);l.useLayoutEffect(()=>{var ce;if(!r)return;const Y=(ce=e.current.multiPageVisualRef.current)==null?void 0:ce.getActivePageRoot();Y instanceof HTMLDivElement&&(e.current.visualRootRef.current=Y)},[r,a,qe.length,e]);const lt=l.useMemo(()=>r?qe[s?a:0]??"":he(Q).body,[r,qe,a,s,Q]),ct=l.useMemo(()=>Bg(it(lt)),[lt]);Z.activePageHtmlRef.current=lt,Z.pageCanvasSizedRef.current=ct,l.useEffect(()=>{const ce=(et?et.split(`
321
- `):[]).map(we=>{const Be=document.createElement("link");return Be.rel="stylesheet",Be.href=we,Be.setAttribute(Ds,""),document.head.append(Be),Be});return()=>{for(const we of ce)we.remove()}},[et]),l.useEffect(()=>{(!A||n!=="visual"||!j)&&e.current.setActiveThreadId(null)},[A,n,j,e]),l.useEffect(()=>{if(!E)return;const Y=ce=>{var tn;const we=e.current,Be=ce.target;if((tn=we.commentPanelRef.current)!=null&&tn.contains(Be))return;const en=we.visualRootRef.current;en&&cb(en,Be)||we.setActiveThreadId(null)};return document.addEventListener("pointerdown",Y),()=>document.removeEventListener("pointerdown",Y)},[E,e]),l.useEffect(()=>{if(!r||n!=="html")return;const Y=t.pages[a]??t.pages[0]??"";Z.htmlModePageHtmlRef.current=Y,ee(Y)},[r,n,t.pages,t.revision,a,Z]),l.useEffect(()=>{if(!A||n!=="visual")return;const Y=e.current.visualRootRef.current;Y&&(LP(Y,K),lb(Y,j))},[A,n,K,j,Q,e]);const St=n==="visual"&&d&&G&&ct,mn=l.useMemo(()=>E?zP(K,E):null,[E,K]),ut=n==="visual"?r?i.jsx(PE,{ref:Z.multiPageVisualRef,pages:qe,activePageIndex:a,hasSelectedPage:s,scrollRootRef:Z.workspaceRef,suppressPageFlushRef:Z.suppressPageFlushRef,pendingInsertPageFocusRef:Z.pendingInsertPageFocusRef,onActivePageIndexChange:Y=>{var Be;Z.activePageIndexRef.current=Y,Z.setActivePageIndex(Y);const ce=(Be=Z.multiPageVisualRef.current)==null?void 0:Be.getContainer(),we=ce?We(ce,Y):null;we instanceof HTMLDivElement&&(Z.visualRootRef.current=we)},onPageSelected:()=>{Z.setHasSelectedPage(!0)},onPageChange:(Y,ce)=>{const we=se.current[Y]??"";Z.recordPageVisualHtml(Y,Zt(ce,he(we).body),!0)},onPageFlush:(Y,ce)=>{const we=se.current[Y]??"";Z.recordPageVisualHtml(Y,Zt(ce,he(we).body),!1)},onBeforeInput:Z.handleVisualBeforeInput,onPointerDown:Y=>{if(Y.currentTarget instanceof HTMLDivElement&&(Z.visualRootRef.current=Y.currentTarget),Z.handleVisualPointerDown(Y),Y.currentTarget instanceof HTMLDivElement){const ce=Y.currentTarget;requestAnimationFrame(()=>vo(ce))}},onMouseUp:Z.handleVisualMouseUp,onContextMenu:Z.handleVisualContextMenu,placeholder:g,disabled:o,rulerVisible:d,rulerUnit:f,zoomScale:u,onMarginPreview:Z.multiPageRulerMarginPreview,onMarginChange:Z.multiPageRulerMarginChange,onIndentChange:Z.multiPageRulerIndentChange,resolveEmbeddedImageDataUrl:h?Z.resolveEmbeddedImageDataUrl:void 0,hydrateEmbeddedImages:h?Z.hydrateExportHtml:void 0,pageLayoutEnabled:G}):i.jsx(BN,{ref:Z.visualRootRef,html:he(Q).body,pageHtml:Q,rulerVisible:d,rulerUnit:f,zoomScale:u,pageLayoutEnabled:G,propSyncGuardRef:Z.visualPropSyncGuardRef,resolveEmbeddedImageDataUrl:h?Z.resolveEmbeddedImageDataUrl:void 0,hydrateEmbeddedImages:h?Z.hydrateExportHtml:void 0,onMarginPreview:Z.singlePageRulerMarginPreview,onMarginChange:Z.singlePageRulerMarginChange,onIndentChange:Z.singlePageRulerIndentChange,onChange:Y=>Z.recordVisualInputHtml(Y,!0),onBeforeInput:Z.handleVisualBeforeInput,onPointerDown:Y=>{if(Z.handleVisualPointerDown(Y),Y.currentTarget instanceof HTMLDivElement){const ce=Y.currentTarget;requestAnimationFrame(()=>vo(ce))}},onMouseUp:Z.handleVisualMouseUp,onContextMenu:Z.handleVisualContextMenu,placeholder:g,disabled:o}):i.jsxs("div",{className:Se.htmlModeShell,children:[r&&t.pages.length>1?i.jsx(NN,{pageCount:t.pages.length,activeIndex:a,onSelect:Z.handleHtmlPageTabSelect}):null,i.jsx(RN,{ref:Z.htmlAreaRef,html:r?xe:Q,onChange:Y=>{Z.htmlModePageHtmlRef.current=Y,ee(Y),Z.handleHtmlSurfaceChange(Y)},placeholder:g,disabled:o})]});return i.jsxs(i.Fragment,{children:[i.jsxs("div",{ref:Z.workspaceRef,className:`${Se.workspace} ${ct?Se.workspacePageSized:""} ${St?Se.workspaceWithRuler:""}`,onDragEnter:Z.htmlFileDrop.onDragEnter,onDragOver:Z.htmlFileDrop.onDragOver,onDragLeave:Z.htmlFileDrop.onDragLeave,onDrop:Z.htmlFileDrop.onDrop,children:[n==="visual"?i.jsx("div",{className:Se.pageCanvasViewport,"data-page-canvas-sized":ct?"":void 0,children:ut}):ut,Z.htmlFileDrop.dragging?i.jsx(WN,{}):null]}),n==="visual"&&!o&&(F!=null&&F.isConnected)?i.jsx(UN,{img:F,onResize:Z.handleImageResize,onResizeEnd:Z.handleImageResizeEnd}):null,A&&j&&mn?i.jsx(TN,{panelRef:Z.commentPanelRef,thread:mn,locale:R,disabled:D,commentAuthor:T,onPost:Z.postCommentMessage,onClose:()=>Z.setActiveThreadId(null)}):null,i.jsx(hw,{open:N.open,x:N.x,y:N.y,kind:N.kind,inTable:N.inTable,canMergeCells:N.canMergeCells,canUnmergeCells:N.canUnmergeCells,canDeletePage:N.canDeletePage,canAddComment:N.canAddComment,hiddenCommands:U,commands:$,onClose:()=>Z.setContextMenu(Y=>({...Y,open:!1}))})]})}const qN=l.memo(GN,VN),ZN=.005;function YN({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:o,onOpen:a,mode:s,defaultMode:u="visual",onModeChange:d,fullscreen:f,defaultFullscreen:h=!1,onFullscreenChange:g,placeholder:y,disabled:b,readOnly:w=!1,className:x,locale:S="en",toolbarBackground:k,workspaceBackground:v,menuColor:A,menuBackground:j,menuFontSize:D,menuFontFamily:R,border:T,menuVisible:E=!0,toolbarVisible:N=!0,allowedChrome:K,customActions:$,customFonts:P,transformHtml:F,sanitizeHtml:U=!0,loadCustomParagraphStyles:G,onSaveCustomParagraphStyle:me,onDeleteCustomParagraphStyle:se,customImagePicker:V,disableBuiltinImageInsert:re,customBackgroundImagePicker:de,disableBuiltinBackgroundImageInsert:oe,disableBuiltinBackgroundImageSources:_,customAudioPicker:Q,disableBuiltinAudioInsert:xe,customVideoPicker:ee,disableBuiltinVideoInsert:Z,disableHtmlFileDrop:Ee=!1,toolbarCustomization:et,darkMode:qe=!1,darkModePersistence:lt,toolbarPosition:ct="top",toolbarPositionPersistence:St,enablePageProperties:mn=!1,defaultPageProperties:ut,optimizeEmbeddedImages:Y=!1,enableMultiPages:ce=!1,pages:we,defaultPages:Be,onPagesChange:en,defaultRulerVisible:tn=!0,rulerUnit:nn="in",enableComments:dt=!1,defaultCommentsVisible:Rn=!0,commentAuthor:Dn,comments:tt,defaultComments:Gr=[],onCommentsChange:qr,renderingCapabilities:Ze,onCapabilitiesValidation:xr}){var tf;const Fe=!!(b||w),Oe=!!b,Pt=Ze?gd(Ze):!0,q=ce?we!==void 0:e!==void 0,te=ir(Be??(t.trim()?[t]:[nr()]));let le=te;!q&&ut&&Pt&&(le=te.map(c=>$f(c,ut))),Pt||(le=le.map(Rc));const Ce=l.useRef(null);Y&&Ce.current===null&&(Ce.current=kv());const Ye=l.useRef(null);Ye.current===null&&(Ye.current=Y&&Ce.current?le.map(c=>Ce.current.externalizeHtml(c)):[...le]);const fn=ce?zt(Ye.current):Ye.current[0]??"",nt=U?mo(fn):fn,rn=ce&&we!==void 0?zt(ir(we)):e,Un=l.useMemo(()=>{if(rn!==void 0)return U?mo(rn):rn},[rn,U]),jn=l.useRef(n);jn.current=n;const mt=l.useRef(Y);mt.current=Y;const Me=l.useCallback(c=>!mt.current||!Ce.current?c:Ce.current.externalizeHtml(c),[]),ft=l.useCallback(c=>!mt.current||!Ce.current?c:Ce.current.hydrateHtml(c),[]),pn=l.useCallback(c=>c.map(m=>ft(m)),[ft]),Gs=l.useCallback(c=>{var m;return((m=Ce.current)==null?void 0:m.getDataUrl(c))??null},[]),Mi=l.useCallback(c=>{var m;(m=jn.current)==null||m.call(jn,ft(c))},[ft]),[qs]=l.useState(()=>{if(Y&&e!==void 0&&!ce){const c=U?mo(e):e;return Ce.current?Ce.current.externalizeHtml(c):c}return nt}),[pt,Ni]=es({value:s,defaultValue:u,onChange:d}),[Mt,gn]=es({value:f,defaultValue:h,onChange:g}),[Vn,Zs]=l.useState(Rn),[_o,Ys]=l.useState(tn),Li=l.useRef(_o);Li.current=_o;const[Wn,hn]=l.useState(null),[Mo,wr]=es({value:tt,defaultValue:Gr,onChange:qr}),B=l.useRef(null),$t=l.useRef(null),Bi=l.useRef(null),Cr=l.useRef(null),xt=l.useRef(null),vr=l.useRef(!1),Fi=l.useRef(null),At=l.useRef(null),ye=l.useRef(ce);ye.current=ce;const Xs=l.useRef(ut);Xs.current=ut;const kd=l.useRef(Pt);kd.current=Pt;const Gn=l.useRef(dt);Gn.current=dt;const Sd=l.useRef(w);Sd.current=w;const Pd=l.useRef(Fe);Pd.current=Fe;const Hi=l.useRef(Vn);Hi.current=Vn;const zi=l.useRef(Mo);zi.current=Mo;const Oi=l.useRef(en);Oi.current=en;const Ki=l.useRef(null),$i=l.useRef(!1),Zr=l.useCallback(()=>{var m;$i.current=!1;const c=Ki.current;Ki.current=null,c&&((m=Oi.current)==null||m.call(Oi,c.pages,c.activePageIndex))},[]),Yr=l.useCallback((c,m)=>{Ki.current={pages:[...c],activePageIndex:m},!$i.current&&($i.current=!0,queueMicrotask(Zr))},[Zr]),Js=l.useRef(we);Js.current=we;const Ad=l.useMemo(()=>!Y||we===void 0?we:ir(we).map(c=>{var C;const m=U?mo(c):c;return((C=Ce.current)==null?void 0:C.externalizeHtml(m))??m}),[Y,we,U]),wt=EA({enabled:ce,pagesProp:Ad,defaultPages:Ye.current??[nr()]}),Xr=l.useRef(null),Td=l.useRef(null),[Jr,No]=l.useState(0),Ae=l.useRef(Jr);Ae.current=Jr;const In=l.useRef(ce?((tf=Ye.current)==null?void 0:tf[0])??"":""),Qr=l.useRef(!1),[Lo,kr]=l.useState(!1),on=l.useRef(Lo);on.current=Lo;const[Qs,yy]=l.useState(0),Rd=l.useRef(!1),Dd=l.useRef(!1),Nt=l.useMemo(()=>Jb(),[]),el=l.useRef(null);el.current===null&&(el.current=ce?NT(Ye.current??[nr()]):MT(Me(nt)));const ie=el.current,bn=l.useCallback(()=>{const c=ie.canUndo(),m=ie.canRedo();c===Rd.current&&m===Dd.current||(Rd.current=c,Dd.current=m,yy(C=>C+1))},[ie]),ae=l.useRef(nt),Re=l.useRef(Ye.current??[nr()]);ce&&(Re.current=wt.pages);const jd=l.useRef(""),Id=l.useRef(!1),Ut=l.useRef(!0),eo=l.useRef(""),En=l.useRef(null),L=l.useRef(pt);L.current=pt;const Ed=l.useRef(Mt);Ed.current=Mt;const Ue=l.useRef(null),[,xy]=l.useState(0),Bo=l.useRef(null);Bo.current===null&&(Bo.current=QP(()=>{xy(c=>c+1)}));const Ui=l.useRef(F);Ui.current=F;const _d=l.useRef(U);_d.current=U;const Vt=l.useRef({}),Lt=l.useRef(null),Wt=l.useRef(null),an=l.useRef(null),sn=l.useRef(null),qn=l.useRef(null),Bt=l.useRef(null),[Fo,tl]=l.useState(lr),nl=l.useRef(Fo);nl.current=Fo;const _n=l.useRef(xo),[Ho,Vi]=l.useState({value:null,unit:xo,mixed:!1}),Zn=l.useRef(Ho);Zn.current=Ho;const[zo,rl]=l.useState({value:null,mixed:!1}),Oo=l.useRef(zo);Oo.current=zo;const[Ko,ol]=l.useState({value:null,mixed:!1}),$o=l.useRef(Ko);$o.current=Ko;const[Uo,il]=l.useState({value:null,mixed:!1}),Vo=l.useRef(Uo);Vo.current=Uo;const[Wi,al]=l.useState({tag:null,mixed:!1}),sl=l.useRef(Wi);sl.current=Wi;const[Md,ll]=l.useState({align:"left",mixed:!1}),cl=l.useRef(Md);cl.current=Md;const[Nd,ul]=l.useState({type:null,mixed:!1}),Wo=l.useRef(Nd);Wo.current=Nd;const[Ld,dl]=l.useState(!1),Bd=l.useRef(Ld);Bd.current=Ld;const[Gi,ml]=l.useState(!1),fl=l.useRef(Gi);fl.current=Gi;const[qi,Fd]=l.useState(!1),Zi=l.useRef(qi);Zi.current=qi;const Yi=l.useRef(null),Xi=l.useRef(null),[Hd,zd]=l.useState(!1),Od=l.useRef(Hd);Od.current=Hd;const{fontDialog:Ji,setFontDialog:Qi,customizeToolbarOpen:pl,setCustomizeToolbarOpen:Kd,documentPreview:ea,setDocumentPreview:$d,toolbarSettings:gl,setToolbarSettings:ta,toolbarSettingsLoading:wy,setToolbarSettingsLoading:hl,toolbarSettingsBusy:Cy,setToolbarSettingsBusy:bl,paragraphDialog:Go,setParagraphDialog:to,customCssDialog:yl,setCustomCssDialog:xl,pageDialog:qo,setPageDialog:Sr,deletePageConfirmOpen:wl,setDeletePageConfirmOpen:Cl,customStyleDialog:vy,setCustomStyleDialog:Zo,linkDialog:vl,setLinkDialog:na,bookmarkDialog:Ud,setBookmarkDialog:kl,imageDialog:ky,setImageDialog:ra,audioDialog:Sy,setAudioDialog:oa,youtubeDialog:Py,setYoutubeDialog:Yo,imageProperties:Ay,setImageProperties:ia,tableDialog:Sl,setTableDialog:Pl,tableProperties:Al,setTableProperties:Tl,cellProperties:Rl,setCellProperties:Dl,rowProperties:jl,setRowProperties:Il,helpDialog:El,setHelpDialog:Xo,aboutDialogOpen:_l,setAboutDialogOpen:Vd}=IA(),[Ty,Wd]=l.useState(!1),[Ml,aa]=l.useState(null),Pr=l.useRef(xr);Pr.current=xr;const Tt=l.useMemo(()=>Ze?_b(Ze):void 0,[Ze]),[Yn,sa]=l.useState(()=>lt?qe:sp()??qe),[no,la]=l.useState(()=>St?ct:lp()??ct),[Jo,Ry]=l.useState(()=>BA()??"fitWidth"),[Nl,Dy]=l.useState(1),[ca,Gd]=l.useState([]),[ua,Ll]=l.useState(!1),[jy,da]=l.useState(!1),[Iy,Bl]=l.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1,canDeletePage:!1,canAddComment:!1}),[Ct,ro]=l.useState(null),Fl=l.useRef(Ct);Fl.current=Ct;const[ma,qd]=l.useState(!1),Zd=l.useRef(ma);Zd.current=ma;const[fa,Yd]=l.useState(!1),Xd=l.useRef(fa);Xd.current=fa;const[pa,Jd]=l.useState(!1),Qd=l.useRef(pa);Qd.current=pa;const em=l.useRef(void 0),ga=l.useRef(ca);ga.current=ca;const tm=l.useRef(ua);tm.current=ua;const ha=!!(G&&me),Hl=l.useRef(ha);Hl.current=ha;const nm=l.useRef(G);nm.current=G;const rm=l.useRef(me);rm.current=me;const om=l.useRef(se);om.current=se;const im=l.useRef(o);im.current=o;const am=l.useRef(a);am.current=a;const sm=l.useRef(V);sm.current=V;const Mn=de??V,lm=oe??re??!1,zl=_??re??!1,Ol=l.useRef(Mn);Ol.current=Mn;const Kl=l.useRef(lm);Kl.current=lm;const Ey=l.useRef(zl);Ey.current=zl;const cm=l.useRef(Q);cm.current=Q;const um=l.useRef(ee);um.current=ee;const dm=l.useRef(et);dm.current=et;const mm=l.useRef(lt);mm.current=lt;const fm=l.useRef(St);fm.current=St;const pm=l.useRef(Yn);pm.current=Yn;const gm=l.useRef(no);gm.current=no;const ba=l.useRef(Jo);ba.current=Jo;const ya=l.useRef(Nl);ya.current=Nl;const hm=l.useRef(re);hm.current=re;const bm=l.useRef(xe);bm.current=xe;const ym=l.useRef(Z);ym.current=Z;const $l=l.useRef(0),Qo=l.useRef(0),xm=l.useRef(0),xa=l.useRef(0),wm=l.useRef(0),wa=l.useRef(0),Cm=l.useRef(0),oo=l.useMemo(()=>Xp(P),[P]),io=l.useRef(oo);io.current=oo;const Ca=l.useCallback(()=>{var c;if(ye.current){const m=(c=xt.current)==null?void 0:c.getActivePageRoot();if(m instanceof HTMLElement)return m}return B.current},[]),yn=l.useCallback(()=>{var C;const c=B.current;if(c!=null&&c.hasAttribute(Kr)){const I=Cf(c);if(I!==null)return I}const m=(C=xt.current)==null?void 0:C.getActivePageIndex();return typeof m=="number"?m:Ae.current},[]),ei=l.useCallback(()=>{if(ye.current){const c=xt.current;if(!c)return null;const m=yn();if(m===null)return null;c.ensurePageMounted(m);const C=c.getContainer(),I=C?We(C,m):null;return I instanceof HTMLDivElement?(B.current=I,I):null}return B.current},[yn]),ao=l.useCallback(()=>{if(!ye.current)return ae.current;const c=yn()??Ae.current;return Re.current[c]??""},[yn]);l.useLayoutEffect(()=>{var m;if(!ce)return;const c=(m=xt.current)==null?void 0:m.getActivePageRoot();c instanceof HTMLDivElement&&(B.current=c)},[ce,Jr]);const va=l.useRef(()=>{}),Ul=l.useRef(!1),_y=l.useCallback(()=>{if(Ul.current||L.current!=="visual")return;const c=Cr.current;if(c){Ul.current=!0;try{const m=getComputedStyle(c),C=parseFloat(m.paddingLeft)+parseFloat(m.paddingRight),I=parseFloat(m.paddingTop)+parseFloat(m.paddingBottom),M=Math.max(0,c.clientWidth-C),z=Math.max(0,c.clientHeight-I);let X=0,ne=0;if(Id.current){const ge=QC(it(jd.current));ge&&(X=ge.width,ne=ge.height)}else{const ge=Ca(),Ne=ya.current>0?ya.current:1;X=((ge==null?void 0:ge.offsetWidth)??0)/Ne,ne=((ge==null?void 0:ge.offsetHeight)??0)/Ne}X<=0&&(X=M),ne<=0&&(ne=z);const pe=uk(ba.current,M,z,X,ne);Math.abs(pe-ya.current)>=ZN&&Dy(pe)}finally{Ul.current=!1}}},[Ca]);va.current=_y,l.useLayoutEffect(()=>{if(pt!=="visual")return;const c=Ca();!c||c!==document.activeElement||vo(c)},[pt,Jr,Ca]);const ka=l.useCallback(async()=>{const c=nm.current;if(!c)return;const m=++$l.current;Ll(!0);try{const C=await c();if(m!==$l.current)return;Gd(C)}catch{}finally{m===$l.current&&Ll(!1)}},[]);l.useEffect(()=>{if(!G||!me){Gd([]),Ll(!1);return}ka()},[G,me,ka]);const vm=l.useCallback(async c=>{ta(c);const m=dm.current;if(m!=null&&m.load&&m.save){const C=++xm.current;bl(!0);try{await m.save(c)}catch{}finally{C===xm.current&&bl(!1)}return}HT(c)},[]);l.useEffect(()=>{const c=et;if(!(c!=null&&c.load)||!c.save){ta(FT()),hl(!1),bl(!1);return}const m=++Qo.current;return hl(!0),(async()=>{try{const C=await c.load();if(m!==Qo.current)return;ta(C)}catch{if(m!==Qo.current)return;ta(null)}finally{m===Qo.current&&hl(!1)}})(),()=>{Qo.current+=1}},[et]);const km=l.useCallback(async c=>{sa(c);const m=mm.current;if(m!=null&&m.load&&m.save){const C=++wm.current;try{await m.save(c)}catch{}finally{if(C!==wm.current)return}return}MA(c)},[]),Sm=l.useCallback(c=>{ba.current=c,Ry(c),FA(c);const m=Cr.current;m&&(m.scrollTop=0,m.scrollLeft=0),va.current()},[]);l.useEffect(()=>{const c=lt;if(!(c!=null&&c.load)||!c.save){sa(sp()??qe);return}const m=++xa.current;return(async()=>{try{const C=await c.load();if(m!==xa.current)return;sa(typeof C=="boolean"?C:qe)}catch{if(m!==xa.current)return;sa(qe)}})(),()=>{xa.current+=1}},[lt,qe]),l.useLayoutEffect(()=>{if(va.current(),pt!=="visual")return;const c=Cr.current;if(!c||typeof ResizeObserver>"u")return;const m=dk(()=>{va.current()}),C=new ResizeObserver(()=>{m.schedule()});return C.observe(c),()=>{C.disconnect(),m.cancel()}},[pt,Jr,Jo,ce]);const Pm=l.useCallback(async c=>{la(c);const m=fm.current;if(m!=null&&m.load&&m.save){const C=++Cm.current;try{await m.save(c)}catch{}finally{if(C!==Cm.current)return}return}zA(c)},[]);l.useEffect(()=>{const c=St;if(!(c!=null&&c.load)||!c.save){la(lp()??ct);return}const m=++wa.current;return(async()=>{try{const C=await c.load();if(m!==wa.current)return;la(jb(C)??ct)}catch{if(m!==wa.current)return;la(ct)}})(),()=>{wa.current+=1}},[St,ct]);const Xn=l.useCallback((c,m)=>{var ne,pe;const C=_d.current?mo(c):c,I=((ne=Ui.current)==null?void 0:ne.call(Ui,C))??C,M=fb(ae.current,I,ft);m!=null&&m.fullReplace&&!M&&mt.current&&((pe=Ce.current)==null||pe.clear());const z=Me(I);if(M)return ae.current=z,{stored:z,stateUpdated:!1};z!==ae.current&&(Ut.current=!0);const X=Xr.current;if(ye.current){const ge=wt;if(!ge)return ae.current=z,{stored:z,stateUpdated:!1};const Ne=ge.replacePages(ar(z));return ae.current=Ne.joined,Re.current=Ne.pages,L.current==="html"&&!mt.current&&(X==null||X.setHtml(z)),Yr(pn(Ne.pages),Ae.current),{stored:z,stateUpdated:!0}}return mt.current?(ae.current=z,X==null||X.setStorageHtml(z),Mi(z),{stored:z,stateUpdated:!0}):(ae.current=z,X==null||X.setHtml(z),{stored:z,stateUpdated:!0})},[Me,ft,pn,Mi,Yr]),Gt=l.useCallback((c,m,C,I)=>{var ne;const M=c.map(pe=>Me(pe)),z=wt;if(!z)return zt(M);const X=z.setPages(M,{editedIndex:C});if(!X.changed)return X.joined;if(Re.current=X.pages,Ut.current=!0,ae.current=X.joined,Js.current===void 0&&L.current==="html"&&!mt.current&&((ne=Xr.current)==null||ne.setHtml(X.joined)),Yr(pn(X.pages),Ae.current),!(I!=null&&I.skipHistory)&&qt(ie)){const{changedIndices:pe,pages:ge}=X;if(pe.length===1){const Ne=C??pe[0];ie.recordPageEdit(Ne,ge[Ne]??"",{coalesce:m})}else pe.length>1?ie.recordReplaceAll(ge):C!==void 0?ie.recordPageEdit(C,ge[C]??"",{coalesce:m}):ie.recordReplaceAll(ge)}return bn(),X.joined},[bn,Me,pn,ie,wt,Yr]),Jn=l.useCallback(c=>{var z,X;if(L.current!=="visual")return;const m=mt.current?ne=>{var pe;return((pe=Ce.current)==null?void 0:pe.getDataUrl(ne))??null}:void 0,C=mt.current?ft:void 0;if((z=$t.current)==null||z.call($t),ye.current){const ne=(X=xt.current)==null?void 0:X.getContainer();if(!ne)return;const pe=ar(c);for(let ge=0;ge<pe.length;ge+=1){const Ne=We(ne,ge);if(!Ne)continue;const Le=cn(he(pe[ge]??"").body);ws(Ne,Le,{resolveDataUrl:m,hydrateEmbeddedImages:C})}return}const I=B.current;if(!I)return;const M=cn(he(c).body);ws(I,M,{resolveDataUrl:m,hydrateEmbeddedImages:C})},[ft]),gt=l.useCallback((c,m)=>{const{stored:C,stateUpdated:I}=Xn(c,{fullReplace:!m});return!m&&I&&Jn(C),qt(ie)?ie.recordReplaceAll(ar(C)):ie.record(C,{coalesce:m}),bn(),C},[bn,Xn,ie,Jn]),My=l.useCallback(c=>{if(ye.current){const m=Ae.current,I=Re.current.slice();I[m]=c,Gt(I,!1,m);return}gt(c,!1)},[Gt,gt]),Am=ET({enabled:!Fe&&!Ee,onHtml:My}),ve=l.useCallback((c,m)=>{var C;return(C=$t.current)==null||C.call($t),gt(ri(c,Oa(c,ae.current,io.current,{liveRoot:B.current??void 0})),m)},[gt]),Ny=l.useCallback((c,m)=>ve(Zt(c,ae.current),m),[ve]),Sa=l.useCallback((c,m,C)=>{iv(c,m,C)},[]),Pa=l.useCallback((c,m,C)=>{const I={...ui(c),atRule:it(Hg(m,C))};return pu(c,I)},[]),Ar=l.useCallback((c,m,C)=>ri(c,Oa(c,m,io.current,{liveRoot:C})),[]),ht=l.useCallback(c=>{const m=xt.current,C=m==null?void 0:m.getContainer(),I=wt.pages.length>0?wt.pages:Re.current;if(!C||!m)return[...I];const M=wt;if(!M)return[...I];const z=M.dirtyPagesRef.current,X=(c==null?void 0:c.allPages)===!0,ne=Ae.current;let pe=!1;const ge=I.map((Le,rt)=>{if(!(X||z.has(rt)||rt===ne))return Le;const Bn=We(C,rt);let lo=null;if(Bn?(Bs(Bn),lo=Bn.innerHTML):lo=m.flushPageHtml(rt),lo===null){const rf=cn(he(Le).body),of=_f(rf);if(of===rf)return Le;const af=Ar(Zt(of,he(Le).body),Le);return af!==Le&&(pe=!0),af}const sx=Zt(lo,he(Le).body),nf=Ar(sx,Le,Bn??void 0);return nf!==Le&&(pe=!0),nf});if(pe){const Le=mt.current?ge.map(jr=>Me(jr)):ge,rt=M.setPages(Le);ae.current=rt.joined}M.markPagesClean();const Ne=pe?M.pages:I;return mt.current?Ne.map(Le=>Me(Le)):[...Ne]},[Me,wt,Ar]),Tr=l.useCallback((c,m,C)=>{const I=Ar(m,Re.current[c]??""),M=Xc(Re.current,c,I);M.changed&&Gt(M.pages,C,c)},[Gt,Ar]),Rr=l.useCallback((c,m,C)=>{const I=Re.current[c]??"",M=he(m).body,z=_f(M),X=z===M?m:Ar(Zt(z,he(I).body),I),ne=Xc(Re.current,c,X);ne.changed&&Gt(ne.pages,C,c)},[Gt,Ar]),ti=l.useCallback((c,m)=>{const C=he(c).body;ye.current?Tr(Ae.current,C,m):ve(C,m)},[Tr,ve]),fe=l.useCallback((c,m,C)=>{var X;const I=C?he(C).body:c.innerHTML,M=ne=>C?I:Zt(I,he(ne).body);if(!ye.current){ve(M(ae.current),m);return}const z=(X=xt.current)==null?void 0:X.getContainer();if(!z){ve(M(ae.current),m);return}for(let ne=0;ne<Re.current.length;ne+=1)if(We(z,ne)===c){Tr(ne,M(Re.current[ne]??""),m);return}ve(M(ae.current),m)},[Tr,ve]),Tm=l.useCallback((c,m)=>{Sd.current||fe(c,m)},[fe]),Ly=l.useMemo(()=>AE(()=>B.current,()=>ae.current,Sa),[Sa]),By=l.useMemo(()=>TE(()=>B.current,()=>ae.current,Pa,c=>ve(he(c).body,!1)),[Pa,ve]),Fy=l.useMemo(()=>Sp(()=>B.current,nn??"in",c=>fe(c,!1)),[nn,fe]),Hy=l.useMemo(()=>RE(c=>{var C;const m=(C=xt.current)==null?void 0:C.getContainer();return m?We(m,c):null},c=>Re.current[c]??"",Sa),[Sa]),zy=l.useMemo(()=>DE(c=>{var C;const m=(C=xt.current)==null?void 0:C.getContainer();return m?We(m,c):null},c=>Re.current[c]??"",Pa,(c,m)=>Tr(c,he(m).body,!1)),[Pa,Tr]),Oy=l.useMemo(()=>Sp(()=>{var m;const c=(m=xt.current)==null?void 0:m.getContainer();return c?We(c,Ae.current):null},nn??"in",c=>fe(c,!1)),[nn,fe]),Aa=l.useCallback(()=>{const c=ye.current?ht():[ae.current];return c[Ae.current]??c[0]??""},[ht]),Dr=l.useCallback(()=>{if(!ye.current)return[ae.current];if(L.current==="html"){const c=Re.current.slice();return c[Ae.current]=In.current,c}return ht({allPages:!0})},[ht]),Ta=l.useCallback(c=>{if(!ye.current||L.current!=="visual"||!on.current)return;vr.current=!0;const m=ht(),C=Math.max(0,Math.min(c,m.length)),I=[...m],M=kd.current&&Xs.current?$f(nr(),Xs.current):nr();I.splice(C,0,M);const z=I.map(X=>Me(X));Gt(I,!1,void 0,{skipHistory:!0}),qt(ie)&&ie.recordInsertPage(C,z),Ae.current=C,No(C),kr(!0),Fi.current=C},[ht,Gt,ie,Me]),Rm=l.useCallback(()=>{const c=yn();c===null||!on.current||Ta(c)},[Ta,yn]),Dm=l.useCallback(()=>{const c=yn();c===null||!on.current||Ta(c+1)},[Ta,yn]),jm=l.useCallback(()=>{if(!ye.current||L.current!=="visual"||!on.current)return;vr.current=!0;const c=ht();if(c.length<=1){vr.current=!1;return}const m=yn();if(m===null){vr.current=!1;return}const C=c[m]??"",I=c.filter((ne,pe)=>pe!==m),M=Me(C),z=I.map(ne=>Me(ne));Gt(I,!1,void 0,{skipHistory:!0}),qt(ie)&&ie.recordDeletePage(m,M,z);const X=Math.min(m,I.length-1);Ae.current=X,No(X),kr(!0)},[ht,Gt,ie,yn,Me]);l.useEffect(()=>{ce||kr(!1)},[ce]),l.useEffect(()=>()=>{Ki.current&&($i.current=!1,Zr())},[Zr]);const Ra=l.useCallback(c=>{var I,M;const m=wt.replacePages([...c]);ae.current=m.joined,Re.current=m.pages,Ut.current=!0,Yr(pn(m.pages),Ae.current);const C=Math.max(0,Math.min(Ae.current,m.pages.length-1));C!==Ae.current&&(Ae.current=C,No(C)),Js.current===void 0&&L.current==="html"&&!mt.current&&((I=Xr.current)==null||I.setHtml(m.joined)),(M=$t.current)==null||M.call($t),Jn(m.joined),qt(ie)&&ie.applyPresent(m.pages)},[pn,ie,wt,Yr,Jn]),Da=l.useCallback(()=>{if(L.current!=="visual"||Fe){ro(null);return}const c=B.current;if(!c)return;const m=sr(c);ro(C=>m||(C&&C.isConnected&&c.contains(C)?C:null))},[Fe]),ja=l.useCallback(()=>{if(qt(ie)){const m=ie.undo();if(m===null)return;ie.markApplying(),Ra(m),bn();return}const c=ie.undo();c!==null&&(ie.markApplying(),Xn(c,{fullReplace:!0}),Jn(c),ie.finishApplying(),Da(),bn())},[Ra,bn,Xn,ie,Da,Jn]),Ia=l.useCallback(()=>{if(qt(ie)){const m=ie.redo();if(m===null)return;ie.markApplying(),Ra(m),bn();return}const c=ie.redo();c!==null&&(ie.markApplying(),Xn(c,{fullReplace:!0}),Jn(c),ie.finishApplying(),Da(),bn())},[Ra,bn,Xn,ie,Da,Jn]);l.useEffect(()=>{if(ce){qt(ie)&&(we!==void 0&&!Y?ie.syncPages(Re.current):ie.applyPresent(Re.current));return}qt(ie)||ie.syncExternal(ae.current)},[ce,Y,ie,we]);const H=l.useCallback(()=>{Ue.current=wn({mode:L.current,visualEl:B.current,htmlEl:At.current})},[]),xn=l.useCallback(c=>{if(!c||L.current!=="visual"){qd(!1),Yd(!1),Jd(!1);return}qd(ad(c)!==null),Yd(Hf(c)),Jd(zf(c))},[]),Ea=l.useCallback(()=>{const c=wn({mode:L.current,visualEl:B.current,htmlEl:At.current}),m=Ue.current;Uc(m,c)||(Ue.current=c)},[]),Vl=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){Vi({value:null,unit:_n.current,mixed:!1});return}const m=kh(c,_n.current);Lt.current&&(m.value=Lt.current.value,m.unit=Lt.current.unit,m.mixed=!1),_n.current=m.unit,Vi(C=>C.value===m.value&&C.unit===m.unit&&C.mixed===m.mixed?C:m)},[]),Wl=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){rl({value:null,mixed:!1});return}const m=tg(c);Wt.current&&(m.value=Wt.current.value,m.mixed=!1),rl(C=>C.value===m.value&&C.mixed===m.mixed?C:m)},[]),Gl=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){ol({value:null,mixed:!1}),il({value:null,mixed:!1});return}const m=os(c,"color");an.current&&(m.value=an.current.value,m.mixed=!1);const C=os(c,"backgroundColor");sn.current&&(C.value=sn.current.value,C.mixed=!1),ol(I=>I.value===m.value&&I.mixed===m.mixed?I:m),il(I=>I.value===C.value&&I.mixed===C.mixed?I:C)},[]),ql=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){al({tag:null,mixed:!1});return}const m=tS(c);al(C=>C.tag===m.tag&&C.mixed===m.mixed?C:m)},[]),Zl=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){ll({align:null,mixed:!1}),ul({type:null,mixed:!1}),dl(!1),zd(!1);return}const m=Xh(c);ll(z=>z.align===m.align&&z.mixed===m.mixed?z:m);const C=Lh(c);ul(z=>z.type===C.type&&z.mixed===C.mixed?z:C);const I=dS(c);dl(z=>z===I?z:I);const M=yP(c);zd(z=>z===M?z:M)},[]),O=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){tl(lr()),ml(!1),Vl(),Wl(),Gl(),ql(),Zl();return}const m=Ue.current,C=!!(m&&!m.collapsed);ml(M=>M===C?M:C);const I=Rh(go(c),Vt.current);tl(M=>_k(M,I)?M:I),Vl(),Wl(),Gl(),ql(),Zl()},[Vl,Wl,Gl,ql,Zl]),Im=l.useCallback(()=>{const c=Ue.current,m=Bt.current;!m||!c||c.collapsed&&c.start===m.start&&c.end===m.end||(Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,qn.current=null,Bt.current=null)},[]);l.useEffect(()=>{if(pt==="visual"){O();return}Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,qn.current=null,Bt.current=null,tl(lr()),Vi({value:null,unit:_n.current,mixed:!1}),rl({value:null,mixed:!1}),ol({value:null,mixed:!1}),il({value:null,mixed:!1}),al({tag:null,mixed:!1}),ll({align:null,mixed:!1}),ul({type:null,mixed:!1}),dl(!1),ml(!1)},[pt,O]);const ni=l.useCallback((c,m,C)=>{pf({snapshot:c,visualEl:B.current,htmlEl:At.current,getHtml:()=>L.current==="visual"&&B.current?B.current.innerHTML:ae.current,setHtml:I=>{if(L.current==="visual"){const M=ye.current?Re.current[Ae.current]??"":ae.current;ti(Zt(he(I).body,he(M).body),!1);return}gt(I,!1)},content:m,asHtml:C})},[gt,ti]),Ky=l.useCallback(c=>{if(!ye.current||c===Ae.current)return;Qr.current&&Rr(Ae.current,In.current,!0),Qr.current=!1,Ae.current=c,No(c);const m=Re.current[c]??"";In.current=m},[Rr]),$y=l.useCallback(c=>{if(Qr.current=!0,ye.current){if(mt.current){const m=Me(c);In.current=m,Rr(Ae.current,m,!0)}else In.current=c,Rr(Ae.current,c,!0);return}gt(c,!0)},[Me,gt,Rr]),Em=l.useCallback(c=>{var m;if(L.current==="visual"&&c==="html"){if(ye.current){const C=ht({allPages:!0}),I=Ae.current,M=C[I]??C[0]??"";In.current=M,Qr.current=!1,ae.current=zt(C),Zr()}else if(B.current){const C=Zt(B.current.innerHTML,he(ae.current).body),I=ri(C,Oa(C,ae.current,io.current,{liveRoot:B.current??void 0}));if(mt.current){const M=Me(I),z=ae.current;(m=Xr.current)==null||m.setStorageHtml(M),ae.current=M,M!==z&&(Ut.current=!0,qt(ie)||ie.record(M,{coalesce:!0}))}else I!==ae.current&&gt(I,!0)}}L.current==="html"&&c==="visual"&&ye.current&&(Qr.current&&Rr(Ae.current,In.current,!0),Qr.current=!1),Ni(c),c!=="visual"&&kr(!1)},[Me,Zr,ie,gt,Rr,Ni,ht]);l.useEffect(()=>{if(!Mt)return;const c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c}},[Mt]),l.useEffect(()=>{if(!Mt)return;const c=m=>{m.key==="Escape"&&(m.defaultPrevented||Ji.open||yl.open||Go.open||qo.open||wl||Sl.open||Al.open||Rl.open||jl.open||pl||ea.open||El.open||_l||(m.preventDefault(),gn(!1)))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[Mt,gn,Ji.open,yl.open,Go.open,qo.open,wl,Sl.open,Al.open,Rl.open,jl.open,pl,ea.open,El.open,_l]),l.useEffect(()=>{const c=()=>{if(L.current!=="visual"||!B.current)return;const m=window.getSelection();if(!m||m.rangeCount===0)return;const C=m.anchorNode;!C||!B.current.contains(C)&&B.current!==C||En.current===null&&(En.current=window.requestAnimationFrame(()=>{var M;En.current=null;const I=B.current;if(!(!I||L.current!=="visual")&&(H(),Im(),O(),ro(sr(I)),xn(I),Gn.current&&Hi.current&&!((M=Bi.current)!=null&&M.contains(document.activeElement)))){const z=Ue.current;z&&hn(qf(I,z))}}))};return document.addEventListener("selectionchange",c),()=>{document.removeEventListener("selectionchange",c),En.current!==null&&(window.cancelAnimationFrame(En.current),En.current=null)}},[H,Im,O,xn]),l.useEffect(()=>{if(pt!=="html")return;const c=At.current;if(!c)return;const m=()=>H();return c.addEventListener("select",m),c.addEventListener("keyup",m),c.addEventListener("mouseup",m),()=>{c.removeEventListener("select",m),c.removeEventListener("keyup",m),c.removeEventListener("mouseup",m)}},[pt,H]);const W=l.useCallback(c=>{const m=wn({mode:"visual",visualEl:c,htmlEl:At.current}),C=Ue.current,I=Uc(C,m)?C:m.visualRange?m:C??m;Ue.current=I,c.focus();const M=wi(c,I);if(M){const z=window.getSelection();try{z==null||z.removeAllRanges(),z==null||z.addRange(M),Ue.current={...I,visualRange:M}}catch{}}return Ue.current??I},[]),Nn=l.useCallback(()=>{Yi.current=null,Xi.current=null,Fd(!1)},[]),_m=l.useCallback(()=>{if(!Zi.current||!Yi.current||!Xi.current||L.current!=="visual")return;const c=B.current;if(!c)return;H();const m=Ue.current;!m||m.collapsed||ZP(m,Xi.current)||(W(c),XP(c,Yi.current),fe(c,!1),H(),O(),Nn())},[H,W,ve,O,Nn]),Mm=l.useCallback(()=>{if(L.current!=="visual"){Nn();return}if(Zi.current){Nn();return}const c=B.current;if(!c){Nn();return}const m=W(c);if(m.collapsed){Nn();return}Yi.current=YP(c),Xi.current={...m},Fd(!0),H()},[Nn,W,H]),Uy=l.useCallback(()=>{_m()},[_m]);l.useEffect(()=>{(pt!=="visual"||Fe)&&Nn()},[pt,Fe,Nn]);const Yl=l.useCallback((c,m)=>{if(L.current!=="visual")return;const C=B.current;if(!C)return;const I=m??_n.current,M=Fr(c,I);if(!M)return;_n.current=M.unit;const z=W(C);if(z.collapsed){Lt.current=M,Bt.current={start:z.start,end:z.end},O();return}Lt.current=null,ru(C,M.value,M.unit)&&(fe(C,!1),H(),O())},[W,ve,H,O]),Nm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(C.collapsed){Wt.current={value:c},Bt.current={start:C.start,end:C.end},O();return}Wt.current=null,Kc(m,c)&&(fe(m,!1),H(),O())},[W,ve,H,O]),Xl=l.useCallback((c,m)=>{if(L.current!=="visual")return;const C=B.current;if(!C)return;const I=W(C),M=c==="color"?an:sn;if(I.collapsed){M.current={value:m},Bt.current={start:I.start,end:I.end},O();return}M.current=null,fi(C,c,m)&&(fe(C,!1),H(),O())},[W,ve,H,O]),Jl=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(Qi({open:!1,tab:"general"}),C.collapsed){if(c.size!==null){const X=Fr(c.size,c.unit);X&&(Lt.current=X,_n.current=X.unit)}const M=go(m),z={};for(const X of Jt)c.marks[X]!==M[X]&&(z[X]=c.marks[X]);Vt.current=z,c.fontColorMixed||(an.current={value:c.fontColor}),c.highlightColorMixed||(sn.current={value:c.highlightColor}),c.fontFamilyMixed||(Wt.current={value:c.fontFamily}),Bt.current={start:C.start,end:C.end},O();return}if(Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,Bt.current=null,c.size!==null){const M=Fr(c.size,c.unit);M&&(_n.current=M.unit,ru(m,M.value,M.unit))}const I=go(m);for(const M of Jt)c.marks[M]!==I[M]&&au(m,M);c.fontFamilyMixed||Kc(m,c.fontFamily),c.fontColorMixed||fi(m,"color",c.fontColor),c.highlightColorMixed||fi(m,"backgroundColor",c.highlightColor),fe(m,!1),H(),O()},[W,ve,H,O]),Ql=l.useCallback((c,m)=>{if(L.current!=="visual")return;const C=B.current;if(!C)return;W(C),to(M=>({...M,open:!1}));let I=Qh(C,c);if(m&&zS(C,m)&&(I=!0),!I){H(),O();return}fe(C,!1),H(),O()},[W,ve,H,O]),Lm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(xl(I=>({...I,open:!1})),!Fs(c)){H(),O();return}if(C.collapsed){qn.current=c,Bt.current={start:C.start,end:C.end},O();return}if(qn.current=null,!Th(m,c)){H(),O();return}fe(m,!1),H(),O()},[W,ve,H,O]),ec=l.useCallback(c=>{if(L.current!=="visual")return;const m=ei();if(!m)return;W(m),Sr(z=>({...z,open:!1}));const C=ao(),I=JSON.stringify(c.atRule)!==JSON.stringify(it(he(C).body)),M=pu(m,c);if(I&&Io(m,M.pageHtml),!M.changed&&!I){H(),O();return}fe(m,!1,M.pageHtml),H(),O()},[W,fe,H,O,ei,ao]),Bm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),na(C=>({...C,open:!1})),!SP(m,c)){H(),O();return}fe(m,!1),H(),O()}},[W,ve,H,O]),Fm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),kl(C=>({...C,open:!1})),!RP(m,c)){H(),O();return}fe(m,!1),H(),O()}},[W,ve,H,O]),_a=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),ra({open:!1}),!$v(m,c,Ce.current)){H(),O();return}fe(m,!1),H(),O()}},[W,ve,H,O]),Ma=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),oa({open:!1}),!d0(m,c)){H(),O();return}fe(m,!1),H(),O()}},[W,ve,H,O]),Hm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Yo({open:!1}),!R0(m,c)){H(),O();return}fe(m,!1),H(),O()}},[W,ve,H,O]),zm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Pl({open:!1}),!CS(m,c)){H(),O();return}fe(m,!1),H(),O(),xn(m)}},[W,ve,H,O,xn]),Om=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Tl(C=>({...C,open:!1})),!rA(m,c)){H(),O();return}fe(m,!1),H(),O()}},[W,ve,H,O]),Km=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Dl(C=>({...C,open:!1})),!fA(m,c)){H(),O();return}fe(m,!1),H(),O(),xn(m)}},[W,ve,H,O,xn]),$m=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Il(C=>({...C,open:!1})),!kA(m,c)){H(),O();return}fe(m,!1),H(),O()}},[W,ve,H,O]),Ln=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),!c(m)){H(),O();return}fe(m,!1),H(),O(),xn(m)}},[W,ve,H,O,xn]),tc=l.useCallback(c=>{_a({src:c.src,alt:c.alt??"",title:c.title??"",css:c.css})},[_a]),nc=l.useCallback(c=>{Ma({src:c.src,title:c.title??"",css:c.css})},[Ma]),rc=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Yo({open:!1}),!D0(m,{src:c.src,title:c.title??"",css:c.css})){H(),O();return}fe(m,!1),H(),O()}},[W,ve,H,O]),Um=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),ia(C=>({...C,open:!1})),!a1(m,c)){H(),O();return}fe(m,!1),H(),O()}},[W,ve,H,O]),Vy=l.useCallback((c,m)=>{Ct!=null&&Ct.isConnected&&J0(Ct,c,m)},[Ct]),Wy=l.useCallback(()=>{const c=B.current;!c||!(Ct!=null&&Ct.isConnected)||(fe(c,!1),Sc(c,Ct),H(),O())},[Ct,ve,H,O]),Na=l.useCallback(()=>{if(L.current!=="visual"||!B.current)return ae.current;const c=Zt(B.current.innerHTML,he(ae.current).body);return ri(c,Oa(c,ae.current,io.current,{liveRoot:B.current}))},[]),La=l.useCallback(()=>{if(ye.current){const c=zt(Dr());return ae.current=c,ft(c)}if(Ut.current){const c=L.current==="visual"?Na():ae.current;c!==ae.current&&(ae.current=c)}return ft(ae.current)},[Dr,ft,Na]),Gy=l.useRef(-1),Vm=l.useCallback(()=>{if(!Ut.current&&eo.current)return eo.current;const c=Ut.current&&L.current==="visual"?Na():ae.current;return c!==ae.current&&(ae.current=c),eo.current=c,Ut.current=!1,c},[Na]),Wm=l.useCallback(()=>{if(!Ut.current&&eo.current)return eo.current;const c=ht(),m=JSON.stringify(c);return eo.current=m,Gy.current=wt.revision,Ut.current=!1,m},[ht,wt.revision]),qy=l.useCallback(()=>ye.current?Wm():Vm(),[Wm,Vm]);jA({onAutoSave:r?async c=>{Ut.current=!1;const m=ye.current?pn(JSON.parse(c)):ft(c);return r(m)}:void 0,getHtml:qy}),l.useEffect(()=>()=>{var c;(c=Ce.current)==null||c.clear()},[]),l.useEffect(()=>{var m;if(!Y||e===void 0||ce)return;const c=Me(e);(m=Xr.current)==null||m.setStorageHtml(c),ae.current=c,qt(ie)||ie.syncExternal(c)},[ce,Me,ie,Y,e]),l.useEffect(()=>{if(!Y||!ce||we===void 0||Ut.current)return;const c=ir(we).map(C=>Me(C));if(Nr(c,Re.current))return;const m=wt.replacePages(c);if(ae.current=m.joined,Re.current=m.pages,qt(ie)&&ie.syncPages(m.pages),L.current==="html"){const C=m.pages[Ae.current]??"";In.current=C}},[ce,Me,ie,Y,wt,we]),l.useEffect(()=>()=>{var c;(c=Bo.current)==null||c.cancel()},[]);const De=l.useMemo(()=>({getHtml:La,setHtml:c=>{gt(c,!1)},getMode:()=>L.current,setMode:Em,getFullscreen:()=>Ed.current,setFullscreen:gn,getDarkMode:()=>pm.current,setDarkMode:c=>{km(c)},getPageZoom:()=>ba.current,setPageZoom:Sm,getToolbarPosition:()=>gm.current,setToolbarPosition:c=>{Pm(c)},openCustomizeToolbar:()=>{Kd(!0)},openDocumentPreview:()=>{$d({open:!0,html:ft(zt(Dr()))})},openHelp:()=>{Xo({open:!0,topicId:"getStarted"})},openKeyboardShortcuts:()=>{Xo({open:!0,topicId:"keyboardShortcuts"})},openAbout:()=>{Vd(!0)},openCompatibilityCheck:()=>{var C;if(!Ze)return;const c=ye.current?[...Re.current]:[ae.current],m=yu(c,Ze);aa(m),(C=Pr.current)==null||C.call(Pr,m),Wd(!0)},toggleReadAloud:()=>{const c=Bo.current;if(!c)return;const m=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current}),C=Yf(Ka(m),La());C&&c.toggle(C)},toggleRuler:()=>{Ys(c=>!c)},isReadingAloud:()=>{var c;return((c=Bo.current)==null?void 0:c.isSpeaking())??!1},isRulerVisible:()=>Li.current,canReadAloud:()=>{if(!Qa())return!1;const c=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current});return Yf(Ka(c),La())!==null},undo:ja,redo:Ia,canUndo:()=>ie.canUndo(),canRedo:()=>ie.canRedo(),getSelection:()=>{const c=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current});return Ka(c)},insertText:c=>{const m=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current});ni(m,c,!1)},insertHtml:(c,m)=>{const C=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current}),I=m===void 0;ni(C,I?c:m,I)},toggleFontMark:c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(C.collapsed){const I=go(m);Vt.current=Nk(Vt.current,I,c),Bt.current={start:C.start,end:C.end},O();return}Vt.current={},Bt.current=null,au(m,c)&&(fe(m,!1),H(),O())},clearFormatting:()=>{if(L.current!=="visual")return;const c=B.current;!c||W(c).collapsed||(Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,qn.current=null,Bt.current=null,qP(c)&&(fe(c,!1),H(),O()))},toggleFormatBrush:Mm,isFormatBrushActive:()=>Zi.current,isFontMarkActive:c=>nl.current[c],hasTextSelection:()=>L.current==="visual"&&fl.current,setFontSize:(c,m)=>{Yl(c,m)},setFontSizeUnit:c=>{var X;const m=B.current,C=Zn.current;if(L.current!=="visual"||!m||C.value===null||C.mixed){_n.current=c,Vi(ne=>({...ne,unit:c}));return}const I=W(m),M=vk(m,((X=I.visualRange)==null?void 0:X.startContainer)??m),z=rg(C.value,C.unit,c,M.parentPx,M.rootPx);Yl(z,c)},getFontSize:()=>Zn.current.value,getFontSizeUnit:()=>Zn.current.unit,isFontSizeMixed:()=>Zn.current.mixed,setFontFamily:c=>{Nm(c)},getFontFamily:()=>Oo.current.value,isFontFamilyMixed:()=>Oo.current.mixed,getFontFaces:()=>io.current,setFontColor:c=>{Xl("color",c)},setHighlightColor:c=>{Xl("backgroundColor",c)},getFontColor:()=>$o.current.value,isFontColorMixed:()=>$o.current.mixed,getHighlightColor:()=>Vo.current.value,isHighlightColorMixed:()=>Vo.current.mixed,setParagraphStyle:c=>{if(L.current!=="visual")return;const m=B.current;m&&(W(m),nS(m,c)&&(fe(m,!1),H(),O()))},getParagraphStyle:()=>sl.current.tag,isParagraphStyleMixed:()=>sl.current.mixed,setTextAlign:c=>{if(L.current!=="visual")return;const m=B.current;m&&(W(m),Jh(m,c)&&(fe(m,!1),H(),O()))},getTextAlign:()=>cl.current.align,isTextAlignMixed:()=>cl.current.mixed,indent:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),mS(c)&&(fe(c,!1),H(),O()))},outdent:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),fS(c)&&(fe(c,!1),H(),O()))},canOutdent:()=>L.current==="visual"&&Bd.current,toggleList:c=>{if(L.current!=="visual")return;const m=B.current;m&&(W(m),iS(m,c)&&(fe(m,!1),H(),O()))},isBulletList:()=>Wo.current.type==="ul"&&!Wo.current.mixed,isNumberedList:()=>Wo.current.type==="ol"&&!Wo.current.mixed,openFontProperties:c=>{L.current==="visual"&&Qi({open:!0,tab:c??"general"})},applyFontProperties:c=>{Jl(c)},openCustomCss:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=c?Ph(c):{value:null,mixed:!1},C=m.mixed||!m.value?"":Rk(m.value);xl({open:!0,value:C})},applyCustomCss:c=>{Lm(c)},openParagraphProperties:c=>{if(L.current!=="visual")return;const m=B.current;m&&W(m),to({open:!0,tab:c??"general",value:m?Wa(m):Br(),backgroundImage:m?Tc(m):vn()})},applyParagraphProperties:(c,m)=>{Ql(c,m)},openPageProperties:(c,m)=>{if(L.current!=="visual")return;const C=ei();C&&W(C);const I=ao(),M=C?ui(C):hi();Sr({open:!0,tab:c==="print"&&!mn?"font":c??"font",paragraphTab:m??"spacing",value:{...M,atRule:it(he(I).body)}})},applyPageProperties:c=>{ec(c)},openPageBackgroundImage:()=>{if(L.current!=="visual")return;const c=ei();c&&W(c);const m=Ol.current;if(Kl.current&&m){m.onPick(M=>{const z=ao(),X=c?ui(c):hi();ec({...X,backgroundImage:{...X.backgroundImage,src:M.src},atRule:it(he(z).body)})});return}const C=ao(),I=c?ui(c):hi();Sr({open:!0,tab:"paragraph",paragraphTab:"backgroundImage",value:{...I,atRule:it(he(C).body)}})},openParagraphBackgroundImage:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=Ol.current;if(Kl.current&&m){m.onPick(C=>{const I=c?Wa(c):Br(),M=c?Tc(c):vn();Ql(I,{...M,src:C.src})});return}to({open:!0,tab:"backgroundImage",value:c?Wa(c):Br(),backgroundImage:c?Tc(c):vn()})},openCustomParagraphStyleDialog:c=>{if(L.current!=="visual"||!Hl.current)return;if(c){const C=ga.current.find(I=>I.id===c);if(!C)return;Zo({open:!0,mode:"edit",style:C});return}const m=B.current;m&&W(m),Zo({open:!0,mode:"create",font:{size:Zn.current.mixed?null:Zn.current.value,unit:Zn.current.unit,marks:{...nl.current},fontFamily:Oo.current.mixed?null:Oo.current.value,fontColor:$o.current.mixed?null:$o.current.value,highlightColor:Vo.current.mixed?null:Vo.current.value},paragraph:eb(m?Wa(m):Br())})},applyCustomParagraphStyle:c=>{const m=ga.current.find(I=>I.id===c);if(!m||(Jl({size:m.font.size,unit:m.font.unit,marks:m.font.marks,fontFamily:m.font.fontFamily??null,fontFamilyMixed:!1,fontColor:m.font.fontColor,highlightColor:m.font.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}),!m.paragraph))return;const C=B.current;!C||L.current!=="visual"||(W(C),FS(C,m.paragraph)&&(fe(C,!1),H(),O()))},customParagraphStylesEnabled:()=>Hl.current,getCustomParagraphStyles:()=>ga.current,isCustomParagraphStylesLoading:()=>tm.current,openLinkDialog:c=>{if(L.current!=="visual")return;const m=B.current;m&&W(m);const C=m?ob(m):Os(),I=m?hu(m):[],M=(C==null?void 0:C.href)??"",z=M.startsWith("#")?M.slice(1):"",X=I.some(ne=>ne.id===z)?z:"";na({open:!0,tab:c??"link",href:M,title:(C==null?void 0:C.title)??"",targetBlank:(C==null?void 0:C.targetBlank)??!1,textDecorationNone:(C==null?void 0:C.textDecorationNone)??!1,hoverMode:(C==null?void 0:C.hoverMode)??"color",hoverColor:(C==null?void 0:C.hoverColor)??null,hoverHtml:(C==null?void 0:C.hoverHtml)??"",bookmarks:I,selectedBookmarkId:X})},applyLink:c=>{Bm(c)},openBookmarkDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c),kl({open:!0,existingIds:c?hu(c).map(m=>m.id):[]})},applyBookmark:c=>{Fm(c)},openImageDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=sm.current;if(hm.current&&m){m.onPick(tc);return}ra({open:!0})},applyImage:c=>{_a(c)},openAudioDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=cm.current;if(bm.current&&m){m.onPick(nc);return}oa({open:!0})},applyAudio:c=>{Ma(c)},openYoutubeDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=um.current;if(ym.current&&m){m.onPick(rc);return}Yo({open:!0})},applyYoutube:c=>{Hm(c)},openImageProperties:c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;W(m);const C=sr(m),I=i1(m);!C||!I||ia({open:!0,tab:c??"general",value:I,aspectRatio:n1(C)})},applyImageProperties:c=>{Um(c)},insertHorizontalRule:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),O0(c)&&(fe(c,!1),H(),O()))},insertPageBreak:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),W0(c)&&(fe(c,!1),H(),O()))},insertPageBefore:()=>{Rm()},insertPageAfter:()=>{Dm()},deletePage:()=>{!ye.current||L.current!=="visual"||on.current&&(Dr().length<=1||Cl(!0))},isMultiPagesEnabled:()=>ye.current,hasSelectedPage:()=>ye.current&&L.current==="visual"&&on.current,canDeletePage:()=>ye.current&&L.current==="visual"&&on.current&&Dr().length>1,canInsertPageBackgroundImage:()=>!(L.current!=="visual"||ye.current&&!on.current),canInsertParagraphBackgroundImage:()=>{if(L.current!=="visual")return!1;const c=B.current;return c?$n(c).length>0:!1},getActivePageHtml:()=>Aa(),getAllPagesHtml:()=>pn(Dr()),openTableDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c),Pl({open:!0})},applyTable:c=>{zm(c)},openTableProperties:()=>{if(L.current!=="visual")return;const c=B.current;if(!c)return;W(c);const m=nA(c);m&&Tl({open:!0,value:m})},applyTableProperties:c=>{Om(c)},openCellProperties:()=>{if(L.current!=="visual")return;const c=B.current;if(!c)return;W(c);const m=mA(c);m&&Dl({open:!0,value:m})},applyCellProperties:c=>{Km(c)},openRowProperties:()=>{if(L.current!=="visual")return;const c=B.current;if(!c)return;W(c);const m=vA(c);m&&Il({open:!0,value:m})},applyRowProperties:c=>{$m(c)},insertRowBelow:()=>{Ln(c=>cu(c,"below"))},insertRowBefore:()=>{Ln(c=>cu(c,"before"))},deleteRow:()=>{Ln(c=>vS(c))},insertColumnAfter:()=>{Ln(c=>Ff(c,"after"))},insertColumnBefore:()=>{Ln(c=>Ff(c,"before"))},deleteColumn:()=>{Ln(c=>kS(c))},mergeCells:()=>{Ln(c=>AS(c))},unmergeCells:()=>{Ln(c=>TS(c))},cut:async()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),await $P(c)&&(fe(c,!1),H(),O()))},copy:async()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),await mb(c))},deleteSelection:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),db(c)&&(fe(c,!1),H(),O()))},addComment:()=>{if(!Gn.current||b||L.current!=="visual")return;const c=B.current;if(!c)return;const m=W(c),C=qf(c,m);if(C){hn(C);return}const I=EP(c,m);if(!I)return;const M=BP(I);_P(c,M.id,m)&&(Zf(c,M.id),H(),Tm(c,!1),wr([...zi.current,M]),hn(M.id))},toggleCommentsVisible:()=>{Zs(c=>{const m=!c,C=B.current;return C&&lb(C,m),m})},areCommentsVisible:()=>Hi.current,canAddComment:()=>!Gn.current||b||L.current!=="visual"?!1:fl.current||Fl.current!==null,isCommentsEnabled:()=>Gn.current,getCommentThreads:()=>zi.current,setCommentThreads:c=>wr(c),openCommentThread:c=>{const m=B.current;!m||L.current!=="visual"||Zf(m,c)&&(H(),hn(c))},isContentLocked:()=>Pd.current,isLink:()=>Od.current,isImageSelected:()=>L.current==="visual"&&Fl.current!==null,isInTable:()=>L.current==="visual"&&Zd.current,canMergeCells:()=>L.current==="visual"&&Xd.current,canUnmergeCells:()=>L.current==="visual"&&Qd.current,...o!=null?{onSave:c=>im.current(c)}:{},...a!=null?{onOpen:()=>am.current()}:{}}),[gt,ve,fe,Tm,Em,gn,km,Sm,Pm,ni,ja,Ia,H,O,W,Yl,Nm,Xl,Jl,Lm,Ql,ec,Bm,Fm,_a,Ma,Hm,Um,zm,Om,Km,$m,Ln,tc,nc,rc,La,Aa,Dr,Rm,Dm,jm,Mm,o,a,b,wr,mn,Ze]),Ba=l.useCallback(()=>{var C;if(!Ze)return aa(null),null;const c=ye.current?[...Re.current]:[ae.current],m=yu(c,Ze);return aa(m),(C=Pr.current)==null||C.call(Pr,m),m},[Ze]);l.useEffect(()=>{if(!Ze){aa(null);return}const c=window.setTimeout(()=>{Ba()},750);return()=>window.clearTimeout(c)},[Qs,Ze,Ba]);const Gm=l.useRef(Pt);l.useEffect(()=>{const c=Gm.current;if(Gm.current=Pt,!c||Pt)return;if(ye.current){const M=ht({allPages:!0}),z=M.map(Rc);z.some((X,ne)=>X!==M[ne])&&Gt(z,!1);return}const m=ae.current,C=he(m),I=Rc(C.body);I!==C.body&&Xn(ri(I,C.hrefs),{fullReplace:!0})},[Pt,ht,Gt,Xn]);const oc=l.useCallback((c,m,C,I)=>{const{activePageIndexAtCapture:M,pageHtmlAtCapture:z,selectedHtmlAtCapture:X}=I;if(c.mode==="visual"){let ne=B.current;if(ye.current){const pe=xt.current;pe==null||pe.ensurePageMounted(M);const ge=pe==null?void 0:pe.getContainer();ne=ge?We(ge,M):ne}if(ne){B.current=ne;const pe=Xw(ne,c,X);if(pe&&!pe.collapsed){Jw(pe,m,C);const Le=ye.current?z??Re.current[M]??"":ae.current;ti(Zt(he(ne.innerHTML).body,he(Le).body),!1);return}ne.focus({preventScroll:!0});const ge=wi(ne,c),Ne=ge!==null?{...c,visualRange:ge.cloneRange()}:c;pf({snapshot:Ne,visualEl:ne,htmlEl:At.current,getHtml:()=>L.current==="visual"&&ne?ne.innerHTML:ae.current,setHtml:Le=>{if(L.current==="visual"){const rt=ye.current?Re.current[M]??"":ae.current;ti(Zt(he(Le).body,he(rt).body),!1);return}gt(Le,!1)},content:m,asHtml:C});return}}ni(c,m,C)},[ni,ti,gt]),qm=l.useCallback(()=>{En.current!==null&&(window.cancelAnimationFrame(En.current),En.current=null,H()),Ea()},[H,Ea]),Zm=l.useCallback(()=>{var Ne,Le;const c=qw({stored:Ue.current,mode:L.current,visualEl:B.current,htmlEl:At.current}),m={...c,visualRange:((Ne=c.visualRange)==null?void 0:Ne.cloneRange())??null};Ue.current=m;const C=ye.current?Ae.current:0,I=c.mode==="visual"&&ye.current?Aa():null,M=((Le=B.current)==null?void 0:Le.innerHTML)??"",z=I?cn(he(I).body):M,X=(()=>{if(c.mode==="html"){const jr=De.getHtml(),Bn=Math.min(c.start,c.end),lo=Math.max(c.start,c.end);return jr.slice(Bn,lo)}const rt=B.current;return rt&&Qw(rt,m)||c.text})(),ne=c.mode==="visual"&&ye.current&&!c.collapsed&&X?Zw(z,M,X):null,pe=ne&&ye.current?{pageIndex:C,start:ne.start,end:ne.end,pageBodyAtCapture:z}:null,ge={activePageIndexAtCapture:C,pageHtmlAtCapture:I,selectedHtmlAtCapture:X};return{mode:m.mode,selection:Ka(m),getHtml:De.getHtml,getSelectedHtml:()=>X,getPinnedPageBodySelection:()=>pe,setHtml:rt=>{gt(rt,!1)},insertText:rt=>oc(m,rt,!1,ge),insertHtml:(rt,jr)=>{const Bn=jr===void 0;oc(m,Bn?rt:jr,Bn,ge)}}},[oc,De.getHtml,Aa,gt]),{catalog:Fa,layout:Ym}=l.useMemo(()=>nw($,eI,tI),[$]),Ha=l.useMemo(()=>cR(Ym,K),[Ym,K]),Xm=l.useMemo(()=>({...Ha,iconGroups:LT(Ha.iconGroups,gl)}),[Ha,gl]),Jm=ce&&pt==="visual",Qm=l.useMemo(()=>yI(Xm,Jm),[Xm,Jm]),ic=l.useMemo(()=>nT(Qm,Tt),[Qm,Tt]),ac=l.useMemo(()=>Tt?dT(Fa):Fa,[Fa,Tt]),sc=l.useMemo(()=>dt?iI(ac,Vn):ac,[ac,dt,Vn]),lc=l.useMemo(()=>{let c=Tt?mT(ic):ic;return dt&&(c=aI(c)),c},[ic,Tt,dt]),cc=l.useMemo(()=>({disabled:Oe,readOnly:w,enableComments:dt}),[Oe,w,dt]),Zy=l.useCallback(c=>{if(!Wn||!Dn||b)return;const m=FP(Dn,c);wr(HP(zi.current,Wn,m))},[Wn,Dn,b,wr]),so=l.useMemo(()=>({...bk(De),...rw($,Zm,qm)}),[De,$,Zm,qm]),uc=l.useMemo(()=>yk(De),[De,Fo,Ho,zo,Ko,Uo,Wi,ca,ua,ha,oo,Ct,ma,fa,pa,Gi,qi,Yn,no,Jo,Lo,Qs,Mt]);l.useLayoutEffect(()=>{Nt.bump("history")},[Qs,Nt]),l.useLayoutEffect(()=>{Nt.bump("marks")},[Fo,Ho,zo,Ko,Uo,Wi,qi,Nt]),l.useLayoutEffect(()=>{Nt.bump("table")},[ma,fa,pa,Nt]),l.useLayoutEffect(()=>{Nt.bump("selection")},[Gi,Ct,Nt]),l.useLayoutEffect(()=>{Nt.bump("chrome")},[Yn,no,Jo,Lo,Mt,ca,ua,ha,oo,Nt]);const Yy=l.useCallback(c=>{if(Fe||c.inputType!=="insertText"&&c.inputType!=="insertReplacementText"||!c.data||!Mk(Vt.current)&&!Lt.current&&!Mw(Wt.current)&&!dC({color:an.current,backgroundColor:sn.current})&&!Ik(qn.current))return;const m=B.current;m&&(c.preventDefault(),Uk(m,c.data,Vt.current,Lt.current,{color:an.current,backgroundColor:sn.current},Wt.current,qn.current),Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,qn.current=null,Bt.current=null,fe(m,!0),H(),O())},[Fe,ve,H,O]),Xy=l.useCallback(c=>{var pe;if(Fe||!yw(c,em.current))return;c.preventDefault(),c.stopPropagation();let m=B.current;if(ye.current){const ge=c.currentTarget instanceof HTMLElement&&c.currentTarget.hasAttribute(Kr)?c.currentTarget:xv(c.target);if(ge instanceof HTMLElement){const Ne=Cf(ge);Ne!==null&&((pe=xt.current)==null||pe.activatePageAt(Ne),B.current=ge,m=ge,on.current=!0,kr(!0))}}else c.currentTarget instanceof HTMLDivElement&&(B.current=c.currentTarget,m=c.currentTarget);if(!m)return;W(m);const C=eu(m,c.target),I=bs(m,c.target);I&&!_i(m).includes(I)&&PS(m,I);const M={inTable:Et(m,c.target)!==null,canMergeCells:Hf(m),canUnmergeCells:zf(m)},z={canDeletePage:ye.current&&on.current&&ht().length>1},X={canAddComment:Gn.current&&!b};if(C){Sc(m,C),H(),ro(C),Bl({open:!0,x:c.clientX,y:c.clientY,kind:"image",...M,...z,...X,inTable:Et(m,C)!==null});return}const ne=wn({mode:"visual",visualEl:m,htmlEl:At.current});Ue.current=ne,Bl({open:!0,x:c.clientX,y:c.clientY,kind:ne.collapsed?"caret":"text",...M,...z,canAddComment:X.canAddComment&&!ne.collapsed})},[Fe,H,W,ht,b,kr]),Jy=l.useCallback(c=>{if(em.current=c.pointerType,b)return;const m=B.current;if(!m)return;if(Gn.current&&Hi.current){const I=cb(m,c.target);if(I){const M=I.getAttribute("data-comment-thread");M&&hn(M);return}}if(Fe&&!Gn.current)return;const C=eu(m,c.target);if(!C){ro(null);return}c.preventDefault(),Sc(m,C),H(),ro(C)},[b,Fe,H]),ef=l.useCallback(c=>{if(Fe)return;if(c.key==="Tab"&&!c.ctrlKey&&!c.metaKey&&!c.altKey){if(L.current!=="visual")return;const C=B.current;if(!C)return;const I=c.target;if(!(I instanceof Node)||!C.contains(I))return;W(C);const M=SS(C,c.shiftKey);if(!M)return;c.preventDefault(),typeof M=="object"&&M.changed&&fe(C,!1),H(),O(),xn(C);return}if(!(c.ctrlKey||c.metaKey))return;if(c.key==="Enter"&&!c.shiftKey){c.preventDefault(),De.insertPageBreak();return}const m=c.key.toLowerCase();if(m==="z"&&!c.shiftKey){c.preventDefault(),ja();return}if(m==="z"&&c.shiftKey||m==="y"){c.preventDefault(),Ia();return}if(m==="b"&&!c.shiftKey){c.preventDefault(),De.toggleFontMark("bold");return}if(m==="i"&&!c.shiftKey){c.preventDefault(),De.toggleFontMark("italic");return}if(m==="u"&&!c.shiftKey){c.preventDefault(),De.toggleFontMark("underline");return}if(m==="x"&&c.shiftKey){c.preventDefault(),De.toggleFontMark("strikethrough");return}m==="p"&&!c.shiftKey&&(c.preventDefault(),so.print())},[Fe,ja,Ia,De,so,W,ve,H,O,xn]),Qy=l.useCallback(c=>{if(c.key==="F1"){c.preventDefault(),Xo({open:!0,topicId:"getStarted"});return}if(c.key==="Escape"&&Wn){c.preventDefault(),hn(null);return}ef(c)},[Wn,ef]),ex=[Se.root,zc(Yn).className,Mt?Se.fullscreen:"",x].filter(Boolean).join(" "),tx=XN({dark:Yn,toolbarBackground:k,workspaceBackground:v,menuColor:A,menuBackground:j,menuFontSize:D,menuFontFamily:R,border:T}),nx=zc(Yn)["data-wysiwyg-theme"];Td.current={multiPageVisualRef:xt,workspaceRef:Cr,suppressPageFlushRef:vr,pendingInsertPageFocusRef:Fi,visualRootRef:B,visualPropSyncGuardRef:$t,htmlAreaRef:At,commentPanelRef:Bi,activePageIndexRef:Ae,htmlModePageHtmlRef:In,setHtmlModePageHtml:()=>{},activePageHtmlRef:jd,pageCanvasSizedRef:Id,setActivePageIndex:No,setHasSelectedPage:kr,setActiveThreadId:hn,setContextMenu:Bl,recordVisualInputHtml:Ny,recordPageVisualHtml:Tr,handleVisualBeforeInput:Yy,handleVisualPointerDown:Jy,handleVisualMouseUp:Uy,handleVisualContextMenu:Xy,handleHtmlPageTabSelect:Ky,handleHtmlSurfaceChange:$y,handleImageResize:Vy,handleImageResizeEnd:Wy,multiPageRulerMarginPreview:Hy,multiPageRulerMarginChange:zy,multiPageRulerIndentChange:Oy,singlePageRulerMarginPreview:Ly,singlePageRulerMarginChange:By,singlePageRulerIndentChange:Fy,resolveEmbeddedImageDataUrl:Y?Gs:void 0,hydrateExportHtml:ft,postCommentMessage:Zy,htmlFileDrop:Am};const rx=l.useMemo(()=>hy({catalog:sc,layout:lc,commands:so,queries:uc,queryRevisions:Nt,disabled:Oe,chromeLock:cc}),[Oe,cc,so,sc,lc,uc,Nt]),ox=l.useMemo(()=>({documentBridgeRef:Xr,htmlRef:ae,pagesRef:Re}),[]),ix=l.useMemo(()=>({profile:Tt,validation:Ml,refreshValidation:Ba}),[Tt,Ml,Ba]),ax=l.useCallback(c=>rT(c,Tt),[Tt]);return i.jsx(cw,{locale:S,children:i.jsx(sw,{dark:Yn,children:i.jsx(OA,{value:ix,children:i.jsx(cN,{value:ox,children:i.jsxs("div",{className:ex,style:tx,"data-fullscreen":Mt?"":void 0,"data-wysiwyg-theme":nx,"data-toolbar-position":no,"data-comments-visible":dt&&Vn?"":void 0,onKeyDown:Qy,children:[i.jsx(sN,{menuVisible:E,captureChromeSelection:Ea,displayCatalog:sc,displayLayout:lc,commands:so,queries:uc,queryRevisions:Nt,chromeDisabled:Oe,chromeLock:cc,contentLocked:Fe,customizeToolbarOpen:pl,baseCatalog:Fa,allowedLayout:Ha,toolbarSettings:gl,toolbarSettingsLoading:wy,toolbarSettingsBusy:Cy,onCustomizeToolbarClose:()=>Kd(!1),onToolbarSettingsChange:c=>{vm(c)},onToolbarSettingsReset:()=>{vm(null)},documentPreview:ea,onDocumentPreviewClose:()=>$d({open:!1,html:ea.html}),helpDialog:El,onHelpDialogClose:()=>Xo(c=>({...c,open:!1})),onHelpTopicChange:c=>Xo(m=>({...m,open:!0,topicId:c})),aboutDialogOpen:_l,onAboutDialogClose:()=>Vd(!1),fontDialog:Ji,fontSizeState:Ho,markState:Fo,fontFamilyState:zo,fontColorState:Ko,highlightColorState:Uo,fontFaces:oo,onFontDialogTabChange:c=>Qi({open:!0,tab:c}),onFontDialogClose:()=>Qi({open:!1,tab:Ji.tab}),onApplyFontProperties:c=>De.applyFontProperties(c),paragraphDialog:Go,customBackgroundImagePicker:Mn,disableBuiltinBackgroundImageSources:zl,onParagraphCustomImagePick:()=>{Mn==null||Mn.onPick(c=>{to(m=>({...m,tab:"backgroundImage",backgroundImage:{...m.backgroundImage,src:c.src}}))})},onParagraphDialogTabChange:c=>to({...Go,open:!0,tab:c}),onParagraphDialogClose:()=>to({...Go,open:!1}),onApplyParagraphProperties:({value:c,backgroundImage:m})=>De.applyParagraphProperties(c,m),customCssDialog:yl,onCustomCssDialogClose:()=>xl(c=>({...c,open:!1})),onApplyCustomCss:c=>De.applyCustomCss(c),pageDialog:qo,enablePageProperties:mn&&Pt,onPageCustomImagePick:()=>{Mn==null||Mn.onPick(c=>{Sr(m=>({...m,tab:"paragraph",paragraphTab:"backgroundImage",value:{...m.value,backgroundImage:{...m.value.backgroundImage,src:c.src}}}))})},onPageDialogTabChange:c=>Sr({...qo,open:!0,tab:c}),onPageDialogClose:()=>Sr({...qo,open:!1}),onApplyPageProperties:c=>De.applyPageProperties(c),onPageDialogResetAtRule:()=>{const c=ei();if(!c||L.current!=="visual")return;const m=ye.current?ao():he(ae.current).body,C=QS(c,m);C.changed&&(fe(c,!1,C.pageHtml),Sr(I=>({...I,value:{...I.value,atRule:or()}})))},deletePageConfirmOpen:wl,onDeletePageConfirmClose:()=>Cl(!1),onDeletePageConfirm:()=>{jm(),Cl(!1)},customStyleDialog:vy,canDeleteCustomParagraphStyle:!!se,customStyleBusy:jy,onCustomStyleDialogClose:()=>Zo({open:!1}),onCustomStyleSave:async c=>{const m=rm.current;if(m){da(!0);try{await m(c),Zo({open:!1}),await ka()}finally{da(!1)}}},onCustomStyleDelete:async c=>{const m=om.current;if(m){da(!0);try{await m(c),Zo({open:!1}),await ka()}finally{da(!1)}}},linkDialog:vl,onLinkDialogTabChange:c=>na({...vl,open:!0,tab:c}),onLinkDialogClose:()=>na({...vl,open:!1}),onApplyLink:c=>De.applyLink(c),bookmarkDialog:Ud,onBookmarkDialogClose:()=>kl({...Ud,open:!1}),onApplyBookmark:c=>De.applyBookmark(c),imageDialogOpen:ky.open,customImagePicker:V,customAudioPicker:Q,customVideoPicker:ee,onImageDialogClose:()=>ra({open:!1}),onApplyImage:c=>De.applyImage(c),onImageDialogCustomPick:()=>{ra({open:!1}),V==null||V.onPick(tc)},audioDialogOpen:Sy.open,onAudioDialogClose:()=>oa({open:!1}),onApplyAudio:c=>De.applyAudio(c),onAudioDialogCustomPick:()=>{oa({open:!1}),Q==null||Q.onPick(nc)},youtubeDialogOpen:Py.open,onYoutubeDialogClose:()=>Yo({open:!1}),onApplyYoutube:c=>De.applyYoutube(c),onYoutubeDialogCustomPick:()=>{Yo({open:!1}),ee==null||ee.onPick(rc)},imageProperties:Ay,onImagePropertiesTabChange:c=>ia(m=>({...m,tab:c})),onImagePropertiesClose:()=>ia(c=>({...c,open:!1})),onApplyImageProperties:c=>De.applyImageProperties(c),tableDialogOpen:Sl.open,onTableDialogClose:()=>Pl({open:!1}),onApplyTable:c=>De.applyTable(c),tableProperties:Al,onTablePropertiesClose:()=>Tl(c=>({...c,open:!1})),onApplyTableProperties:c=>De.applyTableProperties(c),cellProperties:Rl,onCellPropertiesClose:()=>Dl(c=>({...c,open:!1})),onApplyCellProperties:c=>De.applyCellProperties(c),rowProperties:jl,onRowPropertiesClose:()=>Il(c=>({...c,open:!1})),onApplyRowProperties:c=>De.applyRowProperties(c),compatibilityPanelOpen:Ty,capabilitiesValidation:Ml,onCompatibilityPanelClose:()=>Wd(!1),isToolbarItemAllowed:Tt?ax:void 0}),i.jsx(lN,{toolbarVisible:N,toolbarPos:no,captureChromeSelection:Ea,toolbarShellProps:rx,children:i.jsx(qN,{propsRef:Td,pageStore:wt,mode:pt,enableMultiPages:ce,contentLocked:Fe,activePageIndex:Jr,hasSelectedPage:Lo,pageZoomScale:Nl,rulerVisible:_o,rulerUnit:nn,optimizeEmbeddedImages:Y,placeholder:y,value:e,pagesProp:we,controlledHtml:Un,initialHtml:nt,initialStorageHtml:qs,defaultPages:Ye.current??[nr()],ingestedPagesProp:Ad,onChange:n,fontFaces:oo,enableComments:dt,commentsVisible:Vn,disabled:b,locale:S,commentAuthor:Dn,activeThreadId:Wn,contextMenu:Iy,commentThreads:Mo,commands:so,htmlFileDropDragging:Am.dragging,selectedImage:Ct,hiddenContextMenuCommands:Tt==null?void 0:Tt.hiddenContextMenuCommands,pageLayoutEnabled:Pt})}),Mt?i.jsx(JN,{onClick:()=>gn(!1)}):null]})})})})})}function XN({dark:e,toolbarBackground:t,workspaceBackground:n,menuColor:r,menuBackground:o,menuFontSize:a,menuFontFamily:s,border:u}){const d={};return n&&(d["--wysiwyg-workspace-background"]=n),e||(t&&(d["--wysiwyg-toolbar-background"]=t),r&&(d["--wysiwyg-menu-color"]=r),o&&(d["--wysiwyg-menu-background"]=o)),a&&(d["--wysiwyg-menu-font-size"]=a),s&&(d["--wysiwyg-menu-font-family"]=s),u==="none"?(d["--wysiwyg-border-width"]="0",d["--wysiwyg-border-radius"]="0",d["--wysiwyg-border-shadow"]="none"):u&&(u.width&&(d["--wysiwyg-border-width"]=u.width),u.color&&(d["--wysiwyg-border-color"]=u.color),u.radius&&(d["--wysiwyg-border-radius"]=u.radius),u.shadow&&(d["--wysiwyg-border-shadow"]=u.shadow)),Object.keys(d).length?d:void 0}function JN({onClick:e}){const t=J();return i.jsx("button",{type:"button",className:Se.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:i.jsx(Ge,{className:Se.exitFullscreenIcon})})}function QN(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)===bt?!0:t.length===2&&t.some(r=>r.name===bt)&&t.some(r=>r.name==="class"&&r.value.includes("wysiwyg-comment-anchor"))?!e.hasAttribute("style"):!1}function eL(e){for(const t of[...e.querySelectorAll(`[${bt}]`)])t.removeAttribute(bt),t instanceof HTMLElement&&t.classList.remove("wysiwyg-comment-anchor");for(const t of[...e.querySelectorAll("span")]){if(!QN(t))continue;const n=t.parentNode;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}}function tL(e){const t=e.trim();if(!t)return e;const n=new DOMParser().parseFromString(t,"text/html");return eL(n.body),n.body.innerHTML}exports.Editor=YN;exports.PAGE_SEPARATOR=cs;exports.formatCapabilityViolationLocation=zb;exports.formatCapabilityViolationMessage=Hb;exports.isPageLayoutAllowed=gd;exports.joinPagesToHtml=zt;exports.normalizeContract=Us;exports.resolveEditorCapabilities=_b;exports.sanitizeDocumentHtml=mo;exports.sanitizePageHtml=gu;exports.splitPagesFromHtml=ar;exports.stripCommentAnchors=tL;exports.validateHtmlAgainstCapabilities=Lb;exports.validatePagesAgainstCapabilities=yu;
320
+ `)},[r,t.pages,t.revision,a,Q,v]),qe=dN(r?t.pages:[],r?t.revision:0);l.useLayoutEffect(()=>{var ce;if(!r)return;const Y=(ce=e.current.multiPageVisualRef.current)==null?void 0:ce.getActivePageRoot();Y instanceof HTMLDivElement&&(e.current.visualRootRef.current=Y)},[r,a,qe.length,e]);const lt=l.useMemo(()=>r?qe[s?a:0]??"":ge(Q).body,[r,qe,a,s,Q]),ct=l.useMemo(()=>Bg(it(lt)),[lt]);Z.activePageHtmlRef.current=lt,Z.pageCanvasSizedRef.current=ct,l.useEffect(()=>{const ce=(et?et.split(`
321
+ `):[]).map(we=>{const Le=document.createElement("link");return Le.rel="stylesheet",Le.href=we,Le.setAttribute(Ds,""),document.head.append(Le),Le});return()=>{for(const we of ce)we.remove()}},[et]),l.useEffect(()=>{(!A||n!=="visual"||!I)&&e.current.setActiveThreadId(null)},[A,n,I,e]),l.useEffect(()=>{if(!E)return;const Y=ce=>{var tn;const we=e.current,Le=ce.target;if((tn=we.commentPanelRef.current)!=null&&tn.contains(Le))return;const en=we.visualRootRef.current;en&&cb(en,Le)||we.setActiveThreadId(null)};return document.addEventListener("pointerdown",Y),()=>document.removeEventListener("pointerdown",Y)},[E,e]),l.useEffect(()=>{if(!r||n!=="html")return;const Y=t.pages[a]??t.pages[0]??"";Z.htmlModePageHtmlRef.current=Y,ee(Y)},[r,n,t.pages,t.revision,a,Z]),l.useEffect(()=>{if(!A||n!=="visual")return;const Y=e.current.visualRootRef.current;Y&&(LP(Y,K),lb(Y,I))},[A,n,K,I,Q,e]);const St=n==="visual"&&d&&G&&ct,mn=l.useMemo(()=>E?zP(K,E):null,[E,K]),ut=n==="visual"?r?i.jsx(PE,{ref:Z.multiPageVisualRef,pages:qe,activePageIndex:a,hasSelectedPage:s,scrollRootRef:Z.workspaceRef,suppressPageFlushRef:Z.suppressPageFlushRef,pendingInsertPageFocusRef:Z.pendingInsertPageFocusRef,onActivePageIndexChange:Y=>{var Le;Z.activePageIndexRef.current=Y,Z.setActivePageIndex(Y);const ce=(Le=Z.multiPageVisualRef.current)==null?void 0:Le.getContainer(),we=ce?We(ce,Y):null;we instanceof HTMLDivElement&&(Z.visualRootRef.current=we)},onPageSelected:()=>{Z.setHasSelectedPage(!0)},onPageChange:(Y,ce)=>{const we=se.current[Y]??"";Z.recordPageVisualHtml(Y,Zt(ce,ge(we).body),!0)},onPageFlush:(Y,ce)=>{const we=se.current[Y]??"";Z.recordPageVisualHtml(Y,Zt(ce,ge(we).body),!1)},onBeforeInput:Z.handleVisualBeforeInput,onPointerDown:Y=>{if(Y.currentTarget instanceof HTMLDivElement&&(Z.visualRootRef.current=Y.currentTarget),Z.handleVisualPointerDown(Y),Y.currentTarget instanceof HTMLDivElement){const ce=Y.currentTarget;requestAnimationFrame(()=>vo(ce))}},onMouseUp:Z.handleVisualMouseUp,onContextMenu:Z.handleVisualContextMenu,placeholder:g,disabled:o,rulerVisible:d,rulerUnit:f,zoomScale:u,onMarginPreview:Z.multiPageRulerMarginPreview,onMarginChange:Z.multiPageRulerMarginChange,onIndentChange:Z.multiPageRulerIndentChange,resolveEmbeddedImageDataUrl:h?Z.resolveEmbeddedImageDataUrl:void 0,hydrateEmbeddedImages:h?Z.hydrateExportHtml:void 0,pageLayoutEnabled:G}):i.jsx(BN,{ref:Z.visualRootRef,html:ge(Q).body,pageHtml:Q,rulerVisible:d,rulerUnit:f,zoomScale:u,pageLayoutEnabled:G,propSyncGuardRef:Z.visualPropSyncGuardRef,resolveEmbeddedImageDataUrl:h?Z.resolveEmbeddedImageDataUrl:void 0,hydrateEmbeddedImages:h?Z.hydrateExportHtml:void 0,onMarginPreview:Z.singlePageRulerMarginPreview,onMarginChange:Z.singlePageRulerMarginChange,onIndentChange:Z.singlePageRulerIndentChange,onChange:Y=>Z.recordVisualInputHtml(Y,!0),onBeforeInput:Z.handleVisualBeforeInput,onPointerDown:Y=>{if(Z.handleVisualPointerDown(Y),Y.currentTarget instanceof HTMLDivElement){const ce=Y.currentTarget;requestAnimationFrame(()=>vo(ce))}},onMouseUp:Z.handleVisualMouseUp,onContextMenu:Z.handleVisualContextMenu,placeholder:g,disabled:o}):i.jsxs("div",{className:Se.htmlModeShell,children:[r&&t.pages.length>1?i.jsx(NN,{pageCount:t.pages.length,activeIndex:a,onSelect:Z.handleHtmlPageTabSelect}):null,i.jsx(RN,{ref:Z.htmlAreaRef,html:r?ye:Q,onChange:Y=>{Z.htmlModePageHtmlRef.current=Y,ee(Y),Z.handleHtmlSurfaceChange(Y)},placeholder:g,disabled:o})]});return i.jsxs(i.Fragment,{children:[i.jsxs("div",{ref:Z.workspaceRef,className:`${Se.workspace} ${ct?Se.workspacePageSized:""} ${St?Se.workspaceWithRuler:""}`,onDragEnter:Z.htmlFileDrop.onDragEnter,onDragOver:Z.htmlFileDrop.onDragOver,onDragLeave:Z.htmlFileDrop.onDragLeave,onDrop:Z.htmlFileDrop.onDrop,children:[n==="visual"?i.jsx("div",{className:Se.pageCanvasViewport,"data-page-canvas-sized":ct?"":void 0,children:ut}):ut,Z.htmlFileDrop.dragging?i.jsx(WN,{}):null]}),n==="visual"&&!o&&(F!=null&&F.isConnected)?i.jsx(UN,{img:F,onResize:Z.handleImageResize,onResizeEnd:Z.handleImageResizeEnd}):null,A&&I&&mn?i.jsx(TN,{panelRef:Z.commentPanelRef,thread:mn,locale:R,disabled:D,commentAuthor:T,onPost:Z.postCommentMessage,onClose:()=>Z.setActiveThreadId(null)}):null,i.jsx(hw,{open:N.open,x:N.x,y:N.y,kind:N.kind,inTable:N.inTable,canMergeCells:N.canMergeCells,canUnmergeCells:N.canUnmergeCells,canDeletePage:N.canDeletePage,canAddComment:N.canAddComment,hiddenCommands:U,commands:$,onClose:()=>Z.setContextMenu(Y=>({...Y,open:!1}))})]})}const qN=l.memo(GN,VN),ZN=.005;function YN({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:o,onOpen:a,mode:s,defaultMode:u="visual",onModeChange:d,fullscreen:f,defaultFullscreen:h=!1,onFullscreenChange:g,placeholder:y,disabled:b,readOnly:w=!1,className:x,locale:S="en",toolbarBackground:k,workspaceBackground:v,menuColor:A,menuBackground:I,menuFontSize:D,menuFontFamily:R,border:T,menuVisible:E=!0,toolbarVisible:N=!0,allowedChrome:K,customActions:$,customFonts:P,transformHtml:F,sanitizeHtml:U=!0,loadCustomParagraphStyles:G,onSaveCustomParagraphStyle:me,onDeleteCustomParagraphStyle:se,customImagePicker:V,disableBuiltinImageInsert:re,customBackgroundImagePicker:de,disableBuiltinBackgroundImageInsert:oe,disableBuiltinBackgroundImageSources:_,customAudioPicker:Q,disableBuiltinAudioInsert:ye,customVideoPicker:ee,disableBuiltinVideoInsert:Z,disableHtmlFileDrop:Ee=!1,toolbarCustomization:et,darkMode:qe=!1,darkModePersistence:lt,toolbarPosition:ct="top",toolbarPositionPersistence:St,enablePageProperties:mn=!1,defaultPageProperties:ut,optimizeEmbeddedImages:Y=!1,enableMultiPages:ce=!1,pages:we,defaultPages:Le,onPagesChange:en,defaultRulerVisible:tn=!0,rulerUnit:nn="in",enableComments:dt=!1,defaultCommentsVisible:Rn=!0,commentAuthor:Dn,comments:tt,defaultComments:Gr=[],onCommentsChange:qr,renderingCapabilities:Ze,onCapabilitiesValidation:xr}){var tf;const Be=!!(b||w),Oe=!!b,Pt=Ze?gd(Ze):!0,q=ce?we!==void 0:e!==void 0,te=ir(Le??(t.trim()?[t]:[nr()]));let le=te;!q&&ut&&Pt&&(le=te.map(c=>$f(c,ut))),Pt||(le=le.map(Rc));const Ce=l.useRef(null);Y&&Ce.current===null&&(Ce.current=kv());const Ye=l.useRef(null);Ye.current===null&&(Ye.current=Y&&Ce.current?le.map(c=>Ce.current.externalizeHtml(c)):[...le]);const fn=ce?zt(Ye.current):Ye.current[0]??"",nt=U?mo(fn):fn,rn=ce&&we!==void 0?zt(ir(we)):e,Un=l.useMemo(()=>{if(rn!==void 0)return U?mo(rn):rn},[rn,U]),In=l.useRef(n);In.current=n;const mt=l.useRef(Y);mt.current=Y;const Me=l.useCallback(c=>!mt.current||!Ce.current?c:Ce.current.externalizeHtml(c),[]),ft=l.useCallback(c=>!mt.current||!Ce.current?c:Ce.current.hydrateHtml(c),[]),pn=l.useCallback(c=>c.map(m=>ft(m)),[ft]),Gs=l.useCallback(c=>{var m;return((m=Ce.current)==null?void 0:m.getDataUrl(c))??null},[]),Mi=l.useCallback(c=>{var m;(m=In.current)==null||m.call(In,ft(c))},[ft]),[qs]=l.useState(()=>{if(Y&&e!==void 0&&!ce){const c=U?mo(e):e;return Ce.current?Ce.current.externalizeHtml(c):c}return nt}),[pt,Ni]=es({value:s,defaultValue:u,onChange:d}),[Mt,gn]=es({value:f,defaultValue:h,onChange:g}),[Vn,Zs]=l.useState(Rn),[_o,Ys]=l.useState(tn),Li=l.useRef(_o);Li.current=_o;const[Wn,hn]=l.useState(null),[Mo,wr]=es({value:tt,defaultValue:Gr,onChange:qr}),B=l.useRef(null),$t=l.useRef(null),Bi=l.useRef(null),Cr=l.useRef(null),xt=l.useRef(null),vr=l.useRef(!1),Fi=l.useRef(null),At=l.useRef(null),be=l.useRef(ce);be.current=ce;const Xs=l.useRef(ut);Xs.current=ut;const kd=l.useRef(Pt);kd.current=Pt;const Gn=l.useRef(dt);Gn.current=dt;const Sd=l.useRef(w);Sd.current=w;const Pd=l.useRef(Be);Pd.current=Be;const Hi=l.useRef(Vn);Hi.current=Vn;const zi=l.useRef(Mo);zi.current=Mo;const Oi=l.useRef(en);Oi.current=en;const Ki=l.useRef(null),$i=l.useRef(!1),Zr=l.useCallback(()=>{var m;$i.current=!1;const c=Ki.current;Ki.current=null,c&&((m=Oi.current)==null||m.call(Oi,c.pages,c.activePageIndex))},[]),Yr=l.useCallback((c,m)=>{Ki.current={pages:[...c],activePageIndex:m},!$i.current&&($i.current=!0,queueMicrotask(Zr))},[Zr]),Js=l.useRef(we);Js.current=we;const Ad=l.useMemo(()=>!Y||we===void 0?we:ir(we).map(c=>{var C;const m=U?mo(c):c;return((C=Ce.current)==null?void 0:C.externalizeHtml(m))??m}),[Y,we,U]),wt=EA({enabled:ce,pagesProp:Ad,defaultPages:Ye.current??[nr()]}),Xr=l.useRef(null),Td=l.useRef(null),[Jr,No]=l.useState(0),Ae=l.useRef(Jr);Ae.current=Jr;const jn=l.useRef(ce?((tf=Ye.current)==null?void 0:tf[0])??"":""),Qr=l.useRef(!1),[Lo,kr]=l.useState(!1),on=l.useRef(Lo);on.current=Lo;const[Qs,yy]=l.useState(0),Rd=l.useRef(!1),Dd=l.useRef(!1),Nt=l.useMemo(()=>Jb(),[]),el=l.useRef(null);el.current===null&&(el.current=ce?NT(Ye.current??[nr()]):MT(Me(nt)));const ie=el.current,bn=l.useCallback(()=>{const c=ie.canUndo(),m=ie.canRedo();c===Rd.current&&m===Dd.current||(Rd.current=c,Dd.current=m,yy(C=>C+1))},[ie]),ae=l.useRef(nt),Re=l.useRef(Ye.current??[nr()]);ce&&(Re.current=wt.pages);const Id=l.useRef(""),jd=l.useRef(!1),Ut=l.useRef(!0),eo=l.useRef(""),En=l.useRef(null),L=l.useRef(pt);L.current=pt;const Ed=l.useRef(Mt);Ed.current=Mt;const Ue=l.useRef(null),[,xy]=l.useState(0),Bo=l.useRef(null);Bo.current===null&&(Bo.current=QP(()=>{xy(c=>c+1)}));const Ui=l.useRef(F);Ui.current=F;const _d=l.useRef(U);_d.current=U;const Vt=l.useRef({}),Lt=l.useRef(null),Wt=l.useRef(null),an=l.useRef(null),sn=l.useRef(null),qn=l.useRef(null),Bt=l.useRef(null),[Fo,tl]=l.useState(lr),nl=l.useRef(Fo);nl.current=Fo;const _n=l.useRef(xo),[Ho,Vi]=l.useState({value:null,unit:xo,mixed:!1}),Zn=l.useRef(Ho);Zn.current=Ho;const[zo,rl]=l.useState({value:null,mixed:!1}),Oo=l.useRef(zo);Oo.current=zo;const[Ko,ol]=l.useState({value:null,mixed:!1}),$o=l.useRef(Ko);$o.current=Ko;const[Uo,il]=l.useState({value:null,mixed:!1}),Vo=l.useRef(Uo);Vo.current=Uo;const[Wi,al]=l.useState({tag:null,mixed:!1}),sl=l.useRef(Wi);sl.current=Wi;const[Md,ll]=l.useState({align:"left",mixed:!1}),cl=l.useRef(Md);cl.current=Md;const[Nd,ul]=l.useState({type:null,mixed:!1}),Wo=l.useRef(Nd);Wo.current=Nd;const[Ld,dl]=l.useState(!1),Bd=l.useRef(Ld);Bd.current=Ld;const[Gi,ml]=l.useState(!1),fl=l.useRef(Gi);fl.current=Gi;const[qi,Fd]=l.useState(!1),Zi=l.useRef(qi);Zi.current=qi;const Yi=l.useRef(null),Xi=l.useRef(null),[Hd,zd]=l.useState(!1),Od=l.useRef(Hd);Od.current=Hd;const{fontDialog:Ji,setFontDialog:Qi,customizeToolbarOpen:pl,setCustomizeToolbarOpen:Kd,documentPreview:ea,setDocumentPreview:$d,toolbarSettings:gl,setToolbarSettings:ta,toolbarSettingsLoading:wy,setToolbarSettingsLoading:hl,toolbarSettingsBusy:Cy,setToolbarSettingsBusy:bl,paragraphDialog:Go,setParagraphDialog:to,customCssDialog:yl,setCustomCssDialog:xl,pageDialog:qo,setPageDialog:Sr,deletePageConfirmOpen:wl,setDeletePageConfirmOpen:Cl,customStyleDialog:vy,setCustomStyleDialog:Zo,linkDialog:vl,setLinkDialog:na,bookmarkDialog:Ud,setBookmarkDialog:kl,imageDialog:ky,setImageDialog:ra,audioDialog:Sy,setAudioDialog:oa,youtubeDialog:Py,setYoutubeDialog:Yo,imageProperties:Ay,setImageProperties:ia,tableDialog:Sl,setTableDialog:Pl,tableProperties:Al,setTableProperties:Tl,cellProperties:Rl,setCellProperties:Dl,rowProperties:Il,setRowProperties:jl,helpDialog:El,setHelpDialog:Xo,aboutDialogOpen:_l,setAboutDialogOpen:Vd}=jA(),[Ty,Wd]=l.useState(!1),[Ml,aa]=l.useState(null),Pr=l.useRef(xr);Pr.current=xr;const Tt=l.useMemo(()=>Ze?_b(Ze):void 0,[Ze]),[Yn,sa]=l.useState(()=>lt?qe:sp()??qe),[no,la]=l.useState(()=>St?ct:lp()??ct),[Jo,Ry]=l.useState(()=>BA()??"fitWidth"),[Nl,Dy]=l.useState(1),[ca,Gd]=l.useState([]),[ua,Ll]=l.useState(!1),[Iy,da]=l.useState(!1),[jy,Bl]=l.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1,canDeletePage:!1,canAddComment:!1}),[Ct,ro]=l.useState(null),Fl=l.useRef(Ct);Fl.current=Ct;const[ma,qd]=l.useState(!1),Zd=l.useRef(ma);Zd.current=ma;const[fa,Yd]=l.useState(!1),Xd=l.useRef(fa);Xd.current=fa;const[pa,Jd]=l.useState(!1),Qd=l.useRef(pa);Qd.current=pa;const em=l.useRef(void 0),ga=l.useRef(ca);ga.current=ca;const tm=l.useRef(ua);tm.current=ua;const ha=!!(G&&me),Hl=l.useRef(ha);Hl.current=ha;const nm=l.useRef(G);nm.current=G;const rm=l.useRef(me);rm.current=me;const om=l.useRef(se);om.current=se;const im=l.useRef(o);im.current=o;const am=l.useRef(a);am.current=a;const sm=l.useRef(V);sm.current=V;const Mn=de??V,lm=oe??re??!1,zl=_??re??!1,Ol=l.useRef(Mn);Ol.current=Mn;const Kl=l.useRef(lm);Kl.current=lm;const Ey=l.useRef(zl);Ey.current=zl;const cm=l.useRef(Q);cm.current=Q;const um=l.useRef(ee);um.current=ee;const dm=l.useRef(et);dm.current=et;const mm=l.useRef(lt);mm.current=lt;const fm=l.useRef(St);fm.current=St;const pm=l.useRef(Yn);pm.current=Yn;const gm=l.useRef(no);gm.current=no;const ba=l.useRef(Jo);ba.current=Jo;const ya=l.useRef(Nl);ya.current=Nl;const hm=l.useRef(re);hm.current=re;const bm=l.useRef(ye);bm.current=ye;const ym=l.useRef(Z);ym.current=Z;const $l=l.useRef(0),Qo=l.useRef(0),xm=l.useRef(0),xa=l.useRef(0),wm=l.useRef(0),wa=l.useRef(0),Cm=l.useRef(0),oo=l.useMemo(()=>Xp(P),[P]),io=l.useRef(oo);io.current=oo;const Ca=l.useCallback(()=>{var c;if(be.current){const m=(c=xt.current)==null?void 0:c.getActivePageRoot();if(m instanceof HTMLElement)return m}return B.current},[]),yn=l.useCallback(()=>{var C;const c=B.current;if(c!=null&&c.hasAttribute(Kr)){const j=Cf(c);if(j!==null)return j}const m=(C=xt.current)==null?void 0:C.getActivePageIndex();return typeof m=="number"?m:Ae.current},[]),ei=l.useCallback(()=>{if(be.current){const c=xt.current;if(!c)return null;const m=yn();if(m===null)return null;c.ensurePageMounted(m);const C=c.getContainer(),j=C?We(C,m):null;return j instanceof HTMLDivElement?(B.current=j,j):null}return B.current},[yn]),ao=l.useCallback(()=>{if(!be.current)return ae.current;const c=yn()??Ae.current;return Re.current[c]??""},[yn]);l.useLayoutEffect(()=>{var m;if(!ce)return;const c=(m=xt.current)==null?void 0:m.getActivePageRoot();c instanceof HTMLDivElement&&(B.current=c)},[ce,Jr]);const va=l.useRef(()=>{}),Ul=l.useRef(!1),_y=l.useCallback(()=>{if(Ul.current||L.current!=="visual")return;const c=Cr.current;if(c){Ul.current=!0;try{const m=getComputedStyle(c),C=parseFloat(m.paddingLeft)+parseFloat(m.paddingRight),j=parseFloat(m.paddingTop)+parseFloat(m.paddingBottom),M=Math.max(0,c.clientWidth-C),H=Math.max(0,c.clientHeight-j);let X=0,ne=0;if(jd.current){const xe=QC(it(Id.current));xe&&(X=xe.width,ne=xe.height)}else{const xe=Ca(),Fe=ya.current>0?ya.current:1;X=((xe==null?void 0:xe.offsetWidth)??0)/Fe,ne=H}X<=0&&(X=M),ne<=0&&(ne=H);const pe=uk(ba.current,M,H,X,ne);Math.abs(pe-ya.current)>=ZN&&Dy(pe)}finally{Ul.current=!1}}},[Ca]);va.current=_y,l.useLayoutEffect(()=>{if(pt!=="visual")return;const c=Ca();!c||c!==document.activeElement||vo(c)},[pt,Jr,Ca]);const ka=l.useCallback(async()=>{const c=nm.current;if(!c)return;const m=++$l.current;Ll(!0);try{const C=await c();if(m!==$l.current)return;Gd(C)}catch{}finally{m===$l.current&&Ll(!1)}},[]);l.useEffect(()=>{if(!G||!me){Gd([]),Ll(!1);return}ka()},[G,me,ka]);const vm=l.useCallback(async c=>{ta(c);const m=dm.current;if(m!=null&&m.load&&m.save){const C=++xm.current;bl(!0);try{await m.save(c)}catch{}finally{C===xm.current&&bl(!1)}return}HT(c)},[]);l.useEffect(()=>{const c=et;if(!(c!=null&&c.load)||!c.save){ta(FT()),hl(!1),bl(!1);return}const m=++Qo.current;return hl(!0),(async()=>{try{const C=await c.load();if(m!==Qo.current)return;ta(C)}catch{if(m!==Qo.current)return;ta(null)}finally{m===Qo.current&&hl(!1)}})(),()=>{Qo.current+=1}},[et]);const km=l.useCallback(async c=>{sa(c);const m=mm.current;if(m!=null&&m.load&&m.save){const C=++wm.current;try{await m.save(c)}catch{}finally{if(C!==wm.current)return}return}MA(c)},[]),Sm=l.useCallback(c=>{ba.current=c,Ry(c),FA(c);const m=Cr.current;m&&(m.scrollTop=0,m.scrollLeft=0),va.current()},[]);l.useEffect(()=>{const c=lt;if(!(c!=null&&c.load)||!c.save){sa(sp()??qe);return}const m=++xa.current;return(async()=>{try{const C=await c.load();if(m!==xa.current)return;sa(typeof C=="boolean"?C:qe)}catch{if(m!==xa.current)return;sa(qe)}})(),()=>{xa.current+=1}},[lt,qe]),l.useLayoutEffect(()=>{if(va.current(),pt!=="visual")return;const c=Cr.current;if(!c||typeof ResizeObserver>"u")return;const m=dk(()=>{va.current()}),C=new ResizeObserver(()=>{m.schedule()});return C.observe(c),()=>{C.disconnect(),m.cancel()}},[pt,Jr,Jo,ce]);const Pm=l.useCallback(async c=>{la(c);const m=fm.current;if(m!=null&&m.load&&m.save){const C=++Cm.current;try{await m.save(c)}catch{}finally{if(C!==Cm.current)return}return}zA(c)},[]);l.useEffect(()=>{const c=St;if(!(c!=null&&c.load)||!c.save){la(lp()??ct);return}const m=++wa.current;return(async()=>{try{const C=await c.load();if(m!==wa.current)return;la(Ib(C)??ct)}catch{if(m!==wa.current)return;la(ct)}})(),()=>{wa.current+=1}},[St,ct]);const Xn=l.useCallback((c,m)=>{var ne,pe;const C=_d.current?mo(c):c,j=((ne=Ui.current)==null?void 0:ne.call(Ui,C))??C,M=fb(ae.current,j,ft);m!=null&&m.fullReplace&&!M&&mt.current&&((pe=Ce.current)==null||pe.clear());const H=Me(j);if(M)return ae.current=H,{stored:H,stateUpdated:!1};H!==ae.current&&(Ut.current=!0);const X=Xr.current;if(be.current){const xe=wt;if(!xe)return ae.current=H,{stored:H,stateUpdated:!1};const Fe=xe.replacePages(ar(H));return ae.current=Fe.joined,Re.current=Fe.pages,L.current==="html"&&!mt.current&&(X==null||X.setHtml(H)),Yr(pn(Fe.pages),Ae.current),{stored:H,stateUpdated:!0}}return mt.current?(ae.current=H,X==null||X.setStorageHtml(H),Mi(H),{stored:H,stateUpdated:!0}):(ae.current=H,X==null||X.setHtml(H),{stored:H,stateUpdated:!0})},[Me,ft,pn,Mi,Yr]),Gt=l.useCallback((c,m,C,j)=>{var ne;const M=c.map(pe=>Me(pe)),H=wt;if(!H)return zt(M);const X=H.setPages(M,{editedIndex:C});if(!X.changed)return X.joined;if(Re.current=X.pages,Ut.current=!0,ae.current=X.joined,Js.current===void 0&&L.current==="html"&&!mt.current&&((ne=Xr.current)==null||ne.setHtml(X.joined)),Yr(pn(X.pages),Ae.current),!(j!=null&&j.skipHistory)&&qt(ie)){const{changedIndices:pe,pages:xe}=X;if(pe.length===1){const Fe=C??pe[0];ie.recordPageEdit(Fe,xe[Fe]??"",{coalesce:m})}else pe.length>1?ie.recordReplaceAll(xe):C!==void 0?ie.recordPageEdit(C,xe[C]??"",{coalesce:m}):ie.recordReplaceAll(xe)}return bn(),X.joined},[bn,Me,pn,ie,wt,Yr]),Jn=l.useCallback(c=>{var H,X;if(L.current!=="visual")return;const m=mt.current?ne=>{var pe;return((pe=Ce.current)==null?void 0:pe.getDataUrl(ne))??null}:void 0,C=mt.current?ft:void 0;if((H=$t.current)==null||H.call($t),be.current){const ne=(X=xt.current)==null?void 0:X.getContainer();if(!ne)return;const pe=ar(c);for(let xe=0;xe<pe.length;xe+=1){const Fe=We(ne,xe);if(!Fe)continue;const Ne=cn(ge(pe[xe]??"").body);ws(Fe,Ne,{resolveDataUrl:m,hydrateEmbeddedImages:C})}return}const j=B.current;if(!j)return;const M=cn(ge(c).body);ws(j,M,{resolveDataUrl:m,hydrateEmbeddedImages:C})},[ft]),gt=l.useCallback((c,m)=>{const{stored:C,stateUpdated:j}=Xn(c,{fullReplace:!m});return!m&&j&&Jn(C),qt(ie)?ie.recordReplaceAll(ar(C)):ie.record(C,{coalesce:m}),bn(),C},[bn,Xn,ie,Jn]),My=l.useCallback(c=>{if(be.current){const m=Ae.current,j=Re.current.slice();j[m]=c,Gt(j,!1,m);return}gt(c,!1)},[Gt,gt]),Am=ET({enabled:!Be&&!Ee,onHtml:My}),ve=l.useCallback((c,m)=>{var C;return(C=$t.current)==null||C.call($t),gt(ri(c,Oa(c,ae.current,io.current,{liveRoot:B.current??void 0})),m)},[gt]),Ny=l.useCallback((c,m)=>ve(Zt(c,ae.current),m),[ve]),Sa=l.useCallback((c,m,C)=>{iv(c,m,C)},[]),Pa=l.useCallback((c,m,C)=>{const j={...ui(c),atRule:it(Hg(m,C))};return pu(c,j)},[]),Ar=l.useCallback((c,m,C)=>ri(c,Oa(c,m,io.current,{liveRoot:C})),[]),ht=l.useCallback(c=>{const m=xt.current,C=m==null?void 0:m.getContainer(),j=wt.pages.length>0?wt.pages:Re.current;if(!C||!m)return[...j];const M=wt;if(!M)return[...j];const H=M.dirtyPagesRef.current,X=(c==null?void 0:c.allPages)===!0,ne=Ae.current;let pe=!1;const xe=j.map((Ne,rt)=>{if(!(X||H.has(rt)||rt===ne))return Ne;const Bn=We(C,rt);let lo=null;if(Bn?(Bs(Bn),lo=Bn.innerHTML):lo=m.flushPageHtml(rt),lo===null){const rf=cn(ge(Ne).body),of=_f(rf);if(of===rf)return Ne;const af=Ar(Zt(of,ge(Ne).body),Ne);return af!==Ne&&(pe=!0),af}const sx=Zt(lo,ge(Ne).body),nf=Ar(sx,Ne,Bn??void 0);return nf!==Ne&&(pe=!0),nf});if(pe){const Ne=mt.current?xe.map(Ir=>Me(Ir)):xe,rt=M.setPages(Ne);ae.current=rt.joined}M.markPagesClean();const Fe=pe?M.pages:j;return mt.current?Fe.map(Ne=>Me(Ne)):[...Fe]},[Me,wt,Ar]),Tr=l.useCallback((c,m,C)=>{const j=Ar(m,Re.current[c]??""),M=Xc(Re.current,c,j);M.changed&&Gt(M.pages,C,c)},[Gt,Ar]),Rr=l.useCallback((c,m,C)=>{const j=Re.current[c]??"",M=ge(m).body,H=_f(M),X=H===M?m:Ar(Zt(H,ge(j).body),j),ne=Xc(Re.current,c,X);ne.changed&&Gt(ne.pages,C,c)},[Gt,Ar]),ti=l.useCallback((c,m)=>{const C=ge(c).body;be.current?Tr(Ae.current,C,m):ve(C,m)},[Tr,ve]),fe=l.useCallback((c,m,C)=>{var X;const j=C?ge(C).body:c.innerHTML,M=ne=>C?j:Zt(j,ge(ne).body);if(!be.current){ve(M(ae.current),m);return}const H=(X=xt.current)==null?void 0:X.getContainer();if(!H){ve(M(ae.current),m);return}for(let ne=0;ne<Re.current.length;ne+=1)if(We(H,ne)===c){Tr(ne,M(Re.current[ne]??""),m);return}ve(M(ae.current),m)},[Tr,ve]),Tm=l.useCallback((c,m)=>{Sd.current||fe(c,m)},[fe]),Ly=l.useMemo(()=>AE(()=>B.current,()=>ae.current,Sa),[Sa]),By=l.useMemo(()=>TE(()=>B.current,()=>ae.current,Pa,c=>ve(ge(c).body,!1)),[Pa,ve]),Fy=l.useMemo(()=>Sp(()=>B.current,nn??"in",c=>fe(c,!1)),[nn,fe]),Hy=l.useMemo(()=>RE(c=>{var C;const m=(C=xt.current)==null?void 0:C.getContainer();return m?We(m,c):null},c=>Re.current[c]??"",Sa),[Sa]),zy=l.useMemo(()=>DE(c=>{var C;const m=(C=xt.current)==null?void 0:C.getContainer();return m?We(m,c):null},c=>Re.current[c]??"",Pa,(c,m)=>Tr(c,ge(m).body,!1)),[Pa,Tr]),Oy=l.useMemo(()=>Sp(()=>{var m;const c=(m=xt.current)==null?void 0:m.getContainer();return c?We(c,Ae.current):null},nn??"in",c=>fe(c,!1)),[nn,fe]),Aa=l.useCallback(()=>{const c=be.current?ht():[ae.current];return c[Ae.current]??c[0]??""},[ht]),Dr=l.useCallback(()=>{if(!be.current)return[ae.current];if(L.current==="html"){const c=Re.current.slice();return c[Ae.current]=jn.current,c}return ht({allPages:!0})},[ht]),Ta=l.useCallback(c=>{if(!be.current||L.current!=="visual"||!on.current)return;vr.current=!0;const m=ht(),C=Math.max(0,Math.min(c,m.length)),j=[...m],M=kd.current&&Xs.current?$f(nr(),Xs.current):nr();j.splice(C,0,M);const H=j.map(X=>Me(X));Gt(j,!1,void 0,{skipHistory:!0}),qt(ie)&&ie.recordInsertPage(C,H),Ae.current=C,No(C),kr(!0),Fi.current=C},[ht,Gt,ie,Me]),Rm=l.useCallback(()=>{const c=yn();c===null||!on.current||Ta(c)},[Ta,yn]),Dm=l.useCallback(()=>{const c=yn();c===null||!on.current||Ta(c+1)},[Ta,yn]),Im=l.useCallback(()=>{if(!be.current||L.current!=="visual"||!on.current)return;vr.current=!0;const c=ht();if(c.length<=1){vr.current=!1;return}const m=yn();if(m===null){vr.current=!1;return}const C=c[m]??"",j=c.filter((ne,pe)=>pe!==m),M=Me(C),H=j.map(ne=>Me(ne));Gt(j,!1,void 0,{skipHistory:!0}),qt(ie)&&ie.recordDeletePage(m,M,H);const X=Math.min(m,j.length-1);Ae.current=X,No(X),kr(!0)},[ht,Gt,ie,yn,Me]);l.useEffect(()=>{ce||kr(!1)},[ce]),l.useEffect(()=>()=>{Ki.current&&($i.current=!1,Zr())},[Zr]);const Ra=l.useCallback(c=>{var j,M;const m=wt.replacePages([...c]);ae.current=m.joined,Re.current=m.pages,Ut.current=!0,Yr(pn(m.pages),Ae.current);const C=Math.max(0,Math.min(Ae.current,m.pages.length-1));C!==Ae.current&&(Ae.current=C,No(C)),Js.current===void 0&&L.current==="html"&&!mt.current&&((j=Xr.current)==null||j.setHtml(m.joined)),(M=$t.current)==null||M.call($t),Jn(m.joined),qt(ie)&&ie.applyPresent(m.pages)},[pn,ie,wt,Yr,Jn]),Da=l.useCallback(()=>{if(L.current!=="visual"||Be){ro(null);return}const c=B.current;if(!c)return;const m=sr(c);ro(C=>m||(C&&C.isConnected&&c.contains(C)?C:null))},[Be]),Ia=l.useCallback(()=>{if(qt(ie)){const m=ie.undo();if(m===null)return;ie.markApplying(),Ra(m),bn();return}const c=ie.undo();c!==null&&(ie.markApplying(),Xn(c,{fullReplace:!0}),Jn(c),ie.finishApplying(),Da(),bn())},[Ra,bn,Xn,ie,Da,Jn]),ja=l.useCallback(()=>{if(qt(ie)){const m=ie.redo();if(m===null)return;ie.markApplying(),Ra(m),bn();return}const c=ie.redo();c!==null&&(ie.markApplying(),Xn(c,{fullReplace:!0}),Jn(c),ie.finishApplying(),Da(),bn())},[Ra,bn,Xn,ie,Da,Jn]);l.useEffect(()=>{if(ce){qt(ie)&&(we!==void 0&&!Y?ie.syncPages(Re.current):ie.applyPresent(Re.current));return}qt(ie)||ie.syncExternal(ae.current)},[ce,Y,ie,we]);const z=l.useCallback(()=>{Ue.current=wn({mode:L.current,visualEl:B.current,htmlEl:At.current})},[]),xn=l.useCallback(c=>{if(!c||L.current!=="visual"){qd(!1),Yd(!1),Jd(!1);return}qd(ad(c)!==null),Yd(Hf(c)),Jd(zf(c))},[]),Ea=l.useCallback(()=>{const c=wn({mode:L.current,visualEl:B.current,htmlEl:At.current}),m=Ue.current;Uc(m,c)||(Ue.current=c)},[]),Vl=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){Vi({value:null,unit:_n.current,mixed:!1});return}const m=kh(c,_n.current);Lt.current&&(m.value=Lt.current.value,m.unit=Lt.current.unit,m.mixed=!1),_n.current=m.unit,Vi(C=>C.value===m.value&&C.unit===m.unit&&C.mixed===m.mixed?C:m)},[]),Wl=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){rl({value:null,mixed:!1});return}const m=tg(c);Wt.current&&(m.value=Wt.current.value,m.mixed=!1),rl(C=>C.value===m.value&&C.mixed===m.mixed?C:m)},[]),Gl=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){ol({value:null,mixed:!1}),il({value:null,mixed:!1});return}const m=os(c,"color");an.current&&(m.value=an.current.value,m.mixed=!1);const C=os(c,"backgroundColor");sn.current&&(C.value=sn.current.value,C.mixed=!1),ol(j=>j.value===m.value&&j.mixed===m.mixed?j:m),il(j=>j.value===C.value&&j.mixed===C.mixed?j:C)},[]),ql=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){al({tag:null,mixed:!1});return}const m=tS(c);al(C=>C.tag===m.tag&&C.mixed===m.mixed?C:m)},[]),Zl=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){ll({align:null,mixed:!1}),ul({type:null,mixed:!1}),dl(!1),zd(!1);return}const m=Xh(c);ll(H=>H.align===m.align&&H.mixed===m.mixed?H:m);const C=Lh(c);ul(H=>H.type===C.type&&H.mixed===C.mixed?H:C);const j=dS(c);dl(H=>H===j?H:j);const M=yP(c);zd(H=>H===M?H:M)},[]),O=l.useCallback(()=>{const c=B.current;if(L.current!=="visual"||!c){tl(lr()),ml(!1),Vl(),Wl(),Gl(),ql(),Zl();return}const m=Ue.current,C=!!(m&&!m.collapsed);ml(M=>M===C?M:C);const j=Rh(go(c),Vt.current);tl(M=>_k(M,j)?M:j),Vl(),Wl(),Gl(),ql(),Zl()},[Vl,Wl,Gl,ql,Zl]),jm=l.useCallback(()=>{const c=Ue.current,m=Bt.current;!m||!c||c.collapsed&&c.start===m.start&&c.end===m.end||(Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,qn.current=null,Bt.current=null)},[]);l.useEffect(()=>{if(pt==="visual"){O();return}Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,qn.current=null,Bt.current=null,tl(lr()),Vi({value:null,unit:_n.current,mixed:!1}),rl({value:null,mixed:!1}),ol({value:null,mixed:!1}),il({value:null,mixed:!1}),al({tag:null,mixed:!1}),ll({align:null,mixed:!1}),ul({type:null,mixed:!1}),dl(!1),ml(!1)},[pt,O]);const ni=l.useCallback((c,m,C)=>{pf({snapshot:c,visualEl:B.current,htmlEl:At.current,getHtml:()=>L.current==="visual"&&B.current?B.current.innerHTML:ae.current,setHtml:j=>{if(L.current==="visual"){const M=be.current?Re.current[Ae.current]??"":ae.current;ti(Zt(ge(j).body,ge(M).body),!1);return}gt(j,!1)},content:m,asHtml:C})},[gt,ti]),Ky=l.useCallback(c=>{if(!be.current||c===Ae.current)return;Qr.current&&Rr(Ae.current,jn.current,!0),Qr.current=!1,Ae.current=c,No(c);const m=Re.current[c]??"";jn.current=m},[Rr]),$y=l.useCallback(c=>{if(Qr.current=!0,be.current){if(mt.current){const m=Me(c);jn.current=m,Rr(Ae.current,m,!0)}else jn.current=c,Rr(Ae.current,c,!0);return}gt(c,!0)},[Me,gt,Rr]),Em=l.useCallback(c=>{var m;if(L.current==="visual"&&c==="html"){if(be.current){const C=ht({allPages:!0}),j=Ae.current,M=C[j]??C[0]??"";jn.current=M,Qr.current=!1,ae.current=zt(C),Zr()}else if(B.current){const C=Zt(B.current.innerHTML,ge(ae.current).body),j=ri(C,Oa(C,ae.current,io.current,{liveRoot:B.current??void 0}));if(mt.current){const M=Me(j),H=ae.current;(m=Xr.current)==null||m.setStorageHtml(M),ae.current=M,M!==H&&(Ut.current=!0,qt(ie)||ie.record(M,{coalesce:!0}))}else j!==ae.current&&gt(j,!0)}}L.current==="html"&&c==="visual"&&be.current&&(Qr.current&&Rr(Ae.current,jn.current,!0),Qr.current=!1),Ni(c),c!=="visual"&&kr(!1)},[Me,Zr,ie,gt,Rr,Ni,ht]);l.useEffect(()=>{if(!Mt)return;const c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c}},[Mt]),l.useEffect(()=>{if(!Mt)return;const c=m=>{m.key==="Escape"&&(m.defaultPrevented||Ji.open||yl.open||Go.open||qo.open||wl||Sl.open||Al.open||Rl.open||Il.open||pl||ea.open||El.open||_l||(m.preventDefault(),gn(!1)))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[Mt,gn,Ji.open,yl.open,Go.open,qo.open,wl,Sl.open,Al.open,Rl.open,Il.open,pl,ea.open,El.open,_l]),l.useEffect(()=>{const c=()=>{if(L.current!=="visual"||!B.current)return;const m=window.getSelection();if(!m||m.rangeCount===0)return;const C=m.anchorNode;!C||!B.current.contains(C)&&B.current!==C||En.current===null&&(En.current=window.requestAnimationFrame(()=>{var M;En.current=null;const j=B.current;if(!(!j||L.current!=="visual")&&(z(),jm(),O(),ro(sr(j)),xn(j),Gn.current&&Hi.current&&!((M=Bi.current)!=null&&M.contains(document.activeElement)))){const H=Ue.current;H&&hn(qf(j,H))}}))};return document.addEventListener("selectionchange",c),()=>{document.removeEventListener("selectionchange",c),En.current!==null&&(window.cancelAnimationFrame(En.current),En.current=null)}},[z,jm,O,xn]),l.useEffect(()=>{if(pt!=="html")return;const c=At.current;if(!c)return;const m=()=>z();return c.addEventListener("select",m),c.addEventListener("keyup",m),c.addEventListener("mouseup",m),()=>{c.removeEventListener("select",m),c.removeEventListener("keyup",m),c.removeEventListener("mouseup",m)}},[pt,z]);const W=l.useCallback(c=>{const m=wn({mode:"visual",visualEl:c,htmlEl:At.current}),C=Ue.current,j=Uc(C,m)?C:m.visualRange?m:C??m;Ue.current=j,c.focus();const M=wi(c,j);if(M){const H=window.getSelection();try{H==null||H.removeAllRanges(),H==null||H.addRange(M),Ue.current={...j,visualRange:M}}catch{}}return Ue.current??j},[]),Nn=l.useCallback(()=>{Yi.current=null,Xi.current=null,Fd(!1)},[]),_m=l.useCallback(()=>{if(!Zi.current||!Yi.current||!Xi.current||L.current!=="visual")return;const c=B.current;if(!c)return;z();const m=Ue.current;!m||m.collapsed||ZP(m,Xi.current)||(W(c),XP(c,Yi.current),fe(c,!1),z(),O(),Nn())},[z,W,ve,O,Nn]),Mm=l.useCallback(()=>{if(L.current!=="visual"){Nn();return}if(Zi.current){Nn();return}const c=B.current;if(!c){Nn();return}const m=W(c);if(m.collapsed){Nn();return}Yi.current=YP(c),Xi.current={...m},Fd(!0),z()},[Nn,W,z]),Uy=l.useCallback(()=>{_m()},[_m]);l.useEffect(()=>{(pt!=="visual"||Be)&&Nn()},[pt,Be,Nn]);const Yl=l.useCallback((c,m)=>{if(L.current!=="visual")return;const C=B.current;if(!C)return;const j=m??_n.current,M=Fr(c,j);if(!M)return;_n.current=M.unit;const H=W(C);if(H.collapsed){Lt.current=M,Bt.current={start:H.start,end:H.end},O();return}Lt.current=null,ru(C,M.value,M.unit)&&(fe(C,!1),z(),O())},[W,ve,z,O]),Nm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(C.collapsed){Wt.current={value:c},Bt.current={start:C.start,end:C.end},O();return}Wt.current=null,Kc(m,c)&&(fe(m,!1),z(),O())},[W,ve,z,O]),Xl=l.useCallback((c,m)=>{if(L.current!=="visual")return;const C=B.current;if(!C)return;const j=W(C),M=c==="color"?an:sn;if(j.collapsed){M.current={value:m},Bt.current={start:j.start,end:j.end},O();return}M.current=null,fi(C,c,m)&&(fe(C,!1),z(),O())},[W,ve,z,O]),Jl=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(Qi({open:!1,tab:"general"}),C.collapsed){if(c.size!==null){const X=Fr(c.size,c.unit);X&&(Lt.current=X,_n.current=X.unit)}const M=go(m),H={};for(const X of Jt)c.marks[X]!==M[X]&&(H[X]=c.marks[X]);Vt.current=H,c.fontColorMixed||(an.current={value:c.fontColor}),c.highlightColorMixed||(sn.current={value:c.highlightColor}),c.fontFamilyMixed||(Wt.current={value:c.fontFamily}),Bt.current={start:C.start,end:C.end},O();return}if(Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,Bt.current=null,c.size!==null){const M=Fr(c.size,c.unit);M&&(_n.current=M.unit,ru(m,M.value,M.unit))}const j=go(m);for(const M of Jt)c.marks[M]!==j[M]&&au(m,M);c.fontFamilyMixed||Kc(m,c.fontFamily),c.fontColorMixed||fi(m,"color",c.fontColor),c.highlightColorMixed||fi(m,"backgroundColor",c.highlightColor),fe(m,!1),z(),O()},[W,ve,z,O]),Ql=l.useCallback((c,m)=>{if(L.current!=="visual")return;const C=B.current;if(!C)return;W(C),to(M=>({...M,open:!1}));let j=Qh(C,c);if(m&&zS(C,m)&&(j=!0),!j){z(),O();return}fe(C,!1),z(),O()},[W,ve,z,O]),Lm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(xl(j=>({...j,open:!1})),!Fs(c)){z(),O();return}if(C.collapsed){qn.current=c,Bt.current={start:C.start,end:C.end},O();return}if(qn.current=null,!Th(m,c)){z(),O();return}fe(m,!1),z(),O()},[W,ve,z,O]),ec=l.useCallback(c=>{if(L.current!=="visual")return;const m=ei();if(!m)return;W(m),Sr(H=>({...H,open:!1}));const C=ao(),j=JSON.stringify(c.atRule)!==JSON.stringify(it(ge(C).body)),M=pu(m,c);if(j&&jo(m,M.pageHtml),!M.changed&&!j){z(),O();return}fe(m,!1,M.pageHtml),z(),O()},[W,fe,z,O,ei,ao]),Bm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),na(C=>({...C,open:!1})),!SP(m,c)){z(),O();return}fe(m,!1),z(),O()}},[W,ve,z,O]),Fm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),kl(C=>({...C,open:!1})),!RP(m,c)){z(),O();return}fe(m,!1),z(),O()}},[W,ve,z,O]),_a=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),ra({open:!1}),!$v(m,c,Ce.current)){z(),O();return}fe(m,!1),z(),O()}},[W,ve,z,O]),Ma=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),oa({open:!1}),!d0(m,c)){z(),O();return}fe(m,!1),z(),O()}},[W,ve,z,O]),Hm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Yo({open:!1}),!R0(m,c)){z(),O();return}fe(m,!1),z(),O()}},[W,ve,z,O]),zm=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Pl({open:!1}),!CS(m,c)){z(),O();return}fe(m,!1),z(),O(),xn(m)}},[W,ve,z,O,xn]),Om=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Tl(C=>({...C,open:!1})),!rA(m,c)){z(),O();return}fe(m,!1),z(),O()}},[W,ve,z,O]),Km=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Dl(C=>({...C,open:!1})),!fA(m,c)){z(),O();return}fe(m,!1),z(),O(),xn(m)}},[W,ve,z,O,xn]),$m=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),jl(C=>({...C,open:!1})),!kA(m,c)){z(),O();return}fe(m,!1),z(),O()}},[W,ve,z,O]),Ln=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),!c(m)){z(),O();return}fe(m,!1),z(),O(),xn(m)}},[W,ve,z,O,xn]),tc=l.useCallback(c=>{_a({src:c.src,alt:c.alt??"",title:c.title??"",css:c.css})},[_a]),nc=l.useCallback(c=>{Ma({src:c.src,title:c.title??"",css:c.css})},[Ma]),rc=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),Yo({open:!1}),!D0(m,{src:c.src,title:c.title??"",css:c.css})){z(),O();return}fe(m,!1),z(),O()}},[W,ve,z,O]),Um=l.useCallback(c=>{if(L.current!=="visual")return;const m=B.current;if(m){if(W(m),ia(C=>({...C,open:!1})),!a1(m,c)){z(),O();return}fe(m,!1),z(),O()}},[W,ve,z,O]),Vy=l.useCallback((c,m)=>{Ct!=null&&Ct.isConnected&&J0(Ct,c,m)},[Ct]),Wy=l.useCallback(()=>{const c=B.current;!c||!(Ct!=null&&Ct.isConnected)||(fe(c,!1),Sc(c,Ct),z(),O())},[Ct,ve,z,O]),Na=l.useCallback(()=>{if(L.current!=="visual"||!B.current)return ae.current;const c=Zt(B.current.innerHTML,ge(ae.current).body);return ri(c,Oa(c,ae.current,io.current,{liveRoot:B.current}))},[]),La=l.useCallback(()=>{if(be.current){const c=zt(Dr());return ae.current=c,ft(c)}if(Ut.current){const c=L.current==="visual"?Na():ae.current;c!==ae.current&&(ae.current=c)}return ft(ae.current)},[Dr,ft,Na]),Gy=l.useRef(-1),Vm=l.useCallback(()=>{if(!Ut.current&&eo.current)return eo.current;const c=Ut.current&&L.current==="visual"?Na():ae.current;return c!==ae.current&&(ae.current=c),eo.current=c,Ut.current=!1,c},[Na]),Wm=l.useCallback(()=>{if(!Ut.current&&eo.current)return eo.current;const c=ht(),m=JSON.stringify(c);return eo.current=m,Gy.current=wt.revision,Ut.current=!1,m},[ht,wt.revision]),qy=l.useCallback(()=>be.current?Wm():Vm(),[Wm,Vm]);IA({onAutoSave:r?async c=>{Ut.current=!1;const m=be.current?pn(JSON.parse(c)):ft(c);return r(m)}:void 0,getHtml:qy}),l.useEffect(()=>()=>{var c;(c=Ce.current)==null||c.clear()},[]),l.useEffect(()=>{var m;if(!Y||e===void 0||ce)return;const c=Me(e);(m=Xr.current)==null||m.setStorageHtml(c),ae.current=c,qt(ie)||ie.syncExternal(c)},[ce,Me,ie,Y,e]),l.useEffect(()=>{if(!Y||!ce||we===void 0||Ut.current)return;const c=ir(we).map(C=>Me(C));if(Nr(c,Re.current))return;const m=wt.replacePages(c);if(ae.current=m.joined,Re.current=m.pages,qt(ie)&&ie.syncPages(m.pages),L.current==="html"){const C=m.pages[Ae.current]??"";jn.current=C}},[ce,Me,ie,Y,wt,we]),l.useEffect(()=>()=>{var c;(c=Bo.current)==null||c.cancel()},[]);const De=l.useMemo(()=>({getHtml:La,setHtml:c=>{gt(c,!1)},getMode:()=>L.current,setMode:Em,getFullscreen:()=>Ed.current,setFullscreen:gn,getDarkMode:()=>pm.current,setDarkMode:c=>{km(c)},getPageZoom:()=>ba.current,setPageZoom:Sm,getToolbarPosition:()=>gm.current,setToolbarPosition:c=>{Pm(c)},openCustomizeToolbar:()=>{Kd(!0)},openDocumentPreview:()=>{$d({open:!0,html:ft(zt(Dr()))})},openHelp:()=>{Xo({open:!0,topicId:"getStarted"})},openKeyboardShortcuts:()=>{Xo({open:!0,topicId:"keyboardShortcuts"})},openAbout:()=>{Vd(!0)},openCompatibilityCheck:()=>{var C;if(!Ze)return;const c=be.current?[...Re.current]:[ae.current],m=yu(c,Ze);aa(m),(C=Pr.current)==null||C.call(Pr,m),Wd(!0)},toggleReadAloud:()=>{const c=Bo.current;if(!c)return;const m=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current}),C=Yf(Ka(m),La());C&&c.toggle(C)},toggleRuler:()=>{Ys(c=>!c)},isReadingAloud:()=>{var c;return((c=Bo.current)==null?void 0:c.isSpeaking())??!1},isRulerVisible:()=>Li.current,canReadAloud:()=>{if(!Qa())return!1;const c=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current});return Yf(Ka(c),La())!==null},undo:Ia,redo:ja,canUndo:()=>ie.canUndo(),canRedo:()=>ie.canRedo(),getSelection:()=>{const c=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current});return Ka(c)},insertText:c=>{const m=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current});ni(m,c,!1)},insertHtml:(c,m)=>{const C=Ue.current??wn({mode:L.current,visualEl:B.current,htmlEl:At.current}),j=m===void 0;ni(C,j?c:m,j)},toggleFontMark:c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(C.collapsed){const j=go(m);Vt.current=Nk(Vt.current,j,c),Bt.current={start:C.start,end:C.end},O();return}Vt.current={},Bt.current=null,au(m,c)&&(fe(m,!1),z(),O())},clearFormatting:()=>{if(L.current!=="visual")return;const c=B.current;!c||W(c).collapsed||(Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,qn.current=null,Bt.current=null,qP(c)&&(fe(c,!1),z(),O()))},toggleFormatBrush:Mm,isFormatBrushActive:()=>Zi.current,isFontMarkActive:c=>nl.current[c],hasTextSelection:()=>L.current==="visual"&&fl.current,setFontSize:(c,m)=>{Yl(c,m)},setFontSizeUnit:c=>{var X;const m=B.current,C=Zn.current;if(L.current!=="visual"||!m||C.value===null||C.mixed){_n.current=c,Vi(ne=>({...ne,unit:c}));return}const j=W(m),M=vk(m,((X=j.visualRange)==null?void 0:X.startContainer)??m),H=rg(C.value,C.unit,c,M.parentPx,M.rootPx);Yl(H,c)},getFontSize:()=>Zn.current.value,getFontSizeUnit:()=>Zn.current.unit,isFontSizeMixed:()=>Zn.current.mixed,setFontFamily:c=>{Nm(c)},getFontFamily:()=>Oo.current.value,isFontFamilyMixed:()=>Oo.current.mixed,getFontFaces:()=>io.current,setFontColor:c=>{Xl("color",c)},setHighlightColor:c=>{Xl("backgroundColor",c)},getFontColor:()=>$o.current.value,isFontColorMixed:()=>$o.current.mixed,getHighlightColor:()=>Vo.current.value,isHighlightColorMixed:()=>Vo.current.mixed,setParagraphStyle:c=>{if(L.current!=="visual")return;const m=B.current;m&&(W(m),nS(m,c)&&(fe(m,!1),z(),O()))},getParagraphStyle:()=>sl.current.tag,isParagraphStyleMixed:()=>sl.current.mixed,setTextAlign:c=>{if(L.current!=="visual")return;const m=B.current;m&&(W(m),Jh(m,c)&&(fe(m,!1),z(),O()))},getTextAlign:()=>cl.current.align,isTextAlignMixed:()=>cl.current.mixed,indent:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),mS(c)&&(fe(c,!1),z(),O()))},outdent:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),fS(c)&&(fe(c,!1),z(),O()))},canOutdent:()=>L.current==="visual"&&Bd.current,toggleList:c=>{if(L.current!=="visual")return;const m=B.current;m&&(W(m),iS(m,c)&&(fe(m,!1),z(),O()))},isBulletList:()=>Wo.current.type==="ul"&&!Wo.current.mixed,isNumberedList:()=>Wo.current.type==="ol"&&!Wo.current.mixed,openFontProperties:c=>{L.current==="visual"&&Qi({open:!0,tab:c??"general"})},applyFontProperties:c=>{Jl(c)},openCustomCss:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=c?Ph(c):{value:null,mixed:!1},C=m.mixed||!m.value?"":Rk(m.value);xl({open:!0,value:C})},applyCustomCss:c=>{Lm(c)},openParagraphProperties:c=>{if(L.current!=="visual")return;const m=B.current;m&&W(m),to({open:!0,tab:c??"general",value:m?Wa(m):Br(),backgroundImage:m?Tc(m):vn()})},applyParagraphProperties:(c,m)=>{Ql(c,m)},openPageProperties:(c,m)=>{if(L.current!=="visual")return;const C=ei();C&&W(C);const j=ao(),M=C?ui(C):hi();Sr({open:!0,tab:c==="print"&&!mn?"font":c??"font",paragraphTab:m??"spacing",value:{...M,atRule:it(ge(j).body)}})},applyPageProperties:c=>{ec(c)},openPageBackgroundImage:()=>{if(L.current!=="visual")return;const c=ei();c&&W(c);const m=Ol.current;if(Kl.current&&m){m.onPick(M=>{const H=ao(),X=c?ui(c):hi();ec({...X,backgroundImage:{...X.backgroundImage,src:M.src},atRule:it(ge(H).body)})});return}const C=ao(),j=c?ui(c):hi();Sr({open:!0,tab:"paragraph",paragraphTab:"backgroundImage",value:{...j,atRule:it(ge(C).body)}})},openParagraphBackgroundImage:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=Ol.current;if(Kl.current&&m){m.onPick(C=>{const j=c?Wa(c):Br(),M=c?Tc(c):vn();Ql(j,{...M,src:C.src})});return}to({open:!0,tab:"backgroundImage",value:c?Wa(c):Br(),backgroundImage:c?Tc(c):vn()})},openCustomParagraphStyleDialog:c=>{if(L.current!=="visual"||!Hl.current)return;if(c){const C=ga.current.find(j=>j.id===c);if(!C)return;Zo({open:!0,mode:"edit",style:C});return}const m=B.current;m&&W(m),Zo({open:!0,mode:"create",font:{size:Zn.current.mixed?null:Zn.current.value,unit:Zn.current.unit,marks:{...nl.current},fontFamily:Oo.current.mixed?null:Oo.current.value,fontColor:$o.current.mixed?null:$o.current.value,highlightColor:Vo.current.mixed?null:Vo.current.value},paragraph:eb(m?Wa(m):Br())})},applyCustomParagraphStyle:c=>{const m=ga.current.find(j=>j.id===c);if(!m||(Jl({size:m.font.size,unit:m.font.unit,marks:m.font.marks,fontFamily:m.font.fontFamily??null,fontFamilyMixed:!1,fontColor:m.font.fontColor,highlightColor:m.font.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}),!m.paragraph))return;const C=B.current;!C||L.current!=="visual"||(W(C),FS(C,m.paragraph)&&(fe(C,!1),z(),O()))},customParagraphStylesEnabled:()=>Hl.current,getCustomParagraphStyles:()=>ga.current,isCustomParagraphStylesLoading:()=>tm.current,openLinkDialog:c=>{if(L.current!=="visual")return;const m=B.current;m&&W(m);const C=m?ob(m):Os(),j=m?hu(m):[],M=(C==null?void 0:C.href)??"",H=M.startsWith("#")?M.slice(1):"",X=j.some(ne=>ne.id===H)?H:"";na({open:!0,tab:c??"link",href:M,title:(C==null?void 0:C.title)??"",targetBlank:(C==null?void 0:C.targetBlank)??!1,textDecorationNone:(C==null?void 0:C.textDecorationNone)??!1,hoverMode:(C==null?void 0:C.hoverMode)??"color",hoverColor:(C==null?void 0:C.hoverColor)??null,hoverHtml:(C==null?void 0:C.hoverHtml)??"",bookmarks:j,selectedBookmarkId:X})},applyLink:c=>{Bm(c)},openBookmarkDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c),kl({open:!0,existingIds:c?hu(c).map(m=>m.id):[]})},applyBookmark:c=>{Fm(c)},openImageDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=sm.current;if(hm.current&&m){m.onPick(tc);return}ra({open:!0})},applyImage:c=>{_a(c)},openAudioDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=cm.current;if(bm.current&&m){m.onPick(nc);return}oa({open:!0})},applyAudio:c=>{Ma(c)},openYoutubeDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c);const m=um.current;if(ym.current&&m){m.onPick(rc);return}Yo({open:!0})},applyYoutube:c=>{Hm(c)},openImageProperties:c=>{if(L.current!=="visual")return;const m=B.current;if(!m)return;W(m);const C=sr(m),j=i1(m);!C||!j||ia({open:!0,tab:c??"general",value:j,aspectRatio:n1(C)})},applyImageProperties:c=>{Um(c)},insertHorizontalRule:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),O0(c)&&(fe(c,!1),z(),O()))},insertPageBreak:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),W0(c)&&(fe(c,!1),z(),O()))},insertPageBefore:()=>{Rm()},insertPageAfter:()=>{Dm()},deletePage:()=>{!be.current||L.current!=="visual"||on.current&&(Dr().length<=1||Cl(!0))},isMultiPagesEnabled:()=>be.current,hasSelectedPage:()=>be.current&&L.current==="visual"&&on.current,canDeletePage:()=>be.current&&L.current==="visual"&&on.current&&Dr().length>1,canInsertPageBackgroundImage:()=>!(L.current!=="visual"||be.current&&!on.current),canInsertParagraphBackgroundImage:()=>{if(L.current!=="visual")return!1;const c=B.current;return c?$n(c).length>0:!1},getActivePageHtml:()=>Aa(),getAllPagesHtml:()=>pn(Dr()),openTableDialog:()=>{if(L.current!=="visual")return;const c=B.current;c&&W(c),Pl({open:!0})},applyTable:c=>{zm(c)},openTableProperties:()=>{if(L.current!=="visual")return;const c=B.current;if(!c)return;W(c);const m=nA(c);m&&Tl({open:!0,value:m})},applyTableProperties:c=>{Om(c)},openCellProperties:()=>{if(L.current!=="visual")return;const c=B.current;if(!c)return;W(c);const m=mA(c);m&&Dl({open:!0,value:m})},applyCellProperties:c=>{Km(c)},openRowProperties:()=>{if(L.current!=="visual")return;const c=B.current;if(!c)return;W(c);const m=vA(c);m&&jl({open:!0,value:m})},applyRowProperties:c=>{$m(c)},insertRowBelow:()=>{Ln(c=>cu(c,"below"))},insertRowBefore:()=>{Ln(c=>cu(c,"before"))},deleteRow:()=>{Ln(c=>vS(c))},insertColumnAfter:()=>{Ln(c=>Ff(c,"after"))},insertColumnBefore:()=>{Ln(c=>Ff(c,"before"))},deleteColumn:()=>{Ln(c=>kS(c))},mergeCells:()=>{Ln(c=>AS(c))},unmergeCells:()=>{Ln(c=>TS(c))},cut:async()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),await $P(c)&&(fe(c,!1),z(),O()))},copy:async()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),await mb(c))},deleteSelection:()=>{if(L.current!=="visual")return;const c=B.current;c&&(W(c),db(c)&&(fe(c,!1),z(),O()))},addComment:()=>{if(!Gn.current||b||L.current!=="visual")return;const c=B.current;if(!c)return;const m=W(c),C=qf(c,m);if(C){hn(C);return}const j=EP(c,m);if(!j)return;const M=BP(j);_P(c,M.id,m)&&(Zf(c,M.id),z(),Tm(c,!1),wr([...zi.current,M]),hn(M.id))},toggleCommentsVisible:()=>{Zs(c=>{const m=!c,C=B.current;return C&&lb(C,m),m})},areCommentsVisible:()=>Hi.current,canAddComment:()=>!Gn.current||b||L.current!=="visual"?!1:fl.current||Fl.current!==null,isCommentsEnabled:()=>Gn.current,getCommentThreads:()=>zi.current,setCommentThreads:c=>wr(c),openCommentThread:c=>{const m=B.current;!m||L.current!=="visual"||Zf(m,c)&&(z(),hn(c))},isContentLocked:()=>Pd.current,isLink:()=>Od.current,isImageSelected:()=>L.current==="visual"&&Fl.current!==null,isInTable:()=>L.current==="visual"&&Zd.current,canMergeCells:()=>L.current==="visual"&&Xd.current,canUnmergeCells:()=>L.current==="visual"&&Qd.current,...o!=null?{onSave:c=>im.current(c)}:{},...a!=null?{onOpen:()=>am.current()}:{}}),[gt,ve,fe,Tm,Em,gn,km,Sm,Pm,ni,Ia,ja,z,O,W,Yl,Nm,Xl,Jl,Lm,Ql,ec,Bm,Fm,_a,Ma,Hm,Um,zm,Om,Km,$m,Ln,tc,nc,rc,La,Aa,Dr,Rm,Dm,Im,Mm,o,a,b,wr,mn,Ze]),Ba=l.useCallback(()=>{var C;if(!Ze)return aa(null),null;const c=be.current?[...Re.current]:[ae.current],m=yu(c,Ze);return aa(m),(C=Pr.current)==null||C.call(Pr,m),m},[Ze]);l.useEffect(()=>{if(!Ze){aa(null);return}const c=window.setTimeout(()=>{Ba()},750);return()=>window.clearTimeout(c)},[Qs,Ze,Ba]);const Gm=l.useRef(Pt);l.useEffect(()=>{const c=Gm.current;if(Gm.current=Pt,!c||Pt)return;if(be.current){const M=ht({allPages:!0}),H=M.map(Rc);H.some((X,ne)=>X!==M[ne])&&Gt(H,!1);return}const m=ae.current,C=ge(m),j=Rc(C.body);j!==C.body&&Xn(ri(j,C.hrefs),{fullReplace:!0})},[Pt,ht,Gt,Xn]);const oc=l.useCallback((c,m,C,j)=>{const{activePageIndexAtCapture:M,pageHtmlAtCapture:H,selectedHtmlAtCapture:X}=j;if(c.mode==="visual"){let ne=B.current;if(be.current){const pe=xt.current;pe==null||pe.ensurePageMounted(M);const xe=pe==null?void 0:pe.getContainer();ne=xe?We(xe,M):ne}if(ne){B.current=ne;const pe=Xw(ne,c,X);if(pe&&!pe.collapsed){Jw(pe,m,C);const Ne=be.current?H??Re.current[M]??"":ae.current;ti(Zt(ge(ne.innerHTML).body,ge(Ne).body),!1);return}ne.focus({preventScroll:!0});const xe=wi(ne,c),Fe=xe!==null?{...c,visualRange:xe.cloneRange()}:c;pf({snapshot:Fe,visualEl:ne,htmlEl:At.current,getHtml:()=>L.current==="visual"&&ne?ne.innerHTML:ae.current,setHtml:Ne=>{if(L.current==="visual"){const rt=be.current?Re.current[M]??"":ae.current;ti(Zt(ge(Ne).body,ge(rt).body),!1);return}gt(Ne,!1)},content:m,asHtml:C});return}}ni(c,m,C)},[ni,ti,gt]),qm=l.useCallback(()=>{En.current!==null&&(window.cancelAnimationFrame(En.current),En.current=null,z()),Ea()},[z,Ea]),Zm=l.useCallback(()=>{var Fe,Ne;const c=qw({stored:Ue.current,mode:L.current,visualEl:B.current,htmlEl:At.current}),m={...c,visualRange:((Fe=c.visualRange)==null?void 0:Fe.cloneRange())??null};Ue.current=m;const C=be.current?Ae.current:0,j=c.mode==="visual"&&be.current?Aa():null,M=((Ne=B.current)==null?void 0:Ne.innerHTML)??"",H=j?cn(ge(j).body):M,X=(()=>{if(c.mode==="html"){const Ir=De.getHtml(),Bn=Math.min(c.start,c.end),lo=Math.max(c.start,c.end);return Ir.slice(Bn,lo)}const rt=B.current;return rt&&Qw(rt,m)||c.text})(),ne=c.mode==="visual"&&be.current&&!c.collapsed&&X?Zw(H,M,X):null,pe=ne&&be.current?{pageIndex:C,start:ne.start,end:ne.end,pageBodyAtCapture:H}:null,xe={activePageIndexAtCapture:C,pageHtmlAtCapture:j,selectedHtmlAtCapture:X};return{mode:m.mode,selection:Ka(m),getHtml:De.getHtml,getSelectedHtml:()=>X,getPinnedPageBodySelection:()=>pe,setHtml:rt=>{gt(rt,!1)},insertText:rt=>oc(m,rt,!1,xe),insertHtml:(rt,Ir)=>{const Bn=Ir===void 0;oc(m,Bn?rt:Ir,Bn,xe)}}},[oc,De.getHtml,Aa,gt]),{catalog:Fa,layout:Ym}=l.useMemo(()=>nw($,ej,tj),[$]),Ha=l.useMemo(()=>cR(Ym,K),[Ym,K]),Xm=l.useMemo(()=>({...Ha,iconGroups:LT(Ha.iconGroups,gl)}),[Ha,gl]),Jm=ce&&pt==="visual",Qm=l.useMemo(()=>yj(Xm,Jm),[Xm,Jm]),ic=l.useMemo(()=>nT(Qm,Tt),[Qm,Tt]),ac=l.useMemo(()=>Tt?dT(Fa):Fa,[Fa,Tt]),sc=l.useMemo(()=>dt?ij(ac,Vn):ac,[ac,dt,Vn]),lc=l.useMemo(()=>{let c=Tt?mT(ic):ic;return dt&&(c=aj(c)),c},[ic,Tt,dt]),cc=l.useMemo(()=>({disabled:Oe,readOnly:w,enableComments:dt}),[Oe,w,dt]),Zy=l.useCallback(c=>{if(!Wn||!Dn||b)return;const m=FP(Dn,c);wr(HP(zi.current,Wn,m))},[Wn,Dn,b,wr]),so=l.useMemo(()=>({...bk(De),...rw($,Zm,qm)}),[De,$,Zm,qm]),uc=l.useMemo(()=>yk(De),[De,Fo,Ho,zo,Ko,Uo,Wi,ca,ua,ha,oo,Ct,ma,fa,pa,Gi,qi,Yn,no,Jo,Lo,Qs,Mt]);l.useLayoutEffect(()=>{Nt.bump("history")},[Qs,Nt]),l.useLayoutEffect(()=>{Nt.bump("marks")},[Fo,Ho,zo,Ko,Uo,Wi,qi,Nt]),l.useLayoutEffect(()=>{Nt.bump("table")},[ma,fa,pa,Nt]),l.useLayoutEffect(()=>{Nt.bump("selection")},[Gi,Ct,Nt]),l.useLayoutEffect(()=>{Nt.bump("chrome")},[Yn,no,Jo,Lo,Mt,ca,ua,ha,oo,Nt]);const Yy=l.useCallback(c=>{if(Be||c.inputType!=="insertText"&&c.inputType!=="insertReplacementText"||!c.data||!Mk(Vt.current)&&!Lt.current&&!Mw(Wt.current)&&!dC({color:an.current,backgroundColor:sn.current})&&!jk(qn.current))return;const m=B.current;m&&(c.preventDefault(),Uk(m,c.data,Vt.current,Lt.current,{color:an.current,backgroundColor:sn.current},Wt.current,qn.current),Vt.current={},Lt.current=null,Wt.current=null,an.current=null,sn.current=null,qn.current=null,Bt.current=null,fe(m,!0),z(),O())},[Be,ve,z,O]),Xy=l.useCallback(c=>{var pe;if(Be||!yw(c,em.current))return;c.preventDefault(),c.stopPropagation();let m=B.current;if(be.current){const xe=c.currentTarget instanceof HTMLElement&&c.currentTarget.hasAttribute(Kr)?c.currentTarget:xv(c.target);if(xe instanceof HTMLElement){const Fe=Cf(xe);Fe!==null&&((pe=xt.current)==null||pe.activatePageAt(Fe),B.current=xe,m=xe,on.current=!0,kr(!0))}}else c.currentTarget instanceof HTMLDivElement&&(B.current=c.currentTarget,m=c.currentTarget);if(!m)return;W(m);const C=eu(m,c.target),j=bs(m,c.target);j&&!_i(m).includes(j)&&PS(m,j);const M={inTable:Et(m,c.target)!==null,canMergeCells:Hf(m),canUnmergeCells:zf(m)},H={canDeletePage:be.current&&on.current&&ht().length>1},X={canAddComment:Gn.current&&!b};if(C){Sc(m,C),z(),ro(C),Bl({open:!0,x:c.clientX,y:c.clientY,kind:"image",...M,...H,...X,inTable:Et(m,C)!==null});return}const ne=wn({mode:"visual",visualEl:m,htmlEl:At.current});Ue.current=ne,Bl({open:!0,x:c.clientX,y:c.clientY,kind:ne.collapsed?"caret":"text",...M,...H,canAddComment:X.canAddComment&&!ne.collapsed})},[Be,z,W,ht,b,kr]),Jy=l.useCallback(c=>{if(em.current=c.pointerType,b)return;const m=B.current;if(!m)return;if(Gn.current&&Hi.current){const j=cb(m,c.target);if(j){const M=j.getAttribute("data-comment-thread");M&&hn(M);return}}if(Be&&!Gn.current)return;const C=eu(m,c.target);if(!C){ro(null);return}c.preventDefault(),Sc(m,C),z(),ro(C)},[b,Be,z]),ef=l.useCallback(c=>{if(Be)return;if(c.key==="Tab"&&!c.ctrlKey&&!c.metaKey&&!c.altKey){if(L.current!=="visual")return;const C=B.current;if(!C)return;const j=c.target;if(!(j instanceof Node)||!C.contains(j))return;W(C);const M=SS(C,c.shiftKey);if(!M)return;c.preventDefault(),typeof M=="object"&&M.changed&&fe(C,!1),z(),O(),xn(C);return}if(!(c.ctrlKey||c.metaKey))return;if(c.key==="Enter"&&!c.shiftKey){c.preventDefault(),De.insertPageBreak();return}const m=c.key.toLowerCase();if(m==="z"&&!c.shiftKey){c.preventDefault(),Ia();return}if(m==="z"&&c.shiftKey||m==="y"){c.preventDefault(),ja();return}if(m==="b"&&!c.shiftKey){c.preventDefault(),De.toggleFontMark("bold");return}if(m==="i"&&!c.shiftKey){c.preventDefault(),De.toggleFontMark("italic");return}if(m==="u"&&!c.shiftKey){c.preventDefault(),De.toggleFontMark("underline");return}if(m==="x"&&c.shiftKey){c.preventDefault(),De.toggleFontMark("strikethrough");return}m==="p"&&!c.shiftKey&&(c.preventDefault(),so.print())},[Be,Ia,ja,De,so,W,ve,z,O,xn]),Qy=l.useCallback(c=>{if(c.key==="F1"){c.preventDefault(),Xo({open:!0,topicId:"getStarted"});return}if(c.key==="Escape"&&Wn){c.preventDefault(),hn(null);return}ef(c)},[Wn,ef]),ex=[Se.root,zc(Yn).className,Mt?Se.fullscreen:"",x].filter(Boolean).join(" "),tx=XN({dark:Yn,toolbarBackground:k,workspaceBackground:v,menuColor:A,menuBackground:I,menuFontSize:D,menuFontFamily:R,border:T}),nx=zc(Yn)["data-wysiwyg-theme"];Td.current={multiPageVisualRef:xt,workspaceRef:Cr,suppressPageFlushRef:vr,pendingInsertPageFocusRef:Fi,visualRootRef:B,visualPropSyncGuardRef:$t,htmlAreaRef:At,commentPanelRef:Bi,activePageIndexRef:Ae,htmlModePageHtmlRef:jn,setHtmlModePageHtml:()=>{},activePageHtmlRef:Id,pageCanvasSizedRef:jd,setActivePageIndex:No,setHasSelectedPage:kr,setActiveThreadId:hn,setContextMenu:Bl,recordVisualInputHtml:Ny,recordPageVisualHtml:Tr,handleVisualBeforeInput:Yy,handleVisualPointerDown:Jy,handleVisualMouseUp:Uy,handleVisualContextMenu:Xy,handleHtmlPageTabSelect:Ky,handleHtmlSurfaceChange:$y,handleImageResize:Vy,handleImageResizeEnd:Wy,multiPageRulerMarginPreview:Hy,multiPageRulerMarginChange:zy,multiPageRulerIndentChange:Oy,singlePageRulerMarginPreview:Ly,singlePageRulerMarginChange:By,singlePageRulerIndentChange:Fy,resolveEmbeddedImageDataUrl:Y?Gs:void 0,hydrateExportHtml:ft,postCommentMessage:Zy,htmlFileDrop:Am};const rx=l.useMemo(()=>hy({catalog:sc,layout:lc,commands:so,queries:uc,queryRevisions:Nt,disabled:Oe,chromeLock:cc}),[Oe,cc,so,sc,lc,uc,Nt]),ox=l.useMemo(()=>({documentBridgeRef:Xr,htmlRef:ae,pagesRef:Re}),[]),ix=l.useMemo(()=>({profile:Tt,validation:Ml,refreshValidation:Ba}),[Tt,Ml,Ba]),ax=l.useCallback(c=>rT(c,Tt),[Tt]);return i.jsx(cw,{locale:S,children:i.jsx(sw,{dark:Yn,children:i.jsx(OA,{value:ix,children:i.jsx(cN,{value:ox,children:i.jsxs("div",{className:ex,style:tx,"data-fullscreen":Mt?"":void 0,"data-wysiwyg-theme":nx,"data-toolbar-position":no,"data-comments-visible":dt&&Vn?"":void 0,onKeyDown:Qy,children:[i.jsx(sN,{menuVisible:E,captureChromeSelection:Ea,displayCatalog:sc,displayLayout:lc,commands:so,queries:uc,queryRevisions:Nt,chromeDisabled:Oe,chromeLock:cc,contentLocked:Be,customizeToolbarOpen:pl,baseCatalog:Fa,allowedLayout:Ha,toolbarSettings:gl,toolbarSettingsLoading:wy,toolbarSettingsBusy:Cy,onCustomizeToolbarClose:()=>Kd(!1),onToolbarSettingsChange:c=>{vm(c)},onToolbarSettingsReset:()=>{vm(null)},documentPreview:ea,onDocumentPreviewClose:()=>$d({open:!1,html:ea.html}),helpDialog:El,onHelpDialogClose:()=>Xo(c=>({...c,open:!1})),onHelpTopicChange:c=>Xo(m=>({...m,open:!0,topicId:c})),aboutDialogOpen:_l,onAboutDialogClose:()=>Vd(!1),fontDialog:Ji,fontSizeState:Ho,markState:Fo,fontFamilyState:zo,fontColorState:Ko,highlightColorState:Uo,fontFaces:oo,onFontDialogTabChange:c=>Qi({open:!0,tab:c}),onFontDialogClose:()=>Qi({open:!1,tab:Ji.tab}),onApplyFontProperties:c=>De.applyFontProperties(c),paragraphDialog:Go,customBackgroundImagePicker:Mn,disableBuiltinBackgroundImageSources:zl,onParagraphCustomImagePick:()=>{Mn==null||Mn.onPick(c=>{to(m=>({...m,tab:"backgroundImage",backgroundImage:{...m.backgroundImage,src:c.src}}))})},onParagraphDialogTabChange:c=>to({...Go,open:!0,tab:c}),onParagraphDialogClose:()=>to({...Go,open:!1}),onApplyParagraphProperties:({value:c,backgroundImage:m})=>De.applyParagraphProperties(c,m),customCssDialog:yl,onCustomCssDialogClose:()=>xl(c=>({...c,open:!1})),onApplyCustomCss:c=>De.applyCustomCss(c),pageDialog:qo,enablePageProperties:mn&&Pt,onPageCustomImagePick:()=>{Mn==null||Mn.onPick(c=>{Sr(m=>({...m,tab:"paragraph",paragraphTab:"backgroundImage",value:{...m.value,backgroundImage:{...m.value.backgroundImage,src:c.src}}}))})},onPageDialogTabChange:c=>Sr({...qo,open:!0,tab:c}),onPageDialogClose:()=>Sr({...qo,open:!1}),onApplyPageProperties:c=>De.applyPageProperties(c),onPageDialogResetAtRule:()=>{const c=ei();if(!c||L.current!=="visual")return;const m=be.current?ao():ge(ae.current).body,C=QS(c,m);C.changed&&(fe(c,!1,C.pageHtml),Sr(j=>({...j,value:{...j.value,atRule:or()}})))},deletePageConfirmOpen:wl,onDeletePageConfirmClose:()=>Cl(!1),onDeletePageConfirm:()=>{Im(),Cl(!1)},customStyleDialog:vy,canDeleteCustomParagraphStyle:!!se,customStyleBusy:Iy,onCustomStyleDialogClose:()=>Zo({open:!1}),onCustomStyleSave:async c=>{const m=rm.current;if(m){da(!0);try{await m(c),Zo({open:!1}),await ka()}finally{da(!1)}}},onCustomStyleDelete:async c=>{const m=om.current;if(m){da(!0);try{await m(c),Zo({open:!1}),await ka()}finally{da(!1)}}},linkDialog:vl,onLinkDialogTabChange:c=>na({...vl,open:!0,tab:c}),onLinkDialogClose:()=>na({...vl,open:!1}),onApplyLink:c=>De.applyLink(c),bookmarkDialog:Ud,onBookmarkDialogClose:()=>kl({...Ud,open:!1}),onApplyBookmark:c=>De.applyBookmark(c),imageDialogOpen:ky.open,customImagePicker:V,customAudioPicker:Q,customVideoPicker:ee,onImageDialogClose:()=>ra({open:!1}),onApplyImage:c=>De.applyImage(c),onImageDialogCustomPick:()=>{ra({open:!1}),V==null||V.onPick(tc)},audioDialogOpen:Sy.open,onAudioDialogClose:()=>oa({open:!1}),onApplyAudio:c=>De.applyAudio(c),onAudioDialogCustomPick:()=>{oa({open:!1}),Q==null||Q.onPick(nc)},youtubeDialogOpen:Py.open,onYoutubeDialogClose:()=>Yo({open:!1}),onApplyYoutube:c=>De.applyYoutube(c),onYoutubeDialogCustomPick:()=>{Yo({open:!1}),ee==null||ee.onPick(rc)},imageProperties:Ay,onImagePropertiesTabChange:c=>ia(m=>({...m,tab:c})),onImagePropertiesClose:()=>ia(c=>({...c,open:!1})),onApplyImageProperties:c=>De.applyImageProperties(c),tableDialogOpen:Sl.open,onTableDialogClose:()=>Pl({open:!1}),onApplyTable:c=>De.applyTable(c),tableProperties:Al,onTablePropertiesClose:()=>Tl(c=>({...c,open:!1})),onApplyTableProperties:c=>De.applyTableProperties(c),cellProperties:Rl,onCellPropertiesClose:()=>Dl(c=>({...c,open:!1})),onApplyCellProperties:c=>De.applyCellProperties(c),rowProperties:Il,onRowPropertiesClose:()=>jl(c=>({...c,open:!1})),onApplyRowProperties:c=>De.applyRowProperties(c),compatibilityPanelOpen:Ty,capabilitiesValidation:Ml,onCompatibilityPanelClose:()=>Wd(!1),isToolbarItemAllowed:Tt?ax:void 0}),i.jsx(lN,{toolbarVisible:N,toolbarPos:no,captureChromeSelection:Ea,toolbarShellProps:rx,children:i.jsx(qN,{propsRef:Td,pageStore:wt,mode:pt,enableMultiPages:ce,contentLocked:Be,activePageIndex:Jr,hasSelectedPage:Lo,pageZoomScale:Nl,rulerVisible:_o,rulerUnit:nn,optimizeEmbeddedImages:Y,placeholder:y,value:e,pagesProp:we,controlledHtml:Un,initialHtml:nt,initialStorageHtml:qs,defaultPages:Ye.current??[nr()],ingestedPagesProp:Ad,onChange:n,fontFaces:oo,enableComments:dt,commentsVisible:Vn,disabled:b,locale:S,commentAuthor:Dn,activeThreadId:Wn,contextMenu:jy,commentThreads:Mo,commands:so,htmlFileDropDragging:Am.dragging,selectedImage:Ct,hiddenContextMenuCommands:Tt==null?void 0:Tt.hiddenContextMenuCommands,pageLayoutEnabled:Pt})}),Mt?i.jsx(JN,{onClick:()=>gn(!1)}):null]})})})})})}function XN({dark:e,toolbarBackground:t,workspaceBackground:n,menuColor:r,menuBackground:o,menuFontSize:a,menuFontFamily:s,border:u}){const d={};return n&&(d["--wysiwyg-workspace-background"]=n),e||(t&&(d["--wysiwyg-toolbar-background"]=t),r&&(d["--wysiwyg-menu-color"]=r),o&&(d["--wysiwyg-menu-background"]=o)),a&&(d["--wysiwyg-menu-font-size"]=a),s&&(d["--wysiwyg-menu-font-family"]=s),u==="none"?(d["--wysiwyg-border-width"]="0",d["--wysiwyg-border-radius"]="0",d["--wysiwyg-border-shadow"]="none"):u&&(u.width&&(d["--wysiwyg-border-width"]=u.width),u.color&&(d["--wysiwyg-border-color"]=u.color),u.radius&&(d["--wysiwyg-border-radius"]=u.radius),u.shadow&&(d["--wysiwyg-border-shadow"]=u.shadow)),Object.keys(d).length?d:void 0}function JN({onClick:e}){const t=J();return i.jsx("button",{type:"button",className:Se.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:i.jsx(Ge,{className:Se.exitFullscreenIcon})})}function QN(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)===bt?!0:t.length===2&&t.some(r=>r.name===bt)&&t.some(r=>r.name==="class"&&r.value.includes("wysiwyg-comment-anchor"))?!e.hasAttribute("style"):!1}function eL(e){for(const t of[...e.querySelectorAll(`[${bt}]`)])t.removeAttribute(bt),t instanceof HTMLElement&&t.classList.remove("wysiwyg-comment-anchor");for(const t of[...e.querySelectorAll("span")]){if(!QN(t))continue;const n=t.parentNode;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}}function tL(e){const t=e.trim();if(!t)return e;const n=new DOMParser().parseFromString(t,"text/html");return eL(n.body),n.body.innerHTML}exports.Editor=YN;exports.PAGE_SEPARATOR=cs;exports.formatCapabilityViolationLocation=zb;exports.formatCapabilityViolationMessage=Hb;exports.isPageLayoutAllowed=gd;exports.joinPagesToHtml=zt;exports.normalizeContract=Us;exports.resolveEditorCapabilities=_b;exports.sanitizeDocumentHtml=mo;exports.sanitizePageHtml=gu;exports.splitPagesFromHtml=ar;exports.stripCommentAnchors=tL;exports.validateHtmlAgainstCapabilities=Lb;exports.validatePagesAgainstCapabilities=yu;