@pie-element/math-inline 13.0.8-next.20261103123052 → 13.0.8-next.20261104122226
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/dist/browser/author/index.js +1 -1
- package/dist/browser/controller/index.js +220 -114
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/author/index.js +1 -1
- package/dist/browser/editor-runtime/controller/index.js +220 -114
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/print/index.js +1 -1
- package/dist/browser/print/index.js +1 -1
- package/dist/schemas/configuration.schema.json +1 -1
- package/dist/schemas/model.schema.json +1 -1
- package/dist/schemas/session.schema.json +1 -1
- package/package.json +2 -2
|
@@ -37862,7 +37862,7 @@ var LL = class extends z.Component {
|
|
|
37862
37862
|
}
|
|
37863
37863
|
}, eR = Object.freeze({
|
|
37864
37864
|
name: "@pie-element/math-inline",
|
|
37865
|
-
version: "13.0.8-next.
|
|
37865
|
+
version: "13.0.8-next.20261104122226"
|
|
37866
37866
|
});
|
|
37867
37867
|
//#endregion
|
|
37868
37868
|
export { $L as default, eR as piePackage };
|
|
@@ -91,7 +91,7 @@ var m = {
|
|
|
91
91
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.logger = void 0, e.logger = (e) => () => {};
|
|
92
92
|
})), v = /* @__PURE__ */ r(((e) => {
|
|
93
93
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
94
|
-
var t = _().logger("mv:lexer");
|
|
94
|
+
var t = (0, _().logger)("mv:lexer");
|
|
95
95
|
e.default = class {
|
|
96
96
|
constructor(e, t = "\\s") {
|
|
97
97
|
this.input = "", this.location = 0, this.whitespace = RegExp(`^(${t})+`), this.rules = e.map((e) => {
|
|
@@ -180,7 +180,7 @@ var m = {
|
|
|
180
180
|
intersect: !0
|
|
181
181
|
};
|
|
182
182
|
function n(r) {
|
|
183
|
-
var i = t.get_tree(r);
|
|
183
|
+
var i = (0, t.get_tree)(r);
|
|
184
184
|
if (!Array.isArray(i)) return i;
|
|
185
185
|
var a = i[0], o = i.slice(1);
|
|
186
186
|
if (o = o.map(function(e, t) {
|
|
@@ -192,11 +192,11 @@ var m = {
|
|
|
192
192
|
return [a].concat(o);
|
|
193
193
|
}
|
|
194
194
|
e.flatten = n, e.unflattenRight = function(n) {
|
|
195
|
-
var r = t.get_tree(n);
|
|
195
|
+
var r = (0, t.get_tree)(n);
|
|
196
196
|
if (!Array.isArray(r)) return r;
|
|
197
197
|
var i = r[0], a = r.slice(1);
|
|
198
198
|
if (a = a.map(function(t, n) {
|
|
199
|
-
return e.unflattenRight(t);
|
|
199
|
+
return (0, e.unflattenRight)(t);
|
|
200
200
|
}), a.length > 2 && e.is_associative[i]) {
|
|
201
201
|
for (var o = [
|
|
202
202
|
i,
|
|
@@ -211,11 +211,11 @@ var m = {
|
|
|
211
211
|
}
|
|
212
212
|
return [i].concat(a);
|
|
213
213
|
}, e.unflattenLeft = function(n) {
|
|
214
|
-
var r = t.get_tree(n);
|
|
214
|
+
var r = (0, t.get_tree)(n);
|
|
215
215
|
if (!Array.isArray(r)) return r;
|
|
216
216
|
var i = r[0], a = r.slice(1);
|
|
217
217
|
if (a = a.map(function(t, n) {
|
|
218
|
-
return e.unflattenLeft(t);
|
|
218
|
+
return (0, e.unflattenLeft)(t);
|
|
219
219
|
}), a.length > 2 && e.is_associative[i]) {
|
|
220
220
|
for (var o = [
|
|
221
221
|
i,
|
|
@@ -233,7 +233,7 @@ var m = {
|
|
|
233
233
|
if (!Array.isArray(t)) return [];
|
|
234
234
|
var n = t[0], r = t.slice(1);
|
|
235
235
|
return e.is_associative[n] ? r.reduce(function(t, r) {
|
|
236
|
-
return Array.isArray(r) && r[0] === n ? t.concat(e.allChildren(r)) : t.concat([r]);
|
|
236
|
+
return Array.isArray(r) && r[0] === n ? t.concat((0, e.allChildren)(r)) : t.concat([r]);
|
|
237
237
|
}, []) : r;
|
|
238
238
|
};
|
|
239
239
|
})), x = /* @__PURE__ */ r(((e, t, n) => {
|
|
@@ -242,7 +242,7 @@ var m = {
|
|
|
242
242
|
};
|
|
243
243
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.LatexToAst = e.DEFAULT_OPTS = e.latex_rules = e.whitespace_rule = void 0;
|
|
244
244
|
var i = g(), a = r(v()), o = b();
|
|
245
|
-
_().logger("mv:latex-to-ast"), e.whitespace_rule = "\\s|\\\\,|\\\\!|\\\\ |\\\\>|\\\\;|\\\\:|\\\\quad\\b|\\\\qquad\\b";
|
|
245
|
+
(0, _().logger)("mv:latex-to-ast"), e.whitespace_rule = "\\s|\\\\,|\\\\!|\\\\ |\\\\>|\\\\;|\\\\:|\\\\quad\\b|\\\\qquad\\b";
|
|
246
246
|
var s = "(E[+\\-]?[0-9]+\\s*($|(?=\\,|&|\\||\\\\\\||\\)|\\}|\\\\}|\\]|\\\\\\\\|\\\\end)))?";
|
|
247
247
|
e.latex_rules = [
|
|
248
248
|
["(mm|cm|km|ft|yd|mi|mmi|li|rd|angstrom|mil|mL|ml|L|m3|in3|ft3|pt|qt|gal|bbl){1}", "UNIT"],
|
|
@@ -546,7 +546,7 @@ var m = {
|
|
|
546
546
|
this.lexer.set_input(e), this.advance();
|
|
547
547
|
var n = this.statement_list(t);
|
|
548
548
|
if (this.token.token_type !== "EOF") throw new i.ParseError("Invalid location of '" + this.token.original_text + "'", this.lexer.location);
|
|
549
|
-
return o.flatten(n);
|
|
549
|
+
return (0, o.flatten)(n);
|
|
550
550
|
}
|
|
551
551
|
statement_list(e) {
|
|
552
552
|
for (var t = [this.statement(e)]; this.token.token_type === ",";) this.advance(), t.push(this.statement(e));
|
|
@@ -828,8 +828,8 @@ var m = {
|
|
|
828
828
|
} else a = t;
|
|
829
829
|
this.advance();
|
|
830
830
|
} else if (this.token.token_type === "INFINITY") a = Infinity, this.advance();
|
|
831
|
-
else if (this.token.token_type === "deg") a = ["*",
|
|
832
|
-
else if (this.token.token_type === "grad") a = ["*",
|
|
831
|
+
else if (this.token.token_type === "deg") a = ["*", Math.PI / 180], this.advance();
|
|
832
|
+
else if (this.token.token_type === "grad") a = ["*", Math.PI / 200], this.advance();
|
|
833
833
|
else if (this.token.token_type === "UNIT") a = ["unit", this.token.token_text], this.advance();
|
|
834
834
|
else if (this.token.token_type === "SQRT") {
|
|
835
835
|
this.advance();
|
|
@@ -37002,10 +37002,10 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37002
37002
|
})), __ = /* @__PURE__ */ r(((e) => {
|
|
37003
37003
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.replacer = e.parse = e.mathjs = void 0;
|
|
37004
37004
|
var t = g_();
|
|
37005
|
-
e.mathjs = t.create(t.all, { number: "Fraction" }), e.parse = e.mathjs.parse, e.replacer = e.mathjs.replacer;
|
|
37005
|
+
e.mathjs = (0, t.create)(t.all, { number: "Fraction" }), e.parse = e.mathjs.parse, e.replacer = e.mathjs.replacer;
|
|
37006
37006
|
})), v_ = /* @__PURE__ */ r(((e) => {
|
|
37007
37007
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.AstToMathJs = void 0;
|
|
37008
|
-
var t = __(), n = _().logger("mv:ast-to-math"), r = t.mathjs, i = {
|
|
37008
|
+
var t = __(), n = (0, _().logger)("mv:ast-to-math"), r = t.mathjs, i = {
|
|
37009
37009
|
"+": function(e) {
|
|
37010
37010
|
return new r.OperatorNode("+", "add", e);
|
|
37011
37011
|
},
|
|
@@ -37174,7 +37174,7 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37174
37174
|
};
|
|
37175
37175
|
})), y_ = /* @__PURE__ */ r(((e) => {
|
|
37176
37176
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.sort = e.sortRelationalNode = e.flattenNode = void 0;
|
|
37177
|
-
var t = _(), n = __().mathjs, r = t.logger("mv:node-sort"), i = (e, t) => {
|
|
37177
|
+
var t = _(), n = __().mathjs, r = (0, t.logger)("mv:node-sort"), i = (e, t) => {
|
|
37178
37178
|
if (r("[compareNodes]: a:", e.toString(), e.type), r("[compareNodes]: b:", t.toString(), t.type), e.isSymbolNode && t.isSymbolNode) return e.name.localeCompare(t.name);
|
|
37179
37179
|
if (e.isConstantNode && t.isConstantNode) return r("a.value", e.value), r("b.value", t.value), e.value - t.value;
|
|
37180
37180
|
if (e.isConstantNode && !t.isConstantNode) return -1;
|
|
@@ -37239,15 +37239,15 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37239
37239
|
let e = n.some((e) => t.conditionals.includes(e)) && a.some((e) => t.conditionals.includes(e));
|
|
37240
37240
|
t.conditionals.includes("equal") ? t.params.sort(i) : e && t.params ? i(t.params[0], t.params[t.params.length - 1]) > -1 && t.params.reverse() : t.conditionals = t.conditionals.map((e) => (e === "smaller" ? (s = !0, e = "larger") : e === "smallerEq" && (s = !0, e = "largerEq"), e));
|
|
37241
37241
|
}
|
|
37242
|
-
return t.params && s && (t.conditionals.reverse(), t.params.reverse()), o && o.type === "RelationalNode" && t.args && (t = e.sort(t)), t;
|
|
37242
|
+
return t.params && s && (t.conditionals.reverse(), t.params.reverse()), o && o.type === "RelationalNode" && t.args && (t = (0, e.sort)(t)), t;
|
|
37243
37243
|
});
|
|
37244
37244
|
}, e.sort = (t) => {
|
|
37245
37245
|
let n = t;
|
|
37246
|
-
return t.type === "RelationalNode" ? e.sortRelationalNode(t) : (t.isOperatorNode && t.fn === "smaller" && (t.op = ">", t.fn = "larger", t.args = t.args.reverse()), t.isOperatorNode && t.fn === "smallerEq" && (t.op = ">=", t.fn = "largerEq", t.args = t.args.reverse()), t.isFunctionNode && t.fn.name.match("=|NE|≃|≈|≈|≉|~|≃|≁|≅|≆") && (t.args = t.args.sort(i)), t.isOperatorNode && (t.fn == "larger" || t.fn == "largerEq" || t.fn == "equal" || t.fn == "unequal") && (t.args = t.args.map(e.sort), (t.fn === "equal" || t.fn === "unequal") && (t.args = t.args.sort(i))), t.isArrayNode ? (t.items = t.items.sort(i), t) : (n = e.flattenNode(t).transform(a), n));
|
|
37246
|
+
return t.type === "RelationalNode" ? (0, e.sortRelationalNode)(t) : (t.isOperatorNode && t.fn === "smaller" && (t.op = ">", t.fn = "larger", t.args = t.args.reverse()), t.isOperatorNode && t.fn === "smallerEq" && (t.op = ">=", t.fn = "largerEq", t.args = t.args.reverse()), t.isFunctionNode && t.fn.name.match("=|NE|≃|≈|≈|≉|~|≃|≁|≅|≆") && (t.args = t.args.sort(i)), t.isOperatorNode && (t.fn == "larger" || t.fn == "largerEq" || t.fn == "equal" || t.fn == "unequal") && (t.args = t.args.map(e.sort), (t.fn === "equal" || t.fn === "unequal") && (t.args = t.args.sort(i))), t.isArrayNode ? (t.items = t.items.sort(i), t) : (n = (0, e.flattenNode)(t).transform(a), n));
|
|
37247
37247
|
};
|
|
37248
37248
|
})), b_ = /* @__PURE__ */ r(((e) => {
|
|
37249
|
-
Object.defineProperty(e, "__esModule", { value: !0 }), e.equationsHaveTheSameVariables = e.solveLinearEquation = e.solveQuadraticEquation = e.
|
|
37250
|
-
var t = __(), n = C_(), { simplify:
|
|
37249
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.equationsHaveTheSameVariables = e.solveLinearEquation = e.solveQuadraticEquation = e.getCoefficients = e.getVariables = e.transformEqualityInExpression = e.areEquationsNumericallyEquivalent = e.areNumericallyEquivalent = e.getSamplePoints = e.hasSymbolicExponent = e.expressionsCanBeCompared = void 0;
|
|
37250
|
+
var t = __(), n = g_(), r = C_(), { simplify: i } = t.mathjs, a = t.mathjs, o = (0, n.create)(n.all), s = [
|
|
37251
37251
|
{
|
|
37252
37252
|
l: "-((n1)*(n2))",
|
|
37253
37253
|
r: "(n1)*(n2)"
|
|
@@ -37268,7 +37268,7 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37268
37268
|
l: "(n1+n2)*n3/n4",
|
|
37269
37269
|
r: "(n1*n3)/n4+(n2*n3)/n4"
|
|
37270
37270
|
}
|
|
37271
|
-
],
|
|
37271
|
+
], c = (e) => Math.round(e * 0x9184e72a000) / 0x9184e72a000;
|
|
37272
37272
|
e.expressionsCanBeCompared = (e, t) => {
|
|
37273
37273
|
let n = !0, r = !1, i = !1, a = !1;
|
|
37274
37274
|
return e.traverse(function(e, t, i) {
|
|
@@ -37281,72 +37281,122 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37281
37281
|
return e.traverse((e) => {
|
|
37282
37282
|
e.isOperatorNode && e.op === "^" && !e.args[1]?.isConstantNode && (t = !0);
|
|
37283
37283
|
}), t;
|
|
37284
|
-
}
|
|
37285
|
-
|
|
37286
|
-
|
|
37287
|
-
|
|
37288
|
-
|
|
37289
|
-
|
|
37290
|
-
|
|
37291
|
-
|
|
37292
|
-
|
|
37293
|
-
let
|
|
37284
|
+
};
|
|
37285
|
+
var l = (e) => () => {
|
|
37286
|
+
e = e + 1831565813 | 0;
|
|
37287
|
+
let t = Math.imul(e ^ e >>> 15, 1 | e);
|
|
37288
|
+
return t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t, ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
37289
|
+
};
|
|
37290
|
+
e.getSamplePoints = (e, t = 12) => {
|
|
37291
|
+
let n = l(443);
|
|
37292
|
+
return Array.from({ length: t }, () => e.reduce((e, t) => {
|
|
37293
|
+
let r = .5 + 4 * n();
|
|
37294
|
+
return e[t] = n() < .5 ? -r : r, e;
|
|
37295
|
+
}, {}));
|
|
37296
|
+
};
|
|
37297
|
+
var u = (e, t) => {
|
|
37298
|
+
let n;
|
|
37299
|
+
try {
|
|
37300
|
+
n = o.compile(e.toString());
|
|
37301
|
+
} catch {
|
|
37302
|
+
return t.map(() => NaN);
|
|
37303
|
+
}
|
|
37304
|
+
return t.map((e) => {
|
|
37294
37305
|
try {
|
|
37295
|
-
let
|
|
37296
|
-
return
|
|
37306
|
+
let t = n.evaluate(Object.assign({}, e));
|
|
37307
|
+
return typeof t == "number" ? t : NaN;
|
|
37297
37308
|
} catch {
|
|
37298
|
-
return
|
|
37309
|
+
return NaN;
|
|
37310
|
+
}
|
|
37311
|
+
});
|
|
37312
|
+
}, d = (e, t, n) => Math.abs(e - t) <= n * Math.max(1, Math.abs(e), Math.abs(t));
|
|
37313
|
+
e.areNumericallyEquivalent = (t, n, r, i = 1e-10) => {
|
|
37314
|
+
let a = (0, e.getSamplePoints)(r), o = u(t, a), s = u(n, a);
|
|
37315
|
+
return o.filter((e, t) => Number.isFinite(e) && Number.isFinite(s[t])).length >= 3 && o.every((e, t) => !Number.isFinite(e) || !Number.isFinite(s[t]) || d(e, s[t], i));
|
|
37316
|
+
};
|
|
37317
|
+
var f = (e, t) => e.reduce((e, n) => e.reduce((e, r) => e.concat(Array.from({ length: 2 * t + 1 }, (e, i) => Object.assign(Object.assign({}, r), { [n]: i - t }))), []), [{}]), p = (t, n, r, { allowVariableFactor: i = !1, positiveOnly: a = !1 } = {}) => {
|
|
37318
|
+
let o = 1e-9, s = (0, e.getSamplePoints)(r), c = u(t, s), l = u(n, s), p = [];
|
|
37319
|
+
for (let e = 0; e < s.length; e++) {
|
|
37320
|
+
let t = c[e], n = l[e];
|
|
37321
|
+
if (!Number.isFinite(t) || !Number.isFinite(n)) continue;
|
|
37322
|
+
let r = Math.abs(t) < o, i = Math.abs(n) < o;
|
|
37323
|
+
if (!(r && i)) {
|
|
37324
|
+
if (r || i) return !1;
|
|
37325
|
+
p.push({
|
|
37326
|
+
point: s[e],
|
|
37327
|
+
ratio: t / n
|
|
37328
|
+
});
|
|
37299
37329
|
}
|
|
37330
|
+
}
|
|
37331
|
+
return p.length < 3 ? !1 : (i ? f(r, 2).filter((e) => !a || Object.values(e).every((e) => e % 2 == 0)) : [{}]).some((e) => {
|
|
37332
|
+
let t = p.map(({ point: t, ratio: n }) => Object.keys(e).reduce((n, r) => n / t[r] ** +e[r], n));
|
|
37333
|
+
return (!a || t[0] > 0) && t.every((e) => d(e, t[0], o));
|
|
37300
37334
|
});
|
|
37301
|
-
},
|
|
37335
|
+
}, m = 4, h = 60, g = (e) => {
|
|
37336
|
+
let t = 0, n = !1;
|
|
37337
|
+
return e.traverse((e) => {
|
|
37338
|
+
t++, n ||= e.isOperatorNode && e.op === "^" && e.args[1]?.isConstantNode && Math.abs(Number(e.args[1].value)) > m;
|
|
37339
|
+
}), n || t > h;
|
|
37340
|
+
}, _ = (e) => {
|
|
37341
|
+
if (!g(e)) try {
|
|
37342
|
+
let { numerator: t, denominator: n } = o.rationalize(e.toString(), {}, !0);
|
|
37343
|
+
return n ? t : void 0;
|
|
37344
|
+
} catch {
|
|
37345
|
+
return;
|
|
37346
|
+
}
|
|
37347
|
+
};
|
|
37348
|
+
e.areEquationsNumericallyEquivalent = (e, t, n, r = {}) => {
|
|
37349
|
+
if (p(e, t, n, r)) return !0;
|
|
37350
|
+
if (r.positiveOnly) return !1;
|
|
37351
|
+
let i = _(e), a = _(t);
|
|
37352
|
+
return (i !== void 0 || a !== void 0) && p(i || e, a || t, n, r);
|
|
37353
|
+
}, e.transformEqualityInExpression = (e) => (0, r.simplify)(new a.OperatorNode("-", "subtract", e.args)), e.getVariables = (e) => {
|
|
37302
37354
|
let t = [];
|
|
37303
37355
|
return e.traverse(function(e, n, r) {
|
|
37304
37356
|
e.isSymbolNode && e?.name.length === 1 && !t.includes(e.name) && t.push(e.name);
|
|
37305
37357
|
}), t.sort();
|
|
37306
37358
|
}, e.getCoefficients = (e, t) => {
|
|
37307
37359
|
try {
|
|
37308
|
-
let t =
|
|
37360
|
+
let t = a.rationalize(e, {}, !0).coefficients;
|
|
37309
37361
|
return t.every((e) => e < 0) ? t.map((e) => Math.abs(e)) : t;
|
|
37310
37362
|
} catch {
|
|
37311
|
-
t ||
|
|
37363
|
+
t || s.push({
|
|
37312
37364
|
l: "-(n)",
|
|
37313
37365
|
r: "n"
|
|
37314
|
-
}), e =
|
|
37366
|
+
}), e = i(e, s);
|
|
37315
37367
|
try {
|
|
37316
|
-
return
|
|
37368
|
+
return a.rationalize(e, {}, !0).coefficients;
|
|
37317
37369
|
} catch {}
|
|
37318
37370
|
}
|
|
37319
37371
|
return [1, 0];
|
|
37320
|
-
}, e.
|
|
37321
|
-
|
|
37322
|
-
}), e.solveQuadraticEquation = (e) => {
|
|
37323
|
-
let [t, n, r] = e, a = n * n - 4 * r * t, s, c;
|
|
37372
|
+
}, e.solveQuadraticEquation = (e) => {
|
|
37373
|
+
let [t, n, r] = e, i = n * n - 4 * r * t, o, s;
|
|
37324
37374
|
try {
|
|
37325
|
-
|
|
37375
|
+
o = a.compile(a.fraction(-n + a.sqrt(i)) / (2 * r));
|
|
37326
37376
|
} catch {
|
|
37327
|
-
|
|
37377
|
+
o = a.compile("(-b+sqrt(discriminant))/(2*a)");
|
|
37328
37378
|
}
|
|
37329
37379
|
try {
|
|
37330
|
-
|
|
37380
|
+
s = a.compile(a.fraction(-n - a.sqrt(i)) / (2 * r));
|
|
37331
37381
|
} catch {
|
|
37332
|
-
|
|
37382
|
+
s = a.compile("(-b-sqrt(discriminant))/(2*a)");
|
|
37333
37383
|
}
|
|
37334
|
-
let l =
|
|
37335
|
-
discriminant:
|
|
37384
|
+
let l = o.evaluate({
|
|
37385
|
+
discriminant: i,
|
|
37336
37386
|
a: r,
|
|
37337
37387
|
b: n
|
|
37338
|
-
}), u =
|
|
37339
|
-
discriminant:
|
|
37388
|
+
}), u = s.evaluate({
|
|
37389
|
+
discriminant: i,
|
|
37340
37390
|
a: r,
|
|
37341
37391
|
b: n
|
|
37342
37392
|
});
|
|
37343
37393
|
return l.im ? [{
|
|
37344
|
-
re:
|
|
37345
|
-
im:
|
|
37394
|
+
re: c(l.re),
|
|
37395
|
+
im: c(l.im)
|
|
37346
37396
|
}, {
|
|
37347
|
-
re:
|
|
37348
|
-
im:
|
|
37349
|
-
}] : (l =
|
|
37397
|
+
re: c(u.re),
|
|
37398
|
+
im: c(u.im)
|
|
37399
|
+
}] : (l = c(l), u = c(u), [{
|
|
37350
37400
|
re: l,
|
|
37351
37401
|
im: 0
|
|
37352
37402
|
}, {
|
|
@@ -37359,7 +37409,7 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37359
37409
|
if (e.length === 3 && e[0] === 0 && (e = e.splice(1, 2)), e.length === 2) {
|
|
37360
37410
|
if (e[0] === 0 && e[1] === 0) return Infinity;
|
|
37361
37411
|
if (e[0] === 0) return 0;
|
|
37362
|
-
t =
|
|
37412
|
+
t = c(a.divide(e[0], -1 * e[1]));
|
|
37363
37413
|
}
|
|
37364
37414
|
return t;
|
|
37365
37415
|
}
|
|
@@ -37369,29 +37419,27 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37369
37419
|
var t = __(), n = b_(), r = t.mathjs, i = (e, t) => Array.isArray(e) && Array.isArray(t) && e.length === t.length && e.every((e, n) => e === t[n]);
|
|
37370
37420
|
e.compareEquations = (e, t, a) => {
|
|
37371
37421
|
let o = !1;
|
|
37372
|
-
if (n.expressionsCanBeCompared(e, t)) {
|
|
37373
|
-
let s = n.transformEqualityInExpression(e), c = n.transformEqualityInExpression(t);
|
|
37422
|
+
if ((0, n.expressionsCanBeCompared)(e, t)) {
|
|
37423
|
+
let s = (0, n.transformEqualityInExpression)(e), c = (0, n.transformEqualityInExpression)(t);
|
|
37374
37424
|
if (s.equals(c)) return !0;
|
|
37375
|
-
let l = n.getVariables(s), u = n.getVariables(c);
|
|
37376
|
-
if (!n.equationsHaveTheSameVariables(l, u)) return !1;
|
|
37425
|
+
let l = (0, n.getVariables)(s), u = (0, n.getVariables)(c);
|
|
37426
|
+
if (!(0, n.equationsHaveTheSameVariables)(l, u)) return !1;
|
|
37377
37427
|
let d, f;
|
|
37378
|
-
if (n.hasSymbolicExponent(s) || n.hasSymbolicExponent(c)) return n.areNumericallyEquivalent(s, c, l);
|
|
37428
|
+
if ((0, n.hasSymbolicExponent)(s) || (0, n.hasSymbolicExponent)(c)) return (0, n.areNumericallyEquivalent)(s, c, l);
|
|
37379
37429
|
if (l.length === 1) {
|
|
37380
|
-
if (d = n.getCoefficients(s, a), f = n.getCoefficients(c, a), i(d, f)) return !0;
|
|
37430
|
+
if (d = (0, n.getCoefficients)(s, a), f = (0, n.getCoefficients)(c, a), i(d, f)) return !0;
|
|
37381
37431
|
if (d.length === 3 && f.length === 3 && !a && d[0] !== 0 || d.length === 4 && d[0] === 0 && f[0] === 0) {
|
|
37382
37432
|
d[0] === 0 && (d = d.splice(1, 3), f = f.splice(1, 3));
|
|
37383
|
-
let e = n.solveQuadraticEquation(d), t = n.solveQuadraticEquation(f), i = r.complex(e), a = r.complex(t);
|
|
37433
|
+
let e = (0, n.solveQuadraticEquation)(d), t = (0, n.solveQuadraticEquation)(f), i = r.complex(e), a = r.complex(t);
|
|
37384
37434
|
return e[0].im === 0 && e[1].im === 0 ? i[0].equals(a[0]) && i[1].equals(a[1]) || i[0].equals(a[1]) && i[1].equals(a[0]) : e[0].re === t[0].re && e[1].re === t[1].re && e[0].im.toFixed(13) === t[0].im.toFixed(13) && e[1].im.toFixed(13) === t[1].im.toFixed(13);
|
|
37385
37435
|
}
|
|
37386
|
-
let e = n.solveLinearEquation(d);
|
|
37387
|
-
o = e ===
|
|
37388
|
-
}
|
|
37389
|
-
if (l.length === 2) {
|
|
37390
|
-
let e = l[0], t = n.setXToOne(s, e);
|
|
37391
|
-
d = n.getCoefficients(t, a);
|
|
37392
|
-
let r = n.setXToOne(c, e);
|
|
37393
|
-
f = n.getCoefficients(r, a), o = n.solveLinearEquation(d) === n.solveLinearEquation(f);
|
|
37436
|
+
let e = (0, n.solveLinearEquation)(d), t = (0, n.solveLinearEquation)(f);
|
|
37437
|
+
if (o = e === t && e !== void 0, !a && (e === void 0 || t === void 0)) return (0, n.areEquationsNumericallyEquivalent)(s, c, l);
|
|
37394
37438
|
}
|
|
37439
|
+
if (l.length === 2) return (0, n.areEquationsNumericallyEquivalent)(s, c, l, {
|
|
37440
|
+
allowVariableFactor: !0,
|
|
37441
|
+
positiveOnly: a
|
|
37442
|
+
});
|
|
37395
37443
|
if (o && a) return !(r.isPositive(d[0]) && r.isNegative(d[1]) && r.isNegative(f[0]) && r.isPositive(f[1]) || r.isNegative(d[0]) && r.isPositive(d[1]) && r.isPositive(f[0]) && r.isNegative(f[1]));
|
|
37396
37444
|
}
|
|
37397
37445
|
return o;
|
|
@@ -37412,24 +37460,24 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37412
37460
|
left: new r.OperatorNode(i(e.conditionals[0]), e.conditionals[0], [e.params[0], e.params[1]]),
|
|
37413
37461
|
right: new r.OperatorNode(i(e.conditionals[1]), e.conditionals[1], [e.params[1], e.params[2]])
|
|
37414
37462
|
}), e.getLimit = (e, t) => {
|
|
37415
|
-
let r = n.transformEqualityInExpression(e.right), i = n.transformEqualityInExpression(e.left), a = n.solveLinearEquation(n.getCoefficients(r, !0)), o = n.solveLinearEquation(n.getCoefficients(i, !0));
|
|
37463
|
+
let r = (0, n.transformEqualityInExpression)(e.right), i = (0, n.transformEqualityInExpression)(e.left), a = (0, n.solveLinearEquation)((0, n.getCoefficients)(r, !0)), o = (0, n.solveLinearEquation)((0, n.getCoefficients)(i, !0));
|
|
37416
37464
|
return t === "inferior" ? Math.min(a, o) : Math.max(a, o);
|
|
37417
37465
|
}, e.compareCompoundInequations = (t, r) => {
|
|
37418
|
-
if (!n.expressionsCanBeCompared(t, r)) return !1;
|
|
37419
|
-
let i = n.getVariables(t), a = n.getVariables(r);
|
|
37420
|
-
if (!n.equationsHaveTheSameVariables(i, a) && i?.length === 1) return !1;
|
|
37421
|
-
let o = e.splitInequality(t), s = e.splitInequality(r), c = {
|
|
37422
|
-
min: e.getLimit(o, "inferior"),
|
|
37423
|
-
max: e.getLimit(o, "superior")
|
|
37466
|
+
if (!(0, n.expressionsCanBeCompared)(t, r)) return !1;
|
|
37467
|
+
let i = (0, n.getVariables)(t), a = (0, n.getVariables)(r);
|
|
37468
|
+
if (!(0, n.equationsHaveTheSameVariables)(i, a) && i?.length === 1) return !1;
|
|
37469
|
+
let o = (0, e.splitInequality)(t), s = (0, e.splitInequality)(r), c = {
|
|
37470
|
+
min: (0, e.getLimit)(o, "inferior"),
|
|
37471
|
+
max: (0, e.getLimit)(o, "superior")
|
|
37424
37472
|
}, l = {
|
|
37425
|
-
min: e.getLimit(s, "inferior"),
|
|
37426
|
-
max: e.getLimit(s, "superior")
|
|
37473
|
+
min: (0, e.getLimit)(s, "inferior"),
|
|
37474
|
+
max: (0, e.getLimit)(s, "superior")
|
|
37427
37475
|
};
|
|
37428
37476
|
return c.min === l.min && c.max === l.max;
|
|
37429
37477
|
};
|
|
37430
37478
|
})), C_ = /* @__PURE__ */ r(((e) => {
|
|
37431
37479
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.isMathEqual = e.simplify = void 0;
|
|
37432
|
-
var t = _(), n = __(), r =
|
|
37480
|
+
var t = _(), n = __(), r = g_(), i = y_(), a = x_(), o = S_(), s = n.mathjs, c = (0, t.logger)("mv:symbolic"), l = 1e-9, u = (0, r.create)(r.all), d = 1e-13, f = 1e-14, { simplify: p, rationalize: m } = n.mathjs, h = [
|
|
37433
37481
|
{
|
|
37434
37482
|
l: "n1^(1/n2)",
|
|
37435
37483
|
r: "nthRoot(n1, n2)"
|
|
@@ -37572,43 +37620,101 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37572
37620
|
r: "1/n"
|
|
37573
37621
|
}
|
|
37574
37622
|
];
|
|
37575
|
-
e.simplify = (e) =>
|
|
37576
|
-
var
|
|
37577
|
-
let n =
|
|
37578
|
-
|
|
37579
|
-
|
|
37580
|
-
}), n
|
|
37623
|
+
e.simplify = (e) => p(e, h.concat(p.rules));
|
|
37624
|
+
var g = (e, t) => {
|
|
37625
|
+
let n = !1;
|
|
37626
|
+
return e.traverse((e, r) => {
|
|
37627
|
+
n ||= e.isSymbolNode && r !== "fn" && t(e.name);
|
|
37628
|
+
}), n;
|
|
37629
|
+
}, v = (e) => {
|
|
37630
|
+
if (!g(e, (e) => e !== "pi" && e !== "Infinity")) try {
|
|
37631
|
+
let t = u.evaluate(e.toString());
|
|
37632
|
+
return typeof t == "number" ? t : void 0;
|
|
37633
|
+
} catch {
|
|
37634
|
+
return;
|
|
37635
|
+
}
|
|
37636
|
+
}, y = (e) => {
|
|
37637
|
+
let t = v(e);
|
|
37638
|
+
if (t === void 0 || !isFinite(t)) return;
|
|
37639
|
+
let n = t / (Math.PI / 2), r = Math.round(n);
|
|
37640
|
+
return Math.abs(n - r) <= l * Math.max(1, Math.abs(r)) ? r : void 0;
|
|
37641
|
+
}, b = (e) => {
|
|
37642
|
+
let t = !1, n = e.transform((e) => {
|
|
37643
|
+
if (!e.isFunctionNode || e.args?.length !== 1) return e;
|
|
37644
|
+
let n = y(e.args[0]);
|
|
37645
|
+
if (n === void 0) return e;
|
|
37646
|
+
let r = Math.abs(n) % 2 == 1, i = e;
|
|
37647
|
+
switch (e.fn.name) {
|
|
37648
|
+
case "sin":
|
|
37649
|
+
i = r ? e : new s.ConstantNode(0);
|
|
37650
|
+
break;
|
|
37651
|
+
case "cos":
|
|
37652
|
+
i = r ? new s.ConstantNode(0) : e;
|
|
37653
|
+
break;
|
|
37654
|
+
case "tan":
|
|
37655
|
+
i = r ? new s.SymbolNode("Infinity") : new s.ConstantNode(0);
|
|
37656
|
+
break;
|
|
37657
|
+
case "cot":
|
|
37658
|
+
i = r ? new s.ConstantNode(0) : new s.SymbolNode("Infinity");
|
|
37659
|
+
break;
|
|
37660
|
+
case "sec":
|
|
37661
|
+
i = r ? new s.SymbolNode("Infinity") : e;
|
|
37662
|
+
break;
|
|
37663
|
+
case "csc": i = r ? e : new s.SymbolNode("Infinity");
|
|
37664
|
+
}
|
|
37665
|
+
return t ||= i !== e, i;
|
|
37666
|
+
});
|
|
37667
|
+
return {
|
|
37668
|
+
r: t ? n : e,
|
|
37669
|
+
changed: t
|
|
37670
|
+
};
|
|
37671
|
+
}, x = (t) => {
|
|
37672
|
+
let n = b(t), r = n.r, a = n.changed ? v(r) : void 0, o = a !== void 0 && (!isFinite(a) || g(r, (e) => e === "Infinity")) ? a : void 0, l = !0, u = !1, d = !1, f = !1, p = !1;
|
|
37673
|
+
if (r.traverse(function(t, n, r) {
|
|
37674
|
+
t.isArrayNode && (d = !0, t.items = t.items.map((t) => (0, e.simplify)(t))), t.isSymbolNode && (f ||= t.name === "pi", p ||= t.name === "f^{-1}");
|
|
37675
|
+
}), r.args && (r.args = r.args.map((t) => {
|
|
37581
37676
|
if (!t.isFunctionNode && !t.isArrayNode && !p && !f) try {
|
|
37582
|
-
t = e.simplify(t);
|
|
37677
|
+
t = (0, e.simplify)(t);
|
|
37583
37678
|
} catch {}
|
|
37584
|
-
return
|
|
37585
|
-
}), (
|
|
37679
|
+
return u ||= t.isFunctionNode, l &&= !!t.isConstantNode, t;
|
|
37680
|
+
}), (u || p) && (r.args = r.args.map((t) => {
|
|
37586
37681
|
if (!t.isFunctionNode && !t.isArrayNode) try {
|
|
37587
|
-
t =
|
|
37682
|
+
t = m((0, e.simplify)(t), {}, !0).expression;
|
|
37588
37683
|
} catch {}
|
|
37589
37684
|
return t;
|
|
37590
|
-
}))),
|
|
37591
|
-
|
|
37685
|
+
}))), r.fn !== "equal") try {
|
|
37686
|
+
l = !1, r = m(r, {}, !0).expression;
|
|
37592
37687
|
} catch {}
|
|
37593
|
-
if (
|
|
37594
|
-
|
|
37688
|
+
if (r.conditionals && r.params && (r.params = r.params.map((t) => (0, i.sort)((0, e.simplify)(t)))), !d && !l) try {
|
|
37689
|
+
r = (0, e.simplify)(r);
|
|
37595
37690
|
} catch {}
|
|
37596
|
-
return
|
|
37597
|
-
}
|
|
37691
|
+
return c("[normalize] input: ", t.toString(), "output: ", r.toString()), o !== void 0 && (r = isNaN(o) ? new s.SymbolNode("NaN") : isFinite(o) ? new s.ConstantNode(o) : new s.SymbolNode("Infinity")), r.toString() === "Infinity" && (r = new s.SymbolNode("Infinity")), r;
|
|
37692
|
+
}, S = (e) => {
|
|
37693
|
+
if (!(e.filter((e) => e.isSymbolNode).length > 0)) try {
|
|
37694
|
+
let t = e.evaluate();
|
|
37695
|
+
if (typeof t == "boolean") return;
|
|
37696
|
+
let n = +t;
|
|
37697
|
+
return Number.isFinite(n) ? n : void 0;
|
|
37698
|
+
} catch {
|
|
37699
|
+
return;
|
|
37700
|
+
}
|
|
37701
|
+
}, C = (e, t) => Math.abs(e - t) < f + d * Math.max(Math.abs(e), Math.abs(t)), w = (e) => e?.isSymbolNode && e.name === "NaN";
|
|
37598
37702
|
e.isMathEqual = (e, t) => {
|
|
37599
|
-
let n,
|
|
37703
|
+
let n, r;
|
|
37600
37704
|
if (e?.isUnit && t?.isUnit) try {
|
|
37601
|
-
return
|
|
37705
|
+
return s.equal(e, t);
|
|
37602
37706
|
} catch (n) {
|
|
37603
|
-
return
|
|
37707
|
+
return c("[isMathEqual] Error comparing units:", (e?.toString)?.call(e), (t?.toString)?.call(t), n), !1;
|
|
37604
37708
|
}
|
|
37605
|
-
if (e?.isUnit || t?.isUnit) return
|
|
37606
|
-
n = e.conditionals ?
|
|
37607
|
-
let l =
|
|
37709
|
+
if (e?.isUnit || t?.isUnit) return c("[isMathEqual] Mismatched unit comparison:", (e?.toString)?.call(e), (t?.toString)?.call(t)), !1;
|
|
37710
|
+
if (n = e.conditionals ? x(e) : (0, i.sort)(x(e)), r = t.conditionals ? x(t) : (0, i.sort)(x(t)), c("[isMathEqual]", n.toString(), "==?", r.toString()), w(n) || w(r)) return !1;
|
|
37711
|
+
let l = (0, i.sort)(e).equals((0, i.sort)(t)), u = n.toTex().trim() === r.toTex().trim() || n.equals(r) || l;
|
|
37608
37712
|
if (u) return !0;
|
|
37609
|
-
|
|
37610
|
-
if (
|
|
37611
|
-
if (n
|
|
37713
|
+
let d = S(n), f = S(r);
|
|
37714
|
+
if (d !== void 0 && f !== void 0) return C(d, f);
|
|
37715
|
+
if (n.fn === "equal" && r.fn === "equal") return (0, a.compareEquations)(n, r, !1);
|
|
37716
|
+
if (n.fn === "larger" && r.fn === "larger" || n.fn === "largerEq" && r.fn === "largerEq") return n.fn = "equal", r.fn = "equal", n.op = "=", r.op = "=", (0, a.compareEquations)(n, r, !0);
|
|
37717
|
+
if (n?.conditionals?.length === r?.conditionals?.length && n?.conditionals?.length === 2 && (n?.conditionals)?.toString() === (r?.conditionals)?.toString()) {
|
|
37612
37718
|
let e = [
|
|
37613
37719
|
"smaller",
|
|
37614
37720
|
"smallerEq",
|
|
@@ -37616,26 +37722,26 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37616
37722
|
"largerEq",
|
|
37617
37723
|
"equal",
|
|
37618
37724
|
"unequal"
|
|
37619
|
-
], t = e.some((e) => n.conditionals.includes(e)),
|
|
37620
|
-
if (t &&
|
|
37725
|
+
], t = e.some((e) => n.conditionals.includes(e)), i = e.some((e) => r.conditionals.includes(e));
|
|
37726
|
+
if (t && i) return (0, o.compareCompoundInequations)(n, r);
|
|
37621
37727
|
}
|
|
37622
37728
|
return u;
|
|
37623
37729
|
};
|
|
37624
37730
|
})), w_ = /* @__PURE__ */ r(((e) => {
|
|
37625
37731
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.isMathEqual = void 0;
|
|
37626
37732
|
var t = __(), n = _(), r = y_(), { simplify: i } = t.mathjs;
|
|
37627
|
-
n.logger("mv:literal");
|
|
37733
|
+
(0, n.logger)("mv:literal");
|
|
37628
37734
|
var a = {
|
|
37629
37735
|
l: "tzn(n1, n2)",
|
|
37630
37736
|
r: "n1"
|
|
37631
37737
|
};
|
|
37632
|
-
e.isMathEqual = (e, t, n) => (n && n.allowTrailingZeros && (e = i(e, [a]), t = i(t, [a])), n && n.ignoreOrder && (e = r.sort(e), t = r.sort(t)), e.equals(t));
|
|
37738
|
+
e.isMathEqual = (e, t, n) => (n && n.allowTrailingZeros && (e = i(e, [a]), t = i(t, [a])), n && n.ignoreOrder && (e = (0, r.sort)(e), t = (0, r.sort)(t)), e.equals(t));
|
|
37633
37739
|
})), T_ = /* @__PURE__ */ r(((e, t, n) => {
|
|
37634
37740
|
var r = n && n.__importDefault || function(e) {
|
|
37635
37741
|
return e && e.__esModule ? e : { default: e };
|
|
37636
37742
|
};
|
|
37637
37743
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.differenceIsTooGreat = void 0;
|
|
37638
|
-
var a = r(i()).default("difference");
|
|
37744
|
+
var a = (0, r(i()).default)("difference");
|
|
37639
37745
|
e.differenceIsTooGreat = (e, t) => {
|
|
37640
37746
|
let n = Math.min(e.toString().length, t.toString().length), r = Math.max(e.toString().length, t.toString().length), i = 1 / n * 100 + 10 + 17, o = r - n;
|
|
37641
37747
|
return a("a:", e.toString(), "b:", t.toString(), "limit:", i, "diff:", o), o > i;
|
|
@@ -37648,14 +37754,14 @@ var ke = /* @__PURE__ */ r(((e) => {
|
|
|
37648
37754
|
if (!e || !t) return !1;
|
|
37649
37755
|
if (e === t || n.mode === "symbolic" && c(e) && c(t) && parseFloat(e) === parseFloat(t)) return !0;
|
|
37650
37756
|
let l = o.convert(e), u = o.convert(t);
|
|
37651
|
-
if (a.differenceIsTooGreat(l, u)) return !1;
|
|
37757
|
+
if ((0, a.differenceIsTooGreat)(l, u)) return !1;
|
|
37652
37758
|
let d = s.convert(l), f = s.convert(u);
|
|
37653
|
-
return n.mode === "literal" ? i.isMathEqual(d, f, n.literal) : r.isMathEqual(d, f);
|
|
37759
|
+
return n.mode === "literal" ? (0, i.isMathEqual)(d, f, n.literal) : (0, r.isMathEqual)(d, f);
|
|
37654
37760
|
};
|
|
37655
37761
|
})), D_ = /* @__PURE__ */ t((/* @__PURE__ */ r(((e) => {
|
|
37656
37762
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.latexEqual = void 0;
|
|
37657
37763
|
var t = E_();
|
|
37658
|
-
e.latexEqual = (e, n, r) => t.latexEqual(e, n, r);
|
|
37764
|
+
e.latexEqual = (e, n, r) => (0, t.latexEqual)(e, n, r);
|
|
37659
37765
|
})))(), 1), O_ = /[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069\u0640]/g, k_ = /[\uFB50-\uFDFF\uFE70-\uFEFC]+/g, A_ = /\p{Nd}/u, j_ = /(?![0-9])\p{Nd}/gu, M_ = /\u066B/g, N_ = /\u066C/g, P_ = /[\u0622\u0623\u0625\u0671]/g, F_ = /[\u064B-\u065F\u0670]/g, I_ = /* @__PURE__ */ new Map(), L_ = (e) => {
|
|
37660
37766
|
let t = I_.get(e);
|
|
37661
37767
|
if (t !== void 0) return t;
|
|
@@ -37850,7 +37956,7 @@ var Q_ = (e, t, n) => {
|
|
|
37850
37956
|
return o(s) || (c.responsesErrors = s), c;
|
|
37851
37957
|
}, lv = Object.freeze({
|
|
37852
37958
|
name: "@pie-element/math-inline",
|
|
37853
|
-
version: "13.0.8-next.
|
|
37959
|
+
version: "13.0.8-next.20261104122226"
|
|
37854
37960
|
});
|
|
37855
37961
|
//#endregion
|
|
37856
37962
|
export { ov as createCorrectResponseSession, Z_ as createDefaultModel, Q_ as getLogTrace, tv as model, ev as normalize, $_ as outcome, lv as piePackage, cv as validate };
|