108 lines
4.1 KiB
JavaScript
108 lines
4.1 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
|
|
* Module id: 603932
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e, t, n) => {
|
|
var i = !0,
|
|
r = !1,
|
|
a = !1;
|
|
function o(e, t, n) {
|
|
var i = e.attrIndex(t),
|
|
r = [t, n];
|
|
i < 0 ? e.attrPush(r) : (e.attrs[i] = r);
|
|
}
|
|
t.exports = function (e, t) {
|
|
t && ((i = !t.enabled), (r = !!t.label), (a = !!t.labelAfter)),
|
|
e.core.ruler.after("inline", "github-task-lists", function (e) {
|
|
for (var t = e.tokens, n = 2; n < t.length; n++)
|
|
(function (e, t) {
|
|
var n;
|
|
return (
|
|
"inline" === e[t].type &&
|
|
"paragraph_open" === e[t - 1].type &&
|
|
"list_item_open" === e[t - 2].type &&
|
|
(0 === (n = e[t]).content.indexOf("[ ] ") ||
|
|
0 === n.content.indexOf("[x] ") ||
|
|
0 === n.content.indexOf("[X] "))
|
|
);
|
|
})(t, n) &&
|
|
((function (e, t) {
|
|
if (
|
|
(e.children.unshift(
|
|
(function (e, t) {
|
|
var n = new t("html_inline", "", 0),
|
|
r = i ? ' disabled="" ' : "";
|
|
return (
|
|
0 === e.content.indexOf("[ ] ")
|
|
? (n.content =
|
|
'<input class="task-list-item-checkbox"' +
|
|
r +
|
|
'type="checkbox">')
|
|
: (0 === e.content.indexOf("[x] ") ||
|
|
0 === e.content.indexOf("[X] ")) &&
|
|
(n.content =
|
|
'<input class="task-list-item-checkbox" checked=""' +
|
|
r +
|
|
'type="checkbox">'),
|
|
n
|
|
);
|
|
})(e, t),
|
|
),
|
|
(e.children[1].content = e.children[1].content.slice(3)),
|
|
(e.content = e.content.slice(3)),
|
|
r)
|
|
)
|
|
if (a) {
|
|
e.children.pop();
|
|
var n = "task-item-" + Math.ceil(1e7 * Math.random() - 1e3);
|
|
(e.children[0].content =
|
|
e.children[0].content.slice(0, -1) + ' id="' + n + '">'),
|
|
e.children.push(
|
|
(function (e, t, n) {
|
|
var i = new n("html_inline", "", 0);
|
|
return (
|
|
(i.content =
|
|
'<label class="task-list-item-label" for="' +
|
|
t +
|
|
'">' +
|
|
e +
|
|
"</label>"),
|
|
(i.attrs = [{ for: t }]),
|
|
i
|
|
);
|
|
})(e.content, n, t),
|
|
);
|
|
} else
|
|
e.children.unshift(
|
|
(function (e) {
|
|
var t = new e("html_inline", "", 0);
|
|
return (t.content = "<label>"), t;
|
|
})(t),
|
|
),
|
|
e.children.push(
|
|
(function (e) {
|
|
var t = new e("html_inline", "", 0);
|
|
return (t.content = "</label>"), t;
|
|
})(t),
|
|
);
|
|
})(t[n], e.Token),
|
|
o(t[n - 2], "class", "task-list-item" + (i ? "" : " enabled")),
|
|
o(
|
|
t[
|
|
(function (e, t) {
|
|
for (var n = e[t].level - 1, i = t - 1; i >= 0; i--)
|
|
if (e[i].level === n) return i;
|
|
return -1;
|
|
})(t, n - 2)
|
|
],
|
|
"class",
|
|
"contains-task-list",
|
|
));
|
|
});
|
|
};
|
|
};
|
|
|
|
export default moduleFactory;
|