manim-web 0.3.19 → 0.3.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.
- package/README.md +1 -1
- package/dist/AmsConfiguration-BMyoprhk.js +847 -0
- package/dist/AmsConfiguration-BdxxYRby.js +847 -0
- package/dist/ConfigMacrosConfiguration-B8X_JSVI.js +46 -0
- package/dist/ConfigMacrosConfiguration-DUxp6DUV.js +46 -0
- package/dist/Entities-B1o7gN0J.js +429 -0
- package/dist/Entities-C82lnCux.js +429 -0
- package/dist/Factory-BKM7FEO-.js +107 -0
- package/dist/Factory-D-whCqrb.js +107 -0
- package/dist/{GifExporter-7EpPGupp.js → GifExporter-BrxY_q7e.js} +1 -1
- package/dist/{GifExporter-DCrSD6FV.js → GifExporter-S2pbxMc5.js} +1 -1
- package/dist/HtmlNode-BLmQ2r7U.js +981 -0
- package/dist/HtmlNode-DXGeKrcW.js +981 -0
- package/dist/InputJax-DL9oUQY4.js +41 -0
- package/dist/InputJax-DnDWM3Y0.js +41 -0
- package/dist/NewcommandConfiguration-BPjclFig.js +32 -0
- package/dist/NewcommandConfiguration-bJ6P1rBY.js +32 -0
- package/dist/NewcommandMethods-C_E3iLoK.js +187 -0
- package/dist/NewcommandMethods-Cb7yFm5P.js +187 -0
- package/dist/Options-DRlTi0G8.js +63 -0
- package/dist/Options-XPptO-6X.js +63 -0
- package/dist/ParseMethods-BMPfzfQC.js +2636 -0
- package/dist/ParseMethods-D3_HeS1K.js +2636 -0
- package/dist/Styles-Dky5jZUe.js +293 -0
- package/dist/Styles-J-6R3Vr8.js +293 -0
- package/dist/{VideoExporter-6w8xBpcV.js → VideoExporter-6ikT3u9H.js} +1 -1
- package/dist/{VideoExporter-DdQb18dC.js → VideoExporter-D_RxVahH.js} +1 -1
- package/dist/animation/Animation.d.ts +15 -0
- package/dist/animation/Animation.d.ts.map +1 -1
- package/dist/animation/transform/FadeMorphStrategy.d.ts +18 -0
- package/dist/animation/transform/FadeMorphStrategy.d.ts.map +1 -0
- package/dist/animation/transform/FadeTransforms.d.ts +2 -0
- package/dist/animation/transform/FadeTransforms.d.ts.map +1 -1
- package/dist/animation/transform/MorphStrategy.d.ts +8 -0
- package/dist/animation/transform/MorphStrategy.d.ts.map +1 -0
- package/dist/animation/transform/MovementTransforms.d.ts +8 -0
- package/dist/animation/transform/MovementTransforms.d.ts.map +1 -1
- package/dist/animation/transform/PointMorphStrategy.d.ts +36 -0
- package/dist/animation/transform/PointMorphStrategy.d.ts.map +1 -0
- package/dist/animation/transform/ShapeMorphStrategy.d.ts +39 -0
- package/dist/animation/transform/ShapeMorphStrategy.d.ts.map +1 -0
- package/dist/animation/transform/Transform.d.ts +9 -88
- package/dist/animation/transform/Transform.d.ts.map +1 -1
- package/dist/animation/transform/TransformMatching.d.ts.map +1 -1
- package/dist/animation/transform/TransformMatchingBase.d.ts +1 -0
- package/dist/animation/transform/TransformMatchingBase.d.ts.map +1 -1
- package/dist/animation/transform/TransformMatchingShared.d.ts +37 -0
- package/dist/animation/transform/TransformMatchingShared.d.ts.map +1 -0
- package/dist/animation/transform/TransformPairing.d.ts +19 -0
- package/dist/animation/transform/TransformPairing.d.ts.map +1 -0
- package/dist/constants/fontRender.d.ts +19 -0
- package/dist/constants/fontRender.d.ts.map +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/core/AnimateProxy.d.ts +1 -0
- package/dist/core/AnimateProxy.d.ts.map +1 -1
- package/dist/core/Camera.d.ts +19 -6
- package/dist/core/Camera.d.ts.map +1 -1
- package/dist/core/CameraFrame.d.ts +0 -2
- package/dist/core/CameraFrame.d.ts.map +1 -1
- package/dist/core/Group.d.ts +2 -0
- package/dist/core/Group.d.ts.map +1 -1
- package/dist/core/Mobject.d.ts +6 -0
- package/dist/core/Mobject.d.ts.map +1 -1
- package/dist/core/MobjectTraversal.d.ts +25 -0
- package/dist/core/MobjectTraversal.d.ts.map +1 -0
- package/dist/core/Scene.d.ts.map +1 -1
- package/dist/core/TexturedMobject.d.ts +38 -0
- package/dist/core/TexturedMobject.d.ts.map +1 -0
- package/dist/core/ThreeDScene.d.ts +18 -3
- package/dist/core/ThreeDScene.d.ts.map +1 -1
- package/dist/core/VMobject.d.ts +54 -110
- package/dist/core/VMobject.d.ts.map +1 -1
- package/dist/core/VMobjectCurveUtils.d.ts +106 -0
- package/dist/core/VMobjectCurveUtils.d.ts.map +1 -0
- package/dist/core/VMobjectGeometry.d.ts +4 -16
- package/dist/core/VMobjectGeometry.d.ts.map +1 -1
- package/dist/core/VMobjectRendering.d.ts.map +1 -1
- package/dist/core/VMobjectStrokeGeometry.d.ts +20 -0
- package/dist/core/VMobjectStrokeGeometry.d.ts.map +1 -0
- package/dist/core/VMobjectTransformAlignment.d.ts +11 -0
- package/dist/core/VMobjectTransformAlignment.d.ts.map +1 -0
- package/dist/html-DU38zqaN.js +829 -0
- package/dist/html-DjkQuIHJ.js +829 -0
- package/dist/index.js +4 -4
- package/dist/integrations/react.js +5 -5
- package/dist/integrations/vue.js +7 -7
- package/dist/interaction/Draggable.d.ts +2 -0
- package/dist/interaction/Draggable.d.ts.map +1 -1
- package/dist/interaction/OrbitControls.d.ts +2 -0
- package/dist/interaction/OrbitControls.d.ts.map +1 -1
- package/dist/lengths-CP7zmbxJ.js +54 -0
- package/dist/lengths-D4tR1gYA.js +54 -0
- package/dist/liteAdaptor-BLgze3o2.js +616 -0
- package/dist/liteAdaptor-zXv-jsO1.js +616 -0
- package/dist/manim-web.browser.js +35324 -31248
- package/dist/mathjax-7LgaTjtj.js +121 -0
- package/dist/mathjax-CoSFlQ0H.js +121 -0
- package/dist/mo-C5uLT3Z9.js +2675 -0
- package/dist/mo-CNYDGAsg.js +2675 -0
- package/dist/mobjects/geometry/AngleShapes.d.ts +8 -0
- package/dist/mobjects/geometry/AngleShapes.d.ts.map +1 -1
- package/dist/mobjects/geometry/BooleanOperations.d.ts +1 -1
- package/dist/mobjects/geometry/BooleanOperations.d.ts.map +1 -1
- package/dist/mobjects/geometry/PolygonExtensions.d.ts +1 -1
- package/dist/mobjects/geometry/PolygonExtensions.d.ts.map +1 -1
- package/dist/mobjects/graphing/ComplexPlane.d.ts +18 -0
- package/dist/mobjects/graphing/ComplexPlane.d.ts.map +1 -1
- package/dist/mobjects/image/index.d.ts +9 -2
- package/dist/mobjects/image/index.d.ts.map +1 -1
- package/dist/mobjects/text/MarkupText.d.ts.map +1 -1
- package/dist/mobjects/text/MathJaxRenderer.d.ts +4 -2
- package/dist/mobjects/text/MathJaxRenderer.d.ts.map +1 -1
- package/dist/mobjects/text/MathTex.d.ts +9 -2
- package/dist/mobjects/text/MathTex.d.ts.map +1 -1
- package/dist/mobjects/text/MathTexImage.d.ts +14 -4
- package/dist/mobjects/text/MathTexImage.d.ts.map +1 -1
- package/dist/mobjects/text/Text.d.ts +10 -5
- package/dist/mobjects/text/Text.d.ts.map +1 -1
- package/dist/mobjects/text/katexStyles.d.ts.map +1 -1
- package/dist/mobjects/text/svgPathParser.d.ts.map +1 -1
- package/dist/mobjects/three-d/ThreeDAxes.d.ts +121 -9
- package/dist/mobjects/three-d/ThreeDAxes.d.ts.map +1 -1
- package/dist/{chunk-DeC0fbbY.js → rolldown-runtime-DnwLefa7.js} +1 -1
- package/dist/{src-0ifQdJUj.js → src-CW4pfZdP.js} +33071 -29118
- package/dist/svg-CYweEoZ1.js +28698 -0
- package/dist/svg-swSF_J59.js +28698 -0
- package/dist/tex-C4_queV-.js +1423 -0
- package/dist/tex-CA5MLeEe.js +1423 -0
- package/dist/utils/math.d.ts +50 -5
- package/dist/utils/math.d.ts.map +1 -1
- package/package.json +6 -5
- package/dist/AllPackages-C4Ha3Jps.js +0 -7912
- package/dist/AllPackages-Dwxf_-Ps.js +0 -7912
- package/dist/BaseConfiguration-D2fikupy.js +0 -4402
- package/dist/BaseConfiguration-DYpI8zxb.js +0 -4402
- package/dist/Entities-BxzKxtF2.js +0 -458
- package/dist/Entities-gIbwAkB6.js +0 -458
- package/dist/InputJax-BszJvLkW.js +0 -43
- package/dist/InputJax-CgHBfQsv.js +0 -43
- package/dist/MathItem-4gYKatZT.js +0 -77
- package/dist/MathItem-BGJUnd1K.js +0 -77
- package/dist/Options-CQim5zsr.js +0 -188
- package/dist/Options-Cn9jv1mh.js +0 -188
- package/dist/PrioritizedList-C1R4aNEC.js +0 -36
- package/dist/PrioritizedList-lIkFMNlo.js +0 -36
- package/dist/Styles-Bi9Db-2J.js +0 -411
- package/dist/Styles-CzHPc-An.js +0 -411
- package/dist/TeXAtom-Cinii27y.js +0 -2025
- package/dist/TeXAtom-DFdvwkN2.js +0 -2025
- package/dist/html-DKkfg_ss.js +0 -1587
- package/dist/html-DpiYkktJ.js +0 -1587
- package/dist/lengths-C0YS8_KC.js +0 -65
- package/dist/lengths-eBH2o1TO.js +0 -65
- package/dist/liteAdaptor-CB8lQj3d.js +0 -828
- package/dist/liteAdaptor-DvuW8HsZ.js +0 -828
- package/dist/mathjax-BVz9WLAG.js +0 -105
- package/dist/mathjax-BbWkqal4.js +0 -2
- package/dist/mathjax-BrFZxFhK.js +0 -2
- package/dist/mathjax-DdKmwllV.js +0 -105
- package/dist/mo-B60kIOAG.js +0 -3271
- package/dist/mo-cSv2058o.js +0 -3271
- package/dist/svg-BDTt4xHZ.js +0 -23879
- package/dist/svg-DzbC3CbJ.js +0 -23879
- package/dist/tex-CRhAZgfS.js +0 -401
- package/dist/tex-D3LEgNlQ.js +0 -401
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
import { o as e, t } from "./Options-XPptO-6X.js";
|
|
2
|
+
import { r as n, t as r } from "./Styles-J-6R3Vr8.js";
|
|
3
|
+
import { n as i } from "./Entities-B1o7gN0J.js";
|
|
4
|
+
//#region node_modules/@mathjax/src/mjs/core/DOMAdaptor.js
|
|
5
|
+
var a = class {
|
|
6
|
+
constructor(e = null) {
|
|
7
|
+
this.canMeasureNodes = !0, this.document = e;
|
|
8
|
+
}
|
|
9
|
+
node(e, t = {}, n = [], r) {
|
|
10
|
+
let i = this.create(e, r);
|
|
11
|
+
this.setAttributes(i, t);
|
|
12
|
+
for (let e of n) this.append(i, e);
|
|
13
|
+
return i;
|
|
14
|
+
}
|
|
15
|
+
setProperty(e, t, n) {
|
|
16
|
+
e[t] = n;
|
|
17
|
+
}
|
|
18
|
+
getProperty(e, t) {
|
|
19
|
+
return e[t];
|
|
20
|
+
}
|
|
21
|
+
setAttributes(e, t) {
|
|
22
|
+
if (t.style && typeof t.style != "string") for (let n of Object.keys(t.style)) this.setStyle(e, n.replace(/-([a-z])/g, (e, t) => t.toUpperCase()), t.style[n]);
|
|
23
|
+
if (t.properties) for (let n of Object.keys(t.properties)) e[n] = t.properties[n];
|
|
24
|
+
for (let n of Object.keys(t)) (n !== "style" || typeof t.style == "string") && n !== "properties" && this.setAttribute(e, n, t[n]);
|
|
25
|
+
}
|
|
26
|
+
replace(e, t) {
|
|
27
|
+
return this.insert(e, t), this.remove(t), t;
|
|
28
|
+
}
|
|
29
|
+
childNode(e, t) {
|
|
30
|
+
return this.childNodes(e)[t];
|
|
31
|
+
}
|
|
32
|
+
allClasses(e) {
|
|
33
|
+
let t = this.getAttribute(e, "class");
|
|
34
|
+
return t ? t.replace(/ +/g, " ").replace(/^ /, "").replace(/ $/, "").split(/ /) : [];
|
|
35
|
+
}
|
|
36
|
+
cssText(e) {
|
|
37
|
+
return this.kind(e) === "style" ? this.textContent(e) : "";
|
|
38
|
+
}
|
|
39
|
+
}, o = function(e, t, n, r) {
|
|
40
|
+
function i(e) {
|
|
41
|
+
return e instanceof n ? e : new n(function(t) {
|
|
42
|
+
t(e);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return new (n ||= Promise)(function(n, a) {
|
|
46
|
+
function o(e) {
|
|
47
|
+
try {
|
|
48
|
+
c(r.next(e));
|
|
49
|
+
} catch (e) {
|
|
50
|
+
a(e);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function s(e) {
|
|
54
|
+
try {
|
|
55
|
+
c(r.throw(e));
|
|
56
|
+
} catch (e) {
|
|
57
|
+
a(e);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function c(e) {
|
|
61
|
+
e.done ? n(e.value) : i(e.value).then(o, s);
|
|
62
|
+
}
|
|
63
|
+
c((r = r.apply(e, t || [])).next());
|
|
64
|
+
});
|
|
65
|
+
}, s = {
|
|
66
|
+
badCSS: !0,
|
|
67
|
+
badSizes: !0
|
|
68
|
+
};
|
|
69
|
+
function c(r, i = {}) {
|
|
70
|
+
var a;
|
|
71
|
+
return i = e(t({}, s), i), a = class extends r {
|
|
72
|
+
constructor(...n) {
|
|
73
|
+
super(n[0]), this.canMeasureNodes = !1;
|
|
74
|
+
let r = this.constructor;
|
|
75
|
+
this.options = e(t({}, r.OPTIONS), n[1]);
|
|
76
|
+
}
|
|
77
|
+
fontSize(e) {
|
|
78
|
+
return i.badCSS ? this.options.fontSize : super.fontSize(e);
|
|
79
|
+
}
|
|
80
|
+
fontFamily(e) {
|
|
81
|
+
return i.badCSS ? this.options.fontFamily : super.fontFamily(e);
|
|
82
|
+
}
|
|
83
|
+
nodeSize(e, t = 1, n = null) {
|
|
84
|
+
if (!i.badSizes) return super.nodeSize(e, t, n);
|
|
85
|
+
let r = this.textContent(e), o = Array.from(r.replace(a.cjkPattern, "")).length;
|
|
86
|
+
return [(Array.from(r).length - o) * this.options.cjkCharWidth + o * this.options.unknownCharWidth, this.options.unknownCharHeight];
|
|
87
|
+
}
|
|
88
|
+
nodeBBox(e) {
|
|
89
|
+
return i.badSizes ? {
|
|
90
|
+
left: 0,
|
|
91
|
+
right: 0,
|
|
92
|
+
top: 0,
|
|
93
|
+
bottom: 0
|
|
94
|
+
} : super.nodeBBox(e);
|
|
95
|
+
}
|
|
96
|
+
createWorker(e, t) {
|
|
97
|
+
return o(this, void 0, void 0, function* () {
|
|
98
|
+
let { Worker: r } = yield n("node:worker_threads");
|
|
99
|
+
class i {
|
|
100
|
+
constructor(e, t = {}) {
|
|
101
|
+
this.worker = new r(e, t);
|
|
102
|
+
}
|
|
103
|
+
addEventListener(e, t) {
|
|
104
|
+
this.worker.on(e, t);
|
|
105
|
+
}
|
|
106
|
+
postMessage(e) {
|
|
107
|
+
this.worker.postMessage({ data: e });
|
|
108
|
+
}
|
|
109
|
+
terminate() {
|
|
110
|
+
this.worker.terminate();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
let { path: a, maps: o } = t, s = new i(`${a}/${t.worker}`, {
|
|
114
|
+
type: "module",
|
|
115
|
+
workerData: { maps: o }
|
|
116
|
+
});
|
|
117
|
+
return s.addEventListener("message", e), s;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}, a.OPTIONS = Object.assign(Object.assign({}, i.badCSS ? {
|
|
121
|
+
fontSize: 16,
|
|
122
|
+
fontFamily: "Times"
|
|
123
|
+
} : {}), i.badSizes ? {
|
|
124
|
+
cjkCharWidth: 1,
|
|
125
|
+
unknownCharWidth: .6,
|
|
126
|
+
unknownCharHeight: .8
|
|
127
|
+
} : {}), a.cjkPattern = new RegExp([
|
|
128
|
+
"[",
|
|
129
|
+
"ᄀ-ᅟ",
|
|
130
|
+
"〈〉",
|
|
131
|
+
"⺀-〾",
|
|
132
|
+
"-㉇",
|
|
133
|
+
"㉐-䶿",
|
|
134
|
+
"一-꓆",
|
|
135
|
+
"ꥠ-ꥼ",
|
|
136
|
+
"가-힣",
|
|
137
|
+
"豈-",
|
|
138
|
+
"︐-︙",
|
|
139
|
+
"︰-﹫",
|
|
140
|
+
"!-⦆¢-₩",
|
|
141
|
+
"𛀀-𛀁",
|
|
142
|
+
"🈀-🉑",
|
|
143
|
+
"𠀀-",
|
|
144
|
+
"]"
|
|
145
|
+
].join(""), "gu"), a;
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region node_modules/@mathjax/src/mjs/adaptors/lite/Element.js
|
|
149
|
+
var l = class {
|
|
150
|
+
constructor(e, t = {}, n = []) {
|
|
151
|
+
this.kind = e, this.attributes = Object.assign({}, t), this.children = [...n];
|
|
152
|
+
for (let e of this.children) e.parent = this;
|
|
153
|
+
this.styles = null;
|
|
154
|
+
}
|
|
155
|
+
}, u = class {
|
|
156
|
+
get kind() {
|
|
157
|
+
return "#document";
|
|
158
|
+
}
|
|
159
|
+
constructor(e = null) {
|
|
160
|
+
this.defaultView = null, this.root = new l("html", {}, [this.head = new l("head"), this.body = new l("body")]), this.type = "", this.defaultView = e;
|
|
161
|
+
}
|
|
162
|
+
}, d = class {
|
|
163
|
+
get kind() {
|
|
164
|
+
return "#text";
|
|
165
|
+
}
|
|
166
|
+
constructor(e = "") {
|
|
167
|
+
this.value = e;
|
|
168
|
+
}
|
|
169
|
+
}, f = class extends d {
|
|
170
|
+
get kind() {
|
|
171
|
+
return "#comment";
|
|
172
|
+
}
|
|
173
|
+
}, p = class {
|
|
174
|
+
constructor(e) {
|
|
175
|
+
this.nodes = [], this.nodes = [...e];
|
|
176
|
+
}
|
|
177
|
+
append(e) {
|
|
178
|
+
this.nodes.push(e);
|
|
179
|
+
}
|
|
180
|
+
[Symbol.iterator]() {
|
|
181
|
+
let e = 0;
|
|
182
|
+
return { next() {
|
|
183
|
+
return e === this.nodes.length ? {
|
|
184
|
+
value: null,
|
|
185
|
+
done: !0
|
|
186
|
+
} : {
|
|
187
|
+
value: this.nodes[e++],
|
|
188
|
+
done: !1
|
|
189
|
+
};
|
|
190
|
+
} };
|
|
191
|
+
}
|
|
192
|
+
}, m = "[ \\n]+", h = "[ \\n]*", g = "[A-Za-z][^\0- \"'>/=-]*", _ = "[^\0- \"'>/=-]+", v = `(?:'[^']*'|"[^"]*"|${m})`, y = `(?:'([^']*)'|"([^"]*)"|(${m}))`, b = `${_}(?:${h}=${h}${v})?`, x = `(${_})(?:${h}=${h}${y})?`, S = `(<(?:${g}(?:${m}${b})*${h}/?|/${g}|!--[^]*?--|![^]*?)(?:>|$))`, C = {
|
|
193
|
+
tag: new RegExp(S, "u"),
|
|
194
|
+
attr: new RegExp(b, "u"),
|
|
195
|
+
attrsplit: new RegExp(x, "u")
|
|
196
|
+
}, w = class {
|
|
197
|
+
parseFromString(e, t = "text/html", n = null) {
|
|
198
|
+
let r = n.createDocument(), i = n.body(r), a = e.replace(/<\?.*?\?>/g, "").split(C.tag);
|
|
199
|
+
for (; a.length;) {
|
|
200
|
+
let e = a.shift(), t = a.shift();
|
|
201
|
+
e && this.addText(n, i, e), t && t.charAt(t.length - 1) === ">" && (t.charAt(1) === "!" ? this.addComment(n, i, t) : i = t.charAt(1) === "/" ? this.closeTag(n, i, t) : this.openTag(n, i, t, a));
|
|
202
|
+
}
|
|
203
|
+
return this.checkDocument(n, r), r;
|
|
204
|
+
}
|
|
205
|
+
addText(e, t, n) {
|
|
206
|
+
return n = i(n), e.append(t, e.text(n));
|
|
207
|
+
}
|
|
208
|
+
addComment(e, t, n) {
|
|
209
|
+
return e.append(t, new f(n));
|
|
210
|
+
}
|
|
211
|
+
closeTag(e, t, n) {
|
|
212
|
+
let r = n.slice(2, n.length - 1).toLowerCase();
|
|
213
|
+
for (; e.parent(t) && e.kind(t) !== r;) t = e.parent(t);
|
|
214
|
+
return e.parent(t);
|
|
215
|
+
}
|
|
216
|
+
openTag(e, t, n, r) {
|
|
217
|
+
let i = this.constructor.PCDATA, a = this.constructor.SELF_CLOSING, o = n.match(/<(.*?)[\s\n>/]/)[1].toLowerCase(), s = e.node(o), c = n.replace(/^<.*?[\s\n>]/, "").split(C.attrsplit);
|
|
218
|
+
return (c.pop().match(/>$/) || c.length < 5) && (this.addAttributes(e, s, c), e.append(t, s), !a[o] && !n.match(/\/>$/) && (i[o] ? this.handlePCDATA(e, s, o, r) : t = s)), t;
|
|
219
|
+
}
|
|
220
|
+
addAttributes(e, t, n) {
|
|
221
|
+
for (; n.length;) {
|
|
222
|
+
let [, r, a, o, s] = n.splice(0, 5), c = i(a || o || s || "");
|
|
223
|
+
e.setAttribute(t, r, c);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
handlePCDATA(e, t, n, r) {
|
|
227
|
+
let i = [], a = "</" + n + ">", o = "";
|
|
228
|
+
for (; r.length && o !== a;) i.push(o), i.push(r.shift()), o = r.shift();
|
|
229
|
+
e.append(t, e.text(i.join("")));
|
|
230
|
+
}
|
|
231
|
+
checkDocument(e, t) {
|
|
232
|
+
let n = this.getOnlyChild(e, e.body(t));
|
|
233
|
+
if (n) {
|
|
234
|
+
for (let r of e.childNodes(e.body(t))) {
|
|
235
|
+
if (r === n) break;
|
|
236
|
+
r instanceof f && r.value.match(/^<!DOCTYPE/) && (t.type = r.value);
|
|
237
|
+
}
|
|
238
|
+
switch (e.kind(n)) {
|
|
239
|
+
case "html":
|
|
240
|
+
for (let r of n.children) switch (e.kind(r)) {
|
|
241
|
+
case "head":
|
|
242
|
+
t.head = r;
|
|
243
|
+
break;
|
|
244
|
+
case "body":
|
|
245
|
+
t.body = r;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
t.root = n, e.remove(n), e.parent(t.body) !== n && e.append(n, t.body), e.parent(t.head) !== n && e.insert(t.head, t.body);
|
|
249
|
+
break;
|
|
250
|
+
case "head":
|
|
251
|
+
t.head = e.replace(n, t.head);
|
|
252
|
+
break;
|
|
253
|
+
case "body":
|
|
254
|
+
t.body = e.replace(n, t.body);
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
getOnlyChild(e, t) {
|
|
260
|
+
let n = null;
|
|
261
|
+
for (let r of e.childNodes(t)) if (r instanceof l) {
|
|
262
|
+
if (n) return null;
|
|
263
|
+
n = r;
|
|
264
|
+
}
|
|
265
|
+
return n;
|
|
266
|
+
}
|
|
267
|
+
serialize(e, t, n = !1) {
|
|
268
|
+
let r = this.constructor.SELF_CLOSING, i = e.kind(t), a = this.allAttributes(e, t, n).map((e) => e.name + "=\"" + this.protectAttribute(e.value, n) + "\"").join(" "), o = this.serializeInner(e, t, n);
|
|
269
|
+
return `<${i}` + (a ? " " + a : "") + ((!n || o) && !r[i] ? `>${o}</${i}>` : n ? "/>" : ">");
|
|
270
|
+
}
|
|
271
|
+
serializeInner(e, t, n = !1) {
|
|
272
|
+
let r = this.constructor.PCDATA;
|
|
273
|
+
return Object.hasOwn(r, t.kind) ? e.childNodes(t).map((t) => e.value(t)).join("") : e.childNodes(t).map((t) => {
|
|
274
|
+
let r = e.kind(t);
|
|
275
|
+
return r === "#text" ? this.protectHTML(e.value(t)) : r === "#comment" ? t.value : this.serialize(e, t, n);
|
|
276
|
+
}).join("");
|
|
277
|
+
}
|
|
278
|
+
allAttributes(e, t, n) {
|
|
279
|
+
let r = e.allAttributes(t);
|
|
280
|
+
if (!n) return r;
|
|
281
|
+
let i = e.kind(t), a = this.constructor.XMLNS;
|
|
282
|
+
if (!Object.hasOwn(a, i)) return r;
|
|
283
|
+
for (let { name: e } of r) if (e === "xmlns") return r;
|
|
284
|
+
return r.push({
|
|
285
|
+
name: "xmlns",
|
|
286
|
+
value: a[i]
|
|
287
|
+
}), r;
|
|
288
|
+
}
|
|
289
|
+
protectAttribute(e, t) {
|
|
290
|
+
return typeof e != "string" && (e = String(e)), e = e.replace(/&/g, "&").replace(/"/g, """), t && (e = e.replace(/</g, "<").replace(/>/g, ">")), e;
|
|
291
|
+
}
|
|
292
|
+
protectHTML(e) {
|
|
293
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
w.SELF_CLOSING = {
|
|
297
|
+
area: !0,
|
|
298
|
+
base: !0,
|
|
299
|
+
br: !0,
|
|
300
|
+
col: !0,
|
|
301
|
+
command: !0,
|
|
302
|
+
embed: !0,
|
|
303
|
+
hr: !0,
|
|
304
|
+
img: !0,
|
|
305
|
+
input: !0,
|
|
306
|
+
keygen: !0,
|
|
307
|
+
link: !0,
|
|
308
|
+
menuitem: !0,
|
|
309
|
+
meta: !0,
|
|
310
|
+
param: !0,
|
|
311
|
+
source: !0,
|
|
312
|
+
track: !0,
|
|
313
|
+
wbr: !0
|
|
314
|
+
}, w.PCDATA = {
|
|
315
|
+
option: !0,
|
|
316
|
+
textarea: !0,
|
|
317
|
+
fieldset: !0,
|
|
318
|
+
title: !0,
|
|
319
|
+
style: !0,
|
|
320
|
+
script: !0
|
|
321
|
+
}, w.XMLNS = {
|
|
322
|
+
svg: "http://www.w3.org/2000/svg",
|
|
323
|
+
math: "http://www.w3.org/1998/Math/MathML",
|
|
324
|
+
html: "http://www.w3.org/1999/xhtml"
|
|
325
|
+
};
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region node_modules/@mathjax/src/mjs/adaptors/lite/Window.js
|
|
328
|
+
var T = class {
|
|
329
|
+
constructor() {
|
|
330
|
+
this.DOMParser = w, this.NodeList = p, this.HTMLCollection = p, this.HTMLElement = l, this.DocumentFragment = p, this.Document = u, this.document = new u(this);
|
|
331
|
+
}
|
|
332
|
+
}, E = function(e, t, n, r) {
|
|
333
|
+
function i(e) {
|
|
334
|
+
return e instanceof n ? e : new n(function(t) {
|
|
335
|
+
t(e);
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
return new (n ||= Promise)(function(n, a) {
|
|
339
|
+
function o(e) {
|
|
340
|
+
try {
|
|
341
|
+
c(r.next(e));
|
|
342
|
+
} catch (e) {
|
|
343
|
+
a(e);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
function s(e) {
|
|
347
|
+
try {
|
|
348
|
+
c(r.throw(e));
|
|
349
|
+
} catch (e) {
|
|
350
|
+
a(e);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function c(e) {
|
|
354
|
+
e.done ? n(e.value) : i(e.value).then(o, s);
|
|
355
|
+
}
|
|
356
|
+
c((r = r.apply(e, t || [])).next());
|
|
357
|
+
});
|
|
358
|
+
}, D = class extends a {
|
|
359
|
+
constructor() {
|
|
360
|
+
super(), this.parser = new w(), this.window = new T();
|
|
361
|
+
}
|
|
362
|
+
parse(e, t) {
|
|
363
|
+
return this.parser.parseFromString(e, t, this);
|
|
364
|
+
}
|
|
365
|
+
create(e, t = null) {
|
|
366
|
+
return new l(e);
|
|
367
|
+
}
|
|
368
|
+
text(e) {
|
|
369
|
+
return new d(e);
|
|
370
|
+
}
|
|
371
|
+
comment(e) {
|
|
372
|
+
return new f(e);
|
|
373
|
+
}
|
|
374
|
+
createDocument() {
|
|
375
|
+
return new u();
|
|
376
|
+
}
|
|
377
|
+
head(e = this.document) {
|
|
378
|
+
return e.head;
|
|
379
|
+
}
|
|
380
|
+
body(e = this.document) {
|
|
381
|
+
return e.body;
|
|
382
|
+
}
|
|
383
|
+
root(e = this.document) {
|
|
384
|
+
return e.root;
|
|
385
|
+
}
|
|
386
|
+
doctype(e = this.document) {
|
|
387
|
+
return e.type;
|
|
388
|
+
}
|
|
389
|
+
tags(e, t, n = null, r = null) {
|
|
390
|
+
let i = [], a = [];
|
|
391
|
+
if (n) return a;
|
|
392
|
+
let o = e;
|
|
393
|
+
for (; o;) {
|
|
394
|
+
let e = o.kind;
|
|
395
|
+
if (e !== "#text" && e !== "#comment") {
|
|
396
|
+
if (o = o, e === t && (a.push(o), a.length === r)) return a;
|
|
397
|
+
o.children.length && (i = o.children.concat(i));
|
|
398
|
+
}
|
|
399
|
+
o = i.shift();
|
|
400
|
+
}
|
|
401
|
+
return a;
|
|
402
|
+
}
|
|
403
|
+
elementById(e, t) {
|
|
404
|
+
let n = [], r = e;
|
|
405
|
+
for (; r;) {
|
|
406
|
+
if (r.kind !== "#text" && r.kind !== "#comment") {
|
|
407
|
+
if (r = r, r.attributes.id === t) return r;
|
|
408
|
+
r.children.length && (n = r.children.concat(n));
|
|
409
|
+
}
|
|
410
|
+
r = n.shift();
|
|
411
|
+
}
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
elementsByClass(e, t, n = null) {
|
|
415
|
+
let r = [], i = [], a = e;
|
|
416
|
+
for (; a;) {
|
|
417
|
+
if (a.kind !== "#text" && a.kind !== "#comment") {
|
|
418
|
+
if (a = a, (a.attributes.class || "").trim().split(/ +/).includes(t) && (i.push(a), i.length === n)) return i;
|
|
419
|
+
a.children.length && (r = a.children.concat(r));
|
|
420
|
+
}
|
|
421
|
+
a = r.shift();
|
|
422
|
+
}
|
|
423
|
+
return i;
|
|
424
|
+
}
|
|
425
|
+
elementsByAttribute(e, t, n, r = null) {
|
|
426
|
+
let i = [], a = [], o = e;
|
|
427
|
+
for (; o;) {
|
|
428
|
+
if (o.kind !== "#text" && o.kind !== "#comment") {
|
|
429
|
+
if (o = o, o.attributes[t] === n && (a.push(o), a.length === r)) return a;
|
|
430
|
+
o.children.length && (i = o.children.concat(i));
|
|
431
|
+
}
|
|
432
|
+
o = i.shift();
|
|
433
|
+
}
|
|
434
|
+
return a;
|
|
435
|
+
}
|
|
436
|
+
getElements(e, t) {
|
|
437
|
+
let n = [], r = this.body(t);
|
|
438
|
+
for (let t of e) if (typeof t == "string") if (t.charAt(0) === "#") {
|
|
439
|
+
let e = this.elementById(r, t.slice(1));
|
|
440
|
+
e && n.push(e);
|
|
441
|
+
} else if (t.charAt(0) === ".") n = n.concat(this.elementsByClass(r, t.slice(1)));
|
|
442
|
+
else if (t.match(/^[-a-z][-a-z0-9]*$/i)) n = n.concat(this.tags(r, t));
|
|
443
|
+
else {
|
|
444
|
+
let e = t.match(/^\[(.*?)="(.*?)"\]$/);
|
|
445
|
+
e && (n = n.concat(this.elementsByAttribute(r, e[1], e[2])));
|
|
446
|
+
}
|
|
447
|
+
else Array.isArray(t) ? n = n.concat(t) : t instanceof this.window.NodeList || t instanceof this.window.HTMLCollection ? n = n.concat(t.nodes) : n.push(t);
|
|
448
|
+
return n;
|
|
449
|
+
}
|
|
450
|
+
getElement(e, t = this.document) {
|
|
451
|
+
if (t instanceof u && (t = this.body(t)), e.charAt(0) === "#") return this.elementById(t, e.slice(1));
|
|
452
|
+
if (e.charAt(0) === ".") return this.elementsByClass(t, e.slice(1), 1)[0];
|
|
453
|
+
if (e.match(/^[-a-z][-a-z0-9]*$/i)) return this.tags(t, e, null, 1)[0];
|
|
454
|
+
let n = e.match(/^\[(.*?)="(.*?)"\]$/);
|
|
455
|
+
return n ? this.elementsByAttribute(t, n[1], n[2], 1)[0] : null;
|
|
456
|
+
}
|
|
457
|
+
contains(e, t) {
|
|
458
|
+
for (; t && t !== e;) t = this.parent(t);
|
|
459
|
+
return !!t;
|
|
460
|
+
}
|
|
461
|
+
parent(e) {
|
|
462
|
+
return e.parent;
|
|
463
|
+
}
|
|
464
|
+
childIndex(e) {
|
|
465
|
+
return e.parent ? e.parent.children.findIndex((t) => t === e) : -1;
|
|
466
|
+
}
|
|
467
|
+
append(e, t) {
|
|
468
|
+
return t.parent && this.remove(t), e.children.push(t), t.parent = e, t;
|
|
469
|
+
}
|
|
470
|
+
insert(e, t) {
|
|
471
|
+
if (e.parent && this.remove(e), t && t.parent) {
|
|
472
|
+
let n = this.childIndex(t);
|
|
473
|
+
t.parent.children.splice(n, 0, e), e.parent = t.parent;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
remove(e) {
|
|
477
|
+
let t = this.childIndex(e);
|
|
478
|
+
return t >= 0 && e.parent.children.splice(t, 1), e.parent = null, e;
|
|
479
|
+
}
|
|
480
|
+
replace(e, t) {
|
|
481
|
+
let n = this.childIndex(t);
|
|
482
|
+
return n >= 0 && (t.parent.children[n] = e, e.parent = t.parent, t.parent = null), t;
|
|
483
|
+
}
|
|
484
|
+
clone(e, t = !0) {
|
|
485
|
+
let n = new l(e.kind);
|
|
486
|
+
return n.attributes = Object.assign({}, e.attributes), n.children = t ? e.children.map((e) => {
|
|
487
|
+
if (e.kind === "#text") return new d(e.value);
|
|
488
|
+
if (e.kind === "#comment") return new f(e.value);
|
|
489
|
+
{
|
|
490
|
+
let t = this.clone(e);
|
|
491
|
+
return t.parent = n, t;
|
|
492
|
+
}
|
|
493
|
+
}) : [], n;
|
|
494
|
+
}
|
|
495
|
+
split(e, t) {
|
|
496
|
+
let n = new d(e.value.slice(t));
|
|
497
|
+
return e.value = e.value.slice(0, t), e.parent.children.splice(this.childIndex(e) + 1, 0, n), n.parent = e.parent, n;
|
|
498
|
+
}
|
|
499
|
+
next(e) {
|
|
500
|
+
let t = e.parent;
|
|
501
|
+
if (!t) return null;
|
|
502
|
+
let n = this.childIndex(e) + 1;
|
|
503
|
+
return n >= 0 && n < t.children.length ? t.children[n] : null;
|
|
504
|
+
}
|
|
505
|
+
previous(e) {
|
|
506
|
+
let t = e.parent;
|
|
507
|
+
if (!t) return null;
|
|
508
|
+
let n = this.childIndex(e) - 1;
|
|
509
|
+
return n >= 0 ? t.children[n] : null;
|
|
510
|
+
}
|
|
511
|
+
firstChild(e) {
|
|
512
|
+
return e.children[0];
|
|
513
|
+
}
|
|
514
|
+
lastChild(e) {
|
|
515
|
+
return e.children[e.children.length - 1];
|
|
516
|
+
}
|
|
517
|
+
childNodes(e) {
|
|
518
|
+
return [...e.children];
|
|
519
|
+
}
|
|
520
|
+
childNode(e, t) {
|
|
521
|
+
return e.children[t];
|
|
522
|
+
}
|
|
523
|
+
kind(e) {
|
|
524
|
+
return e.kind;
|
|
525
|
+
}
|
|
526
|
+
value(e) {
|
|
527
|
+
return e.kind === "#text" ? e.value : e.kind === "#comment" ? e.value.replace(/^<!(--)?((?:.|\n)*)\1>$/, "$2") : "";
|
|
528
|
+
}
|
|
529
|
+
textContent(e) {
|
|
530
|
+
return e.children.reduce((e, t) => e + (t.kind === "#text" ? t.value : t.kind === "#comment" ? "" : this.textContent(t)), "");
|
|
531
|
+
}
|
|
532
|
+
innerHTML(e) {
|
|
533
|
+
return this.parser.serializeInner(this, e);
|
|
534
|
+
}
|
|
535
|
+
outerHTML(e) {
|
|
536
|
+
return this.parser.serialize(this, e);
|
|
537
|
+
}
|
|
538
|
+
serializeXML(e) {
|
|
539
|
+
return this.parser.serialize(this, e, !0);
|
|
540
|
+
}
|
|
541
|
+
setAttribute(e, t, n, r = null) {
|
|
542
|
+
typeof n != "string" && (n = String(n)), r && (t = r.replace(/.*\//, "") + ":" + t.replace(/^.*:/, "")), e.attributes[t] = n, t === "style" && (e.styles = null);
|
|
543
|
+
}
|
|
544
|
+
getAttribute(e, t) {
|
|
545
|
+
return e.attributes[t];
|
|
546
|
+
}
|
|
547
|
+
removeAttribute(e, t) {
|
|
548
|
+
delete e.attributes[t];
|
|
549
|
+
}
|
|
550
|
+
hasAttribute(e, t) {
|
|
551
|
+
return Object.hasOwn(e.attributes, t);
|
|
552
|
+
}
|
|
553
|
+
allAttributes(e) {
|
|
554
|
+
let t = e.attributes, n = [];
|
|
555
|
+
for (let e of Object.keys(t)) n.push({
|
|
556
|
+
name: e,
|
|
557
|
+
value: t[e]
|
|
558
|
+
});
|
|
559
|
+
return n;
|
|
560
|
+
}
|
|
561
|
+
addClass(e, t) {
|
|
562
|
+
let n = e.attributes.class?.split(/ /) || [];
|
|
563
|
+
n.includes(t) || (n.push(t), e.attributes.class = n.join(" "));
|
|
564
|
+
}
|
|
565
|
+
removeClass(e, t) {
|
|
566
|
+
let n = e.attributes.class?.split(/ /) || [], r = n.indexOf(t);
|
|
567
|
+
r >= 0 && (n.splice(r, 1), e.attributes.class = n.join(" "));
|
|
568
|
+
}
|
|
569
|
+
hasClass(e, t) {
|
|
570
|
+
return (e.attributes.class || "").split(/ /).includes(t);
|
|
571
|
+
}
|
|
572
|
+
setStyle(e, t, n) {
|
|
573
|
+
e.styles ||= new r(this.getAttribute(e, "style")), e.styles.set(t, n), e.attributes.style = e.styles.cssText;
|
|
574
|
+
}
|
|
575
|
+
getStyle(e, t) {
|
|
576
|
+
if (!e.styles) {
|
|
577
|
+
let t = this.getAttribute(e, "style");
|
|
578
|
+
if (!t) return "";
|
|
579
|
+
e.styles = new r(t);
|
|
580
|
+
}
|
|
581
|
+
return e.styles.get(t);
|
|
582
|
+
}
|
|
583
|
+
allStyles(e) {
|
|
584
|
+
return this.getAttribute(e, "style");
|
|
585
|
+
}
|
|
586
|
+
insertRules(e, t) {
|
|
587
|
+
e.children = [this.text(this.textContent(e) + "\n\n" + t.join("\n\n"))];
|
|
588
|
+
}
|
|
589
|
+
fontSize(e) {
|
|
590
|
+
return 0;
|
|
591
|
+
}
|
|
592
|
+
fontFamily(e) {
|
|
593
|
+
return "";
|
|
594
|
+
}
|
|
595
|
+
nodeSize(e, t = 1, n = null) {
|
|
596
|
+
return [0, 0];
|
|
597
|
+
}
|
|
598
|
+
nodeBBox(e) {
|
|
599
|
+
return {
|
|
600
|
+
left: 0,
|
|
601
|
+
right: 0,
|
|
602
|
+
top: 0,
|
|
603
|
+
bottom: 0
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
createWorker() {
|
|
607
|
+
return E(this, void 0, void 0, function* () {
|
|
608
|
+
return null;
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}, O = class extends c(D) {};
|
|
612
|
+
function k(e = null) {
|
|
613
|
+
return new O(null, e);
|
|
614
|
+
}
|
|
615
|
+
//#endregion
|
|
616
|
+
export { k as liteAdaptor };
|