editate 0.6.22 → 0.6.23

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/lib/index.cjs CHANGED
@@ -37,15 +37,27 @@ var {min: t, max: e} = Math, {keys: n, is: r} = Object, o = t => "string" == typ
37
37
  e = r[1], t = o, n.push(r[2]);
38
38
  }
39
39
  return [ t, e, n ];
40
- }, y = (t, e, n) => {
40
+ }, x = (t, e, n) => {
41
41
  const [r, o, c] = h(t, e), s = d(r, o, n);
42
42
  return s ? (c.push(s[2]), [ s[0], s[1], c ]) : null;
43
- }, x = (t, e) => {
43
+ }, y = (t, e) => {
44
+ let n = 0, r = 0;
45
+ for (const o of t.children) {
46
+ const t = l(o);
47
+ if (t && 0 !== r && n++, o === e) return n;
48
+ if (t) {
49
+ const t = y(o, e);
50
+ if (null != t) return n + t;
51
+ }
52
+ n += p(o), r++;
53
+ }
54
+ return null;
55
+ }, k = (t, e) => {
44
56
  const n = t.children, r = d(t, e);
45
57
  if (r) {
46
58
  const [e, o, c] = r;
47
59
  if (l(e)) {
48
- const [r, s] = x(e, o), i = n.slice(0, c), l = n.slice(c + 1);
60
+ const [r, s] = k(e, o), i = n.slice(0, c), l = n.slice(c + 1);
49
61
  return i.push(r), l.unshift(s), [ {
50
62
  ...t,
51
63
  children: i
@@ -83,16 +95,16 @@ var {min: t, max: e} = Math, {keys: n, is: r} = Object, o = t => "string" == typ
83
95
  text: ""
84
96
  } ] : []
85
97
  } ];
86
- }, k = (t, [e, n]) => {
98
+ }, m = (t, [e, n]) => {
87
99
  let r = 0;
88
100
  for (const o of e) r += f(t, 0, o), 0 !== o && r++, t = t.children[o];
89
101
  return r + n;
90
- }, m = (t, e) => {
102
+ }, g = (t, e) => {
91
103
  const [, n, r] = h(t, e);
92
104
  return [ r, n ];
93
- }, g = (t, [e, n]) => [ k(t, e), k(t, n) ];
105
+ }, _ = (t, [e, n]) => [ m(t, e), m(t, n) ];
94
106
 
