@editora/plugins 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{CodePlugin.native-Bwf25lLX.js → CodePlugin.native-CKJo7IFG.js} +8 -8
  2. package/dist/{CodePlugin.native-Cpp4u3Jl.mjs → CodePlugin.native-D8gGxB8i.mjs} +59 -60
  3. package/dist/a11y-checker.cjs.js +1 -1
  4. package/dist/a11y-checker.esm.js +18 -18
  5. package/dist/anchor.cjs.js +6 -6
  6. package/dist/anchor.esm.js +57 -57
  7. package/dist/blockquote.cjs.js +1 -1
  8. package/dist/blockquote.esm.js +31 -31
  9. package/dist/capitalization.cjs.js +1 -1
  10. package/dist/capitalization.esm.js +25 -25
  11. package/dist/checklist.cjs.js +1 -1
  12. package/dist/checklist.esm.js +30 -30
  13. package/dist/code.cjs.js +1 -1
  14. package/dist/code.esm.js +1 -1
  15. package/dist/collaboration.cjs.js +8 -8
  16. package/dist/collaboration.esm.js +1279 -1169
  17. package/dist/comments.cjs.js +1 -1
  18. package/dist/comments.esm.js +1 -1
  19. package/dist/direction.cjs.js +1 -1
  20. package/dist/direction.esm.js +26 -26
  21. package/dist/document-manager.cjs.js +1 -1
  22. package/dist/document-manager.esm.js +1 -1
  23. package/dist/{documentManager-yjRBab4v.mjs → documentManager-BL98a7YZ.mjs} +402 -404
  24. package/dist/{documentManager-BDz6tovy.js → documentManager-r8t7yZEd.js} +9 -9
  25. package/dist/enterprise.cjs.js +1 -1
  26. package/dist/enterprise.esm.js +1 -1
  27. package/dist/font-family.cjs.js +1 -1
  28. package/dist/font-family.esm.js +26 -26
  29. package/dist/{index-Bm1eqYHh.mjs → index-B-VitI3v.mjs} +23 -22
  30. package/dist/{index-CoflqYuK.js → index-D5xugkYA.js} +2 -2
  31. package/dist/index.cjs.js +1 -1
  32. package/dist/index.esm.js +2 -2
  33. package/dist/preview.cjs.js +3 -3
  34. package/dist/preview.esm.js +48 -51
  35. package/dist/purify.es-B6PsRpEV.js +3 -0
  36. package/dist/purify.es-DmCsrgBd.mjs +1480 -0
  37. package/dist/sanitizeHtml-CDoBlNTk.js +1 -0
  38. package/dist/sanitizeHtml-CtLy8um-.mjs +16 -0
  39. package/dist/spell-check.cjs.js +2 -2
  40. package/dist/spell-check.esm.js +19 -19
  41. package/dist/table.cjs.js +14 -14
  42. package/dist/table.esm.js +158 -150
  43. package/dist/template.cjs.js +20 -21
  44. package/dist/template.esm.js +176 -724
  45. package/package.json +6 -4
