231 lines
7.4 KiB
JavaScript
231 lines
7.4 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 2a4e4dccbc3fdacb.bc4b655d5c.js
|
|
* Module id: 929126
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(545773),
|
|
n = e.i(47091);
|
|
function r(e, i = null) {
|
|
return function (r, o) {
|
|
let { $from: s, $to: l } = r.selection,
|
|
a = s.blockRange(l);
|
|
if (!a) return !1;
|
|
let d = o ? r.tr : null;
|
|
return (
|
|
!!(function (e, r, i, o = null) {
|
|
let s = !1,
|
|
l = r,
|
|
a = r.$from.doc;
|
|
if (
|
|
r.depth >= 2 &&
|
|
r.$from.node(r.depth - 1).type.compatibleContent(i) &&
|
|
0 == r.startIndex
|
|
) {
|
|
if (0 == r.$from.index(r.depth - 1)) return !1;
|
|
let e = a.resolve(r.start - 2);
|
|
(l = new n.NodeRange(e, e, r.depth)),
|
|
r.endIndex < r.parent.childCount &&
|
|
(r = new n.NodeRange(
|
|
r.$from,
|
|
a.resolve(r.$to.end(r.depth)),
|
|
r.depth,
|
|
)),
|
|
(s = !0);
|
|
}
|
|
let d = (0, t.findWrapping)(l, i, o, r);
|
|
return (
|
|
!!d &&
|
|
(e &&
|
|
(function (e, r, i, o, s) {
|
|
let l = n.Fragment.empty;
|
|
for (let e = i.length - 1; e >= 0; e--)
|
|
l = n.Fragment.from(i[e].type.create(i[e].attrs, l));
|
|
e.step(
|
|
new t.ReplaceAroundStep(
|
|
r.start - 2 * !!o,
|
|
r.end,
|
|
r.start,
|
|
r.end,
|
|
new n.Slice(l, 0, 0),
|
|
i.length,
|
|
!0,
|
|
),
|
|
);
|
|
let a = 0;
|
|
for (let e = 0; e < i.length; e++)
|
|
i[e].type == s && (a = e + 1);
|
|
let d = i.length - a,
|
|
c = r.start + i.length - 2 * !!o,
|
|
h = r.parent;
|
|
for (
|
|
let n = r.startIndex, i = r.endIndex, o = !0;
|
|
n < i;
|
|
n++, o = !1
|
|
)
|
|
!o &&
|
|
(0, t.canSplit)(e.doc, c, d) &&
|
|
(e.split(c, d), (c += 2 * d)),
|
|
(c += h.child(n).nodeSize);
|
|
})(e, r, d, s, i),
|
|
!0)
|
|
);
|
|
})(d, a, e, i) && (o && o(d.scrollIntoView()), !0)
|
|
);
|
|
};
|
|
}
|
|
function i(e) {
|
|
return function (r, i) {
|
|
let { $from: o, $to: s } = r.selection,
|
|
l = o.blockRange(
|
|
s,
|
|
(t) => t.childCount > 0 && t.firstChild.type == e,
|
|
);
|
|
return (
|
|
!!l &&
|
|
(!i ||
|
|
(o.node(l.depth - 1).type == e
|
|
? (function (e, r, i, o) {
|
|
let s = e.tr,
|
|
l = o.end,
|
|
a = o.$to.end(o.depth);
|
|
l < a &&
|
|
(s.step(
|
|
new t.ReplaceAroundStep(
|
|
l - 1,
|
|
a,
|
|
l,
|
|
a,
|
|
new n.Slice(
|
|
n.Fragment.from(i.create(null, o.parent.copy())),
|
|
1,
|
|
0,
|
|
),
|
|
1,
|
|
!0,
|
|
),
|
|
),
|
|
(o = new n.NodeRange(
|
|
s.doc.resolve(o.$from.pos),
|
|
s.doc.resolve(a),
|
|
o.depth,
|
|
)));
|
|
let d = (0, t.liftTarget)(o);
|
|
if (null == d) return !1;
|
|
s.lift(o, d);
|
|
let c = s.doc.resolve(s.mapping.map(l, -1) - 1);
|
|
return (
|
|
(0, t.canJoin)(s.doc, c.pos) &&
|
|
c.nodeBefore.type == c.nodeAfter.type &&
|
|
s.join(c.pos),
|
|
r(s.scrollIntoView()),
|
|
!0
|
|
);
|
|
})(r, i, e, l)
|
|
: (function (e, r, i) {
|
|
let o = e.tr,
|
|
s = i.parent;
|
|
for (
|
|
let e = i.end, t = i.endIndex - 1, n = i.startIndex;
|
|
t > n;
|
|
t--
|
|
)
|
|
(e -= s.child(t).nodeSize), o.delete(e - 1, e + 1);
|
|
let l = o.doc.resolve(i.start),
|
|
a = l.nodeAfter;
|
|
if (o.mapping.map(i.end) != i.start + l.nodeAfter.nodeSize)
|
|
return !1;
|
|
let d = 0 == i.startIndex,
|
|
c = i.endIndex == s.childCount,
|
|
h = l.node(-1),
|
|
p = l.index(-1);
|
|
if (
|
|
!h.canReplace(
|
|
p + +!d,
|
|
p + 1,
|
|
a.content.append(
|
|
c ? n.Fragment.empty : n.Fragment.from(s),
|
|
),
|
|
)
|
|
)
|
|
return !1;
|
|
let u = l.pos,
|
|
f = u + a.nodeSize;
|
|
return (
|
|
o.step(
|
|
new t.ReplaceAroundStep(
|
|
u - !!d,
|
|
f + +!!c,
|
|
u + 1,
|
|
f - 1,
|
|
new n.Slice(
|
|
(d
|
|
? n.Fragment.empty
|
|
: n.Fragment.from(s.copy(n.Fragment.empty))
|
|
).append(
|
|
c
|
|
? n.Fragment.empty
|
|
: n.Fragment.from(s.copy(n.Fragment.empty)),
|
|
),
|
|
+!d,
|
|
+!c,
|
|
),
|
|
+!d,
|
|
),
|
|
),
|
|
r(o.scrollIntoView()),
|
|
!0
|
|
);
|
|
})(r, i, l)))
|
|
);
|
|
};
|
|
}
|
|
function o(e) {
|
|
return function (r, i) {
|
|
let { $from: o, $to: s } = r.selection,
|
|
l = o.blockRange(
|
|
s,
|
|
(t) => t.childCount > 0 && t.firstChild.type == e,
|
|
);
|
|
if (!l) return !1;
|
|
let a = l.startIndex;
|
|
if (0 == a) return !1;
|
|
let d = l.parent,
|
|
c = d.child(a - 1);
|
|
if (c.type != e) return !1;
|
|
if (i) {
|
|
let o = c.lastChild && c.lastChild.type == d.type,
|
|
s = n.Fragment.from(o ? e.create() : null),
|
|
a = new n.Slice(
|
|
n.Fragment.from(
|
|
e.create(null, n.Fragment.from(d.type.create(null, s))),
|
|
),
|
|
o ? 3 : 1,
|
|
0,
|
|
),
|
|
h = l.start,
|
|
p = l.end;
|
|
i(
|
|
r.tr
|
|
.step(new t.ReplaceAroundStep(h - (o ? 3 : 1), p, h, p, a, 1, !0))
|
|
.scrollIntoView(),
|
|
);
|
|
}
|
|
return !0;
|
|
};
|
|
}
|
|
e.i(111092),
|
|
e.s([
|
|
"liftListItem",
|
|
() => i,
|
|
"sinkListItem",
|
|
() => o,
|
|
"wrapInList",
|
|
() => r,
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|