95
- function* _(t, [e, n]) {
107
+ function* b(t, [e, n]) {
96
108
  if (e >= n) return;
97
109
  if (!l(t)) return;
98
110
  const r = d(t, e);
@@ -106,21 +118,21 @@ function* _(t, [e, n]) {
106
118
  }
107
119
  }
108
120
 
109
- function* b(t, e) {
110
- if (!l(t) || a(t.children)) for (const n of _(t, e)) {
121
+ function* v(t, e) {
122
+ if (!l(t) || a(t.children)) for (const n of b(t, e)) {
111
123
  const [t, e] = n;
112
- for (const n of b(t, [ 0, p(t) ])) n[1] += e, yield n;
124
+ for (const n of v(t, [ 0, p(t) ])) n[1] += e, yield n;
113
125
  } else yield [ t, 0 ];
114
126
  }
115
127
 
116
- function* v(t, e) {
117
- if (l(t)) for (const [n, r] of _(t, e)) for (const t of v(n, [ 0, p(n) ])) t[1] += r,
128
+ function* T(t, e) {
129
+ if (l(t)) for (const [n, r] of b(t, e)) for (const t of T(n, [ 0, p(n) ])) t[1] += r,
118
130
  yield t; else yield [ t, 0 ];
119
131
  }
120
132
 
121
- var T = (n, r = 0, o = 1 / 0, c) => {
133
+ var E = (n, r = 0, o = 1 / 0, c) => {
122
134
  let s = "", l = r;
123
- for (const [a, u] of v(n, [ r, o ])) {
135
+ for (const [a, u] of T(n, [ r, o ])) {
124
136
  for (let t = u - l; t > 0; t--) s += "\n";
125
137
  const n = p(a), f = u + n;
126
138
  if (i(a)) {
@@ -131,16 +143,16 @@ var T = (n, r = 0, o = 1 / 0, c) => {
131
143
  }
132
144
  for (let e = t(o, p(n)) - l; e > 0; e--) s += "\n";
133
145
  return s;
134
- }, E = (t, e, n) => e >= n ? [] : x(x(t, n)[0], e)[1].children, M = (t, e, n) => t.split("\n").map(t => ({
146
+ }, M = (t, e, n) => e >= n ? [] : k(k(t, n)[0], e)[1].children, S = (t, e, n) => t.split("\n").map(t => ({
135
147
  ...n,
136
148
  children: [ {
137
149
  ...e,
138
150
  text: t
139
151
  } ]
140
- })), S = "delete", w = "insert_text", A = "insert_node", O = (t, e) => {
152
+ })), w = "delete", A = "insert_text", O = "insert_node", R = (t, e) => {
141
153
  const o = n(t);
142
154
  return o.length === n(e).length && o.every(n => n in e && ("text" === n || r(t[n], e[n])));
143
- }, R = (t, e) => {
155
+ }, D = (t, e) => {
144
156
  if (e.length) {
145
157
  const n = t.length;
146
158
  if (t.push(...e), n) {
@@ -149,13 +161,13 @@ var T = (n, r = 0, o = 1 / 0, c) => {
149
161
  let r = e + 1;
150
162
  for (;r <= n; ) {
151
163
  const e = t[r - 1], o = t[r];
152
- t[r - 1] = D(e, o), t.splice(r, 1), n--;
164
+ t[r - 1] = B(e, o), t.splice(r, 1), n--;
153
165
  }
154
166
  })(t, n - 1, n) : o || c || ((t, e = 0, n = t.length - 1) => {
155
167
  let r = e + 1;
156
168
  for (;r <= n; ) {
157
169
  const e = t[r - 1], o = t[r];
158
- i(e) && i(o) && O(e, o) ? (t[r - 1] = {
170
+ i(e) && i(o) && R(e, o) ? (t[r - 1] = {
159
171
  ...e,
160
172
  text: e.text + o.text
161
173
  }, t.splice(r, 1), n--) : r++;
@@ -170,45 +182,45 @@ var T = (n, r = 0, o = 1 / 0, c) => {
170
182
  t.length || t.push({
171
183
  text: ""
172
184
  });
173
- }, D = (...t) => ({
185
+ }, B = (...t) => ({
174
186
  ...t[0],
175
- children: t.reduce((t, e) => (R(t, e.children), t), [])
176
- }), B = (t, e, n, r = 0) => {
187
+ children: t.reduce((t, e) => (D(t, e.children), t), [])
188
+ }), I = (t, e, n, r = 0) => {
177
189
  if (r < e.length) {
178
190
  const o = e[r], c = t.children, s = c.slice();
179
- return s.splice(o, 1, B(c[o], e, n, r + 1)), {
191
+ return s.splice(o, 1, I(c[o], e, n, r + 1)), {
180
192
  ...t,
181
193
  children: s
182
194
  };
183
195
  }
184
196
  return n;
185
- }, I = (t, e, n, r) => {
186
- const [o, c] = x(t, e), s = e < n ? x(t, n)[1] : c, i = a(t.children);
187
- a(r) ? i || (r = D(...r).children) : i && (r = [ {
197
+ }, L = (t, e, n, r) => {
198
+ const [o, c] = k(t, e), s = e < n ? k(t, n)[1] : c, i = a(t.children);
199
+ a(r) ? i || (r = B(...r).children) : i && (r = [ {
188
200
  children: r
189
201
  } ]);
190
202
  const l = o.children.slice();
191
- return R(l, r), R(l, s.children), {
203
+ return D(l, r), D(l, s.children), {
192
204
  ...t,
193
205
  children: l
194
206
  };
195
- }, L = (t, e) => e >= 0 && e <= p(t), P = (t, e) => e.reduce((t, e) => H(t, e), t), H = (t, e, n) => {
207
+ }, P = (t, e) => e >= 0 && e <= p(t), H = (t, e) => e.reduce((t, e) => N(t, e), t), N = (t, e, n) => {
196
208
  switch (e.type) {
197
- case S:
209
+ case w:
198
210
  {
199
211
  const [n, r] = e.range;
200
212
  if (t >= n) return r >= t ? n : t + n - r;
201
213
  break;
202
214
  }
203
215
 
204
- case w:
216
+ case A:
205
217
  {
206
218
  const {at: r, text: o} = e;
207
219
  if (n ? t > r : t >= r) return t + o.length;
208
220
  break;
209
221
  }
210
222
 
211
- case A:
223
+ case O:
212
224
  {
213
225
  const {at: r, fragment: o} = e;
214
226
  if (n ? t > r : t >= r) return t + p({
@@ -218,16 +230,16 @@ var T = (n, r = 0, o = 1 / 0, c) => {
218
230
  }
219
231
  }
220
232
  return t;
221
- }, N = ([t, e], n) => [ H(t, n), H(e, n) ], C = ([t, e]) => t > e ? [ e, t ] : [ t, e ], W = ([t, e]) => t === e, F = ([t, e], [n, r]) => t < r && n < e;
233
+ }, C = ([t, e], n) => [ N(t, n), N(e, n) ], W = ([t, e]) => t > e ? [ e, t ] : [ t, e ], F = ([t, e]) => t === e, U = ([t, e], [n, r]) => t < r && n < e;
222
234
 
223
- function* U(t, e = C(t.selection)) {
224
- if (W(e)) {
225
- const n = y(t.doc, e[0])?.[0];
235
+ function* V(t, e = W(t.selection)) {
236
+ if (F(e)) {
237
+ const n = x(t.doc, e[0])?.[0];
226
238
  n && (yield n);
227
- } else for (const [n, r] of v(t.doc, e)) F(e, [ r, r + p(n) ]) && (yield n);
239
+ } else for (const [n, r] of T(t.doc, e)) U(e, [ r, r + p(n) ]) && (yield n);
228
240
  }
229
241
 
230
- function V(t, e) {
242
+ function q(t, e) {
231
243
  t.apply({
232
244
  type: "patch_node",
233
245
  path: [],
@@ -236,23 +248,23 @@ function V(t, e) {
236
248
  });
237
249
  }
238
250
 
239
- var q = t => 1 === t.nodeType, z = t => 8 === t.nodeType, G = new Map([ [ "BR", 1 ], [ "WBR", 1 ], [ "AREA", 2 ], [ "BASE", 2 ], [ "DATALIST", 2 ], [ "HEAD", 2 ], [ "LINK", 2 ], [ "META", 2 ], [ "RP", 2 ], [ "SCRIPT", 2 ], [ "STYLE", 2 ], [ "TEMPLATE", 2 ], [ "TITLE", 2 ], [ "COLGROUP", 2 ], [ "HR", 3 ], [ "AUDIO", 3 ], [ "CANVAS", 3 ], [ "EMBED", 3 ], [ "IFRAME", 3 ], [ "IMG", 3 ], [ "OBJECT", 3 ], [ "PICTURE", 3 ], [ "VIDEO", 3 ], [ "SVG", 3 ], [ "MATH", 3 ], [ "BUTTON", 3 ], [ "INPUT", 3 ], [ "METER", 3 ], [ "PROGRESS", 3 ], [ "SELECT", 3 ], [ "TEXTAREA", 3 ] ]), J = new Set([ "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE", "LI", "DT", "DD", "TH", "TD" ]), Y = t => J.has(t.tagName), j = (t, e) => t.compareDocumentPosition(e), X = t => t.ownerDocument, Z = t => X(t).getSelection(), K = (t, e) => {
251
+ var z = t => 1 === t.nodeType, G = t => 8 === t.nodeType, J = new Map([ [ "BR", 1 ], [ "WBR", 1 ], [ "AREA", 2 ], [ "BASE", 2 ], [ "DATALIST", 2 ], [ "HEAD", 2 ], [ "LINK", 2 ], [ "META", 2 ], [ "RP", 2 ], [ "SCRIPT", 2 ], [ "STYLE", 2 ], [ "TEMPLATE", 2 ], [ "TITLE", 2 ], [ "COLGROUP", 2 ], [ "HR", 3 ], [ "AUDIO", 3 ], [ "CANVAS", 3 ], [ "EMBED", 3 ], [ "IFRAME", 3 ], [ "IMG", 3 ], [ "OBJECT", 3 ], [ "PICTURE", 3 ], [ "VIDEO", 3 ], [ "SVG", 3 ], [ "MATH", 3 ], [ "BUTTON", 3 ], [ "INPUT", 3 ], [ "METER", 3 ], [ "PROGRESS", 3 ], [ "SELECT", 3 ], [ "TEXTAREA", 3 ] ]), Y = new Set([ "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE", "LI", "DT", "DD", "TH", "TD" ]), j = t => Y.has(t.tagName), X = (t, e) => t.compareDocumentPosition(e), Z = t => t.ownerDocument, K = t => Z(t).getSelection(), Q = (t, e) => {
240
252
  if (t.rangeCount) {
241
253
  const n = t.getRangeAt(0);
242
254
  if (e.contains(n.commonAncestorContainer)) return n;
243
255
  }
244
- }, Q = (t, e, n, r) => {
245
- const [o, c] = ((t, [e, n]) => [ m(t, e), m(t, n) ])(n, r), s = X(t), i = W(r), l = r[0] - r[1] > 0, a = l ? o : c, u = tt(t, e, l ? c : o), f = i ? u : tt(t, e, a), p = s.createRange(), [d, h] = u, [y, x] = f;
246
- return q(d) && t !== d ? h < 1 ? p.setStartBefore(d) : p.setStartAfter(d) : p.setStart(d, h),
247
- q(y) && t !== y ? x < 1 ? p.setEndBefore(y) : p.setEndAfter(y) : p.setEnd(y, x),
256
+ }, $ = (t, e, n, r) => {
257
+ const [o, c] = ((t, [e, n]) => [ g(t, e), g(t, n) ])(n, r), s = Z(t), i = F(r), l = r[0] - r[1] > 0, a = l ? o : c, u = et(t, e, l ? c : o), f = i ? u : et(t, e, a), p = s.createRange(), [d, h] = u, [x, y] = f;
258
+ return z(d) && t !== d ? h < 1 ? p.setStartBefore(d) : p.setStartAfter(d) : p.setStart(d, h),
259
+ z(x) && t !== x ? y < 1 ? p.setEndBefore(x) : p.setEndAfter(x) : p.setEnd(x, y),
248
260
  p;
249
- }, $ = (t, e, n, r, o) => {
250
- const c = Z(t);
251
- if (o || K(c, t)) {
252
- const o = Q(t, e, n, r), s = r[0] - r[1] > 0;
261
+ }, tt = (t, e, n, r, o) => {
262
+ const c = K(t);
263
+ if (o || Q(c, t)) {
264
+ const o = $(t, e, n, r), s = r[0] - r[1] > 0;
253
265
  c.removeAllRanges(), c.addRange(o), s && (c.collapseToEnd(), c.extend(o.startContainer, o.startOffset));
254
266
  }
255
- }, tt = (t, e, [n, r]) => e(({t: e, o, i: c, l: s}) => {
267
+ }, et = (t, e, [n, r]) => e(({t: e, o, i: c, l: s}) => {
256
268
  let i, l = 0;
257
269
  for (;i = e(); ) if (4 === i) {
258
270
  if (l < n.length) for (let t = n[l++]; t > 0; t--) o();
@@ -262,10 +274,10 @@ var q = t => 1 === t.nodeType, z = t => 8 === t.nodeType, G = new Map([ [ "BR",
262
274
  r -= t;
263
275
  }
264
276
  return [ t, 0 ];
265
- }, t), et = (e, n, r, o) => {
277
+ }, t), nt = (e, n, r, o) => {
266
278
  let c = !0;
267
279
  if (e === r && !r.hasChildNodes()) return [ [], 0 ];
268
- if (q(r) && r.hasChildNodes()) {
280
+ if (z(r) && r.hasChildNodes()) {
269
281
  const e = t(o, r.childNodes.length - 1);
270
282
  r = r.childNodes[e], c = e === o, o = 0;
271
283
  }
@@ -282,7 +294,7 @@ var q = t => 1 === t.nodeType, z = t => 8 === t.nodeType, G = new Map([ [ "BR",
282
294
  });
283
295
  let d = 0;
284
296
  for (;t(); ) {
285
- const t = j(r, a());
297
+ const t = X(r, a());
286
298
  if (0 === t || 16 & t) {
287
299
  if (c) break;
288
300
  } else if (4 & t) break;
@@ -290,10 +302,10 @@ var q = t => 1 === t.nodeType, z = t => 8 === t.nodeType, G = new Map([ [ "BR",
290
302
  }
291
303
  return [ p, d + o ];
292
304
  }, e);
293
- }, nt = (t, e, {startOffset: n, startContainer: r, endOffset: o, endContainer: c}) => {
294
- const s = et(t, e, r, n);
295
- return [ s, r === c && n === o ? s : et(t, e, c, o) ];
296
- }, rt = "undefined" != typeof navigator && /Mac|iP(hone|od|ad)/.test(navigator.platform), ot = (t, e) => {
305
+ }, rt = (t, e, {startOffset: n, startContainer: r, endOffset: o, endContainer: c}) => {
306
+ const s = nt(t, e, r, n);
307
+ return [ s, r === c && n === o ? s : nt(t, e, c, o) ];
308
+ }, ot = "undefined" != typeof navigator && /Mac|iP(hone|od|ad)/.test(navigator.platform), ct = (t, e) => {
297
309
  const n = t.endsWith("+"), r = (n ? t.slice(0, -2) : t).split("+"), o = n ? "+" : r.pop(), c = "Space" === o ? " " : o.toLowerCase();
298
310
  let s = !1, i = !1, l = !1, a = !1;
299
311
  return r.forEach(t => {
@@ -307,7 +319,7 @@ var q = t => 1 === t.nodeType, z = t => 8 === t.nodeType, G = new Map([ [ "BR",
307
319
  break;
308
320
 
309
321
  case "Mod":
310
- rt ? l = !0 : i = !0;
322
+ ot ? l = !0 : i = !0;
311
323
  break;
312
324
 
313
325
  case "Alt":
@@ -322,10 +334,10 @@ var q = t => 1 === t.nodeType, z = t => 8 === t.nodeType, G = new Map([ [ "BR",
322
334
  };
323
335
  };
324
336
 
325
- function ct(t) {
337
+ function st(t) {
326
338
  let e = 0, r = 0, o = !1;
327
339
  const c = Date.now, s = [ [ t.doc, t.selection, [] ] ], i = () => s[e], l = () => e > 0, a = () => e < s.length - 1, u = e => {
328
- t.exec(V, e.children);
340
+ t.exec(q, e.children);
329
341
  const r = e, o = t.doc;
330
342
  for (const c of n(r)) "children" !== c && o[c] !== r[c] && t.apply({
331
343
  type: "patch_node",
@@ -350,7 +362,7 @@ function ct(t) {
350
362
  if (a()) {
351
363
  e++;
352
364
  const [n, r, c] = i(), s = t.doc;
353
- o = !0, u(n), o = !1, s !== t.doc && (t.selection = [ P(r[0], c), P(r[1], c) ]);
365
+ o = !0, u(n), o = !1, s !== t.doc && (t.selection = [ H(r[0], c), H(r[1], c) ]);
354
366
  }
355
367
  };
356
368
  t.hook("apply", (n, i) => {
@@ -368,8 +380,8 @@ function ct(t) {
368
380
  r = t, s[e][0] = u, s[e][2].push(n), s.length > e + 1 && (s.length = e + 1), e > 500 && (e--,
369
381
  s.shift());
370
382
  }
371
- }), t.hook("keyboard", ot("Mod+Z", f)), t.hook("keyboard", ot("Shift+Mod+Z", p)),
372
- t.set(ct, {
383
+ }), t.hook("keyboard", ct("Mod+Z", f)), t.hook("keyboard", ct("Shift+Mod+Z", p)),
384
+ t.set(st, {
373
385
  undo: f,
374
386
  redo: p,
375
387
  undoable: l,
@@ -377,9 +389,9 @@ function ct(t) {
377
389
  });
378
390
  }
379
391
 
380
- var st = [], it = () => {}, lt = t => {
392
+ var it = [], lt = () => {}, at = t => {
381
393
  throw Error(t);
382
- }, at = ({doc: t, readonly: e = !1, schema: n, isBlock: r = Y, onWarn: a = console.warn, onError: u = lt}) => {
394
+ }, ut = ({doc: t, readonly: e = !1, schema: n, isBlock: r = j, onWarn: a = console.warn, onError: u = at}) => {
383
395
  let f = [ 0, 0 ];
384
396
  const p = t => {
385
397
  if (!n) return a("An unsafe operation was detected. We recommend using schema option."),
@@ -392,8 +404,8 @@ var st = [], it = () => {}, lt = t => {
392
404
  return !1;
393
405
  };
394
406
  n && !p(t) && u("Invalid document");
395
- const y = new Map, x = new WeakMap, m = t => y.get(t) || st, _ = new Map, b = new Set, v = t => {
396
- const e = _.get(t);
407
+ const x = new Map, y = new WeakMap, k = t => x.get(t) || it, g = new Map, b = new Set, v = t => {
408
+ const e = g.get(t);
397
409
  e && (b.size || s(() => {
398
410
  b.forEach(t => {
399
411
  t();
@@ -402,10 +414,10 @@ var st = [], it = () => {}, lt = t => {
402
414
  b.add(t);
403
415
  }));
404
416
  }, T = t => {
405
- if (!e) if (Array.isArray(t)) for (const e of t) O(e); else O(t);
417
+ if (!e) if (Array.isArray(t)) for (const e of t) E(e); else E(t);
406
418
  return D;
407
- }, O = e => {
408
- const n = t, r = m("apply"), o = r.length;
419
+ }, E = e => {
420
+ const n = t, r = k("apply"), o = r.length;
409
421
  let c = 0;
410
422
  const s = () => {
411
423
  if (c < o) {
@@ -416,43 +428,43 @@ var st = [], it = () => {}, lt = t => {
416
428
  try {
417
429
  const [n, r] = ((t, e, n) => {
418
430
  switch (n.type) {
419
- case S:
431
+ case w:
420
432
  {
421
433
  const [r, o] = n.range;
422
- L(t, r) && L(t, o) && r < o && (t = I(t, r, o, []), e = N(e, n));
434
+ P(t, r) && P(t, o) && r < o && (t = L(t, r, o, []), e = C(e, n));
423
435
  break;
424
436
  }
425
437
 
426
- case w:
438
+ case A:
427
439
  {
428
440
  const {at: r, text: o} = n;
429
- if (L(t, r) && o) {
441
+ if (P(t, r) && o) {
430
442
  const [c, s] = h(t, r), l = d(c, s, !0);
431
443
  let a;
432
444
  if (l) {
433
445
  const t = l[0];
434
446
  i(t) && (a = t);
435
447
  }
436
- t = I(t, r, r, M(o, a, c)), e = N(e, n);
448
+ t = L(t, r, r, S(o, a, c)), e = C(e, n);
437
449
  }
438
450
  break;
439
451
  }
440
452
 
441
- case A:
453
+ case O:
442
454
  {
443
455
  const {at: r, fragment: o} = n;
444
- L(t, r) && o.length && (t = I(t, r, r, o), e = N(e, n));
456
+ P(t, r) && o.length && (t = L(t, r, r, o), e = C(e, n));
445
457
  break;
446
458
  }
447
459
 
448
460
  case "format":
449
461
  {
450
462
  const {range: [e, r], key: o, value: c} = n;
451
- if (L(t, e) && L(t, r) && e <= r) if (e === r) {
463
+ if (P(t, e) && P(t, r) && e <= r) if (e === r) {
452
464
  const [{children: n}, , r] = h(t, e);
453
465
  if (1 === n.length) {
454
466
  const e = n[0];
455
- i(e) && !e.text && (t = B(t, [ ...r, 0 ], {
467
+ i(e) && !e.text && (t = I(t, [ ...r, 0 ], {
456
468
  ...e,
457
469
  [o]: c
458
470
  }));
@@ -465,7 +477,7 @@ var st = [], it = () => {}, lt = t => {
465
477
  ...t,
466
478
  [o]: c
467
479
  } : t;
468
- t = I(t, e, r, E(t, e, r).map(n));
480
+ t = L(t, e, r, M(t, e, r).map(n));
469
481
  }
470
482
  break;
471
483
  }
@@ -476,7 +488,7 @@ var st = [], it = () => {}, lt = t => {
476
488
  for (let n = 0; n < e.length; n++) t = t.children[e[n]];
477
489
  return t;
478
490
  })(t, e);
479
- c && (t = B(t, e, {
491
+ c && (t = I(t, e, {
480
492
  ...c,
481
493
  [r]: o
482
494
  }));
@@ -485,7 +497,7 @@ var st = [], it = () => {}, lt = t => {
485
497
  }
486
498
  return [ t, e ];
487
499
  })(t, f, e);
488
- (({type: t}) => t !== w && t !== S)(e) && !p(n) || (t = n, R(r));
500
+ (({type: t}) => t !== A && t !== w)(e) && !p(n) || (t = n, R(r));
489
501
  } catch (n) {
490
502
  a("rollback operation: " + n);
491
503
  }
@@ -495,7 +507,7 @@ var st = [], it = () => {}, lt = t => {
495
507
  };
496
508
  s(), n !== t && v("change");
497
509
  }, R = e => {
498
- !((t, [e, n]) => L(t, e) && L(t, n))(t, e) || f[0] === e[0] && f[1] === e[1] || (f = e,
510
+ !((t, [e, n]) => P(t, e) && P(t, n))(t, e) || f[0] === e[0] && f[1] === e[1] || (f = e,
499
511
  v("selectionchange"));
500
512
  }, D = {
501
513
  get doc() {
@@ -515,14 +527,14 @@ var st = [], it = () => {}, lt = t => {
515
527
  },
516
528
  apply: T,
517
529
  on: (t, e) => {
518
- let n = _.get(t);
519
- return n || _.set(t, n = new Set), n.add(e), () => {
530
+ let n = g.get(t);
531
+ return n || g.set(t, n = new Set), n.add(e), () => {
520
532
  n.delete(e);
521
533
  };
522
534
  },
523
535
  hook: (t, e) => {
524
- let n = y.get(t);
525
- return n || y.set(t, n = []), n.push(e), () => {
536
+ let n = x.get(t);
537
+ return n || x.set(t, n = []), n.push(e), () => {
526
538
  const t = n.indexOf(e);
527
539
  -1 !== t && n.splice(t, 1);
528
540
  };
@@ -531,25 +543,25 @@ var st = [], it = () => {}, lt = t => {
531
543
  const n = t(D, ...e);
532
544
  return void 0 === n ? D : n;
533
545
  },
534
- get: t => (x.has(t) || u("No value found for key"), x.get(t)),
535
- set: (t, e) => (x.set(t, e), D),
546
+ get: t => (y.has(t) || u("No value found for key"), y.get(t)),
547
+ set: (t, e) => (y.set(t, e), D),
536
548
  input: n => {
537
549
  if (!window.InputEvent || !c(InputEvent.prototype.getTargetRanges)) return a("beforeinput event is not supported."),
538
- it;
550
+ lt;
539
551
  const {contentEditable: s, role: i, ariaMultiLine: l, ariaReadOnly: u} = n, p = n.style.whiteSpace;
540
552
  n.role = "textbox", n.style.whiteSpace = "pre-wrap", n.ariaMultiLine = "true";
541
- let d = !1, h = null, y = !1, x = !1, _ = !1, b = f, v = null;
542
- const E = X(n), M = ((t, e) => {
553
+ let d = !1, h = null, x = !1, y = !1, g = !1, b = f, v = null;
554
+ const E = Z(n), M = ((t, e) => {
543
555
  let n = null, r = null, o = null;
544
556
  const c = () => {
545
557
  if (null != o) return o;
546
558
  if (r) if ((t => 3 === t.nodeType)(r)) {
547
559
  const t = r.data;
548
560
  if (t) return o = "\n" === t ? i() ? 3 : 5 : 1;
549
- } else if (q(r)) {
561
+ } else if (z(r)) {
550
562
  if ("false" === r.contentEditable) return o = 2;
551
563
  {
552
- const t = G.get(r.tagName);
564
+ const t = J.get(r.tagName);
553
565
  if (null != t) return o = 1 === t ? i() ? 3 : 5 : 3 === t ? 2 : 6;
554
566
  if (e(r)) return o = 4;
555
567
  }
@@ -611,19 +623,19 @@ var st = [], it = () => {}, lt = t => {
611
623
  };
612
624
  S();
613
625
  const w = () => {
614
- x || n.focus({
626
+ y || n.focus({
615
627
  preventScroll: !0
616
628
  });
617
629
  }, A = () => {
618
- v = null, f[0] === b[0] && f[1] === b[1] || ($(n, M, t, f), b = f);
630
+ v = null, f[0] === b[0] && f[1] === b[1] || (tt(n, M, t, f), b = f);
619
631
  }, O = () => {
620
632
  null != v && clearTimeout(v);
621
633
  }, B = D.on("change", () => {
622
- x || requestAnimationFrame(w);
634
+ y || requestAnimationFrame(w);
623
635
  }), I = D.on("selectionchange", () => {
624
636
  f[0] === b[0] && f[1] === b[1] || (O(), v = setTimeout(A, 50));
625
- }), L = D.on("readonly", S), H = t => {
626
- for (const e of m("paste")) {
637
+ }), L = D.on("readonly", S), P = t => {
638
+ for (const e of k("paste")) {
627
639
  const n = e(t);
628
640
  if (n) return n;
629
641
  }
@@ -665,28 +677,28 @@ var st = [], it = () => {}, lt = t => {
665
677
  }
666
678
  };
667
679
  })(n, () => {
668
- O(), $(n, M, t, f);
669
- }), F = () => {
670
- R(b = g(t, ((t, e) => {
671
- const n = Z(t), r = K(n, t);
680
+ O(), tt(n, M, t, f);
681
+ }), C = () => {
682
+ R(b = _(t, ((t, e) => {
683
+ const n = K(t), r = Q(n, t);
672
684
  if (!r) return [ [ [ 0 ], 0 ], [ [ 0 ], 0 ] ];
673
- const o = nt(t, e, r), c = j(n.anchorNode, n.focusNode);
685
+ const o = rt(t, e, r), c = X(n.anchorNode, n.focusNode);
674
686
  return (0 === c ? n.anchorOffset > n.focusOffset : 2 & c) ? [ o[1], o[0] ] : o;
675
687
  })(n, M)));
676
688
  }, U = () => {
677
689
  const e = N.v();
678
- N._(!1), e.length && (N.m(e), E.removeEventListener("selectionchange", ot), $(n, M, t, f, !0),
679
- E.addEventListener("selectionchange", ot)), h && (R(h[1]), T(h[0]), h = null), y = !1;
690
+ N._(!1), e.length && (N.m(e), E.removeEventListener("selectionchange", ot), tt(n, M, t, f, !0),
691
+ E.addEventListener("selectionchange", ot)), h && (R(h[1]), T(h[0]), h = null), x = !1;
680
692
  }, V = t => {
681
- if (!y) for (const e of m("keyboard")) if (e(t)) return t.preventDefault(), void N._(!1);
682
- }, z = () => {
683
- y || U();
684
- }, J = e => {
693
+ if (!x) for (const e of k("keyboard")) if (e(t)) return t.preventDefault(), void N._(!1);
694
+ }, q = () => {
695
+ x || U();
696
+ }, G = e => {
685
697
  e.preventDefault();
686
698
  const r = e.inputType;
687
699
  if (r.startsWith("format")) return;
688
700
  if ("historyUndo" === r || "historyRedo" === r) return;
689
- y ? N._(!0) : F();
701
+ x ? N._(!0) : C();
690
702
  const o = e.getTargetRanges()[0];
691
703
  if (o) {
692
704
  let c = "insertParagraph" === r || "insertLineBreak" === r ? "\n" : e.data;
@@ -695,8 +707,8 @@ var st = [], it = () => {}, lt = t => {
695
707
  t && (c = t.getData("text/plain"));
696
708
  }
697
709
  h || (h = [ [], f ]);
698
- const s = h[0], i = g(t, nt(n, M, o));
699
- W(i) || s.push({
710
+ const s = h[0], i = _(t, rt(n, M, o));
711
+ F(i) || s.push({
700
712
  type: "delete",
701
713
  range: i
702
714
  }), c && s.push({
@@ -705,31 +717,31 @@ var st = [], it = () => {}, lt = t => {
705
717
  text: c
706
718
  });
707
719
  }
708
- y || U();
720
+ x || U();
709
721
  }, Y = () => {
710
- y || F(), y = !0;
711
- }, Q = () => {
722
+ x || C(), x = !0;
723
+ }, j = () => {
712
724
  U();
713
- }, tt = () => {
714
- x = !0, F();
715
- }, rt = () => {
716
- x = !1;
725
+ }, $ = () => {
726
+ y = !0, C();
727
+ }, et = () => {
728
+ y = !1;
717
729
  }, ot = () => {
718
- !x || y || _ || F();
730
+ !y || x || g || C();
719
731
  }, ct = t => {
720
- if (F(), !W(f)) for (const e of m("copy")) e(t);
732
+ if (C(), !F(f)) for (const e of k("copy")) e(t);
721
733
  }, st = t => {
722
734
  t.preventDefault(), ct(t.clipboardData);
723
- }, lt = t => {
735
+ }, it = t => {
724
736
  t.preventDefault(), e || (ct(t.clipboardData), T({
725
737
  type: "delete",
726
- range: C(f)
738
+ range: W(f)
727
739
  }));
728
740
  }, at = t => {
729
741
  t.preventDefault();
730
- const e = H(t.clipboardData);
742
+ const e = P(t.clipboardData);
731
743
  if (e) {
732
- const t = C(f), n = t[0], r = [ {
744
+ const t = W(f), n = t[0], r = [ {
733
745
  type: "delete",
734
746
  range: t
735
747
  } ];
@@ -746,25 +758,25 @@ var st = [], it = () => {}, lt = t => {
746
758
  }, ut = e => {
747
759
  e.preventDefault();
748
760
  const r = e.dataTransfer, c = ((t, e, {clientX: n, clientY: r}) => {
749
- const o = X(t);
761
+ const o = Z(t);
750
762
  if (o.caretPositionFromPoint) {
751
763
  const c = o.caretPositionFromPoint(n, r);
752
- if (c) return et(t, e, c.offsetNode, c.offset);
764
+ if (c) return nt(t, e, c.offsetNode, c.offset);
753
765
  } else if (o.caretRangeFromPoint) {
754
766
  const c = o.caretRangeFromPoint(n, r);
755
- if (c) return et(t, e, c.startContainer, c.startOffset);
767
+ if (c) return nt(t, e, c.startContainer, c.startOffset);
756
768
  }
757
769
  })(n, M, e);
758
770
  if (r && c) {
759
771
  let e;
760
772
  const n = [];
761
- _ && n.push({
773
+ g && n.push({
762
774
  type: "delete",
763
- range: C(f)
775
+ range: W(f)
764
776
  });
765
- const s = H(r);
777
+ const s = P(r);
766
778
  if (s) {
767
- const r = k(t, c), i = P(r, n);
779
+ const r = m(t, c), i = H(r, n);
768
780
  n.push(o(s) ? {
769
781
  type: "insert_text",
770
782
  at: i,
@@ -773,54 +785,54 @@ var st = [], it = () => {}, lt = t => {
773
785
  type: "insert_node",
774
786
  at: i,
775
787
  fragment: s
776
- }), e = [ i, P(r, n) ];
788
+ }), e = [ i, H(r, n) ];
777
789
  }
778
790
  T(n), e && R(e);
779
791
  }
780
- _ = !1;
792
+ g = !1;
781
793
  }, ft = t => {
782
- _ = !0, ct(t.dataTransfer);
794
+ g = !0, ct(t.dataTransfer);
783
795
  }, pt = () => {
784
- _ = !1;
796
+ g = !1;
785
797
  };
786
- E.addEventListener("selectionchange", ot), n.addEventListener("keydown", V), n.addEventListener("input", z),
787
- n.addEventListener("beforeinput", J), n.addEventListener("compositionstart", Y),
788
- n.addEventListener("compositionend", Q), n.addEventListener("focus", tt), n.addEventListener("blur", rt),
789
- n.addEventListener("copy", st), n.addEventListener("cut", lt), n.addEventListener("paste", at),
798
+ E.addEventListener("selectionchange", ot), n.addEventListener("keydown", V), n.addEventListener("input", q),
799
+ n.addEventListener("beforeinput", G), n.addEventListener("compositionstart", Y),
800
+ n.addEventListener("compositionend", j), n.addEventListener("focus", $), n.addEventListener("blur", et),
801
+ n.addEventListener("copy", st), n.addEventListener("cut", it), n.addEventListener("paste", at),
790
802
  n.addEventListener("drop", ut), n.addEventListener("dragstart", ft), n.addEventListener("dragend", pt);
791
803
  const dt = [];
792
- return m("mount").forEach(t => {
804
+ return k("mount").forEach(t => {
793
805
  const e = t(n, M);
794
806
  e && dt.push(e);
795
807
  }), () => {
796
808
  d || (d = !0, B(), I(), L(), n.contentEditable = s, n.role = i, n.ariaMultiLine = l,
797
809
  n.ariaReadOnly = u, n.style.whiteSpace = p, N.T(), E.removeEventListener("selectionchange", ot),
798
- n.removeEventListener("keydown", V), n.removeEventListener("input", z), n.removeEventListener("beforeinput", J),
799
- n.removeEventListener("compositionstart", Y), n.removeEventListener("compositionend", Q),
800
- n.removeEventListener("focus", tt), n.removeEventListener("blur", rt), n.removeEventListener("copy", st),
801
- n.removeEventListener("cut", lt), n.removeEventListener("paste", at), n.removeEventListener("drop", ut),
810
+ n.removeEventListener("keydown", V), n.removeEventListener("input", q), n.removeEventListener("beforeinput", G),
811
+ n.removeEventListener("compositionstart", Y), n.removeEventListener("compositionend", j),
812
+ n.removeEventListener("focus", $), n.removeEventListener("blur", et), n.removeEventListener("copy", st),
813
+ n.removeEventListener("cut", it), n.removeEventListener("paste", at), n.removeEventListener("drop", ut),
802
814
  n.removeEventListener("dragstart", ft), n.removeEventListener("dragend", pt), dt.forEach(t => {
803
815
  t();
804
816
  }));
805
817
  };
806
818
  }
807
819
  };
808
- return D.exec(ct), D;
820
+ return D.exec(st), D;
809
821
  };
810
822
 
811
- function ut(t, e) {
823
+ function ft(t, e) {
812
824
  const n = e && e.voidToString;
813
825
  t.hook("copy", e => {
814
- e.setData("text/plain", T(t.doc, ...C(t.selection), n));
826
+ e.setData("text/plain", E(t.doc, ...W(t.selection), n));
815
827
  }), t.hook("paste", t => t.getData("text/plain"));
816
828
  }
817
829
 
818
- var ft = "application/x-editate-editor";
830
+ var pt = "application/x-editate-editor";
819
831
 
820
- function pt(t, e) {
832
+ function dt(t, e) {
821
833
  const n = e.isLocked, r = e => n(h(t.doc, e)[0]), o = (e, r) => {
822
834
  const [o, c] = e;
823
- for (const [s, i] of b(t.doc, e)) {
835
+ for (const [s, i] of v(t.doc, e)) {
824
836
  const t = i + p(s);
825
837
  if ((r ? c >= i && o <= t : c > i && o < t) && n(s)) return !0;
826
838
  }
@@ -831,7 +843,7 @@ function pt(t, e) {
831
843
  const a = c;
832
844
  switch (c = !1, e.type) {
833
845
  case "delete":
834
- if (o(C(e.range), !0)) return c = !0, s(() => {
846
+ if (o(W(e.range), !0)) return c = !0, s(() => {
835
847
  c = !1;
836
848
  }), i(null);
837
849
  break;
@@ -843,8 +855,8 @@ function pt(t, e) {
843
855
 
844
856
  case "format":
845
857
  {
846
- const t = C(e.range);
847
- if (W(t) ? r(t[0]) : o(t, !1)) return i(null);
858
+ const t = W(e.range);
859
+ if (F(t) ? r(t[0]) : o(t, !1)) return i(null);
848
860
  break;
849
861
  }
850
862
 
@@ -865,17 +877,17 @@ function pt(t, e) {
865
877
  }
866
878
  }
867
879
  i(e);
868
- }), t.set(pt, {
869
- locked: t => W(t) ? r(t[0]) : o(t, !0)
880
+ }), t.set(dt, {
881
+ locked: t => F(t) ? r(t[0]) : o(t, !0)
870
882
  });
871
883
  }
872
884
 
873
- var dt = (t, e) => {
885
+ var ht = (t, e) => {
874
886
  const n = parseFloat(t);
875
887
  return n ? t.endsWith("%") ? n / 100 * e : n : 0;
876
- }, ht = (t, e, n, r) => [ t + dt(n, e), t + e - dt(r, e) ], yt = (t, e, [n, r]) => t < n ? t - n : e > r ? e - r : 0, xt = (t, e, n) => Math.max(-e, Math.min(t, n - e));
888
+ }, xt = (t, e, n, r) => [ t + ht(n, e), t + e - ht(r, e) ], yt = (t, e, [n, r]) => t < n ? t - n : e > r ? e - r : 0, kt = (t, e, n) => Math.max(-e, Math.min(t, n - e));
877
889
 
878
- function kt(t) {
890
+ function mt(t) {
879
891
  t.hook("mount", t => {
880
892
  t.ariaMultiLine = null;
881
893
  }), t.hook("apply", (t, e) => {
@@ -886,19 +898,19 @@ function kt(t) {
886
898
  const e = t.fragment;
887
899
  t = {
888
900
  ...t,
889
- fragment: a(e) ? [ D(...e) ] : e
901
+ fragment: a(e) ? [ B(...e) ] : e
890
902
  };
891
903
  }
892
904
  e(t);
893
905
  });
894
906
  }
895
907
 
896
- exports.Delete = function(t, e = C(t.selection)) {
908
+ exports.Delete = function(t, e = W(t.selection)) {
897
909
  t.apply({
898
910
  type: "delete",
899
911
  range: e
900
912
  });
901
- }, exports.Format = function(t, e, n, r = C(t.selection)) {
913
+ }, exports.Format = function(t, e, n, r = W(t.selection)) {
902
914
  t.apply({
903
915
  type: "format",
904
916
  range: r,
@@ -919,13 +931,13 @@ exports.Delete = function(t, e = C(t.selection)) {
919
931
  at: n,
920
932
  text: e
921
933
  });
922
- }, exports.LeavesInRange = U, exports.LockedInRange = function(t, e = C(t.selection)) {
923
- return t.get(pt).locked(e);
934
+ }, exports.LeavesInRange = V, exports.LockedInRange = function(t, e = W(t.selection)) {
935
+ return t.get(dt).locked(e);
924
936
  }, exports.Redo = function(t) {
925
- t.get(ct).redo();
937
+ t.get(st).redo();
926
938
  }, exports.Redoable = function(t) {
927
- return t.get(ct).redoable();
928
- }, exports.ReplaceDoc = V, exports.ReplaceText = function(t, e, n = C(t.selection)) {
939
+ return t.get(st).redoable();
940
+ }, exports.ReplaceDoc = q, exports.ReplaceText = function(t, e, n = W(t.selection)) {
929
941
  t.apply({
930
942
  type: "delete",
931
943
  range: n
@@ -943,7 +955,7 @@ exports.Delete = function(t, e = C(t.selection)) {
943
955
  value: n
944
956
  });
945
957
  }, exports.SetVoidAttr = function(t, e, n, r = t.selection[0]) {
946
- const o = y(t.doc, r, !0);
958
+ const o = x(t.doc, r, !0);
947
959
  o && !i(o[0]) && t.apply({
948
960
  type: "patch_node",
949
961
  path: o[2],
@@ -958,9 +970,9 @@ exports.Delete = function(t, e = C(t.selection)) {
958
970
  key: e,
959
971
  value: c[e] === n ? r : n
960
972
  });
961
- }, exports.ToggleFormat = function(t, e, n = C(t.selection)) {
973
+ }, exports.ToggleFormat = function(t, e, n = W(t.selection)) {
962
974
  let r = !1, o = !1;
963
- for (const c of t.exec(U, n)) if (i(c) && (o = !0, !c[e])) {
975
+ for (const c of t.exec(V, n)) if (i(c) && (o = !0, !c[e])) {
964
976
  r = !0;
965
977
  break;
966
978
  }
@@ -971,18 +983,18 @@ exports.Delete = function(t, e = C(t.selection)) {
971
983
  value: r
972
984
  });
973
985
  }, exports.Undo = function(t) {
974
- t.get(ct).undo();
986
+ t.get(st).undo();
975
987
  }, exports.Undoable = function(t) {
976
- return t.get(ct).undoable();
977
- }, exports.blockLockPlugin = pt, exports.createEditor = at, exports.createPlainEditor = ({text: t, singleline: e, onChange: n, ...r}) => {
978
- const o = at({
988
+ return t.get(st).undoable();
989
+ }, exports.blockLockPlugin = dt, exports.createEditor = ut, exports.createPlainEditor = ({text: t, singleline: e, onChange: n, ...r}) => {
990
+ const o = ut({
979
991
  ...r,
980
992
  doc: {
981
- children: M(t)
993
+ children: S(t)
982
994
  }
983
- }).exec(ut);
984
- return e && o.exec(kt), o.on("change", () => {
985
- n(T(o.doc));
995
+ }).exec(ft);
996
+ return e && o.exec(mt), o.on("change", () => {
997
+ n(E(o.doc));
986
998
  }), o;
987
999
  }, exports.debugPlugin = function(t) {
988
1000
  t.hook("apply", t => {
@@ -1005,12 +1017,12 @@ exports.Delete = function(t, e = C(t.selection)) {
1005
1017
  }
1006
1018
  return null;
1007
1019
  });
1008
- }, exports.getChildAt = d, exports.getLeafAt = y, exports.getLeafBlockAt = h, exports.getNodeSize = p,
1009
- exports.htmlTransferPlugin = function(t, e) {
1020
+ }, exports.getChildAt = d, exports.getLeafAt = x, exports.getLeafBlockAt = h, exports.getNodeOffset = y,
1021
+ exports.getNodeSize = p, exports.htmlTransferPlugin = function(t, e) {
1010
1022
  t.hook("mount", (n, r) => {
1011
1023
  const o = t.hook("copy", t => {
1012
1024
  const e = document.createElement("div");
1013
- e.appendChild(K(Z(n), n).cloneContents()), t.setData("text/html", e.innerHTML);
1025
+ e.appendChild(Q(K(n), n).cloneContents()), t.setData("text/html", e.innerHTML);
1014
1026
  }), c = t.hook("paste", t => {
1015
1027
  const n = t.getData("text/html");
1016
1028
  return n ? ((t, e, n) => {
@@ -1022,7 +1034,7 @@ exports.htmlTransferPlugin = function(t, e) {
1022
1034
  }
1023
1035
  };
1024
1036
  let c = (new DOMParser).parseFromString(t, "text/html").body, s = !1;
1025
- for (const i of [ ...c.childNodes ]) z(i) ? "StartFragment" === i.data ? (s = !0,
1037
+ for (const i of [ ...c.childNodes ]) G(i) ? "StartFragment" === i.data ? (s = !0,
1026
1038
  c = new DocumentFragment) : "EndFragment" === i.data && (s = !1) : s && c.appendChild(i);
1027
1039
  return e(({t, i: e}) => {
1028
1040
  let n, c = null, s = "", i = !1;
@@ -1048,25 +1060,25 @@ exports.htmlTransferPlugin = function(t, e) {
1048
1060
  o(), c();
1049
1061
  };
1050
1062
  });
1051
- }, exports.internalTranferPlugin = function(t) {
1063
+ }, exports.internalTransferPlugin = function(t) {
1052
1064
  t.hook("copy", e => {
1053
- e.setData(ft, JSON.stringify(E(t.doc, ...C(t.selection))));
1065
+ e.setData(pt, JSON.stringify(M(t.doc, ...W(t.selection))));
1054
1066
  }), t.hook("paste", t => {
1055
1067
  try {
1056
- return JSON.parse(t.getData(ft));
1068
+ return JSON.parse(t.getData(pt));
1057
1069
  } catch (e) {
1058
1070
  return null;
1059
1071
  }
1060
1072
  });
1061
- }, exports.iterLeafBlocks = b, exports.iterLeaves = v, exports.keymapPlugin = function(t, e) {
1073
+ }, exports.iterLeafBlocks = v, exports.iterLeaves = T, exports.keymapPlugin = function(t, e) {
1062
1074
  n(e).forEach(n => {
1063
1075
  const r = e[n];
1064
- t.hook("keyboard", ot(n, r));
1076
+ t.hook("keyboard", ct(n, r));
1065
1077
  });
1066
- }, exports.mapPosition = H, exports.plainTransferPlugin = ut, exports.scrollToSelectionPlugin = t => {
1078
+ }, exports.mapPosition = N, exports.plainTransferPlugin = ft, exports.scrollToSelectionPlugin = t => {
1067
1079
  const e = "auto";
1068
1080
  t.hook("mount", (n, r) => {
1069
- const o = X(n), c = o.defaultView, s = ((t, e, n) => {
1081
+ const o = Z(n), c = o.defaultView, s = ((t, e, n) => {
1070
1082
  const {body: r, documentElement: o} = e;
1071
1083
  let c = t;
1072
1084
  for (;c && c !== r && c !== o; ) {
@@ -1080,22 +1092,22 @@ exports.htmlTransferPlugin = function(t, e) {
1080
1092
  const l = t.on("change", () => {
1081
1093
  null == i && (i = setTimeout(() => {
1082
1094
  i = null;
1083
- const o = Q(n, r, t.doc, t.selection);
1095
+ const o = $(n, r, t.doc, t.selection);
1084
1096
  let l = o.getBoundingClientRect();
1085
1097
  if (!l.height) {
1086
- const t = o.startContainer, e = q(t) ? t : t.parentElement;
1098
+ const t = o.startContainer, e = z(t) ? t : t.parentElement;
1087
1099
  e && (l = e.getBoundingClientRect());
1088
1100
  }
1089
1101
  const a = s ? ((t, e, n, r) => {
1090
- const {scrollLeft: o, scrollTop: c, scrollWidth: s, scrollHeight: i, clientLeft: l, clientTop: a, clientWidth: u, clientHeight: f} = e, p = e.getBoundingClientRect(), d = t.getComputedStyle(e), h = xt(yt(n.top, n.bottom, ht(p.top + a, f, d.scrollPaddingTop, d.scrollPaddingBottom)), c, i - f), y = xt(yt(n.left, n.right, ht(p.left + l, u, d.scrollPaddingLeft, d.scrollPaddingRight)), o, s - u);
1091
- return (h || y) && e.scrollBy({
1102
+ const {scrollLeft: o, scrollTop: c, scrollWidth: s, scrollHeight: i, clientLeft: l, clientTop: a, clientWidth: u, clientHeight: f} = e, p = e.getBoundingClientRect(), d = t.getComputedStyle(e), h = kt(yt(n.top, n.bottom, xt(p.top + a, f, d.scrollPaddingTop, d.scrollPaddingBottom)), c, i - f), x = kt(yt(n.left, n.right, xt(p.left + l, u, d.scrollPaddingLeft, d.scrollPaddingRight)), o, s - u);
1103
+ return (h || x) && e.scrollBy({
1092
1104
  top: h,
1093
- left: y,
1105
+ left: x,
1094
1106
  behavior: r
1095
- }), [ y, h ];
1107
+ }), [ x, h ];
1096
1108
  })(c, s, l, e) : [ 0, 0 ];
1097
1109
  ((t, e, [n, r], o) => {
1098
- const {documentElement: c} = t.document, {clientWidth: s, clientHeight: i} = c, l = t.getComputedStyle(c), a = yt(e.top - r, e.bottom - r, ht(0, i, l.scrollPaddingTop, l.scrollPaddingBottom)), u = yt(e.left - n, e.right - n, ht(0, s, l.scrollPaddingLeft, l.scrollPaddingRight));
1110
+ const {documentElement: c} = t.document, {clientWidth: s, clientHeight: i} = c, l = t.getComputedStyle(c), a = yt(e.top - r, e.bottom - r, xt(0, i, l.scrollPaddingTop, l.scrollPaddingBottom)), u = yt(e.left - n, e.right - n, xt(0, s, l.scrollPaddingLeft, l.scrollPaddingRight));
1099
1111
  (a || u) && t.scrollBy({
1100
1112
  top: a,
1101
1113
  left: u,
@@ -1115,7 +1127,7 @@ exports.htmlTransferPlugin = function(t, e) {
1115
1127
  c || (c = !0, requestAnimationFrame(() => {
1116
1128
  c = !1, o && e(() => {
1117
1129
  const e = t.selection;
1118
- return Q(n, r, t.doc, e).getBoundingClientRect();
1130
+ return $(n, r, t.doc, e).getBoundingClientRect();
1119
1131
  });
1120
1132
  }));
1121
1133
  });
@@ -1123,5 +1135,5 @@ exports.htmlTransferPlugin = function(t, e) {
1123
1135
  o = !1, s();
1124
1136
  };
1125
1137
  });
1126
- }, exports.singlelinePlugin = kt, exports.sliceText = T;
1138
+ }, exports.singlelinePlugin = mt, exports.sliceText = E;
1127
1139
  //# sourceMappingURL=index.cjs.map