@@ -1,578 +1,30 @@
1
- import { e as hn } from "./escapeHtml-DyksyvcZ.mjs";
2
- import { i as Tn } from "./dialogHelpers-5d5BuOCW.mjs";
3
- const {
4
- entries: Ut,
5
- setPrototypeOf: Ct,
6
- isFrozen: bn,
7
- getPrototypeOf: En,
8
- getOwnPropertyDescriptor: An
9
- } = Object;
10
- let {
11
- freeze: R,
12
- seal: N,
13
- create: De
14
- } = Object, {
15
- apply: et,
16
- construct: tt
17
- } = typeof Reflect < "u" && Reflect;
18
- R || (R = function(t) {
19
- return t;
20
- });
21
- N || (N = function(t) {
22
- return t;
23
- });
24
- et || (et = function(t, o) {
25
- for (var l = arguments.length, c = new Array(l > 2 ? l - 2 : 0), d = 2; d < l; d++)
26
- c[d - 2] = arguments[d];
27
- return t.apply(o, c);
28
- });
29
- tt || (tt = function(t) {
30
- for (var o = arguments.length, l = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++)
31
- l[c - 1] = arguments[c];
32
- return new t(...l);
33
- });
34
- const Re = L(Array.prototype.forEach), _n = L(Array.prototype.lastIndexOf), wt = L(Array.prototype.pop), se = L(Array.prototype.push), yn = L(Array.prototype.splice), Ce = L(String.prototype.toLowerCase), $e = L(String.prototype.toString), qe = L(String.prototype.match), ce = L(String.prototype.replace), vn = L(String.prototype.indexOf), Sn = L(String.prototype.trim), C = L(Object.prototype.hasOwnProperty), x = L(RegExp.prototype.test), ue = xn(TypeError);
35
- function L(n) {
36
- return function(t) {
37
- t instanceof RegExp && (t.lastIndex = 0);
38
- for (var o = arguments.length, l = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++)
39
- l[c - 1] = arguments[c];
40
- return et(n, t, l);
41
- };
42
- }
43
- function xn(n) {
44
- return function() {
45
- for (var t = arguments.length, o = new Array(t), l = 0; l < t; l++)
46
- o[l] = arguments[l];
47
- return tt(n, o);
48
- };
49
- }
50
- function s(n, t) {
51
- let o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ce;
52
- Ct && Ct(n, null);
53
- let l = t.length;
54
- for (; l--; ) {
55
- let c = t[l];
56
- if (typeof c == "string") {
57
- const d = o(c);
58
- d !== c && (bn(t) || (t[l] = d), c = d);
59
- }
60
- n[c] = !0;
61
- }
62
- return n;
63
- }
64
- function Rn(n) {
65
- for (let t = 0; t < n.length; t++)
66
- C(n, t) || (n[t] = null);
67
- return n;
68
- }
69
- function k(n) {
70
- const t = De(null);
71
- for (const [o, l] of Ut(n))
72
- C(n, o) && (Array.isArray(l) ? t[o] = Rn(l) : l && typeof l == "object" && l.constructor === Object ? t[o] = k(l) : t[o] = l);
73
- return t;
74
- }
75
- function pe(n, t) {
76
- for (; n !== null; ) {
77
- const l = An(n, t);
78
- if (l) {
79
- if (l.get)
80
- return L(l.get);
81
- if (typeof l.value == "function")
82
- return L(l.value);
83
- }
84
- n = En(n);
85
- }
86
- function o() {
87
- return null;
88
- }
89
- return o;
90
- }
91
- const Ot = R(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Xe = R(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Ke = R(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Ln = R(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Ze = R(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Dn = R(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Nt = R(["#text"]), Mt = R(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Qe = R(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), It = R(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Le = R(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Cn = N(/\{\{[\w\W]*|[\w\W]*\}\}/gm), wn = N(/<%[\w\W]*|[\w\W]*%>/gm), On = N(/\$\{[\w\W]*/gm), Nn = N(/^data-[\-\w.\u00B7-\uFFFF]+$/), Mn = N(/^aria-[\-\w]+$/), zt = N(
92
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
93
- // eslint-disable-line no-useless-escape
94
- ), In = N(/^(?:\w+script|data):/i), kn = N(
95
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
96
- // eslint-disable-line no-control-regex
97
- ), Bt = N(/^html$/i), Pn = N(/^[a-z][.\w]*(-[.\w]+)+$/i);
98
- var kt = /* @__PURE__ */ Object.freeze({
99
- __proto__: null,
100
- ARIA_ATTR: Mn,
101
- ATTR_WHITESPACE: kn,
102
- CUSTOM_ELEMENT: Pn,
103
- DATA_ATTR: Nn,
104
- DOCTYPE_NAME: Bt,
105
- ERB_EXPR: wn,
106
- IS_ALLOWED_URI: zt,
107
- IS_SCRIPT_OR_DATA: In,
108
- MUSTACHE_EXPR: Cn,
109
- TMPLIT_EXPR: On
110
- });
111
- const de = {
112
- element: 1,
113
- text: 3,
114
- // Deprecated
115
- progressingInstruction: 7,
116
- comment: 8,
117
- document: 9
118
- }, Hn = function() {
119
- return typeof window > "u" ? null : window;
120
- }, Fn = function(t, o) {
121
- if (typeof t != "object" || typeof t.createPolicy != "function")
122
- return null;
123
- let l = null;
124
- const c = "data-tt-policy-suffix";
125
- o && o.hasAttribute(c) && (l = o.getAttribute(c));
126
- const d = "dompurify" + (l ? "#" + l : "");
127
- try {
128
- return t.createPolicy(d, {
129
- createHTML(w) {
130
- return w;
131
- },
132
- createScriptURL(w) {
133
- return w;
134
- }
135
- });
136
- } catch {
137
- return console.warn("TrustedTypes policy " + d + " could not be created."), null;
138
- }
139
- }, Pt = function() {
140
- return {
141
- afterSanitizeAttributes: [],
142
- afterSanitizeElements: [],
143
- afterSanitizeShadowDOM: [],
144
- beforeSanitizeAttributes: [],
145
- beforeSanitizeElements: [],
146
- beforeSanitizeShadowDOM: [],
147
- uponSanitizeAttribute: [],
148
- uponSanitizeElement: [],
149
- uponSanitizeShadowNode: []
150
- };
151
- };
152
- function Gt() {
153
- let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Hn();
154
- const t = (i) => Gt(i);
155
- if (t.version = "3.3.2", t.removed = [], !n || !n.document || n.document.nodeType !== de.document || !n.Element)
156
- return t.isSupported = !1, t;
157
- let {
158
- document: o
159
- } = n;
160
- const l = o, c = l.currentScript, {
161
- DocumentFragment: d,
162
- HTMLTemplateElement: w,
163
- Node: H,
164
- Element: p,
165
- NodeFilter: m,
166
- NamedNodeMap: W = n.NamedNodeMap || n.MozNamedAttrMap,
167
- HTMLFormElement: V,
168
- DOMParser: Oe,
169
- trustedTypes: he
170
- } = n, re = p.prototype, Xt = pe(re, "cloneNode"), Kt = pe(re, "remove"), Zt = pe(re, "nextSibling"), Qt = pe(re, "childNodes"), Te = pe(re, "parentNode");
171
- if (typeof w == "function") {
172
- const i = o.createElement("template");
173
- i.content && i.content.ownerDocument && (o = i.content.ownerDocument);
174
- }
175
- let v, oe = "";
176
- const {
177
- implementation: Ne,
178
- createNodeIterator: Jt,
179
- createDocumentFragment: en,
180
- getElementsByTagName: tn
181
- } = o, {
182
- importNode: nn
183
- } = l;
184
- let S = Pt();
185
- t.isSupported = typeof Ut == "function" && typeof Te == "function" && Ne && Ne.createHTMLDocument !== void 0;
186
- const {
187
- MUSTACHE_EXPR: Me,
188
- ERB_EXPR: Ie,
189
- TMPLIT_EXPR: ke,
190
- DATA_ATTR: rn,
191
- ARIA_ATTR: on,
192
- IS_SCRIPT_OR_DATA: an,
193
- ATTR_WHITESPACE: at,
194
- CUSTOM_ELEMENT: ln
195
- } = kt;
196
- let {
197
- IS_ALLOWED_URI: it
198
- } = kt, b = null;
199
- const lt = s({}, [...Ot, ...Xe, ...Ke, ...Ze, ...Nt]);
200
- let A = null;
201
- const st = s({}, [...Mt, ...Qe, ...It, ...Le]);
202
- let f = Object.seal(De(null, {
203
- tagNameCheck: {
204
- writable: !0,
205
- configurable: !1,
206
- enumerable: !0,
207
- value: null
208
- },
209
- attributeNameCheck: {
210
- writable: !0,
211
- configurable: !1,
212
- enumerable: !0,
213
- value: null
214
- },
215
- allowCustomizedBuiltInElements: {
216
- writable: !0,
217
- configurable: !1,
218
- enumerable: !0,
219
- value: !1
220
- }
221
- })), ae = null, be = null;
222
- const G = Object.seal(De(null, {
223
- tagCheck: {
224
- writable: !0,
225
- configurable: !1,
226
- enumerable: !0,
227
- value: null
228
- },
229
- attributeCheck: {
230
- writable: !0,
231
- configurable: !1,
232
- enumerable: !0,
233
- value: null
234
- }
235
- }));
236
- let ct = !0, Pe = !0, ut = !1, pt = !0, $ = !1, Ee = !0, j = !1, He = !1, Fe = !1, q = !1, Ae = !1, _e = !1, dt = !0, mt = !1;
237
- const sn = "user-content-";
238
- let Ue = !0, ie = !1, X = {}, M = null;
239
- const ze = s({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
240
- let ft = null;
241
- const gt = s({}, ["audio", "video", "img", "source", "image", "track"]);
242
- let Be = null;
243
- const ht = s({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ye = "http://www.w3.org/1998/Math/MathML", ve = "http://www.w3.org/2000/svg", F = "http://www.w3.org/1999/xhtml";
244
- let K = F, Ge = !1, We = null;
245
- const cn = s({}, [ye, ve, F], $e);
246
- let Se = s({}, ["mi", "mo", "mn", "ms", "mtext"]), xe = s({}, ["annotation-xml"]);
247
- const un = s({}, ["title", "style", "font", "a", "script"]);
248
- let le = null;
249
- const pn = ["application/xhtml+xml", "text/html"], dn = "text/html";
250
- let T = null, Z = null;
251
- const mn = o.createElement("form"), Tt = function(e) {
252
- return e instanceof RegExp || e instanceof Function;
253
- }, Ve = function() {
254
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
255
- if (!(Z && Z === e)) {
256
- if ((!e || typeof e != "object") && (e = {}), e = k(e), le = // eslint-disable-next-line unicorn/prefer-includes
257
- pn.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? dn : e.PARSER_MEDIA_TYPE, T = le === "application/xhtml+xml" ? $e : Ce, b = C(e, "ALLOWED_TAGS") ? s({}, e.ALLOWED_TAGS, T) : lt, A = C(e, "ALLOWED_ATTR") ? s({}, e.ALLOWED_ATTR, T) : st, We = C(e, "ALLOWED_NAMESPACES") ? s({}, e.ALLOWED_NAMESPACES, $e) : cn, Be = C(e, "ADD_URI_SAFE_ATTR") ? s(k(ht), e.ADD_URI_SAFE_ATTR, T) : ht, ft = C(e, "ADD_DATA_URI_TAGS") ? s(k(gt), e.ADD_DATA_URI_TAGS, T) : gt, M = C(e, "FORBID_CONTENTS") ? s({}, e.FORBID_CONTENTS, T) : ze, ae = C(e, "FORBID_TAGS") ? s({}, e.FORBID_TAGS, T) : k({}), be = C(e, "FORBID_ATTR") ? s({}, e.FORBID_ATTR, T) : k({}), X = C(e, "USE_PROFILES") ? e.USE_PROFILES : !1, ct = e.ALLOW_ARIA_ATTR !== !1, Pe = e.ALLOW_DATA_ATTR !== !1, ut = e.ALLOW_UNKNOWN_PROTOCOLS || !1, pt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, $ = e.SAFE_FOR_TEMPLATES || !1, Ee = e.SAFE_FOR_XML !== !1, j = e.WHOLE_DOCUMENT || !1, q = e.RETURN_DOM || !1, Ae = e.RETURN_DOM_FRAGMENT || !1, _e = e.RETURN_TRUSTED_TYPE || !1, Fe = e.FORCE_BODY || !1, dt = e.SANITIZE_DOM !== !1, mt = e.SANITIZE_NAMED_PROPS || !1, Ue = e.KEEP_CONTENT !== !1, ie = e.IN_PLACE || !1, it = e.ALLOWED_URI_REGEXP || zt, K = e.NAMESPACE || F, Se = e.MATHML_TEXT_INTEGRATION_POINTS || Se, xe = e.HTML_INTEGRATION_POINTS || xe, f = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && Tt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (f.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Tt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (f.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (f.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), $ && (Pe = !1), Ae && (q = !0), X && (b = s({}, Nt), A = De(null), X.html === !0 && (s(b, Ot), s(A, Mt)), X.svg === !0 && (s(b, Xe), s(A, Qe), s(A, Le)), X.svgFilters === !0 && (s(b, Ke), s(A, Qe), s(A, Le)), X.mathMl === !0 && (s(b, Ze), s(A, It), s(A, Le))), C(e, "ADD_TAGS") || (G.tagCheck = null), C(e, "ADD_ATTR") || (G.attributeCheck = null), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? G.tagCheck = e.ADD_TAGS : (b === lt && (b = k(b)), s(b, e.ADD_TAGS, T))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? G.attributeCheck = e.ADD_ATTR : (A === st && (A = k(A)), s(A, e.ADD_ATTR, T))), e.ADD_URI_SAFE_ATTR && s(Be, e.ADD_URI_SAFE_ATTR, T), e.FORBID_CONTENTS && (M === ze && (M = k(M)), s(M, e.FORBID_CONTENTS, T)), e.ADD_FORBID_CONTENTS && (M === ze && (M = k(M)), s(M, e.ADD_FORBID_CONTENTS, T)), Ue && (b["#text"] = !0), j && s(b, ["html", "head", "body"]), b.table && (s(b, ["tbody"]), delete ae.tbody), e.TRUSTED_TYPES_POLICY) {
258
- if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
259
- throw ue('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
260
- if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
261
- throw ue('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
262
- v = e.TRUSTED_TYPES_POLICY, oe = v.createHTML("");
263
- } else
264
- v === void 0 && (v = Fn(he, c)), v !== null && typeof oe == "string" && (oe = v.createHTML(""));
265
- R && R(e), Z = e;
266
- }
267
- }, bt = s({}, [...Xe, ...Ke, ...Ln]), Et = s({}, [...Ze, ...Dn]), fn = function(e) {
268
- let r = Te(e);
269
- (!r || !r.tagName) && (r = {
270
- namespaceURI: K,
271
- tagName: "template"
272
- });
273
- const a = Ce(e.tagName), u = Ce(r.tagName);
274
- return We[e.namespaceURI] ? e.namespaceURI === ve ? r.namespaceURI === F ? a === "svg" : r.namespaceURI === ye ? a === "svg" && (u === "annotation-xml" || Se[u]) : !!bt[a] : e.namespaceURI === ye ? r.namespaceURI === F ? a === "math" : r.namespaceURI === ve ? a === "math" && xe[u] : !!Et[a] : e.namespaceURI === F ? r.namespaceURI === ve && !xe[u] || r.namespaceURI === ye && !Se[u] ? !1 : !Et[a] && (un[a] || !bt[a]) : !!(le === "application/xhtml+xml" && We[e.namespaceURI]) : !1;
275
- }, I = function(e) {
276
- se(t.removed, {
277
- element: e
278
- });
279
- try {
280
- Te(e).removeChild(e);
281
- } catch {
282
- Kt(e);
283
- }
284
- }, Y = function(e, r) {
1
+ import { e as q } from "./escapeHtml-DyksyvcZ.mjs";
2
+ import { i as P } from "./dialogHelpers-5d5BuOCW.mjs";
3
+ import { p as z } from "./purify.es-DmCsrgBd.mjs";
4
+ let n = null, s = null, u = null, a = null, m = "", g = "", y = "insert", T = null, d = null, E = null;
5
+ function D(t, e) {
6
+ if (e === t.innerHTML) return;
7
+ const r = window.execEditorCommand || window.executeEditorCommand;
8
+ if (typeof r == "function")
285
9
  try {
286
- se(t.removed, {
287
- attribute: r.getAttributeNode(e),
288
- from: r
289
- });
10
+ r("recordDomTransaction", t, e, t.innerHTML);
290
11
  } catch {
291
- se(t.removed, {
292
- attribute: null,
293
- from: r
294
- });
295
- }
296
- if (r.removeAttribute(e), e === "is")
297
- if (q || Ae)
298
- try {
299
- I(r);
300
- } catch {
301
- }
302
- else
303
- try {
304
- r.setAttribute(e, "");
305
- } catch {
306
- }
307
- }, At = function(e) {
308
- let r = null, a = null;
309
- if (Fe)
310
- e = "<remove></remove>" + e;
311
- else {
312
- const g = qe(e, /^[\r\n\t ]+/);
313
- a = g && g[0];
314
- }
315
- le === "application/xhtml+xml" && K === F && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
316
- const u = v ? v.createHTML(e) : e;
317
- if (K === F)
318
- try {
319
- r = new Oe().parseFromString(u, le);
320
- } catch {
321
- }
322
- if (!r || !r.documentElement) {
323
- r = Ne.createDocument(K, "template", null);
324
- try {
325
- r.documentElement.innerHTML = Ge ? oe : u;
326
- } catch {
327
- }
328
- }
329
- const y = r.body || r.documentElement;
330
- return e && a && y.insertBefore(o.createTextNode(a), y.childNodes[0] || null), K === F ? tn.call(r, j ? "html" : "body")[0] : j ? r.documentElement : y;
331
- }, _t = function(e) {
332
- return Jt.call(
333
- e.ownerDocument || e,
334
- e,
335
- // eslint-disable-next-line no-bitwise
336
- m.SHOW_ELEMENT | m.SHOW_COMMENT | m.SHOW_TEXT | m.SHOW_PROCESSING_INSTRUCTION | m.SHOW_CDATA_SECTION,
337
- null
338
- );
339
- }, je = function(e) {
340
- return e instanceof V && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof W) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
341
- }, yt = function(e) {
342
- return typeof H == "function" && e instanceof H;
343
- };
344
- function U(i, e, r) {
345
- Re(i, (a) => {
346
- a.call(t, e, r, Z);
347
- });
348
- }
349
- const vt = function(e) {
350
- let r = null;
351
- if (U(S.beforeSanitizeElements, e, null), je(e))
352
- return I(e), !0;
353
- const a = T(e.nodeName);
354
- if (U(S.uponSanitizeElement, e, {
355
- tagName: a,
356
- allowedTags: b
357
- }), Ee && e.hasChildNodes() && !yt(e.firstElementChild) && x(/<[/\w!]/g, e.innerHTML) && x(/<[/\w!]/g, e.textContent) || e.nodeType === de.progressingInstruction || Ee && e.nodeType === de.comment && x(/<[/\w]/g, e.data))
358
- return I(e), !0;
359
- if (!(G.tagCheck instanceof Function && G.tagCheck(a)) && (!b[a] || ae[a])) {
360
- if (!ae[a] && xt(a) && (f.tagNameCheck instanceof RegExp && x(f.tagNameCheck, a) || f.tagNameCheck instanceof Function && f.tagNameCheck(a)))
361
- return !1;
362
- if (Ue && !M[a]) {
363
- const u = Te(e) || e.parentNode, y = Qt(e) || e.childNodes;
364
- if (y && u) {
365
- const g = y.length;
366
- for (let D = g - 1; D >= 0; --D) {
367
- const z = Xt(y[D], !0);
368
- z.__removalCount = (e.__removalCount || 0) + 1, u.insertBefore(z, Zt(e));
369
- }
370
- }
371
- }
372
- return I(e), !0;
373
- }
374
- return e instanceof p && !fn(e) || (a === "noscript" || a === "noembed" || a === "noframes") && x(/<\/no(script|embed|frames)/i, e.innerHTML) ? (I(e), !0) : ($ && e.nodeType === de.text && (r = e.textContent, Re([Me, Ie, ke], (u) => {
375
- r = ce(r, u, " ");
376
- }), e.textContent !== r && (se(t.removed, {
377
- element: e.cloneNode()
378
- }), e.textContent = r)), U(S.afterSanitizeElements, e, null), !1);
379
- }, St = function(e, r, a) {
380
- if (be[r] || dt && (r === "id" || r === "name") && (a in o || a in mn))
381
- return !1;
382
- if (!(Pe && !be[r] && x(rn, r))) {
383
- if (!(ct && x(on, r))) {
384
- if (!(G.attributeCheck instanceof Function && G.attributeCheck(r, e))) {
385
- if (!A[r] || be[r]) {
386
- if (
387
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
388
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
389
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
390
- !(xt(e) && (f.tagNameCheck instanceof RegExp && x(f.tagNameCheck, e) || f.tagNameCheck instanceof Function && f.tagNameCheck(e)) && (f.attributeNameCheck instanceof RegExp && x(f.attributeNameCheck, r) || f.attributeNameCheck instanceof Function && f.attributeNameCheck(r, e)) || // Alternative, second condition checks if it's an `is`-attribute, AND
391
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
392
- r === "is" && f.allowCustomizedBuiltInElements && (f.tagNameCheck instanceof RegExp && x(f.tagNameCheck, a) || f.tagNameCheck instanceof Function && f.tagNameCheck(a)))
393
- ) return !1;
394
- } else if (!Be[r]) {
395
- if (!x(it, ce(a, at, ""))) {
396
- if (!((r === "src" || r === "xlink:href" || r === "href") && e !== "script" && vn(a, "data:") === 0 && ft[e])) {
397
- if (!(ut && !x(an, ce(a, at, "")))) {
398
- if (a)
399
- return !1;
400
- }
401
- }
402
- }
403
- }
404
- }
405
- }
406
12
  }
407
- return !0;
408
- }, xt = function(e) {
409
- return e !== "annotation-xml" && qe(e, ln);
410
- }, Rt = function(e) {
411
- U(S.beforeSanitizeAttributes, e, null);
412
- const {
413
- attributes: r
414
- } = e;
415
- if (!r || je(e))
416
- return;
417
- const a = {
418
- attrName: "",
419
- attrValue: "",
420
- keepAttr: !0,
421
- allowedAttributes: A,
422
- forceKeepAttr: void 0
423
- };
424
- let u = r.length;
425
- for (; u--; ) {
426
- const y = r[u], {
427
- name: g,
428
- namespaceURI: D,
429
- value: z
430
- } = y, Q = T(g), Ye = z;
431
- let _ = g === "value" ? Ye : Sn(Ye);
432
- if (a.attrName = Q, a.attrValue = _, a.keepAttr = !0, a.forceKeepAttr = void 0, U(S.uponSanitizeAttribute, e, a), _ = a.attrValue, mt && (Q === "id" || Q === "name") && (Y(g, e), _ = sn + _), Ee && x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, _)) {
433
- Y(g, e);
434
- continue;
435
- }
436
- if (Q === "attributename" && qe(_, "href")) {
437
- Y(g, e);
438
- continue;
439
- }
440
- if (a.forceKeepAttr)
441
- continue;
442
- if (!a.keepAttr) {
443
- Y(g, e);
444
- continue;
445
- }
446
- if (!pt && x(/\/>/i, _)) {
447
- Y(g, e);
448
- continue;
449
- }
450
- $ && Re([Me, Ie, ke], (Dt) => {
451
- _ = ce(_, Dt, " ");
452
- });
453
- const Lt = T(e.nodeName);
454
- if (!St(Lt, Q, _)) {
455
- Y(g, e);
456
- continue;
457
- }
458
- if (v && typeof he == "object" && typeof he.getAttributeType == "function" && !D)
459
- switch (he.getAttributeType(Lt, Q)) {
460
- case "TrustedHTML": {
461
- _ = v.createHTML(_);
462
- break;
463
- }
464
- case "TrustedScriptURL": {
465
- _ = v.createScriptURL(_);
466
- break;
467
- }
468
- }
469
- if (_ !== Ye)
470
- try {
471
- D ? e.setAttributeNS(D, g, _) : e.setAttribute(g, _), je(e) ? I(e) : wt(t.removed);
472
- } catch {
473
- Y(g, e);
474
- }
475
- }
476
- U(S.afterSanitizeAttributes, e, null);
477
- }, gn = function i(e) {
478
- let r = null;
479
- const a = _t(e);
480
- for (U(S.beforeSanitizeShadowDOM, e, null); r = a.nextNode(); )
481
- U(S.uponSanitizeShadowNode, r, null), vt(r), Rt(r), r.content instanceof d && i(r.content);
482
- U(S.afterSanitizeShadowDOM, e, null);
483
- };
484
- return t.sanitize = function(i) {
485
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = null, a = null, u = null, y = null;
486
- if (Ge = !i, Ge && (i = "<!-->"), typeof i != "string" && !yt(i))
487
- if (typeof i.toString == "function") {
488
- if (i = i.toString(), typeof i != "string")
489
- throw ue("dirty is not a string, aborting");
490
- } else
491
- throw ue("toString is not a function");
492
- if (!t.isSupported)
493
- return i;
494
- if (He || Ve(e), t.removed = [], typeof i == "string" && (ie = !1), ie) {
495
- if (i.nodeName) {
496
- const z = T(i.nodeName);
497
- if (!b[z] || ae[z])
498
- throw ue("root node is forbidden and cannot be sanitized in-place");
499
- }
500
- } else if (i instanceof H)
501
- r = At("<!---->"), a = r.ownerDocument.importNode(i, !0), a.nodeType === de.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? r = a : r.appendChild(a);
502
- else {
503
- if (!q && !$ && !j && // eslint-disable-next-line unicorn/prefer-includes
504
- i.indexOf("<") === -1)
505
- return v && _e ? v.createHTML(i) : i;
506
- if (r = At(i), !r)
507
- return q ? null : _e ? oe : "";
508
- }
509
- r && Fe && I(r.firstChild);
510
- const g = _t(ie ? i : r);
511
- for (; u = g.nextNode(); )
512
- vt(u), Rt(u), u.content instanceof d && gn(u.content);
513
- if (ie)
514
- return i;
515
- if (q) {
516
- if (Ae)
517
- for (y = en.call(r.ownerDocument); r.firstChild; )
518
- y.appendChild(r.firstChild);
519
- else
520
- y = r;
521
- return (A.shadowroot || A.shadowrootmode) && (y = nn.call(l, y, !0)), y;
522
- }
523
- let D = j ? r.outerHTML : r.innerHTML;
524
- return j && b["!doctype"] && r.ownerDocument && r.ownerDocument.doctype && r.ownerDocument.doctype.name && x(Bt, r.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + r.ownerDocument.doctype.name + `>
525
- ` + D), $ && Re([Me, Ie, ke], (z) => {
526
- D = ce(D, z, " ");
527
- }), v && _e ? v.createHTML(D) : D;
528
- }, t.setConfig = function() {
529
- let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
530
- Ve(i), He = !0;
531
- }, t.clearConfig = function() {
532
- Z = null, He = !1;
533
- }, t.isValidAttribute = function(i, e, r) {
534
- Z || Ve({});
535
- const a = T(i), u = T(e);
536
- return St(a, u, r);
537
- }, t.addHook = function(i, e) {
538
- typeof e == "function" && se(S[i], e);
539
- }, t.removeHook = function(i, e) {
540
- if (e !== void 0) {
541
- const r = _n(S[i], e);
542
- return r === -1 ? void 0 : yn(S[i], r, 1)[0];
543
- }
544
- return wt(S[i]);
545
- }, t.removeHooks = function(i) {
546
- S[i] = [];
547
- }, t.removeAllHooks = function() {
548
- S = Pt();
549
- }, t;
550
13
  }
551
- var Un = Gt();
552
- let h = null, O = null, J = null, E = null, ee = "", te = "", me = "insert", fe = null, P = null, we = null;
553
- function Wt(n, t) {
554
- if (t === n.innerHTML) return;
555
- const o = window.execEditorCommand || window.executeEditorCommand;
556
- if (typeof o == "function")
557
- try {
558
- o("recordDomTransaction", n, t, n.innerHTML);
559
- } catch {
560
- }
561
- }
562
- function zn(n) {
563
- if (!n) return null;
564
- let t = n.startContainer;
565
- for (; t && t !== document.body; ) {
566
- if (t.nodeType === Node.ELEMENT_NODE) {
567
- const o = t;
568
- if (o.getAttribute("contenteditable") === "true")
569
- return o;
570
- }
571
- t = t.parentNode;
14
+ function F(t) {
15
+ if (!t) return null;
16
+ let e = t.startContainer;
17
+ for (; e && e !== document.body; ) {
18
+ if (e.nodeType === Node.ELEMENT_NODE) {
19
+ const r = e;
20
+ if (r.getAttribute("contenteditable") === "true")
21
+ return r;
22
+ }
23
+ e = e.parentNode;
572
24
  }
573
25
  return null;
574
26
  }
575
- const Bn = [
27
+ const V = [
576
28
  {
577
29
  id: "formal-letter",
578
30
  name: "Formal Letter",
@@ -643,53 +95,53 @@ const Bn = [
643
95
  <h3>Q: What are the requirements?</h3>
644
96
  <p>A: [Answer here]</p>`
645
97
  }
646
- ], ne = [...Bn], Vt = () => ne, nr = (n) => ne.filter((t) => t.category === n), jt = () => {
647
- const n = new Set(ne.map((t) => t.category));
648
- return Array.from(n);
649
- }, Gn = (n) => {
650
- const t = n.toLowerCase();
651
- return ne.filter(
652
- (o) => o.name.toLowerCase().includes(t) || o.description?.toLowerCase().includes(t) || o.tags?.some((l) => l.toLowerCase().includes(t))
98
+ ], b = [...V], M = () => b, oe = (t) => b.filter((e) => e.category === t), N = () => {
99
+ const t = new Set(b.map((e) => e.category));
100
+ return Array.from(t);
101
+ }, _ = (t) => {
102
+ const e = t.toLowerCase();
103
+ return b.filter(
104
+ (r) => r.name.toLowerCase().includes(e) || r.description?.toLowerCase().includes(e) || r.tags?.some((i) => i.toLowerCase().includes(e))
653
105
  );
654
- }, Yt = (n) => Un.sanitize(n, {
106
+ }, B = (t) => z.sanitize(t, {
655
107
  ALLOWED_TAGS: ["p", "br", "strong", "em", "u", "h1", "h2", "h3", "h4", "ul", "ol", "li", "blockquote", "table", "thead", "tbody", "tr", "th", "td", "a", "span"],
656
108
  ALLOWED_ATTR: ["href", "target", "class", "data-key", "data-category"]
657
- }), rr = (n) => ne.some((t) => t.id === n.id) ? (console.warn(`Template with ID ${n.id} already exists`), !1) : (ne.push(n), !0), or = (n) => !!(n.id && n.name && n.category && n.html && n.html.trim().length > 0);
658
- function Wn(n) {
659
- O && B(), O = document.createElement("div"), Tn(O), O.className = "rte-dialog-overlay", Yn(n) && O.classList.add("rte-ui-theme-dark"), O.addEventListener("click", () => B()), h = document.createElement("div"), h.className = "rte-dialog rte-template-dialog", h.addEventListener("click", (o) => o.stopPropagation());
660
- const t = jt();
661
- t.length > 0 && !ee && (ee = t[0]), ge(), O.appendChild(h), document.body.appendChild(O), Vn(), Jn();
109
+ }), ae = (t) => b.some((e) => e.id === t.id) ? (console.warn(`Template with ID ${t.id} already exists`), !1) : (b.push(t), !0), le = (t) => !!(t.id && t.name && t.category && t.html && t.html.trim().length > 0);
110
+ function O(t) {
111
+ s && c(), s = document.createElement("div"), P(s), s.className = "rte-dialog-overlay", Z(t) && s.classList.add("rte-ui-theme-dark"), s.addEventListener("click", () => c()), n = document.createElement("div"), n.className = "rte-dialog rte-template-dialog", n.addEventListener("click", (r) => r.stopPropagation());
112
+ const e = N();
113
+ e.length > 0 && !m && (m = e[0]), w(), s.appendChild(n), document.body.appendChild(s), Q(), ee();
662
114
  }
663
- function Vn() {
664
- $t(), fe = (n) => {
665
- n.key === "Escape" && (!O || !h || (n.preventDefault(), n.stopPropagation(), B()));
666
- }, document.addEventListener("keydown", fe, !0);
115
+ function Q() {
116
+ I(), T = (t) => {
117
+ t.key === "Escape" && (!s || !n || (t.preventDefault(), t.stopPropagation(), c()));
118
+ }, document.addEventListener("keydown", T, !0);
667
119
  }
668
- function $t() {
669
- fe && (document.removeEventListener("keydown", fe, !0), fe = null);
120
+ function I() {
121
+ T && (document.removeEventListener("keydown", T, !0), T = null);
670
122
  }
671
- const jn = '[data-theme="dark"], .dark, .editora-theme-dark', nt = () => {
672
- const n = window.getSelection();
673
- if (!n || n.rangeCount === 0) return null;
674
- const t = n.anchorNode;
675
- return (t instanceof HTMLElement ? t : t?.parentElement)?.closest(
123
+ const W = '[data-theme="dark"], .dark, .editora-theme-dark', L = () => {
124
+ const t = window.getSelection();
125
+ if (!t || t.rangeCount === 0) return null;
126
+ const e = t.anchorNode;
127
+ return (e instanceof HTMLElement ? e : e?.parentElement)?.closest(
676
128
  ".rte-content, .editora-content"
677
129
  ) || null;
678
- }, Yn = (n) => {
679
- const t = n || nt();
680
- return t ? !!t.closest(jn) : !1;
130
+ }, Z = (t) => {
131
+ const e = t || L();
132
+ return e ? !!e.closest(W) : !1;
681
133
  };
682
- function rt() {
683
- const n = zn(J);
684
- if (n) return n;
685
- if (we?.isConnected) return we;
686
- const t = nt();
687
- return t || document.querySelector(".rte-content, .editora-content");
134
+ function C() {
135
+ const t = F(u);
136
+ if (t) return t;
137
+ if (E?.isConnected) return E;
138
+ const e = L();
139
+ return e || document.querySelector(".rte-content, .editora-content");
688
140
  }
689
- function ge() {
690
- if (!h) return;
691
- const n = jt(), t = ot();
692
- h.innerHTML = `
141
+ function w() {
142
+ if (!n) return;
143
+ const t = N(), e = A();
144
+ n.innerHTML = `
693
145
  <div class="rte-dialog-header">
694
146
  <h2>Insert Template</h2>
695
147
  <button class="rte-dialog-close" aria-label="Close">✕</button>
@@ -700,49 +152,49 @@ function ge() {
700
152
  <input
701
153
  type="text"
702
154
  placeholder="Search templates..."
703
- value="${hn(te)}"
155
+ value="${q(g)}"
704
156
  class="rte-input rte-template-search"
705
157
  aria-label="Search templates"
706
158
  />
707
159
 
708
160
  <!-- Category Tabs -->
709
161
  <div class="rte-tabs">
710
- ${n.map((o) => `
711
- <button class="rte-tab ${ee === o ? "active" : ""}" data-category="${o}">
712
- ${o}
162
+ ${t.map((r) => `
163
+ <button class="rte-tab ${m === r ? "active" : ""}" data-category="${r}">
164
+ ${r}
713
165
  </button>
714
166
  `).join("")}
715
167
  </div>
716
168
 
717
169
  <!-- Template List -->
718
170
  <div class="rte-template-list">
719
- ${t.length > 0 ? t.map((o) => `
171
+ ${e.length > 0 ? e.map((r) => `
720
172
  <div
721
- class="rte-template-item ${E?.id === o.id ? "selected" : ""}"
722
- data-template-id="${o.id}"
173
+ class="rte-template-item ${a?.id === r.id ? "selected" : ""}"
174
+ data-template-id="${r.id}"
723
175
  >
724
- <div class="template-name">${o.name}</div>
725
- ${o.description ? `<div class="template-description">${o.description}</div>` : ""}
176
+ <div class="template-name">${r.name}</div>
177
+ ${r.description ? `<div class="template-description">${r.description}</div>` : ""}
726
178
  </div>
727
179
  `).join("") : '<div class="rte-empty-state">No templates found</div>'}
728
180
  </div>
729
181
 
730
182
  <!-- Preview -->
731
- ${E ? `
183
+ ${a ? `
732
184
  <div class="rte-template-preview">
733
185
  <strong>Preview:</strong>
734
- <div class="template-preview-content">${E.html}</div>
186
+ <div class="template-preview-content">${a.html}</div>
735
187
  </div>
736
188
  ` : ""}
737
189
 
738
190
  <!-- Insert Mode Toggle -->
739
191
  <div class="rte-insert-mode">
740
192
  <label>
741
- <input type="radio" name="insertMode" value="insert" ${me === "insert" ? "checked" : ""} />
193
+ <input type="radio" name="insertMode" value="insert" ${y === "insert" ? "checked" : ""} />
742
194
  Insert at cursor
743
195
  </label>
744
196
  <label>
745
- <input type="radio" name="insertMode" value="replace" ${me === "replace" ? "checked" : ""} />
197
+ <input type="radio" name="insertMode" value="replace" ${y === "replace" ? "checked" : ""} />
746
198
  Replace document
747
199
  </label>
748
200
  </div>
@@ -750,15 +202,15 @@ function ge() {
750
202
 
751
203
  <div class="rte-dialog-footer">
752
204
  <button class="rte-button-secondary rte-cancel-btn">Cancel</button>
753
- <button class="rte-button-primary rte-insert-btn" ${E ? "" : "disabled"}>
754
- ${me === "insert" ? "Insert" : "Replace"}
205
+ <button class="rte-button-primary rte-insert-btn" ${a ? "" : "disabled"}>
206
+ ${y === "insert" ? "Insert" : "Replace"}
755
207
  </button>
756
208
  </div>
757
- `, qn();
209
+ `, G();
758
210
  }
759
- function $n() {
760
- if (!h) return;
761
- h.innerHTML = `
211
+ function K() {
212
+ if (!n) return;
213
+ n.innerHTML = `
762
214
  <div class="rte-dialog-header">
763
215
  <h2>Replace Document?</h2>
764
216
  </div>
@@ -770,65 +222,65 @@ function $n() {
770
222
  <button class="rte-button-primary rte-confirm-replace-btn">Replace</button>
771
223
  </div>
772
224
  `;
773
- const n = h.querySelector(".rte-cancel-warning-btn"), t = h.querySelector(".rte-confirm-replace-btn");
774
- n?.addEventListener("click", () => ge()), t?.addEventListener("click", () => Xn());
225
+ const t = n.querySelector(".rte-cancel-warning-btn"), e = n.querySelector(".rte-confirm-replace-btn");
226
+ t?.addEventListener("click", () => w()), e?.addEventListener("click", () => Y());
775
227
  }
776
- function ot() {
777
- const n = Vt();
778
- return te.trim() ? Gn(te) : ee ? n.filter((t) => t.category === ee) : n;
228
+ function A() {
229
+ const t = M();
230
+ return g.trim() ? _(g) : m ? t.filter((e) => e.category === m) : t;
779
231
  }
780
- function qn() {
781
- if (!h) return;
782
- h.querySelector(".rte-dialog-close")?.addEventListener("click", () => B()), h.querySelector(".rte-cancel-btn")?.addEventListener("click", () => B()), h.querySelector(".rte-insert-btn")?.addEventListener("click", () => Je());
783
- const l = h.querySelector(".rte-template-search");
784
- l?.addEventListener("input", (p) => {
785
- P !== null && cancelAnimationFrame(P), te = p.target.value, P = requestAnimationFrame(() => {
786
- P = null, Ht();
232
+ function G() {
233
+ if (!n) return;
234
+ n.querySelector(".rte-dialog-close")?.addEventListener("click", () => c()), n.querySelector(".rte-cancel-btn")?.addEventListener("click", () => c()), n.querySelector(".rte-insert-btn")?.addEventListener("click", () => k());
235
+ const i = n.querySelector(".rte-template-search");
236
+ i?.addEventListener("input", (o) => {
237
+ d !== null && cancelAnimationFrame(d), g = o.target.value, d = requestAnimationFrame(() => {
238
+ d = null, R();
787
239
  });
788
- }), l?.addEventListener("keydown", (p) => {
789
- p.key === "Enter" && E ? Je() : p.key === "Escape" && B();
790
- }), h.querySelector(".rte-tabs")?.addEventListener("click", (p) => {
791
- const W = p.target.closest(".rte-tab");
792
- if (!W) return;
793
- const V = W.getAttribute("data-category");
794
- V && (ee = V, te = "", P !== null && (cancelAnimationFrame(P), P = null), Ht());
240
+ }), i?.addEventListener("keydown", (o) => {
241
+ o.key === "Enter" && a ? k() : o.key === "Escape" && c();
242
+ }), n.querySelector(".rte-tabs")?.addEventListener("click", (o) => {
243
+ const v = o.target.closest(".rte-tab");
244
+ if (!v) return;
245
+ const x = v.getAttribute("data-category");
246
+ x && (m = x, g = "", d !== null && (cancelAnimationFrame(d), d = null), R());
795
247
  });
796
- const d = h.querySelector(".rte-template-list"), w = (p) => {
797
- const W = p.target.closest(".rte-template-item");
798
- if (!W) return null;
799
- const V = W.getAttribute("data-template-id");
800
- return V && Vt().find((Oe) => Oe.id === V) || null;
248
+ const p = n.querySelector(".rte-template-list"), f = (o) => {
249
+ const v = o.target.closest(".rte-template-item");
250
+ if (!v) return null;
251
+ const x = v.getAttribute("data-template-id");
252
+ return x && M().find((j) => j.id === x) || null;
801
253
  };
802
- d?.addEventListener("click", (p) => {
803
- const m = w(p);
804
- m && (E = m, ge());
805
- }), d?.addEventListener("dblclick", (p) => {
806
- const m = w(p);
807
- m && (E = m, Je());
808
- }), h.querySelector(".rte-insert-mode")?.addEventListener("change", (p) => {
809
- const m = p.target;
810
- !m || m.name !== "insertMode" || (me = m.value, ge());
254
+ p?.addEventListener("click", (o) => {
255
+ const l = f(o);
256
+ l && (a = l, w());
257
+ }), p?.addEventListener("dblclick", (o) => {
258
+ const l = f(o);
259
+ l && (a = l, k());
260
+ }), n.querySelector(".rte-insert-mode")?.addEventListener("change", (o) => {
261
+ const l = o.target;
262
+ !l || l.name !== "insertMode" || (y = l.value, w());
811
263
  });
812
264
  }
813
- function Ht() {
814
- const n = ot();
815
- n.length > 0 ? (!E || !n.find((t) => t.id === E.id)) && (E = n[0]) : E = null, ge();
265
+ function R() {
266
+ const t = A();
267
+ t.length > 0 ? (!a || !t.find((e) => e.id === a.id)) && (a = t[0]) : a = null, w();
816
268
  }
817
- function Je() {
818
- if (E)
819
- if (me === "replace") {
820
- if (rt()?.innerHTML?.trim()) {
821
- $n();
269
+ function k() {
270
+ if (a)
271
+ if (y === "replace") {
272
+ if (C()?.innerHTML?.trim()) {
273
+ K();
822
274
  return;
823
275
  }
824
- qt(E), B();
276
+ $(a), c();
825
277
  } else
826
- Zn(E), B();
278
+ J(a), c();
827
279
  }
828
- function Xn() {
829
- E && (qt(E), B());
280
+ function Y() {
281
+ a && ($(a), c());
830
282
  }
831
- const Kn = /* @__PURE__ */ new Set([
283
+ const U = /* @__PURE__ */ new Set([
832
284
  "DIV",
833
285
  "P",
834
286
  "BLOCKQUOTE",
@@ -843,58 +295,58 @@ const Kn = /* @__PURE__ */ new Set([
843
295
  "TD",
844
296
  "TH"
845
297
  ]);
846
- function Ft(n, t) {
847
- let o = n;
848
- for (; o && o !== t; ) {
849
- if (o.nodeType === Node.ELEMENT_NODE && Kn.has(o.tagName))
850
- return o;
851
- o = o.parentNode;
298
+ function S(t, e) {
299
+ let r = t;
300
+ for (; r && r !== e; ) {
301
+ if (r.nodeType === Node.ELEMENT_NODE && U.has(r.tagName))
302
+ return r;
303
+ r = r.parentNode;
852
304
  }
853
305
  return null;
854
306
  }
855
- function Zn(n) {
856
- const t = window.getSelection();
857
- if (!t) return;
858
- const o = rt();
859
- if (!o) return;
860
- if (J)
861
- t.removeAllRanges(), t.addRange(J);
307
+ function J(t) {
308
+ const e = window.getSelection();
309
+ if (!e) return;
310
+ const r = C();
311
+ if (!r) return;
312
+ if (u)
313
+ e.removeAllRanges(), e.addRange(u);
862
314
  else {
863
- const m = document.createRange();
864
- m.selectNodeContents(o), m.collapse(!1), t.removeAllRanges(), t.addRange(m);
315
+ const l = document.createRange();
316
+ l.selectNodeContents(r), l.collapse(!1), e.removeAllRanges(), e.addRange(l);
865
317
  }
866
- if (t.rangeCount === 0) return;
867
- const l = t.getRangeAt(0), c = o?.innerHTML ?? "", d = document.createRange().createContextualFragment(Yt(n.html));
868
- l.deleteContents();
869
- const w = d.lastChild, H = Ft(l.endContainer, o) || Ft(l.startContainer, o);
870
- H && H.parentNode ? H.parentNode.insertBefore(d, H.nextSibling) : l.insertNode(d);
871
- const p = document.createRange();
872
- w ? p.setStartAfter(w) : p.setStartAfter(l.endContainer), p.collapse(!0), t.removeAllRanges(), t.addRange(p), o && (Wt(o, c), o.dispatchEvent(new Event("input", { bubbles: !0 })));
318
+ if (e.rangeCount === 0) return;
319
+ const i = e.getRangeAt(0), H = r?.innerHTML ?? "", p = document.createRange().createContextualFragment(B(t.html));
320
+ i.deleteContents();
321
+ const f = p.lastChild, h = S(i.endContainer, r) || S(i.startContainer, r);
322
+ h && h.parentNode ? h.parentNode.insertBefore(p, h.nextSibling) : i.insertNode(p);
323
+ const o = document.createRange();
324
+ f ? o.setStartAfter(f) : o.setStartAfter(i.endContainer), o.collapse(!0), e.removeAllRanges(), e.addRange(o), r && (D(r, H), r.dispatchEvent(new Event("input", { bubbles: !0 })));
873
325
  }
874
- function qt(n) {
875
- const t = rt();
876
- if (t) {
877
- const o = t.innerHTML;
878
- t.innerHTML = Yt(n.html), Wt(t, o), t.dispatchEvent(new Event("input", { bubbles: !0 }));
326
+ function $(t) {
327
+ const e = C();
328
+ if (e) {
329
+ const r = e.innerHTML;
330
+ e.innerHTML = B(t.html), D(e, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
879
331
  }
880
332
  }
881
- function B() {
882
- $t(), P !== null && (cancelAnimationFrame(P), P = null), O && (O.remove(), O = null), h = null, J = null, te = "", we = null;
333
+ function c() {
334
+ I(), d !== null && (cancelAnimationFrame(d), d = null), s && (s.remove(), s = null), n = null, u = null, g = "", E = null;
883
335
  }
884
- function Qn(n) {
885
- const t = window.getSelection();
886
- t && t.rangeCount > 0 ? J = t.getRangeAt(0).cloneRange() : J = null;
887
- const o = ot();
888
- o.length > 0 && !E && (E = o[0]);
889
- const l = n?.contentElement instanceof HTMLElement ? n.contentElement : nt();
890
- we = l || null, Wn(l);
336
+ function X(t) {
337
+ const e = window.getSelection();
338
+ e && e.rangeCount > 0 ? u = e.getRangeAt(0).cloneRange() : u = null;
339
+ const r = A();
340
+ r.length > 0 && !a && (a = r[0]);
341
+ const i = t?.contentElement instanceof HTMLElement ? t.contentElement : L();
342
+ E = i || null, O(i);
891
343
  }
892
- function Jn() {
344
+ function ee() {
893
345
  if (typeof document > "u") return;
894
- const n = "template-plugin-dialog-styles";
895
- if (document.getElementById(n)) return;
896
- const t = document.createElement("style");
897
- t.id = n, t.textContent = `
346
+ const t = "template-plugin-dialog-styles";
347
+ if (document.getElementById(t)) return;
348
+ const e = document.createElement("style");
349
+ e.id = t, e.textContent = `
898
350
  .rte-dialog-overlay {
899
351
  --rte-tmpl-overlay-bg: rgba(15, 23, 36, 0.56);
900
352
  --rte-tmpl-dialog-bg: #fff;
@@ -1131,30 +583,30 @@ function Jn() {
1131
583
  .rte-button-secondary:hover {
1132
584
  background-color: var(--rte-tmpl-subtle-hover);
1133
585
  }
1134
- `, document.head.appendChild(t);
586
+ `, document.head.appendChild(e);
1135
587
  }
1136
- const ar = () => ({
588
+ const ie = () => ({
1137
589
  name: "template",
1138
590
  toolbar: [
1139
591
  {
1140
592
  label: "Template",
1141
593
  command: "insertTemplate",
1142
- icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 3V9H21V3H3ZM19 5H5V7H19V5Z" fill="#000000"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 11V21H11V11H3ZM9 13H5V19H9V13Z" fill="#000000"></path> <path d="M21 11H13V13H21V11Z" fill="#000000"></path> <path d="M13 15H21V17H13V15Z" fill="#000000"></path> <path d="M21 19H13V21H21V19Z" fill="#000000"></path> </g></svg>'
594
+ icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 3V9H21V3H3ZM19 5H5V7H19V5Z" fill="#000000"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 11V21H11V11H3ZM9 13H5V19H9V13Z" fill="#000000"></path> <path d="M21 11H13V13H21V11Z" fill="#000000"></path> <path d="M13 15H21V17H13V15Z" fill="#000000"></path> <path d="M21 19H13V21H21V19Z" fill="#000000"></path> </g></svg>'
1143
595
  }
1144
596
  ],
1145
597
  commands: {
1146
- insertTemplate: (n, t) => (Qn(t), !0)
598
+ insertTemplate: (t, e) => (X(e), !0)
1147
599
  },
1148
600
  keymap: {}
1149
601
  });
1150
602
  export {
1151
- Bn as PREDEFINED_TEMPLATES,
1152
- ar as TemplatePlugin,
1153
- rr as addCustomTemplate,
1154
- Vt as getAllTemplates,
1155
- jt as getTemplateCategories,
1156
- nr as getTemplatesByCategory,
1157
- Yt as sanitizeTemplate,
1158
- Gn as searchTemplates,
1159
- or as validateTemplate
603
+ V as PREDEFINED_TEMPLATES,
604
+ ie as TemplatePlugin,
605
+ ae as addCustomTemplate,
606
+ M as getAllTemplates,
607
+ N as getTemplateCategories,
608
+ oe as getTemplatesByCategory,
609
+ B as sanitizeTemplate,
610
+ _ as searchTemplates,
611
+ le as validateTemplate
1160
612
  };