@cortex-js/compute-engine 0.86.1 → 0.86.2
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/CHANGELOG.md +40 -0
- package/dist/esm-min/chunks/{chunk-RF2RDYMF.js → chunk-7WM7O5R7.js} +30 -30
- package/dist/esm-min/chunks/{chunk-JBEE4TIQ.js → chunk-S6GEG7AN.js} +1 -1
- package/dist/esm-min/compile.js +14 -14
- package/dist/esm-min/compute-engine.js +2 -2
- package/dist/esm-min/core.js +14 -14
- package/dist/esm-min/cortex.js +3 -3
- package/dist/esm-min/identities.js +2 -2
- package/dist/esm-min/integration-rules.js +3 -3
- package/dist/esm-min/interval.js +2 -2
- package/dist/esm-min/latex-syntax.js +2 -2
- package/dist/esm-min/math-json.js +2 -2
- package/dist/esm-min/numerics.js +2 -2
- package/dist/types/big-decimal/big-decimal.d.ts +1 -1
- package/dist/types/big-decimal/index.d.ts +1 -1
- package/dist/types/big-decimal/transcendentals.d.ts +1 -1
- package/dist/types/big-decimal/utils.d.ts +1 -1
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/configuration-change.d.ts +1 -1
- package/dist/types/common/debug.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/styled-text.d.ts +1 -1
- package/dist/types/common/terminal.d.ts +1 -1
- package/dist/types/common/type/ast-nodes.d.ts +1 -1
- package/dist/types/common/type/boxed-type.d.ts +1 -1
- package/dist/types/common/type/lexer.d.ts +1 -1
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/parser.d.ts +1 -1
- package/dist/types/common/type/primitive.d.ts +1 -1
- package/dist/types/common/type/reduce.d.ts +1 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/type-builder.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +1 -1
- package/dist/types/common/type/utils.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compile.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/conditional-value.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/constants.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/constraint-subject.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/diophantine.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/exp-to-trig.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/explain-labels.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/explain.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/function-literal.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/init-lazy-refs.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match-dispatch.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/modular-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/multivariate-gcd.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/multivariate-poly.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/predicates.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/rule-index.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-congruence.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-domain.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-system.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/stochastic-equal.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/type-guards.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compilation/angular-unit.d.ts +1 -1
- package/dist/types/compute-engine/compilation/base-compiler.d.ts +18 -1
- package/dist/types/compute-engine/compilation/compile-expression.d.ts +1 -1
- package/dist/types/compute-engine/compilation/constant-folding.d.ts +1 -1
- package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/gpu-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/python-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/types.d.ts +1 -1
- package/dist/types/compute-engine/compilation/wgsl-target.d.ts +1 -1
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/differential-equation-utils.d.ts +1 -1
- package/dist/types/compute-engine/engine-assumptions.d.ts +1 -1
- package/dist/types/compute-engine/engine-cache.d.ts +1 -1
- package/dist/types/compute-engine/engine-common-symbols.d.ts +1 -1
- package/dist/types/compute-engine/engine-compilation-targets.d.ts +1 -1
- package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +1 -1
- package/dist/types/compute-engine/engine-declarations.d.ts +1 -1
- package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +1 -1
- package/dist/types/compute-engine/engine-extension-contracts.d.ts +1 -1
- package/dist/types/compute-engine/engine-library-bootstrap.d.ts +1 -1
- package/dist/types/compute-engine/engine-numeric-configuration.d.ts +1 -1
- package/dist/types/compute-engine/engine-runtime-state.d.ts +1 -1
- package/dist/types/compute-engine/engine-scope.d.ts +1 -1
- package/dist/types/compute-engine/engine-sequences.d.ts +1 -1
- package/dist/types/compute-engine/engine-simplification-rules.d.ts +1 -1
- package/dist/types/compute-engine/engine-startup-coordinator.d.ts +1 -1
- package/dist/types/compute-engine/engine-type-resolver.d.ts +1 -1
- package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +1 -1
- package/dist/types/compute-engine/free-functions.d.ts +1 -1
- package/dist/types/compute-engine/function-properties/index.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/fungrim/loader.d.ts +1 -1
- package/dist/types/compute-engine/fungrim/types.d.ts +1 -1
- package/dist/types/compute-engine/global-types.d.ts +1 -1
- package/dist/types/compute-engine/index.d.ts +1 -1
- package/dist/types/compute-engine/interpret-oeis.d.ts +1 -1
- package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
- package/dist/types/compute-engine/interval/elementary.d.ts +1 -1
- package/dist/types/compute-engine/interval/index.d.ts +1 -1
- package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
- package/dist/types/compute-engine/interval/types.d.ts +1 -1
- package/dist/types/compute-engine/interval/util.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/default-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-colors.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-units.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-dms.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/types.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +1 -1
- package/dist/types/compute-engine/library/colors.d.ts +1 -1
- package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/distributions.d.ts +1 -1
- package/dist/types/compute-engine/library/fractals.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/measurement-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/quantity-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/special-functions.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/type-handlers.d.ts +1 -1
- package/dist/types/compute-engine/library/unit-data.d.ts +1 -1
- package/dist/types/compute-engine/library/units.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bernoulli.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/complex-esm-augment.d.ts +1 -1
- package/dist/types/compute-engine/numerics/differential-equations.d.ts +1 -1
- package/dist/types/compute-engine/numerics/diophantine.d.ts +1 -1
- package/dist/types/compute-engine/numerics/distributions.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/gauss-kronrod.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/oscillatory-quadrature.d.ts +1 -1
- package/dist/types/compute-engine/numerics/polynomial-roots.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/random.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +1 -1
- package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/numerics/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/unit-data.d.ts +1 -1
- package/dist/types/compute-engine/oeis.d.ts +1 -1
- package/dist/types/compute-engine/rubi/compile.d.ts +1 -1
- package/dist/types/compute-engine/rubi/driver.d.ts +1 -1
- package/dist/types/compute-engine/rubi/explain-trace.d.ts +1 -1
- package/dist/types/compute-engine/rubi/loader.d.ts +1 -1
- package/dist/types/compute-engine/rubi/match.d.ts +1 -1
- package/dist/types/compute-engine/rubi/normal-form.d.ts +1 -1
- package/dist/types/compute-engine/rubi/rubi-utils.d.ts +1 -1
- package/dist/types/compute-engine/rubi/types.d.ts +1 -1
- package/dist/types/compute-engine/sequence.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/differential-equations.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/explain-derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/interpret.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/limit.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/logic-utils.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/recurrences.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/residue.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/series.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-factorial.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/solver-utils.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/trig-rewrite.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
- package/dist/types/compute-engine/types-definitions.d.ts +1 -1
- package/dist/types/compute-engine/types-engine.d.ts +1 -1
- package/dist/types/compute-engine/types-evaluation.d.ts +1 -1
- package/dist/types/compute-engine/types-expression.d.ts +1 -1
- package/dist/types/compute-engine/types-kernel-evaluation.d.ts +1 -1
- package/dist/types/compute-engine/types-kernel-serialization.d.ts +1 -1
- package/dist/types/compute-engine/types-serialization.d.ts +1 -1
- package/dist/types/compute-engine/types.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +1 -1
- package/dist/types/core.d.ts +1 -1
- package/dist/types/cortex/characters.d.ts +1 -1
- package/dist/types/cortex/diagnostics.d.ts +1 -1
- package/dist/types/cortex/execute-cortex.d.ts +1 -1
- package/dist/types/cortex/formatter.d.ts +1 -1
- package/dist/types/cortex/lexer.d.ts +1 -1
- package/dist/types/cortex/operators.d.ts +1 -1
- package/dist/types/cortex/parse-cortex.d.ts +1 -1
- package/dist/types/cortex/parser.d.ts +1 -1
- package/dist/types/cortex/reserved-words.d.ts +1 -1
- package/dist/types/cortex/serialize-cortex.d.ts +1 -1
- package/dist/types/cortex/tokens.d.ts +1 -1
- package/dist/types/cortex.d.ts +2 -2
- package/dist/types/identities.d.ts +1 -1
- package/dist/types/integration-rules.d.ts +1 -1
- package/dist/types/interval.d.ts +1 -1
- package/dist/types/latex-syntax.d.ts +2 -2
- package/dist/types/math-json/symbols.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/dist/types/numerics.d.ts +1 -1
- package/dist/umd-min/compile.cjs +14 -14
- package/dist/umd-min/compute-engine.cjs +14 -14
- package/dist/umd-min/core.cjs +14 -14
- package/dist/umd-min/cortex.cjs +15 -15
- package/dist/umd-min/identities.cjs +2 -2
- package/dist/umd-min/integration-rules.cjs +2 -2
- package/dist/umd-min/interval.cjs +2 -2
- package/dist/umd-min/latex-syntax.cjs +2 -2
- package/dist/umd-min/math-json.cjs +2 -2
- package/dist/umd-min/numerics.cjs +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.86.
|
|
1
|
+
/** Compute Engine 0.86.2 */
|
|
2
2
|
var Yo=new Map,Mf=1e5;function L(e){if(e<=Mf){let n=Yo.get(e);return n===void 0&&(n=10n**BigInt(e),Yo.set(e,n)),n}return 10n**BigInt(e)}function nn(e){if(e<0n&&(e=-e),e===0n)return 0;let n=0,t=1;for(;e>>BigInt(t)>0n;)t*=2;for(let i=t>>1;i>=1;i>>=1)e>>BigInt(i)>0n&&(n+=i,e>>=BigInt(i));return n+1}function Ko(e,n,t){return e*n>>BigInt(t)}function Qo(e,n,t){return(e<<BigInt(t))/n}function Ai(e,n){if(e===0n)return 0n;if(e<0n)throw new RangeError("fpsqrt: negative input");let t=e<<BigInt(n),i;if(n<wf){i=Cr(t);let a;do a=i,i=(i+t/i)/2n;while(Ce(i-a)>1n)}else i=Br(t,nn(t));let r=(i+t/i)/2n,s=Ce(i*i-t);return Ce(r*r-t)<s?r:i}function Cr(e){let n=nn(e);if(n<=1023){let o=Math.sqrt(Number(e));if(Number.isFinite(o)&&o>=1)return BigInt(Math.floor(o))}let t=n-52,i=Number(e>>BigInt(t)),r=Math.sqrt(i);t&1&&(r*=Math.SQRT2);let s=BigInt(Math.round(r))<<BigInt(t>>1);return s>0n?s:1n}var ea=1024,wf=640;function Br(e,n){if(n<ea){let s=Cr(e),o;do o=s,s=(s+e/s)/2n;while(Ce(s-o)>1n);for(;s*s>e;)s-=1n;for(;(s+1n)*(s+1n)<=e;)s+=1n;return s}let t=n>>2<<1,i=Br(e>>BigInt(t),n-t)<<BigInt(t>>1),r;do r=i,i=(i+e/i)/2n;while(Ce(i-r)>1n);for(;i*i>e;)i-=1n;for(;(i+1n)*(i+1n)<=e;)i+=1n;return i}function Ce(e){return e<0n?-e:e}function tt(e){if(e===0n)return 1;if(e<0n&&(e=-e),e<0x20000000000000n){let i=Number(e);return i<1e8?i<1e4?i<100?i<10?1:2:i<1e3?3:4:i<1e6?i<1e5?5:6:i<1e7?7:8:i<1e12?i<1e10?i<1e9?9:10:i<1e11?11:12:i<1e14?i<1e13?13:14:i<1e15?15:16}let n=e.toString(16).length*4,t=Math.ceil(n*.30102999566398);for(;e<L(t-1);)t--;for(;e>=L(t);)t++;return t}var Df=.7;function Or(e,n){if(e===0n)return 1n<<BigInt(n);let t=Math.round(Df*Math.sqrt(n)),i=t+8,r=n+i,s=BigInt(r),o=1n<<s,a=BigInt(i),u=e<<a,l=u<0n,c=l?-u:u,f=Math.max(0,nn(c)-r+t);c>>=BigInt(f),u=l?-c:c;let p=o,d=u;p+=d;for(let x=2;d=(d*u>>s)/BigInt(x),d!==0n;x++)p+=d;for(let x=0;x<f;x++)p=p*p>>s;return p+(1n<<a-1n)>>a}var Pf=4e4;function Jr(e,n){let t=1n<<BigInt(n);if(e<=0n)throw new RangeError("fpln: input must be positive");return e===t?0n:n>=Pf?Rf(e,n):Af(e,n)}function Af(e,n){let t=BigInt(n),i=1n<<t,r=52,s=n-r,o;if(s>0){let x=Number(e>>BigInt(s))/2**r;o=BigInt(Math.round(Math.log(x)*2**r))<<BigInt(s)}else{let x=Number(e)/Number(i);o=BigInt(Math.round(Math.log(x)*Number(i)))}let a=e*Or(-o,n)>>t,l=(a-i<<t)/(a+i),c=l<0n?-l:l,f=c*c>>t,p=c,d=c;for(let x=3n;p=p*f>>t,p!==0n;x+=2n)d+=p/x;return o+(l<0n?-2n:2n)*d}var An=null;function _f(e){if(An!==null){if(An.bits===e)return An.value;if(An.bits>e)return An.value>>BigInt(An.bits-e)}let n=Math.ceil(e*_i)+12,t;if(n<=Xo.length){let i=Xo.slice(0,n);t=(BigInt(i)<<BigInt(e))/L(i.length)}else t=Lf(e);return An={bits:e,value:t},t}function Rf(e,n){let t=BigInt(n),i=nn(e)-n,r=Math.max(2,Math.ceil(n/2+4-i)),s=e<<BigInt(r-2),o=1n<<t,a=s;for(;Ce(o-a)>1n;){let l=o+a>>1n;a=Bt(o*a),o=l}return Pi(n)*s/(2n*o)-BigInt(r)*_f(n)}var nt="314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009946576407895126946839835259570982582262052248940772671947826848260147699090264013639443745530506820349625245174939965143142980919065925093722169646151570985838741059788595977297549893016175392846813826868386894277415599185592524595395943104997252468084598727364469584865383673622262609912460805124388439045124413654976278079771569143599770012961608944169486855584840635",_i=Math.log10(2),Xo="693147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418687542001481020570685733685520235758130557032670751635075961930727570828371435190307038623891673471123350115364497955239120475172681574932065155524734139525882950453007095326366642654104239157814952043740430385500801944170641671518644712839968171784546957026271631064546150257207402481637773389638550695260668341137273873722928956493547025762652098859693201965058554764703306793654432547632744951250406069438147104689946506220167720424524529612687946546193165174681392672504103802546259656869144192871608293803172714367782654877566485085674077648451464439940461422603193096735402574446070308096085047486638523138181676751438667476647890881437141985494231519973548803751658612753529166100071053558249879414729509293113897155998205654392871700072180857610252368892132449713893203784393530887748259701715591070882368362758984258918535302436342143670611892367891923723146723217205340164925687274778234453534764811494186423867767744060695626573796008670762571991847340226514628379048830620330611446300737194890027436439650025809365194430411911506080948793067865158870900605203468429736193841289652556539686022194122924207574321757489097706752687115817051137009158942665478595964890653058460258668382940022833005382074005677053046787001841624044188332327983863490015631218895606505531512721993983320307514084260914790012651682434438935724727882054862715527418772430024897945401961872339808608316648114909306675193393128904316413706813977764981769748689038877899912965036192707108892641052309247839173735012298424204995689359922066022046549415106139187885744245577510206837030866619480896412186807790208181588580001688115973056186676199187395200766719214592236720602539595436541655311295175989940056000366513567569051245926825743946483168332624901803824240824231452306140963805700702551387702681785163069025513703234053802145019015374029509942262995779647427138157363801729873940704242179972266962979939312706935747240493386530879758721699645129446491883771156701678598804981838896784134938314014073166472765327635919233511233389338709513209059272185471328975470797891384445466676192702885533423429899321803769154973340267546758873236778342916191810430116091695265547859732891763545556742863877463987101912431754255888301206779210280341206879759143081283307230300883494705792496591005860012341561757413272465943",Cf=13591409n,Bf=545140134n,Of=10939058860032000n,Jf=47.11;function Di(e,n){if(n-e===1){let l,c;if(e===0)l=1n,c=1n;else{l=BigInt(6*e-5)*BigInt(2*e-1)*BigInt(6*e-1);let p=BigInt(e);c=p*p*p*Of}let f=l*(Cf+Bf*BigInt(e));return e&1&&(f=-f),[l,c,f]}let t=e+n>>1,[i,r,s]=Di(e,t),[o,a,u]=Di(t,n);return[i*o,r*a,a*s+i*u]}function na(e){return Math.max(2,Math.floor(e/Jf)+3)}function Ff(e){let[,n,t]=Di(0,na(e)),i=1n<<BigInt(e),r=Bt(10005n*i*i);return n*426880n*r/t}function ta(e){let[,n,t]=Di(0,na(Math.ceil(e/_i))),i=L(e),r=Bt(10005n*i*i);return n*426880n*r/t}function Rr(e,n){if(n-e===1){let l=e===0?1n:BigInt(2*e-1),c=e===0?1n:9n*BigInt(2*e+1);return[l,c,l]}let t=e+n>>1,[i,r,s]=Rr(e,t),[o,a,u]=Rr(t,n);return[i*o,r*a,a*s+i*u]}function Lf(e){let n=Math.max(2,Math.ceil(e/3.169925)+5),[,t,i]=Rr(0,n);return(i<<BigInt(e+1))/(3n*t)}function Bt(e){if(e<0n)throw new RangeError("bigintSqrt: negative input");if(e===0n)return 0n;let n=nn(e);if(n>=ea)return Br(e,n);let t=Cr(e),i;do i=t,t=(t+e/t)/2n;while(Ce(t-i)>1n);for(;t*t>e;)t-=1n;for(;(t+1n)*(t+1n)<=e;)t+=1n;return t}var _n=null;function Pi(e){if(_n!==null){if(_n.bits===e)return _n.value;if(_n.bits>e)return _n.value>>BigInt(_n.bits-e)}let n=Vf(e);return _n={bits:e,value:n},n}function Vf(e){let n=Math.ceil(e*_i)+12;if(n+1<=nt.length){let t=nt.slice(0,n+1);return(BigInt(t)<<BigInt(e))/L(t.length-1)}return Ff(e)}function Ri(e,n){let t=BigInt(n),i=1n<<t;if(e===0n)return[0n,i];let r=Pi(n),s=2n*r,o=r/2n,a,u=Ce(e);if(u>i<<30n){let _=nn(u)-n+64,K=n+_,ie=e<<BigInt(_),Mi=2n*Pi(K),en=ie%Mi;en<0n&&(en+=Mi),a=en>>BigInt(_)}else a=e%s;a<0n&&(a+=s);let l=1n,c=1n;a>3n*o?(a=s-a,l=-1n):a>r?(a=a-r,l=-1n,c=-1n):a>o&&(a=r-a,c=-1n);let f=Math.round(n*_i),p=Math.min(18,Math.max(2,Math.ceil(.87*Math.sqrt(f)))),d=0,x=i>>BigInt(p);for(;a>x;)a=a/2n,d++;let b=a,N=i,I=a,M=i,R=a*a,C=2n*t;for(let _=2;;_+=2){if(M=(M*R>>C)/(BigInt(_)*BigInt(_-1)),M===0n){I=(I*R>>C)/(BigInt(_+1)*BigInt(_)),I!==0n&&(_%4===2?(N-=M,b-=I):(N+=M,b+=I));break}if(I=(I*R>>C)/(BigInt(_+1)*BigInt(_)),_%4===2?(N-=M,b-=I):(N+=M,b+=I),I===0n)break}for(let _=0;_<d;_++){let K=2n*b*N>>t,ie=(2n*N*N>>t)-i;b=K,N=ie}return[l*b,c*N]}function Ct(e,n){if(e===0n)return 0n;if(e<0n)return-Ct(-e,n);let t=BigInt(n),i=1n<<t,s=Pi(n)/2n;if(e>i){let d=(i<<t)/e;return s-Ct(d,n)}let o=4n*i/10n,a=0,u=e;for(;u>o;){let d=u*u,x=(i<<t)+d>>t,b=Ai(x,n);u=(u<<t)/(i+b),a++}let l=u,c=u,f=u*u,p=2n*t;for(let d=3;c=c*f>>p,c!==0n;d+=2)d%4===3?l-=c/BigInt(d):l+=c/BigInt(d);for(let d=0;d<a;d++)l=2n*l;return l}var Fr=NaN,h=class e{static precision=50;static ZERO=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:0n,exponent:0}));static ONE=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:1n,exponent:0}));static TWO=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:2n,exponent:0}));static NEGATIVE_ONE=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:-1n,exponent:0}));static HALF=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:5n,exponent:-1}));static NAN=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:0n,exponent:NaN}));static POSITIVE_INFINITY=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:1n,exponent:1/0}));static NEGATIVE_INFINITY=Object.freeze(Object.assign(Object.create(e.prototype),{_digits:1,significand:-1n,exponent:1/0}));static _piFullPrecision=null;static _piCache=null;static _piCachePrecision=0;static _eulerGammaCache=null;static _eulerGammaCachePrecision=0;static get PI(){let n=e.precision;if(e._piCache!==null&&e._piCachePrecision===n)return e._piCache;let t=n+4,i;if(t+1<=nt.length)e._piFullPrecision===null&&(e._piFullPrecision=new e(nt[0]+"."+nt.slice(1))),i=e._piFullPrecision.toPrecision(t);else{let r=t+4;i=V(ta(r),-r).toPrecision(t)}return e._piCache=i,e._piCachePrecision=n,i}static get EULER_GAMMA(){let n=e.precision;if(e._eulerGammaCache!==null&&e._eulerGammaCachePrecision>=n)return e._eulerGammaCache.toPrecision(n);let t=zf(n);return e._eulerGammaCache=t,e._eulerGammaCachePrecision=n,t}significand;exponent;_digits;digitCount(){return this._digits??(this._digits=tt(this.significand))}constructor(n){if(n instanceof e){this.significand=n.significand,this.exponent=n.exponent;return}if(typeof n=="bigint"){[this.significand,this.exponent]=Ci(n,0);return}if(typeof n=="number"){[this.significand,this.exponent]=jf(n);return}[this.significand,this.exponent]=aa(n)}isNaN(){return Number.isNaN(this.exponent)}isZero(){return this.exponent===0&&this.significand===0n}isFinite(){return Number.isFinite(this.exponent)}isInteger(){return this.isFinite()&&this.exponent>=0}isPositive(){return this.significand>0n}isNegative(){return this.significand<0n}cmp(n){if(typeof n=="number"){if(Number.isNaN(n))return Fr;let d=this.exponent;if(Number.isNaN(d))return Fr;if(n===0)return this.significand===0n?0:this.significand>0n?1:-1;if(!Number.isFinite(d))return n===1/0?this.significand>0n?0:-1:n===-1/0?this.significand<0n?0:1:this.significand>0n?1:-1;if(this.significand===0n)return n>0?-1:1;if(n===1/0)return-1;if(n===-1/0)return 1;if(this.significand>0n!=n>0)return this.significand>0n?1:-1;if(Number.isInteger(n)&&d>=0&&d<=15){let x=this.significand*L(d),b=BigInt(n);return x<b?-1:x>b?1:0}n=new e(n)}let t=this.exponent,i=n.exponent,r=this.significand,s=n.significand;if(t!==t||i!==i)return Fr;if(!Number.isFinite(t)||!Number.isFinite(i))return!Number.isFinite(t)&&!Number.isFinite(i)?r===s?0:r>s?1:-1:Number.isFinite(t)?s>0n?-1:1:r>0n?1:-1;if(r===0n)return s===0n?0:s>0n?-1:1;if(s===0n)return r>0n?1:-1;if(r>0n&&s<0n)return 1;if(r<0n&&s>0n)return-1;if(t===i)return r<s?-1:r>s?1:0;let o=this.digitCount(),a=n.digitCount(),u=o+t,l=a+i;if(u!==l){let d=r>0n?1:-1;return u>l?d:-d}let c=r,f=s,p=Math.abs(t-i);if(p>1e3){let d=o,x=a,b=Math.max(d,x)+1;d<b&&(c=c*L(b-d)),x<b&&(f=f*L(b-x))}else t<i?f=f*L(p):c=c*L(p);return c<f?-1:c>f?1:0}eq(n){return typeof n=="number"?n===0?this.significand===0n&&this.exponent===0:n===1?this.significand===1n&&this.exponent===0:n===-1?this.significand===-1n&&this.exponent===0:Number.isInteger(n)&&Number.isFinite(this.exponent)&&this.exponent>=0&&this.exponent<=15?this.significand*L(this.exponent)===BigInt(n):this.cmp(n)===0:this.significand===n.significand&&this.exponent===n.exponent}lt(n){return this.cmp(n)===-1}lte(n){let t=this.cmp(n);return t===-1||t===0}gt(n){return this.cmp(n)===1}gte(n){let t=this.cmp(n);return t===1||t===0}add(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i)){if(t===i)return V(this.significand+n.significand,t);let o=t-i;return o>0?V(this.significand*L(o)+n.significand,i):V(this.significand+n.significand*L(-o),t)}if(t!==t||i!==i)return e.NAN;let r=!Number.isFinite(t),s=!Number.isFinite(i);return r&&s?this.significand!==n.significand?e.NAN:this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:r?this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:n.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY}sub(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i)){if(t===i)return V(this.significand-n.significand,t);let o=t-i;return o>0?V(this.significand*L(o)-n.significand,i):V(this.significand-n.significand*L(-o),t)}if(t!==t||i!==i)return e.NAN;let r=!Number.isFinite(t),s=!Number.isFinite(i);return r&&s?this.significand===n.significand?e.NAN:this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:r?this.significand>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY:n.significand>0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY}mul(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i))return V(this.significand*n.significand,t+i);if(t!==t||i!==i||this.significand===0n||n.significand===0n)return e.NAN;let r=this.significand>0n?1n:-1n,s=n.significand>0n?1n:-1n;return r*s>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY}mulToPrecision(n,t){typeof n=="number"&&(n=new e(n));let i=this.exponent,r=n.exponent,s=this.significand,o=n.significand;if(s!==0n&&o!==0n&&Number.isFinite(i)&&Number.isFinite(r)){let a=s*o,u=i+r,l=this.digitCount()+n.digitCount()-1,f=(a<0n?-a:a)>=L(l)?l+1:l;return f<=t?V(a,u):ia(a,u).roundToPrecKnownDigits(t,f)}return this.mul(n).toPrecision(t)}neg(){let n=this.significand;return n===0n?this:Number.isFinite(this.exponent)?V(-n,this.exponent):n>0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY}abs(){return this.significand>=0n?this:Number.isFinite(this.exponent)?V(-this.significand,this.exponent):e.POSITIVE_INFINITY}floor(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=this.trunc();return this.significand<0n?t.sub(V(1n,0)):t}return this}ceil(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=this.trunc();return this.significand>0n?t.add(V(1n,0)):t}return this}round(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=V(5n,-1);return this.significand>0n?this.add(t).trunc():this.sub(t).trunc()}return this}trunc(){let n=this.exponent;if(n>=0)return this;if(Number.isFinite(n)){let t=this.significand/L(-n);return V(t===0n?0n:t,0)}return this}div(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent,r=this.significand,s=n.significand;if(Number.isFinite(t)&&Number.isFinite(i)){if(s===0n)return r===0n?e.NAN:r>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY;if(r===0n)return V(0n,0);let u=e.precision,l=10,c=this.digitCount(),f=n.digitCount(),p=u+l+Math.max(0,f-c),d=L(p),x=r*d/s,b=t-i-p,N=x<0n?-x:x,I=c+p-f,M=N>=L(I)?I+1:I;return ia(x,b).roundToPrecKnownDigits(u,M)}if(t!==t||i!==i)return e.NAN;let o=!Number.isFinite(t),a=!Number.isFinite(i);if(o&&a)return e.NAN;if(o){let u=r>0n?1n:-1n,l=s>0n?1n:s<0n?-1n:1n;return u*l>0n?e.POSITIVE_INFINITY:e.NEGATIVE_INFINITY}return V(0n,0)}inv(){return V(1n,0).div(this)}divToward(n,t){typeof n=="number"&&(n=new e(n));let i=this.exponent,r=n.exponent,s=this.significand,o=n.significand;if(!Number.isFinite(i)||!Number.isFinite(r)||o===0n||s===0n)return this.div(n);let a=s<0n!=o<0n,u=s<0n?-s:s,l=o<0n?-o:o,c=e.precision,p=c+10+Math.max(0,n.digitCount()-this.digitCount()),d=u*L(p),x=d/l,b=d%l!==0n,N=i-r-p,I=this.digitCount()+p-n.digitCount(),M=x>=L(I)?I+1:I,R=a?t==="floor":t==="ceiling",[C,_]=ra(x,b,N,c,R,M);return V(a?-C:C,_)}sqrtToward(n){if(this.significand===0n)return this.exponent!==this.exponent?this:e.ZERO;if(!Number.isFinite(this.exponent))return this.significand>0n?e.POSITIVE_INFINITY:e.NAN;if(this.significand<0n)return e.NAN;let t=e.precision,i=4,r=this.significand,s=this.exponent,o=s+this.digitCount()-1,a=Math.floor(o/2),u=t+i-a;s+2*u<0&&(u=Math.ceil(-s/2)+1);let l=s+2*u,c=l>=0?r*L(l):r/L(-l),f=Bt(c),p=f*f!==c,[d,x]=ra(f,p,-u,t,n==="ceiling");return V(d,x)}mod(n){typeof n=="number"&&(n=new e(n));let t=this.exponent,i=n.exponent;if(Number.isFinite(t)&&Number.isFinite(i)){if(n.significand===0n)return e.NAN;if(this.significand===0n)return V(0n,0);let r=t-i,s=r>=0?this.significand*L(r):this.significand,o=r>=0?n.significand:n.significand*L(-r),a=s/o;return this.sub(V(a,0).mul(n))}return t!==t||i!==i||!Number.isFinite(t)?e.NAN:new e(this)}pow(n){if(typeof n=="number"&&(n=new e(n)),this.isNaN()||n.isNaN()||!n.isFinite())return e.NAN;if(n.isInteger()){let a=n.toBigInt();if(a===0n)return V(1n,0);if(!this.isFinite())return a>0n?this.significand<0n&&a%2n!==0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY:V(0n,0);if(this.isZero())return a>0n?V(0n,0):e.POSITIVE_INFINITY;if(a<0n)return this.pow(n.neg()).inv();let u=this.significand<0n?-this.significand:this.significand,l=this.digitCount(),c=l>15?l-15:0,f=c>0?Number(u/10n**BigInt(c)):Number(u),p=Math.log10(f)+c+this.exponent,d=Number(a)*p;if(d>9e15)return this.significand<0n&&a%2n!==0n?e.NEGATIVE_INFINITY:e.POSITIVE_INFINITY;if(d<-9e15)return V(0n,0);let x=e.precision,b=a.toString(2).length,N=Math.min(2*b+5,100),I=x+N,M=V(1n,0),R=this,C=a;for(;C>0n;)C&1n&&(M=M.mulToPrecision(R,I)),C>>=1n,C>0n&&(R=R.mulToPrecision(R,I));return M.toPrecision(x)}if(!this.isFinite())return this.significand<0n?e.NAN:n.significand>0n?e.POSITIVE_INFINITY:e.ZERO;if(this.isZero())return n.significand>0n?e.ZERO:e.POSITIVE_INFINITY;if(this.significand<0n)return e.NAN;let t=this.exponent+this.digitCount()-1,r=n.exponent+n.digitCount()-1+Math.log10(Math.abs(t)*2.303+3)+1,s=Math.min(20,Math.max(2,Math.ceil(r)+2)),o=e.precision;e.precision=o+s;try{let a=qf(this,o+s);return n.mul(a).exp().toPrecision(o)}finally{e.precision=o}}toNumber(){return Number.isFinite(this.exponent)?this.significand===0n?0:this.exponent===0?Number(this.significand):Number(this.toString()):this.exponent!==this.exponent?NaN:this.significand>0n?1/0:-1/0}toString(){if(!Number.isFinite(this.exponent))return this.exponent!==this.exponent?"NaN":this.significand>0n?"Infinity":"-Infinity";if(this.significand===0n)return"0";let n=this.significand<0n,t=(n?-this.significand:this.significand).toString(),i=t.length,r=i+this.exponent-1,s=n?"-":"";if(r>20||r<-6){let u=i===1?t:t[0]+"."+t.slice(1),l=r>=0?"+":"";return`${s}${u}e${l}${r}`}if(this.exponent>=0)return s+t+"0".repeat(this.exponent);let o=-this.exponent;if(o<i){let u=t.slice(0,i-o),l=t.slice(i-o);return`${s}${u}.${l}`}let a=o-i;return`${s}0.${"0".repeat(a)}${t}`}toFixed(n){let t=n??0;if(!Number.isFinite(this.exponent))return this.exponent!==this.exponent?"NaN":this.significand>0n?"Infinity":"-Infinity";let i=this.significand<0n,r=i?-this.significand:this.significand,s=this.exponent+t,o,a;if(s>=0)a=r===0n,o=a?"0":r.toString()+"0".repeat(s);else{let f=L(-s),p=r/f,d=r%f,x=f/2n,b;d>x?b=p+1n:d<x||f%2n!==0n||p%2n===0n?b=p:b=p+1n,a=b===0n,o=b.toString()}let u=i&&!a?"-":"";if(t===0)return`${u}${o}`;if(o.length<=t){let f=o.padStart(t,"0");return`${u}0.${f}`}let l=o.slice(0,o.length-t),c=o.slice(o.length-t);return`${u}${l}.${c}`}toPrecision(n){if(this.significand===0n||!Number.isFinite(this.exponent))return this;let t=this.digitCount();return t<=n?this:this.roundToPrecKnownDigits(n,t)}roundToPrecKnownDigits(n,t){let i=this.significand<0n?-this.significand:this.significand,r=t-n,s=L(r),o=i/s,a=i-o*s,u=s/2n;(a>u||a===u&&o%2n!==0n)&&(o+=1n);let l=this.significand<0n?-o:o;return V(l,this.exponent+r)}toBigInt(){if(!Number.isFinite(this.exponent))throw this.exponent!==this.exponent?new RangeError("Cannot convert NaN to BigInt"):new RangeError("Cannot convert Infinity to BigInt");if(this.exponent>=0)return this.significand*L(this.exponent);let n=L(-this.exponent);return this.significand/n}},$f=8,Ot=[];function qf(e,n){let t=e.significand,i=e.exponent;for(let s=Ot.length-1;s>=0;s--){let o=Ot[s];if(o.prec===n&&o.exp===i&&o.sig===t)return o.ln}let r=e.ln();return Ot.push({sig:t,exp:i,prec:n,ln:r}),Ot.length>$f&&Ot.shift(),r}function zf(e){let n=e+20+Math.ceil(Math.log10(e+10)),t=h.precision;h.precision=n;try{let i=Math.ceil(n*Math.LN10/4)+5,r=new h(i),s=r.mul(r),o=h.ONE,a=h.ONE,u=h.ZERO,l=h.ZERO,c=h.ONE.div(new h(10).pow(n)),f=6*i+100;for(let p=1;p<=f;p++){let d=new h(p).mul(p);if(o=o.mul(s).div(d).toPrecision(n),l=l.add(h.ONE.div(p)).toPrecision(n),a=a.add(o).toPrecision(n),u=u.add(o.mul(l)).toPrecision(n),p>i&&o.lt(a.mul(c)))break}return u.div(a).sub(r.ln()).toPrecision(e)}finally{h.precision=t}}function V(e,n){let[t,i]=Ci(e,n),r=Object.create(h.prototype);return r.significand=t,r.exponent=i,r}function ia(e,n){let t=Object.create(h.prototype);return t.significand=e,t.exponent=n,t}function ra(e,n,t,i,r,s){if(e===0n)return[r&&n?1n:0n,t];let o=s??tt(e);if(o<=i)return[r&&n?e+1n:e,t];let a=o-i,u=L(a),l=e/u,c=n||e%u!==0n;return r&&c&&(l+=1n),[l,t+a]}var sa=1000000000n,oa=1000n;function Ci(e,n){if(e===0n)return[0n,0];if((e&1n)!==0n)return[e,n];if(e%10n!==0n)return[e,n];for(;e%sa===0n;)e/=sa,n+=9;for(;e%oa===0n;)e/=oa,n+=3;for(;e%10n===0n;)e/=10n,n+=1;return[e,n]}function jf(e){return Number.isNaN(e)?[0n,NaN]:e===1/0?[1n,1/0]:e===-1/0?[-1n,1/0]:Number.isInteger(e)?Ci(BigInt(e),0):aa(e.toString())}function aa(e){if(e=e.trim(),e===""||e==="NaN")return[0n,NaN];if(e==="Infinity"||e==="+Infinity")return[1n,1/0];if(e==="-Infinity")return[-1n,1/0];let n,t=0,i=e.search(/[eE]/);if(i!==-1){if(n=e.slice(0,i),t=Number(e.slice(i+1)),!Number.isFinite(t))return[0n,NaN]}else n=e;let r=!1;n.startsWith("-")?(r=!0,n=n.slice(1)):n.startsWith("+")&&(n=n.slice(1));let s=n.indexOf("."),o,a;s===-1?(o=n,a=""):(o=n.slice(0,s),a=n.slice(s+1)),o=o.replace(/^0+/,"")||"0";let u=o+a;if(u.length===0||!/^\d+$/.test(u))return[0n,NaN];let l=BigInt(u);r&&(l=-l);let c=-a.length;return Ci(l,c+t)}var Gf=Math.log2(10),ca=Math.log10(2),Zf=16,Vr=1e6;function tn(e,n){let t=Math.ceil(n*Gf)+Zf,i=BigInt(t);return e.exponent>=0?[e.significand*L(e.exponent)<<i,t]:[(e.significand<<i)/L(-e.exponent),t]}function rn(e,n,t){if(e===0n)return h.ZERO;let i=e<0n,r=i?-e:e,s=BigInt(n),o=nn(r)-n,a=Math.floor(o*ca),u=t+4-a,l,c;if(u>=0)l=r*L(u)+(1n<<s-1n)>>s,c=-u;else{let p=L(-u)<<s;l=(r+p/2n)/p,c=-u}if(l===0n)return h.ZERO;let f=tt(l);if(f>t){let p=f-t,d=L(p),x=d/2n,b=l%d;l=l/d,b>=x&&(l+=1n),c+=p}return V(i?-l:l,c)}function ge(e){return e.exponent+e.digitCount()-1}function Lr(e,n){if(e===0n)return 0;let t=e<0n?-e:e,i=n*ca-(tt(t)-1);return i>0?Math.ceil(i):0}var fa=5,ua=BigInt(Number.MAX_SAFE_INTEGER),Rn=null;function pa(e){if(Rn!==null){if(Rn.bits===e)return Rn.value;if(Rn.bits>e)return Rn.value>>BigInt(Rn.bits-e)}let n=Jr(10n<<BigInt(e),e);return Rn={bits:e,value:n},n}h.prototype.sqrt=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.significand<0n)return h.NAN;let e=h.precision,n=e+10,t=ge(this),i=Math.floor(t/2),r=V(this.significand,this.exponent-2*i),[s,o]=tn(r,n),a=Ai(s,o),u=rn(a,o,e);return V(u.significand,u.exponent+i)};h.prototype.cbrt=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;if(this.significand<0n)return this.neg().cbrt().neg();let e=h.precision,n=e+10,t=ge(this),i=Math.floor(t/3),r=V(this.significand,this.exponent-3*i),[s,o]=tn(r,n),a=s<<BigInt(2*o),u,l=r.toNumber();if(o<=1e3&&Number.isFinite(l)&&l>0){let p=Number(1n<<BigInt(o)),d=Math.cbrt(l);Number.isFinite(d)&&d>0?(u=BigInt(Math.floor(d*p)),u===0n&&(u=1n)):u=la(a)}else u=la(a);let c;do{c=u;let p=u*u;if(p===0n){u=1n;break}u=(2n*u+a/p)/3n}while(Ce(u-c)>1n);{let p=(2n*u+a/(u*u))/3n,d=Ce(u*u*u-a);Ce(p*p*p-a)<d&&(u=p)}let f=rn(u,o,e);return V(f.significand,f.exponent+i)};h.sqrt=function(e){return e.sqrt()};h.cbrt=function(e){return e.cbrt()};h.prototype.exp=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.ZERO;if(this.isZero())return h.ONE;if(ge(this)>=17)return this.significand>0n?h.POSITIVE_INFINITY:h.ZERO;let e=h.precision,n=Math.max(0,this.exponent+this.digitCount()),t=e+20+n,[i,r]=tn(this,t),s=pa(r),o=i/s,a=i-o*s;if(a<0n&&(o-=1n,a+=s),o>ua||o<-ua)return o>0n?h.POSITIVE_INFINITY:h.ZERO;let u=rn(Or(a,r),r,e),l=u.exponent+Number(o);return Number.isSafeInteger(l)?V(u.significand,l):o>0n?h.POSITIVE_INFINITY:h.ZERO};h.prototype.ln=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.isZero())return h.NEGATIVE_INFINITY;if(this.significand<0n)return h.NAN;if(this.eq(1))return h.ZERO;let e=h.precision,n=this.significand,t=this.digitCount(),i=this.exponent+t-1,r=V(n,-(t-1)),s=Math.abs(i).toString().length,o=0;if(i===0||i===-1){let p=this.sub(h.ONE);if(!p.isZero()){let d=ge(p);d<0&&(o=-d)}}let a=e+20+s+o,[u,l]=tn(r,a),c=pa(l),f=Jr(u,l)+BigInt(i)*c;return rn(f,l,e)};h.prototype.log=function(e){let n=e instanceof h?e:new h(e),t=h.precision;h.precision=t+10;try{return this.ln().div(n.ln()).toPrecision(t)}finally{h.precision=t}};h.exp=function(e){return e.exp()};h.ln=function(e){return e.ln()};h.log10=function(e){return e.log(10)};h.log2=function(e){return e.log(2)};h.prototype.sin=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=h.precision,n=ge(this);if(n<0&&-2*n>=e+4)return this.toPrecision(e);let t=e+15+(n<0?-n:0);if(n+t+30>Vr)return h.NAN;let[i,r]=tn(this,t),[s]=Ri(i,r);return rn(s,r,e)};h.prototype.cos=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ONE;let e=h.precision,n=ge(this),t=0;for(let i=0;;i++){let r=e+15+t;if(n+r+30>Vr)return h.NAN;let[s,o]=tn(this,r),[,a]=Ri(s,o);if(a===0n){if(i>=3)return h.ZERO;t+=e+30;continue}let u=Lr(a,o);if(u<=t+fa||i>=3)return rn(a,o,e);t=u+5}};h.prototype.tan=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=h.precision,n=ge(this);if(n<0&&-2*n>=e+4)return this.toPrecision(e);let t=n<0?-n:0,i=0;for(let r=0;;r++){let s=e+15+t+i;if(n+s+30>Vr)return h.NAN;let[o,a]=tn(this,s),[u,l]=Ri(o,a);if(l===0n){if(r>=3)return u>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;i+=e+30;continue}let c=Math.max(u===0n?0:Lr(u,a),Lr(l,a));if(c<=i+fa||r>=3){let f=(u<<BigInt(a))/l;return rn(f,a,e)}i=c+5}};h.prototype.atan=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite()){let o=h.PI.div(h.TWO);return this.significand>0n?o:o.neg()}let e=h.precision,n=ge(this);if(n<0&&-2*n>=e+4)return this.toPrecision(e);let t=e+15+(n<0?-n:0),[i,r]=tn(this,t),s=Ct(i,r);return rn(s,r,e)};h.prototype.asin=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=this.abs(),n=h.ONE;if(e.gt(n))return h.NAN;if(e.eq(n)){let d=h.PI.div(h.TWO);return this.significand>0n?d:d.neg()}let t=h.precision,i=ge(this);if(i<0&&-2*i>=t+4)return this.toPrecision(t);let r=t+20+(i<0?-i:0),[s,o]=tn(this,r),a=1n<<BigInt(o),u=Ko(s,s,o),l=a-u,c=Ai(l,o),f=Qo(s,c,o),p=Ct(f,o);return rn(p,o,t)};h.prototype.acos=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.abs().gt(h.ONE))return h.NAN;if(this.eq(1))return h.ZERO;if(this.eq(-1))return h.PI;let n=h.precision,t=h.precision;h.precision=n+10;try{let i=h.TWO;if(this.significand>=0n){let s=h.ONE.sub(this).mulToPrecision(h.HALF,n+10).sqrt();return i.mulToPrecision(s.asin(),n)}let r=h.ONE.add(this).mulToPrecision(h.HALF,n+10).sqrt();return h.PI.sub(i.mul(r.asin())).toPrecision(n)}finally{h.precision=t}};h.sin=function(e){return e.sin()};h.cos=function(e){return e.cos()};h.tan=function(e){return e.tan()};h.asin=function(e){return e.asin()};h.acos=function(e){return e.acos()};h.atan=function(e){return e.atan()};h.atan2=function(e,n){let t=e instanceof h?e:new h(e);if(t.isNaN()||n.isNaN())return h.NAN;let i=h.PI,r=i.div(h.TWO);if(n.isZero())return t.isZero()?h.ZERO:t.significand>0n?r:r.neg();let s=t.div(n);return n.significand>0n?s.atan():t.significand>=0n?s.atan().add(i):s.atan().sub(i)};h.prototype.sinh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;let e=h.precision,n=ge(this);if(n<0){if(-2*n>=e+4)return this.toPrecision(e);let r=h.precision;h.precision=e-n+5;try{let s=this.exp();return s.sub(s.inv()).mulToPrecision(h.HALF,e)}finally{h.precision=r}}if(Math.abs(this.toNumber())>1.16*(e+3)){let r=this.abs().exp().div(h.TWO);return this.significand>0n?r:r.neg()}let t=this.exp(),i=t.inv();return t.sub(i).div(h.TWO)};h.prototype.cosh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ONE;if(!this.isFinite())return h.POSITIVE_INFINITY;let e=h.precision;if(Math.abs(this.toNumber())>1.16*(e+3))return this.abs().exp().div(h.TWO);let n=this.exp(),t=n.inv();return n.add(t).div(h.TWO)};h.prototype.tanh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.ONE:h.NEGATIVE_ONE;let e=h.precision,n=ge(this);if(n<0){if(-2*n>=e+4)return this.toPrecision(e);let i=h.precision;h.precision=e-n+5;try{let r=this.mul(h.TWO).exp();return r.sub(h.ONE).div(r.add(h.ONE)).toPrecision(e)}finally{h.precision=i}}if(Math.abs(this.toNumber())>1.16*(e+3))return this.significand>0n?h.ONE:h.NEGATIVE_ONE;let t=this.mul(h.TWO).exp();return t.sub(h.ONE).div(t.add(h.ONE))};h.sinh=function(e){return e.sinh()};h.cosh=function(e){return e.cosh()};h.tanh=function(e){return e.tanh()};h.prototype.expm1=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_ONE;if(this.isZero())return h.ZERO;let e=h.precision,n=ge(this);if(n<0&&-n>=e+2)return this.toPrecision(e);if(n<0){let t=h.precision;h.precision=e-n+5;try{return this.exp().sub(h.ONE).toPrecision(e)}finally{h.precision=t}}return this.exp().sub(h.ONE)};h.prototype.log1p=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.isZero())return h.ZERO;let e=h.ONE.add(this);if(e.isZero())return h.NEGATIVE_INFINITY;if(e.significand<0n)return h.NAN;let n=h.precision,t=ge(this);if(t<0&&-t>=n+2)return this.toPrecision(n);if(t<0){let i=h.precision;h.precision=n-t+5;try{return h.ONE.add(this).ln().toPrecision(n)}finally{h.precision=i}}return h.ONE.add(this).ln()};h.prototype.asinh=function(){if(this.isNaN())return h.NAN;if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;let e=this.significand<0n,n=this.abs(),t=h.precision,i=ge(this);if(i<0&&-2*i>=t+4)return this.toPrecision(t);let r=()=>n.add(n.mul(n).add(h.ONE).sqrt()).ln(),s;if(i<0){let o=h.precision;h.precision=t-i+5;try{s=r().toPrecision(t)}finally{h.precision=o}}else s=r();return e?s.neg():s};h.prototype.acosh=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:h.NAN;if(this.lt(h.ONE))return h.NAN;if(this.eq(1))return h.ZERO;let e=this.sub(h.ONE).div(h.TWO).sqrt();return h.TWO.mul(e.asinh())};h.prototype.atanh=function(){if(this.isNaN())return h.NAN;if(!this.isFinite())return h.NAN;if(this.isZero())return h.ZERO;let e=this.abs();if(e.eq(1))return this.significand>0n?h.POSITIVE_INFINITY:h.NEGATIVE_INFINITY;if(e.gt(h.ONE))return h.NAN;let n=h.precision,t=ge(this);if(-2*t>=n+4)return this.toPrecision(n);let i=h.precision;h.precision=n-t+5;try{return h.ONE.add(this).div(h.ONE.sub(this)).ln().mulToPrecision(h.HALF,n)}finally{h.precision=i}};h.prototype.nthRoot=function(e){if(this.isNaN()||!Number.isInteger(e)||e===0)return h.NAN;if(e===1)return this;if(e===2)return this.sqrt();if(e===3)return this.cbrt();if(e<0)return this.nthRoot(-e).inv();if(this.isZero())return h.ZERO;if(!this.isFinite())return this.significand>0n?h.POSITIVE_INFINITY:e%2===0?h.NAN:h.NEGATIVE_INFINITY;if(this.significand<0n)return e%2===0?h.NAN:this.neg().nthRoot(e).neg();let n=h.precision,t=h.precision;h.precision=n+8;try{return h.exp(this.ln().div(new h(e))).toPrecision(n)}finally{h.precision=t}};h.asinh=function(e){return e.asinh()};h.acosh=function(e){return e.acosh()};h.atanh=function(e){return e.atanh()};h.expm1=function(e){return e.expm1()};h.log1p=function(e){return e.log1p()};h.nthRoot=function(e,n){return e.nthRoot(n)};function la(e){let n=nn(e);if(n<=1023){let u=Math.cbrt(Number(e));if(Number.isFinite(u)&&u>=1)return BigInt(Math.floor(u))}let t=n-51,i=Number(e>>BigInt(t)),r=Math.cbrt(i),s=Math.floor(t/3),o=t%3;o===1&&(r*=1.2599210498948732),o===2&&(r*=1.5874010519681994);let a=BigInt(Math.round(r))<<BigInt(s);return a>0n?a:1n}var Je=class extends Error{cause;value;constructor({message:n,value:t,cause:i}={}){super(n??"Operation canceled"),t&&(this.value=t),this.cause=i,this.name="CancellationError"}};function sn(e){if(e!==void 0&&Date.now()>=e)throw new Je({cause:"timeout",message:"Timeout exceeded"})}var Bi;function Oi(){return Bi}function da(e,n){let t=Bi;Bi=e;try{return n()}finally{Bi=t}}async function Eh(e,n,t){let i=performance.now();for(;;){let r=performance.now(),s=16;for(;performance.now()-r<s;){let{done:o,value:a}=e.next();if(o)return a;if(t?.aborted)throw new Je({value:a,cause:t.reason});if(performance.now()-i>=n)throw new Je({value:a,cause:"timeout",message:`Timeout exceeded (${n}ms)`})}await new Promise(o=>setTimeout(o,0))}}function Th(e,n){let t=Date.now();for(;;){let{done:i,value:r}=e.next();if(i)return r;if(Date.now()-t>=n)throw new Je({value:r,cause:"timeout",message:`Timeout exceeded (${n}ms)`})}}function Uf(e){let n=e;return n!=null&&typeof n=="object"&&"_kind"in n&&typeof n._kind=="string"}function vh(e){return Uf(e)}function T(e){return e?._kind==="number"}function v(e,n){return e?._kind==="symbol"&&(n===void 0||e.symbol===n)}function g(e,n){return(e?._kind==="function"||e?._kind==="tensor")&&(n===void 0||e.operator===n)}function X(e){return e?._kind==="string"}function Cn(e){return e?._kind==="tensor"}function $r(e){return e?._kind==="dictionary"}function Sh(e){return e?.isCollection===!0}function kh(e){return e?.isIndexedCollection===!0}function Ge(e){if(v(e,"ContinuationPlaceholder"))return!0;if(g(e,"Negate")){let n=e;return n.nops===1&&v(n.ops[0],"ContinuationPlaceholder")}return!1}function we(e){return T(e)?e.numericValue:void 0}function Q(e){return e?._kind==="symbol"?e.symbol:void 0}var ma=new Map;function on(e){for(let[n,t]of Object.entries(e))ma.set(n,t)}function ga(e){let n=e===""?"unknown-rule":e,t=ma.get(n);if(t!==void 0)return{id:n,description:t,registered:!0};if(n.startsWith("rubi:")){let i=n.slice(5),r=i.slice(i.lastIndexOf("/")+1),s=r.match(/^([\d.]+)\s?.*#(\d+)$/);return{id:n,description:s?`Apply integration rule ${s[1]}#${s[2]} (Rubi)`:`Apply integration rule ${r} (Rubi)`,registered:!0}}return{id:n,description:Hf(n),registered:!1}}function Hf(e){if(e==="unknown-rule")return"Simplify";if(e.startsWith("fungrim:"))return`Apply identity ${e}`;if(e.includes("->"))return`Apply ${e.replace(/->/g,"\u2192")}`;if(/^[a-z0-9]+(?:[.-][a-z0-9]+)+$/.test(e)){let n=e.replace(/[.-]/g," ");return n[0].toUpperCase()+n.slice(1)}return e[0].toUpperCase()+e.slice(1)}on({"simplify-terms":"Simplify the terms",fu:"Apply trigonometric simplification (Fu algorithm)","exp-to-trig":"Rewrite exponentials as trigonometric functions (Euler\u2019s formula)","simplify-relational-operator":"Simplify both sides of the relation",addition:"Add the terms",multiplication:"Multiply the factors",division:"Divide the terms",negation:"Negate",power:"Evaluate the power",root:"Evaluate the root",sqrt:"Evaluate the square root",rational:"Simplify the fraction",expand:"Expand the expression","cancel common polynomial factors":"Cancel the common factors","partial fraction decomposition":"Decompose into partial fractions","a/a -> 1":"Cancel the common factor: a\u2044a = 1","combined powers":"Combine the powers","combined powers with same base":"Combine powers with the same base","x^n * x^m -> x^{n+m}":"Combine powers with the same base: x\u207F\xB7x\u1D50 = x\u207F\u207A\u1D50","x * x^n -> x^{n+1}":"Combine powers with the same base: x\xB7x\u207F = x\u207F\u207A\xB9","a^m / a^n -> a^{m-n}":"Subtract the exponents: a\u1D50\u2044a\u207F = a\u1D50\u207B\u207F","a^m / a -> a^{m-1}":"Subtract the exponents: a\u1D50\u2044a = a\u1D50\u207B\xB9","a / a^n -> a^{1-n}":"Subtract the exponents: a\u2044a\u207F = a\xB9\u207B\u207F","(-x)^n -> -x^n when n is odd":"Factor out the sign: (\u2212x)\u207F = \u2212x\u207F for odd n","(-x)^n -> x^n when n is even":"Drop the sign: (\u2212x)\u207F = x\u207F for even n","(-x)^{n/m} -> x^{n/m} when n is even and m is odd":"Drop the sign: (\u2212x)\u207F\u141F\u1D50 = x\u207F\u141F\u1D50 for even n and odd m","(-x)^{n/m} -> -x^{n/m} when n and m are odd":"Factor out the sign: (\u2212x)\u207F\u141F\u1D50 = \u2212x\u207F\u141F\u1D50 for odd n and m","root(-a, n) -> -root(a, n) when n odd":"Factor the sign out of the odd root: \u207F\u221A(\u2212a) = \u2212\u207F\u221Aa","a / (b/c)^d -> a * (c/b)^d":"Dividing by (b\u2044c)\u1D48 is multiplying by (c\u2044b)\u1D48","denest \u221A(a+b\u221Ac) -> \u221Ax+\u221Ay":"Denest the radical","sqrt(x^2) -> |x|":"Apply \u221A(x\xB2) = |x|","sqrt(x^{2n}) -> |x|^n":"Apply \u221A(x\xB2\u207F) = |x|\u207F","root(x^n, n) -> x when n odd":"Apply \u207F\u221A(x\u207F) = x for odd n","root(x^n, n) -> |x| when n even":"Apply \u207F\u221A(x\u207F) = |x| for even n","root(x^m, n) -> |x|^{m/n}":"Rewrite the root as a power: \u207F\u221A(x\u1D50) = |x|\u1D50\u141F\u207F","root(1, n) -> 1":"A root of 1 is 1","root(0, n) -> 0 when n > 0":"A root of 0 is 0","root(root(x, m), n) -> x^{1/(m*n)}":"Combine the nested roots: \u207F\u221A(\u1D50\u221Ax) = x^(1\u2044(m\xB7n))","sqrt(sqrt(x)) -> x^{1/4}":"Combine the nested roots: \u221A(\u221Ax) = x^(1\u20444)","root(sqrt(x), n) -> x^{1/(2n)}":"Combine the nested roots: \u207F\u221A(\u221Ax) = x^(1\u2044(2n))","sqrt(root(x, n)) -> x^{1/(2n)}":"Combine the nested roots: \u221A(\u207F\u221Ax) = x^(1\u2044(2n))","root(product, n) -> factored":"Distribute the root over the product",ln:"Simplify the natural logarithm",log:"Simplify the logarithm","combine ln terms":"Combine the logarithms","combine log terms":"Combine the logarithms","e^ln(x) -> x":"Apply e^(ln x) = x: exp and ln are inverses","c^log_c(x) -> x":"Apply c^(log\uA700 x) = x: the exponential and the logarithm are inverses","e^(ln(x) + y) -> x * e^y":"Split the exponent: e^(ln x + y) = x\xB7e\u02B8","e^(ln(x) * y) -> x^y":"Apply e^(y\xB7ln x) = x\u02B8","c^(log_c(x) + y) -> x * c^y":"Split the exponent: c^(log\uA700 x + y) = x\xB7c\u02B8","c^(log_c(x) * y) -> x^y":"Apply c^(y\xB7log\uA700 x) = x\u02B8","ln(e^x * y) -> x + ln(y)":"Expand the logarithm: ln(e\u02E3\xB7y) = x + ln y","log_c(c) -> 1":"The logarithm of the base is 1","log_c(c^x) -> x":"Apply log\uA700(c\u02E3) = x: the logarithm and the exponential are inverses","log_c(c^x * y) -> x + log_c(y)":"Expand the logarithm: log\uA700(c\u02E3\xB7y) = x + log\uA700 y","log_c(c^x / y) -> x - log_c(y)":"Expand the logarithm: log\uA700(c\u02E3\u2044y) = x \u2212 log\uA700 y","log_c(y / c^x) -> log_c(y) - x":"Expand the logarithm: log\uA700(y\u2044c\u02E3) = log\uA700 y \u2212 x","log_c(x^n) -> n*log_c(x)":"Bring the exponent out: log(x\u207F) = n\xB7log x","log_c(x^n) -> n*log_c(|x|) when n even":"Bring the exponent out: log(x\u207F) = n\xB7log|x| for even n","log_c(x^{p/q}) -> (p/q)*log_c(x)":"Bring the exponent out: log(x\u1D56\u141F\u{107A5}) = (p\u2044q)\xB7log x","log_c(x^{p/q}) -> (p/q)*log_c(|x|) when p even":"Bring the exponent out: log(x\u1D56\u141F\u{107A5}) = (p\u2044q)\xB7log|x| for even p","ln(a)/ln(b) -> k when a = b^k":"Recognize the logarithm ratio: ln(b\u1D4F)\u2044ln(b) = k","log_{1/c}(a) -> -log_c(a)":"Invert the base: log\u2081\u2044\uA700(a) = \u2212log\uA700(a)","log_c(a) / log_c(b) -> ln(a) / ln(b)":"Change of base: log\uA700(a)\u2044log\uA700(b) = ln(a)\u2044ln(b)","log_c(a) / ln(a) -> 1/ln(c)":"Change of base: log\uA700(a)\u2044ln(a) = 1\u2044ln(c)","ln(a) / log_c(a) -> ln(c)":"Change of base: ln(a)\u2044log\uA700(a) = ln(c)","log base 0 or 1 -> NaN":"A logarithm base of 0 or 1 is undefined","log_c(0) -> NaN":"The logarithm of 0 is undefined","abs-negate":"Apply |\u2212x| = |x|","|-x| -> |x|":"Apply |\u2212x| = |x|","|x| -> x":"Drop the absolute value: the argument is non-negative","|x| -> -x":"Resolve the absolute value: the argument is non-positive","|xy| -> x|y| when x >= 0":"Move the non-negative factor out of the absolute value","|x/y| -> |x|/y when y >= 0":"Move the non-negative denominator out of the absolute value","|x/y| -> x/|y| when x >= 0":"Move the non-negative numerator out of the absolute value","|x|^n -> x^n when n is even":"Drop the absolute value: |x|\u207F = x\u207F for even n","|x^n| -> x^n when n is even":"Drop the absolute value: x\u207F \u2265 0 for even n","|x^n| -> |x|^n when n is odd":"Move the absolute value onto the base: |x\u207F| = |x|\u207F for odd n","|x|^(p/q) -> x^(p/q) when p is even":"Drop the absolute value: |x|\u1D56\u141F\u{107A5} = x\u1D56\u141F\u{107A5} for even p","|x^(p/q)| -> x^(p/q) when p is even":"Drop the absolute value: x\u1D56\u141F\u{107A5} \u2265 0 for even p","|x^(p/q)| -> |x|^(p/q) when p is odd":"Move the absolute value onto the base: |x\u1D56\u141F\u{107A5}| = |x|\u1D56\u141F\u{107A5} for odd p","sign positive":"The sign of a positive quantity is 1","sign negative":"The sign of a negative quantity is \u22121","sign zero":"The sign of zero is 0","sin\xB2(x) + cos\xB2(x) -> 1":"Apply the Pythagorean identity: sin\xB2x + cos\xB2x = 1","a*sin\xB2(x) + a*cos\xB2(x) -> a":"Apply the Pythagorean identity: sin\xB2x + cos\xB2x = 1","tan\xB2(x) + 1 -> sec\xB2(x)":"Apply the Pythagorean identity: tan\xB2x + 1 = sec\xB2x","1 + cot\xB2(x) -> csc\xB2(x)":"Apply the Pythagorean identity: 1 + cot\xB2x = csc\xB2x","sin(x)cos(y)+cos(x)sin(y) -> sin(x+y)":"Apply the angle-addition identity: sin x cos y + cos x sin y = sin(x + y)","sin(x)cos(y)-cos(x)sin(y) -> sin(x-y)":"Apply the angle-subtraction identity: sin x cos y \u2212 cos x sin y = sin(x \u2212 y)"});on({"solve.move-terms":"Move all terms to one side","solve.simplify":"Simplify the equation","solve.apply-inverse":"Apply the inverse function to both sides","solve.equate-exponents":"The bases are equal, so equate the exponents","solve.apply-tangent":"Take the tangent of both sides to clear the inverse trigonometric functions","solve.clear-denominators":"Multiply through to clear the denominators","solve.square-both-sides":"Square both sides to eliminate the radical","solve.substitute":"Substitute a new variable","solve.substituted-equation":"Rewrite the equation in the substituted variable","solve.back-substitute":"Substitute back to the original variable","solve.factor-zero-product":"A product is zero exactly when one of its factors is zero","solve.harmonize":"Rewrite the equation in an equivalent form","solve.expand":"Expand the equation","solve.quadratic-formula":"Apply the quadratic formula","solve.rational-roots":"Find the rational roots (rational-root theorem)","solve.polynomial-roots":"Find the remaining roots of the polynomial","solve.candidates":"Candidate solutions","solve.validate-roots":"Check each candidate in the original equation; reject the extraneous ones","solve.filter-domain":"Discard solutions outside the domain of the variable","solve.roots":"The solutions","solve.template":"Solve the matched equation pattern","solve.system.eliminate":"Eliminate a variable from the remaining equations","solve.system.back-substitute":"Substitute the known value back to solve for the next variable","solve.system.parametric":"Express the solutions in terms of a free parameter","solve.system.solve-for":"Solve one equation for one variable","solve.system.substitute":"Substitute into the remaining equations","solve.system.product-sum":"Rewrite the sum and product conditions as a quadratic","solve.case":"Consider the next case","solve.system.normalize-inequality":"Rewrite the inequality with zero on the right-hand side","solve.system.intersect-boundaries":"Find the intersection points of the boundary lines","solve.system.vertices":"Keep the corner points that satisfy every inequality","solve.system.check-constraints":"Substitute the candidate solution into each constraint","solve.system.reject":"Reject the candidate: it violates a constraint"});on({"solve.linear-monomial":"A multiple of the unknown is zero when the unknown is zero","solve.reciprocal":"Solve the reciprocal equation","solve.linear":"Isolate the unknown: subtract the constant, then divide by the coefficient","solve.linear-negated":"Isolate the unknown: subtract the constant, then divide by the coefficient","solve.power":"Take the n-th root of both sides","solve.power-negative-root":"Take the n-th root of both sides (negative root)","solve.quadratic-no-constant-zero":"Factor out the unknown: one solution is 0","solve.quadratic-no-constant":"Factor out the unknown and solve the remaining linear factor","solve.quadratic-formula-positive":"Apply the quadratic formula (positive branch)","solve.quadratic-formula-negative":"Apply the quadratic formula (negative branch)","solve.exponential":"Take the logarithm of both sides","solve.exponential-natural":"Take the natural logarithm of both sides","solve.exponential-natural-unit-exponent":"Take the natural logarithm of both sides","solve.exponential-natural-simple":"Take the natural logarithm of both sides","solve.exponential-natural-unit-coefficient":"Take the natural logarithm of both sides","solve.logarithm-base":"Exponentiate both sides to clear the logarithm","solve.logarithm-base-no-constant":"Exponentiate both sides to clear the logarithm","solve.absolute-value-positive":"Resolve the absolute value (positive case)","solve.absolute-value-negative":"Resolve the absolute value (negative case)","solve.quadratic-in-sqrt-positive":"Solve as a quadratic in the square root of the unknown","solve.quadratic-in-sqrt-negative":"Solve as a quadratic in the square root of the unknown","solve.quadratic-in-sqrt-negated-positive":"Solve as a quadratic in the square root of the unknown","solve.quadratic-in-sqrt-negated-negative":"Solve as a quadratic in the square root of the unknown","solve.radical":"Isolate the radical, then square both sides","solve.logarithm-natural-scaled":"Exponentiate both sides to clear the logarithm","solve.logarithm-natural":"Exponentiate both sides to clear the logarithm","solve.sine":"Apply the inverse sine","solve.sine-second-branch":"Apply the inverse sine (second branch: \u03C0 \u2212 arcsin)","solve.sine-unit":"Apply the inverse sine","solve.sine-unit-second-branch":"Apply the inverse sine (second branch: \u03C0 \u2212 arcsin)","solve.cosine":"Apply the inverse cosine","solve.cosine-negative-branch":"Apply the inverse cosine (negative branch)","solve.cosine-unit":"Apply the inverse cosine","solve.cosine-unit-negative-branch":"Apply the inverse cosine (negative branch)","solve.tangent":"Apply the inverse tangent","solve.tangent-unit":"Apply the inverse tangent","solve.cotangent":"Apply the inverse cotangent","solve.cotangent-unit":"Apply the inverse cotangent","solve.sine-cosine-linear-combination":"Rewrite a\xB7sin x + b\xB7cos x as a single sinusoid"});on({"integrate.constant":"The integral of a constant: \u222Bc dx = c\xB7x","integrate.variable":"The integral of the variable: \u222Bx dx = x\xB2/2","integrate.sum":"Integrate term by term: \u222B(u+v) dx = \u222Bu dx + \u222Bv dx","integrate.constant-factor":"Move the constant factor out of the integral","integrate.collected-power":"Integrate the power of the linear expression","integrate.hyperbolic-to-exp":"Rewrite the hyperbolic functions as exponentials","integrate.trig-to-exp":"Rewrite the trigonometric functions as exponentials","integrate.by-parts":"Integrate by parts","integrate.si-ci":"Express the integral with the sine and cosine integral functions Si and Ci","integrate.trig-to-single-exp":"Substitute a single exponential for the trigonometric functions","integrate.exponential-substitution":"Substitute for the exponential and integrate the rational function","integrate.partial-fractions":"Integrate using partial-fraction decomposition","integrate.previous-result":"Use the integral computed earlier","integrate.simplify":"Simplify the result","integrate.antiderivative":"Find the antiderivative of the integrand","integrate.fundamental-theorem":"Apply the Fundamental Theorem of Calculus: \u222B\u1D43\u1D47 f dx = F(b) \u2212 F(a)","integrate.evaluate-bounds":"Evaluate the antiderivative at the bounds"});on({"derivative.sum-rule":"Apply the sum rule: (u + v)\u2032 = u\u2032 + v\u2032","derivative.product-rule":"Apply the product rule: (u\xB7v)\u2032 = u\u2032\xB7v + u\xB7v\u2032","derivative.quotient-rule":"Apply the quotient rule: (u\u2044v)\u2032 = (u\u2032\xB7v \u2212 u\xB7v\u2032)\u2044v\xB2","derivative.power-rule":"Apply the power rule: (u\u207F)\u2032 = n\xB7u\u207F\u207B\xB9\xB7u\u2032","derivative.exponential-rule":"Differentiate the exponential: (a\u1D58)\u2032 = a\u1D58\xB7ln(a)\xB7u\u2032","derivative.general-power-rule":"Differentiate by logarithmic differentiation: (f^g)\u2032 = f^g\xB7(g\u2032\xB7ln f + g\xB7f\u2032\u2044f)","derivative.chain-rule":"Apply the chain rule: f(u)\u2032 = f\u2032(u)\xB7u\u2032","derivative.known-derivative":"Differentiate using a known derivative","derivative.constant-multiple":"Apply the constant-multiple rule: (c\xB7u)\u2032 = c\xB7u\u2032","derivative.rewrite":"Rewrite in an equivalent differentiable form","derivative.expand-definition":"Expand the definition of the function","derivative.zero":"The expression is locally constant: its derivative is 0","derivative.simplify":"Simplify the result"});{let e=["Sin","Tan","Cot","Csc","Sinh","Tanh","Coth","Csch","Arcsin","Arctan","Arccsc","Arsinh","Artanh","Arcsch"],n=["Cos","Sec","Cosh","Sech"],t={};for(let i of e){let r=i.toLowerCase();t[`${i}(-x) -> -${i}(x)`]=`Use the odd symmetry: ${r}(\u2212x) = \u2212${r}(x)`}for(let i of n){let r=i.toLowerCase();t[`${i}(-x) -> ${i}(x)`]=`Use the even symmetry: ${r}(\u2212x) = ${r}(x)`}on(t)}{let e=["Sin","Tan","Cot","Csc","Sinh","Tanh","Coth","Csch","Arcsin","Arctan","Arccot","Arccsc","Arsinh","Artanh","Arcoth","Arcsch"],n=["Cos","Sec","Cosh","Sech"],t={};for(let i of e){let r=i.toLowerCase();t[`|${i}(x)| -> ${i}(|x|) (odd function)`]=`Move the absolute value onto the argument: |${r}(x)| = ${r}(|x|) because ${r} is odd`}for(let i of n){let r=i.toLowerCase();t[`${i}(|x|) -> ${i}(x) (even function)`]=`Drop the absolute value: ${r}(|x|) = ${r}(x) because ${r} is even`}on(t)}on({"Sin(\u03C0 + x) -> -Sin(x)":"Shift the angle by \u03C0: sin(\u03C0 + x) = \u2212sin(x)","Cos(\u03C0 + x) -> -Cos(x)":"Shift the angle by \u03C0: cos(\u03C0 + x) = \u2212cos(x)","Tan(\u03C0 + x) -> Tan(x)":"Use the period \u03C0 of tangent: tan(\u03C0 + x) = tan(x)","Cot(\u03C0 + x) -> Cot(x)":"Use the period \u03C0 of cotangent: cot(\u03C0 + x) = cot(x)","Sec(\u03C0 + x) -> -Sec(x)":"Shift the angle by \u03C0: sec(\u03C0 + x) = \u2212sec(x)","Csc(\u03C0 + x) -> -Csc(x)":"Shift the angle by \u03C0: csc(\u03C0 + x) = \u2212csc(x)","Sin(\u03C0/2 - x) -> Cos(x)":"Apply the cofunction identity: sin(\u03C0\u20442 \u2212 x) = cos(x)","Cos(\u03C0/2 - x) -> Sin(x)":"Apply the cofunction identity: cos(\u03C0\u20442 \u2212 x) = sin(x)","Tan(\u03C0/2 - x) -> Cot(x)":"Apply the cofunction identity: tan(\u03C0\u20442 \u2212 x) = cot(x)","Cot(\u03C0/2 - x) -> Tan(x)":"Apply the cofunction identity: cot(\u03C0\u20442 \u2212 x) = tan(x)","Sec(\u03C0/2 - x) -> Csc(x)":"Apply the cofunction identity: sec(\u03C0\u20442 \u2212 x) = csc(x)","Csc(\u03C0/2 - x) -> Sec(x)":"Apply the cofunction identity: csc(\u03C0\u20442 \u2212 x) = sec(x)"});{let e=["Sin","Cos","Tan","Cot","Sec","Csc","Arcsin","Arccos"],n={};for(let t of e)n[`${t}(infinity) -> NaN`]=`${t.toLowerCase()} has no limit at infinity`;for(let t of["arctan(+inf) -> \u03C0/2","arctan(-inf) -> -\u03C0/2","arccot(+inf) -> 0","arccot(-inf) -> \u03C0","arcsec(\xB1inf) -> \u03C0/2","arccsc(\xB1inf) -> 0","sinh(+inf) -> +inf","sinh(-inf) -> -inf","cosh(+inf) -> +inf","cosh(-inf) -> +inf","tanh(+inf) -> 1","tanh(-inf) -> -1","coth(+inf) -> 1","coth(-inf) -> -1","sech(+inf) -> 0","sech(-inf) -> 0","csch(+inf) -> 0","csch(-inf) -> 0","arsinh(+inf) -> +inf","arsinh(-inf) -> -inf","arcosh(+inf) -> +inf","arcoth(\xB1inf) -> 0","arcsch(\xB1inf) -> 0","ln(+inf) -> +inf","log_c(+inf) -> +inf when c > 1","log_c(+inf) -> -inf when 0 < c < 1","log_c(0) -> -inf when c > 1","log_c(0) -> +inf when 0 < c < 1","log_inf(x) -> 0","root(+inf, n) -> +inf when n > 0"])n[t]="Evaluate the limit at infinity";for(let t of["artanh(\xB1inf) -> NaN","arsech(\xB1inf) -> NaN","arcosh(-inf) -> NaN","log_inf(inf) -> NaN"])n[t]="The value is undefined at infinity";for(let t of["root(x, 0) -> NaN","root(0, n) -> NaN when n <= 0"])n[t]="The root is undefined";on(n)}var A=245,Jt=260,Fe=270,Z=275,q=390,fe=600,Bn=650,Ft=700,On=810;function ha(e){return!("kind"in e)||e.kind==="expression"}function xa(e){return"kind"in e&&e.kind==="symbol"}function Lt(e){return"kind"in e&&e.kind==="matchfix"}function qr(e){return"kind"in e&&e.kind==="infix"}function zr(e){return"kind"in e&&e.kind==="prefix"}function jr(e){return"kind"in e&&e.kind==="postfix"}function ya(e){return"kind"in e&&e.kind==="environment"}function Ji(e,n){return(t,i,r)=>{let s=t.parseExpression({...r,minPrec:n});return s===null?null:["Not",[e,i,s]]}}var Jn=[{latexTrigger:["\\not","<"],kind:"infix",associativity:"any",precedence:246,parse:"NotLess"},{name:"NotLess",latexTrigger:["\\nless"],kind:"infix",associativity:"any",precedence:246},{latexTrigger:["<"],kind:"infix",associativity:"any",precedence:245,parse:"Less"},{name:"Less",latexTrigger:["\\lt"],kind:"infix",associativity:"any",precedence:245},{latexTrigger:["<","="],kind:"infix",associativity:"any",precedence:241,parse:"LessEqual"},{name:"LessEqual",latexTrigger:["\\le"],kind:"infix",associativity:"any",precedence:241},{latexTrigger:["\\leq"],kind:"infix",associativity:"any",precedence:241,parse:"LessEqual"},{latexTrigger:["\\leqslant"],kind:"infix",associativity:"any",precedence:A+5,parse:"LessEqual"},{latexTrigger:["\u2264"],kind:"infix",associativity:"any",precedence:241,parse:"LessEqual"},{latexTrigger:["\u2265"],kind:"infix",associativity:"any",precedence:242,parse:"GreaterEqual"},{latexTrigger:["\u2260"],kind:"infix",associativity:"right",precedence:255,parse:"NotEqual"},{name:"LessNotEqual",latexTrigger:["\\lneqq"],kind:"infix",associativity:"any",precedence:A},{name:"NotLessNotEqual",latexTrigger:["\\nleqq"],kind:"infix",associativity:"any",precedence:A},{name:"LessOverEqual",latexTrigger:["\\leqq"],kind:"infix",associativity:"any",precedence:A+5},{name:"GreaterOverEqual",latexTrigger:["\\geqq"],kind:"infix",associativity:"any",precedence:A+5,parse:"GreaterEqual"},{name:"Equal",latexTrigger:["="],kind:"infix",associativity:"right",precedence:A},{latexTrigger:["*","="],kind:"infix",associativity:"right",precedence:A,parse:"StarEqual"},{name:"StarEqual",latexTrigger:["\\star","="],kind:"infix",associativity:"right",precedence:A},{name:"PlusEqual",latexTrigger:["+","="],kind:"infix",associativity:"right",precedence:A},{name:"MinusEqual",latexTrigger:["-","="],kind:"infix",associativity:"right",precedence:A},{name:"SlashEqual",latexTrigger:["/","="],kind:"infix",associativity:"right",precedence:A},{latexTrigger:["=","="],kind:"infix",associativity:"right",precedence:A,parse:"Equal"},{name:"EqualEqualEqual",latexTrigger:["=","=","="],kind:"infix",associativity:"right",precedence:A+5},{name:"Tilde",latexTrigger:["\\sim"],kind:"infix",associativity:"right",precedence:A},{name:"NotTilde",latexTrigger:["\\nsim"],kind:"infix",associativity:"right",precedence:A},{name:"TildeEqual",latexTrigger:["\\simeq"],kind:"infix",associativity:"right",precedence:A},{name:"TildeFullEqual",latexTrigger:["\\cong"],kind:"infix",associativity:"right",precedence:A},{name:"NotTildeFullEqual",latexTrigger:["\\ncong"],kind:"infix",associativity:"right",precedence:A},{name:"Approx",latexTrigger:["\\approx"],kind:"infix",associativity:"right",precedence:247},{latexTrigger:["\u2248"],kind:"infix",associativity:"right",precedence:247,parse:"Approx"},{name:"NotApprox",latexTrigger:["\\not","\\approx"],kind:"infix",associativity:"right",precedence:247},{name:"ApproxEqual",latexTrigger:["\\approxeq"],kind:"infix",associativity:"right",precedence:A},{name:"NotApproxEqual",latexTrigger:["\\not","\\approxeq"],kind:"infix",associativity:"right",precedence:250},{name:"NotEqual",latexTrigger:["\\ne"],kind:"infix",associativity:"right",precedence:255},{latexTrigger:["\\neq"],kind:"infix",associativity:"right",precedence:255,parse:"NotEqual"},{latexTrigger:["\\not","="],kind:"infix",associativity:"right",precedence:255,parse:"NotEqual"},{latexTrigger:["\\not","\\le"],kind:"infix",associativity:"right",precedence:241,parse:Ji("LessEqual",241)},{latexTrigger:["\\not","\\leq"],kind:"infix",associativity:"right",precedence:241,parse:Ji("LessEqual",241)},{latexTrigger:["\\not","\\ge"],kind:"infix",associativity:"right",precedence:242,parse:Ji("GreaterEqual",242)},{latexTrigger:["\\not","\\geq"],kind:"infix",associativity:"right",precedence:242,parse:Ji("GreaterEqual",242)},{name:"Unequal",latexTrigger:["!","="],kind:"infix",associativity:"right",precedence:A,parse:"NotEqual"},{name:"GreaterEqual",latexTrigger:["\\ge"],kind:"infix",associativity:"right",precedence:242},{latexTrigger:["\\geq"],kind:"infix",associativity:"right",precedence:242,parse:"GreaterEqual"},{latexTrigger:[">","="],kind:"infix",associativity:"right",precedence:243,parse:"GreaterEqual"},{latexTrigger:["\\geqslant"],kind:"infix",associativity:"right",precedence:A+5,parse:"GreaterEqual"},{name:"GreaterNotEqual",latexTrigger:["\\gneqq"],kind:"infix",associativity:"right",precedence:A},{name:"NotGreaterNotEqual",latexTrigger:["\\ngeqq"],kind:"infix",associativity:"right",precedence:A},{latexTrigger:[">"],kind:"infix",associativity:"right",precedence:245,parse:"Greater"},{name:"Greater",latexTrigger:["\\gt"],kind:"infix",associativity:"right",precedence:245},{name:"NotGreater",latexTrigger:["\\ngtr"],kind:"infix",associativity:"right",precedence:244},{latexTrigger:["\\not",">"],kind:"infix",associativity:"right",precedence:244,parse:"NotGreater"},{name:"RingEqual",latexTrigger:["\\circeq"],kind:"infix",associativity:"right",precedence:A},{name:"TriangleEqual",latexTrigger:["\\triangleq"],kind:"infix",associativity:"right",precedence:A},{name:"DotEqual",latexTrigger:["\\doteq"],kind:"infix",associativity:"right",precedence:A+5},{name:"DotEqualDot",latexTrigger:["\\doteqdot"],kind:"infix",associativity:"right",precedence:A+5},{name:"FallingDotEqual",latexTrigger:["\\fallingdotseq"],kind:"infix",associativity:"right",precedence:A+5},{name:"RisingDotEqual",latexTrigger:["\\fallingdotseq"],kind:"infix",associativity:"right",precedence:A+5},{name:"QuestionEqual",latexTrigger:["\\questeq"],kind:"infix",associativity:"right",precedence:A},{name:"MuchLess",latexTrigger:["\\ll"],kind:"infix",associativity:"right",precedence:A},{name:"MuchGreater",latexTrigger:["\\gg"],kind:"infix",associativity:"right",precedence:A},{name:"Precedes",latexTrigger:["\\prec"],kind:"infix",associativity:"right",precedence:A},{name:"Succeeds",latexTrigger:["\\succ"],kind:"infix",associativity:"right",precedence:A},{name:"PrecedesEqual",latexTrigger:["\\preccurlyeq"],kind:"infix",associativity:"right",precedence:A},{name:"SucceedsEqual",latexTrigger:["\\curlyeqprec"],kind:"infix",associativity:"right",precedence:A},{name:"NotPrecedes",latexTrigger:["\\nprec"],kind:"infix",associativity:"right",precedence:A},{name:"NotSucceeds",latexTrigger:["\\nsucc"],kind:"infix",associativity:"right",precedence:A},{name:"Between",latexTrigger:["\\between"],kind:"infix",associativity:"right",precedence:A+5}];var Vt=["Error","'missing'"];function Te(e){return!!(typeof e=="number"||En(e)||typeof e=="string"&&ot(e))}function En(e){return e!==null&&typeof e=="object"&&"num"in e}function it(e){return e!==null&&typeof e=="object"&&"sym"in e}function Ur(e){return e!==null&&typeof e=="object"&&"str"in e}function Ta(e){return e!==null&&typeof e=="object"&&"dict"in e&&typeof e.dict=="object"&&!Array.isArray(e.dict)&&e.dict!==null}function rt(e){return e!==null&&typeof e=="object"&&"fn"in e&&Array.isArray(e.fn)&&e.fn.length>0&&typeof e.fn[0]=="string"}function Wf(e){return e!==null&&typeof e=="object"&&("fn"in e||"num"in e||"sym"in e||"str"in e)}function _h(e){return Wf(e)&&(e.latex!==void 0||e.wikidata!==void 0||e.sourceOffsets!==void 0)}function B(e){return e==null?null:typeof e=="object"&&"str"in e?e.str:typeof e!="string"?null:e.length>=2&&e.at(0)==="'"&&e.at(-1)==="'"?e.substring(1,e.length-1):ot(e)||$t(e)?null:e}function Hr(e){if(e==null||B(e)!==null)return null;let n=y(e);return n?[n,...E(e).map(t=>Hr(t)).filter(t=>t!==null)]:e}function y(e){return Array.isArray(e)?e[0]:e==null?"":rt(e)?e.fn[0]:""}function E(e){return Array.isArray(e)?e.slice(1):e!==void 0&&rt(e)?e.fn.slice(1):[]}function m(e,n){return Array.isArray(e)?e[n]??null:e===null||!rt(e)?null:e.fn[n]??null}function J(e){return e==null?0:Array.isArray(e)?Math.max(0,e.length-1):rt(e)?Math.max(0,e.fn.length-1):0}function Wr(e){return e==null?null:y(e)==="Hold"?m(e,1):e}function S(e){return typeof e=="string"&&$t(e)?e.length>=2&&e.at(0)==="`"&&e.at(-1)==="`"?e.slice(1,-1):e:e==null?null:it(e)?e.sym:null}function ba(e){let n=y(e);if(n==="KeyValuePair"||n==="Tuple"||n==="Pair"){let[t,i]=E(e),r=B(t);return r?[r,i??"Nothing"]:null}return null}function Yr(e){if(e===null)return null;if(Ta(e))return e;let n=ba(e);if(n)return{dict:{[n[0]]:Ea(n[1])??"Nothing"}};if(y(e)==="Dictionary"){let t={};for(let i of E(e)){let r=ba(i);r&&(t[r[0]]=Ea(r[1])??"Nothing")}return{dict:t}}return null}function Fi(e){return{dict:Object.fromEntries(Object.entries(e).map(([t,i])=>[t,Zr(i)??"Nothing"]))}}function Yf(e){if(e=e.toLowerCase().replace(/[nd]$/,"").replace(/[\u0009-\u000d\u0020\u00a0]/g,""),e==="nan")return NaN;if(/^(infinity|\+infinity|oo|\+oo)$/i.test(e))return 1/0;if(/^(-infinity|-oo)$/.test(e))return-1/0;if(/\([0-9]+\)/.test(e)){let[n,t,i,r]=e.match(/(.+)\(([0-9]+)\)(.*)$/)??[];e=t+i.repeat(Math.ceil(16/i.length))+(r??"")}return parseFloat(e)}function P(e){return typeof e=="number"?e:typeof e=="string"&&ot(e)?Yf(e):e!==void 0&&En(e)?P(e.num):null}function Fn(e){if(e==null)return null;if(S(e)==="Half")return[1,2];let n=y(e);if(!n)return null;let t=null,i=null;if(n==="Negate"){let r=Fn(E(e)[0]);if(r)return[-r[0],r[1]]}if(n==="Rational"||n==="Divide"){let[r,s]=E(e);t=P(r)??NaN,i=P(s)??NaN}if(n==="Power"){let[r,s]=E(e),o=P(s);o===1?(t=P(r),i=1):o===-1&&(t=1,i=P(r))}if(n==="Multiply"){let[r,s]=E(e);if(y(s)==="Power"){let[o,a]=E(s);P(a)===-1&&(t=P(r),i=P(o))}}return t===null||i===null?null:Number.isInteger(t)&&Number.isInteger(i)?[t,i]:null}function Li(e,n){let t=null;if(Array.isArray(e)&&(t=e),rt(e)&&(t=e.fn),t===null)return[];let i=1,r=[];for(;i<t.length;)r.push(n(t[i])),i+=1;return r}function Ln(e,n,t){let i=y(n),r=y(t);return i===e&&r===e?[e,...E(n),...E(t)]:i===e?[e,...E(n),t]:r===e?[e,n,...E(t)]:[e,n,t]}function an(e){if(e==null)return null;let n=y(e);if(n==="Delimiter"){if(e=m(e,1),e===null)return[];if(n=y(e),n!=="Sequence")return[e]}return n!=="Sequence"?null:E(e)}function F(e){return e==null||e==="Nothing"?!0:y(e)==="Sequence"&&J(e)===0}function O(e){return F(e)?Vt:e}function Gr(e){return e[0]==="Square"?Gr(e.slice(1))+2:e.reduce((n,t)=>n+st(t),0)}function st(e){if(e===null)return 0;if(typeof e=="number"||typeof e=="string"||Te(e)||it(e)||Ur(e))return 1;if(Array.isArray(e))return Gr(e);if("fn"in e)return Gr(e.fn);let n=Yr(e);if(n){let t=n,i=Object.keys(t);return 1+i.length+i.reduce((r,s)=>r+st(t[s]),0)}return 0}function ot(e){return/^(nan|oo|\+oo|-oo|infinity|\+infinity|-infinity)$/i.test(e)||/^[+-]?(0|[1-9][0-9]*)(\.([0-9]+(\([0-9]+\))?|\([0-9]+\)))?([eE][+-]?[0-9]+)?$/.test(e)}function $t(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)||e.length>=2&&e[0]==="`"&&e[e.length-1]==="`"}function Na(e){return e.length>=2&&e[0]==="'"&&e[e.length-1]==="'"?!0:!ot(e)&&!$t(e)}function Zr(e){if(typeof e=="string")return{str:e};if(typeof e=="number")return{num:e.toString()};if(typeof e=="boolean")return e?"True":"False";if(Array.isArray(e))return["List",...e.map(n=>Zr(n)??"Nothing")];if(e===null)return null;if(typeof e=="object"){let n={};for(let t in e)n[t]=Zr(e[t])??"Nothing";return{dict:n}}return rt(e)||it(e)||En(e)||Ur(e)||Ta(e)?e:null}function Ea(e){return e==null?null:Ur(e)?e.str:En(e)?parseFloat(e.num):it(e)?e.sym:typeof e=="string"||typeof e=="number"?e:Array.isArray(e)?{fn:e}:e}function Xf(e){let n=e.index;e.skipVisualSpace();let t=!1;return e.match("(")&&(e.skipVisualSpace(),t=e.peek==="\\bmod"||e.peek==="\\pmod"||e.peek==="\\mod"||e.matchAll(["m","o","d"])),e.index=n,t}function Kf(e,n){let t=e.index;if(e.skipVisualSpace(),e.match("(")){if(e.skipVisualSpace(),e.match("\\bmod")||e.match("\\pmod")||e.match("\\mod")||e.matchAll(["m","o","d"])){e.skipVisualSpace();let s=e.parseExpression({...n,minPrec:0})??e.parseGroup();if(e.skipVisualSpace(),s!==null&&e.match(")"))return s}return e.index=t,null}let i=e.parseExpression({...n,minPrec:On});if(i!==null&&y(i)==="Mod"){let r=J(i)>=2?m(i,2):m(i,1);if(r!==null)return r}return e.index=t,null}function qt(e,n,t){let i=e.parseExpression({...t,minPrec:A,condition:s=>Xf(s)||(t.condition?.(s)??!1)}),r=Kf(e,t);return r!==null?y(n)==="Congruent"?["And",n,["Congruent",O(m(n,2)),O(i),r]]:["Congruent",n,O(i),r]:["Equivalent",n,O(i)]}var Sa=[{name:"True",kind:"symbol",latexTrigger:["\\top"]},{kind:"symbol",latexTrigger:"\\mathrm{True}",parse:"True"},{kind:"symbol",latexTrigger:"\\operatorname{True}",parse:"True"},{kind:"symbol",latexTrigger:"\\mathsf{T}",parse:"True"},{name:"False",kind:"symbol",latexTrigger:["\\bot"]},{kind:"symbol",latexTrigger:"\\operatorname{False}",parse:"False"},{kind:"symbol",latexTrigger:"\\mathsf{F}",parse:"False"},{name:"And",kind:"infix",latexTrigger:["\\land"],precedence:235},{kind:"infix",latexTrigger:["\\wedge"],parse:"And",precedence:235},{kind:"infix",latexTrigger:"\\&",parse:"And",precedence:235},{kind:"infix",latexTrigger:"\\operatorname{and}",parse:"And",precedence:235},{name:"Or",kind:"infix",latexTrigger:["\\lor"],precedence:230},{kind:"infix",latexTrigger:["\\vee"],parse:"Or",precedence:230},{kind:"infix",latexTrigger:"\\operatorname{or}",parse:"Or",precedence:230},{name:"Xor",kind:"infix",latexTrigger:["\\veebar"],precedence:232},{name:"Not",kind:"prefix",latexTrigger:["\\lnot"],precedence:880},{kind:"prefix",latexTrigger:["\\neg"],parse:"Not",precedence:880},{name:"Nand",kind:"infix",latexTrigger:["\\barwedge"],precedence:232},{name:"Nor",kind:"infix",latexTrigger:["\u22BD"],precedence:232},{kind:"function",symbolTrigger:"and",parse:"And"},{kind:"function",symbolTrigger:"or",parse:"Or"},{kind:"function",symbolTrigger:"not",parse:"Not"},{name:"Implies",kind:"infix",precedence:220,associativity:"right",latexTrigger:["\\implies"],serialize:"\\implies"},{latexTrigger:["\\Rightarrow"],kind:"infix",precedence:220,associativity:"right",parse:"Implies"},{latexTrigger:["\\Longrightarrow"],kind:"infix",precedence:220,associativity:"right",parse:"Implies"},{latexTrigger:["\\longrightarrow"],kind:"infix",precedence:220,associativity:"right",parse:"Implies"},{latexTrigger:["=",">"],kind:"infix",precedence:220,associativity:"right",parse:(e,n,t)=>{if(e.options.strict!==!1)return null;let i=e.parseExpression({...t,minPrec:220});return i===null?null:["Implies",n,i]}},{name:"Equivalent",latexTrigger:["\\iff"],kind:"infix",associativity:"right",precedence:219},{latexTrigger:["\\Leftrightarrow"],kind:"infix",associativity:"right",precedence:219,parse:"Equivalent"},{latexTrigger:["\\leftrightarrow"],kind:"infix",associativity:"right",precedence:219,parse:"Equivalent"},{latexTrigger:["\\Longleftrightarrow"],kind:"infix",associativity:"right",precedence:219,parse:"Equivalent"},{latexTrigger:["\\longleftrightarrow"],kind:"infix",associativity:"right",precedence:219,parse:"Equivalent"},{latexTrigger:["<","=",">"],kind:"infix",precedence:219,associativity:"right",parse:(e,n,t)=>{if(e.options.strict!==!1)return null;let i=e.parseExpression({...t,minPrec:219});return i===null?null:["Equivalent",n,i]}},{latexTrigger:["\\equiv"],kind:"infix",associativity:"right",precedence:A,parse:qt},{latexTrigger:["\u2261"],kind:"infix",associativity:"right",precedence:A,parse:qt},{latexTrigger:["\\equiv"],kind:"prefix",precedence:A,parse:(e,n)=>qt(e,e.error("missing",e.index),n??{minPrec:0})},{latexTrigger:["\\not","\\equiv"],kind:"infix",associativity:"right",precedence:A,parse:(e,n,t)=>["Not",qt(e,n,t)]},{latexTrigger:["\u2262"],kind:"infix",associativity:"right",precedence:A,parse:(e,n,t)=>["Not",qt(e,n,t)]},{latexTrigger:["\\pmod"],kind:"infix",precedence:A-1,parse:(e,n)=>{let t=e.parseGroup()??e.parseToken();return["Mod",n,O(t)]}},{name:"Proves",kind:"infix",latexTrigger:["\\vdash"],precedence:220,associativity:"right",serialize:"\\vdash"},{name:"Entails",kind:"infix",latexTrigger:["\\vDash"],precedence:220,associativity:"right",serialize:"\\vDash"},{name:"Satisfies",kind:"infix",latexTrigger:["\\models"],precedence:220,associativity:"right",serialize:"\\models"},{name:"ForAll",kind:"prefix",latexTrigger:["\\forall"],precedence:200,serialize:zt("\\forall"),parse:Tn("ForAll")},{name:"Exists",kind:"prefix",latexTrigger:["\\exists"],precedence:200,serialize:zt("\\exists"),parse:Tn("Exists")},{name:"ExistsUnique",kind:"prefix",latexTrigger:["\\exists","!"],precedence:200,serialize:zt("\\exists!"),parse:Tn("ExistsUnique")},{name:"NotForAll",kind:"prefix",latexTrigger:["\\lnot","\\forall"],precedence:200,serialize:zt("\\lnot\\forall"),parse:Tn("NotForAll")},{name:"NotExists",kind:"prefix",latexTrigger:["\\lnot","\\exists"],precedence:200,serialize:zt("\\lnot\\exists"),parse:Tn("NotExists")},{name:"KroneckerDelta",kind:"prefix",latexTrigger:["\\delta","_"],precedence:200,serialize:(e,n)=>{let t=E(n);return t.length===0?"\\delta":t.every(i=>S(i))?`\\delta_{${t.map(i=>e.serialize(i)).join("")}}`:`\\delta_{${t.map(i=>e.serialize(i)).join(", ")}}`},parse:e=>{let n=e.parseGroup();if(n===null){let i=e.parseToken();return i?["KroneckerDelta",i]:null}let t=an(n);return t&&t.length<=2?["KroneckerDelta",...t]:y(n)==="InvisibleOperator"?["KroneckerDelta",...E(n)]:n!==null?["KroneckerDelta",n]:null}},{name:"Boole",kind:"matchfix",openTrigger:"[",closeTrigger:"]",parse:(e,n)=>{let t=y(n);return!t||!Jn.some(i=>i.name===t)?null:["Boole",n]}},{kind:"matchfix",openTrigger:"\\llbracket",closeTrigger:"\\rrbracket",parse:(e,n)=>{let t=y(n);return!t||!Jn.some(i=>i.name===t)?null:["Boole",n]}},{name:"Predicate",serialize:(e,n)=>{let t=E(n);if(t.length===0)return"";let i=t[0],r=typeof i=="string"?i:e.serialize(i);if(t.length===1)return r;let s=t.slice(1).map(o=>e.serialize(o));return`${r}(${s.join(", ")})`}}];function zt(e){return(n,t)=>{let i=E(t);if(i.length===0)return e;if(i.length===1)return`${e} ${n.serialize(i[0])}`;let r=n.serialize(i[0]),s=n.serialize(i[1]);return`${e} ${r}, ${s}`}}function va(e,n){return e.peek==="\\to"||e.peek==="\\rightarrow"||e.peek==="\\implies"||e.peek==="\\Rightarrow"||e.peek==="\\iff"||e.peek==="\\Leftrightarrow"||e.peek==="\\land"||e.peek==="\\wedge"||e.peek==="\\lor"||e.peek==="\\vee"||(n?.condition?.(e)??!1)}function Tn(e){return(n,t)=>{let i=n.index,r=n.diagnosticsCheckpoint(),s=n.options.quantifierScope!=="loose",o=n.parseSymbol(t),a=typeof o=="string"?o:null;if(o){if(n.skipSpace(),n.match(",")||n.match("\\mid")||n.match(".")||n.match(":")||n.match("\\colon")){let f=s?{...t,condition:d=>va(d,t)}:t;n.enterQuantifierScope();let p=n.parseExpression(f);return n.exitQuantifierScope(),a&&n.pruneUndeclared([a],r),[e,o,O(p)]}n.enterQuantifierScope();let c=n.parseEnclosure();if(n.exitQuantifierScope(),c)return a&&n.pruneUndeclared([a],r),[e,o,O(c)]}n.index=i;let u={...t,condition:c=>c.peek===":"||c.peek==="\\colon"||(t?.condition?.(c)??!1)},l=n.parseExpression(u);if(l===null)return null;if(n.skipSpace(),n.matchAny([",","\\mid",":","\\colon"])){let c=s?{...t,condition:p=>va(p,t)}:t;n.enterQuantifierScope();let f=n.parseExpression(c);return n.exitQuantifierScope(),[e,l,O(f)]}if(n.match("(")){n.enterQuantifierScope();let c=n.parseExpression(t);return n.exitQuantifierScope(),n.match(")")?[e,l,O(c)]:null}return y(l)!==""?[e,l,"True"]:null}}function Qf(e){let n=[];for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);if(i>=55296&&i<=56319){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343){let s=i-55296,o=r-56320;i=2**16+s*2**10+o,t++}}n.push(i)}return n}var Vi=8205,ka=[127462,127487];function Ia(e){return e===Vi||e===65038||e===65039||e>=127995&&e<=128e3||e>=129456&&e<=129460||e>=917536&&e<=917632}function ep(e){return e>=ka[0]&&e<=ka[1]}function Ma(e){if(/^[\u0020-\u00FF]*$/.test(e))return e;let n=[],t=Qf(e),i=0;for(;i<t.length;){let r=t[i++],s=t[i];if(s===Vi){let o=i-1;for(i+=2;t[i]===Vi;)i+=2;n.push(String.fromCodePoint(...t.slice(o,i)))}else if(Ia(s)){let o=i-1;for(;Ia(t[i]);)i+=t[i]===Vi?2:1;n.push(String.fromCodePoint(...t.slice(o,i)))}else ep(r)?(i+=1,n.push(String.fromCodePoint(...t.slice(i-2,i)))):n.push(String.fromCodePoint(r))}return n}var np={"\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u207B":"-","\u2071":"i",\u207F:"n"},tp={"\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u208B":"-"},wa=new Map;function ip(e){let n=wa.get(e.source);if(!n){let t=e.source.startsWith("^")?e.source.slice(1):e.source;n=new RegExp(t,"y"),wa.set(e.source,n)}return n}var Xr=class{s;pos;joined;offsets=null;obeyspaces=!1;constructor(n){if(n=n.normalize("NFC"),n=n.replace(/[\u200E\u200F\u2066-\u2069\u202A-\u202E]/g,""),n=n.replace(/\u2212/g,"-"),n=n.replace(/[⁰¹²³⁴⁵⁶⁷⁸⁹⁻ⁱⁿ]+/g,t=>`^{${Array.from(t).map(r=>np[r]).join("")}}`),n=n.replace(/[₀₁₂₃₄₅₆₇₈₉₋]+/g,t=>`_{${Array.from(t).map(r=>tp[r]).join("")}}`),this.s=Ma(n),this.pos=0,typeof this.s=="string")this.joined=this.s;else{this.joined=this.s.join("");let t=new Array(this.s.length+1),i=0;for(let r=0;r<this.s.length;r++)t[r]=i,i+=this.s[r].length;t[this.s.length]=i,this.offsets=t}}end(){return this.pos>=this.s.length}get(){return this.pos<this.s.length?this.s[this.pos++]:""}peek(){return this.s[this.pos]}match(n){let t=ip(n);typeof this.s=="string"?t.lastIndex=this.pos:t.lastIndex=this.offsets[this.pos<this.s.length?this.pos:this.s.length];let i=t.exec(this.joined);return i?.[0]?(this.pos+=i[0].length,i[0]):null}next(){if(this.end())return null;if(!this.obeyspaces&&this.match(/^[ \f\n\r\t\v\xA0\u2028\u2029]+/))return"<space>";if(this.obeyspaces&&this.match(/^[ \f\n\r\t\v\xA0\u2028\u2029]/))return"<space>";let n=this.get();if(n==="\\"){if(!this.end()){let t=this.match(/^[a-zA-Z]+/);if(t)this.match(/^[ \f\n\r\t\v\xA0\u2028\u2029]*/);else if(t=this.get(),t===" ")return"<space>";return"\\"+t}}else{if(n==="{")return"<{>";if(n==="}")return"<}>";if(n==="^"){if(this.peek()==="^"){this.get();let t=this.match(/^(\^(\^(\^(\^[0-9a-f])?[0-9a-f])?[0-9a-f])?[0-9a-f])?[0-9a-f][0-9a-f]/);if(t)return String.fromCodePoint(parseInt(t.slice(t.lastIndexOf("^")+1),16))}return n}else if(n==="#"){if(!this.end()){let t=!1;if(/[0-9?]/.test(this.peek())&&(t=!0,this.pos+1<this.s.length)){let i=this.s[this.pos+1];t=/[^0-9A-Za-z]/.test(i)}return t?"#"+this.get():"#"}}else if(n==="$")return this.peek()==="$"?(this.get(),"<$$>"):"<$>"}return n}};function rp(e,n){let t=e.next();if(!t)return[];let i=[];if(t!=="\\relax"){if(t==="\\noexpand")t=e.next(),t&&i.push(t);else if(t==="\\obeyspaces")e.obeyspaces=!0;else if(t==="\\space"||t==="~")i.push("<space>");else if(t==="\\bgroup")i.push("<{>");else if(t==="\\egroup")i.push("<}>");else if(t==="\\string")t=e.next(),t&&(t[0]==="\\"?Array.from(t).forEach(r=>i.push(r==="\\"?"\\backslash":r)):t==="<{>"?i.push("\\{"):t==="<space>"?i.push("~"):t==="<}>"&&i.push("\\}"));else if(t==="\\csname"){let r="",s=!1,o=[];do o.length===0&&(t=e.next(),o=t?[t]:[]),s=o.length===0,!s&&t==="\\endcsname"&&(s=!0,o.shift()),s||(s=t==="<$>"||t==="<$$>"||t==="<{>"||t==="<}>"||!!t&&t.length>1&&t[0]==="\\"),s||(r+=o.shift());while(!s);r&&i.push("\\"+r),i=i.concat(o)}else if(t!=="\\endcsname")if(t.length>1&&t[0]==="#"){let r=t.slice(1),s=n;i=i.concat(re(s?.[r]??s?.["?"]??"\\placeholder{}",n))}else i.push(t)}return i}function re(e,n=[],t){let r=e.toString().split(/(\r?\n)/),s="",o="",a=0;for(let c=0;c<r.length;c+=2){let f=r[c],p=r[c+1]??"";s+=o,o=" ";let d=f.match(/((?:\\%)|[^%])*/);if(d!==null&&(s+=d[0],t!==void 0&&d[0].length<f.length)){let x=a+d[0].length,b=a+f.length;t.push({start:x,end:b,discardedLength:f.length-d[0].length})}a+=f.length+p.length}let u=new Xr(s),l=[];do l.push(...rp(u,n));while(!u.end());return l}function $i(e){return re(e).length}function k(e){let n="",t="";for(let i of e)i!=null&&(typeof i=="string"&&(/[a-zA-Z]/.test(i[0])&&(t+=n),/\\[a-zA-Z]+\*?$/.test(i)?n=" ":n=""),t+=i.toString());return t}function un(e,n,t){return n.includes(e)&&(n=`{${n}}`),/^[0-9]$/.test(t)?`${n}${e}${t}`:`${n}${e}{${t}}`}function Le(e){let n=[];if(Array.isArray(e))for(let i of e)if(Array.isArray(i))for(let r of i)n.push(r);else n.push(i);else n=[e];return k(n.map(i=>({"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"})[i]??i))}function Da(e){return typeof e=="string"?e.startsWith("$")&&e.endsWith("$"):!1}function sp(e){if(typeof e=="number")return e.toString();if(typeof e=="string"){let n=e.trim();if(n.startsWith("$$")&&n.endsWith("$$"))return n.slice(2,-2);if(n.startsWith("$")&&n.endsWith("$"))return n.slice(1,-1)}return Array.isArray(e)?sp(k(e)):null}function Pa(e){return typeof e!="string"?!1:Jn.some(n=>n.name===e)}function qi(e){return typeof e!="string"?!1:["Less","LessEqual","Greater","GreaterEqual"].includes(e)}function zi(e){return typeof e!="string"?!1:["Equal","NotEqual"].includes(e)}var ji=["number","finite_number","complex","finite_complex","imaginary","real","finite_real","rational","finite_rational","integer","finite_integer","non_finite_number"],Kr=["indexed_collection","list","tuple"],Gi=[...Kr,"collection","set","record","dictionary"],Zi=["scalar",...ji,"boolean","string"],Qr=["value","color",...Gi,...Zi],es=["expression","symbol","function",...Qr],ns=["any","unknown","nothing","never","error",...es],Ui=new Set(ji),Aa=new Set(Gi),_a=new Set(Zi),Vn=new Set(ns);function jh(e){return typeof e!="string"?!1:Vn.has(e)}function jt(e){return typeof e=="string"?Vn.has(e):typeof e!="object"||!("kind"in e)?!1:e.kind==="signature"||e.kind==="union"||e.kind==="intersection"||e.kind==="negation"||e.kind==="value"||e.kind==="tuple"||e.kind==="list"||e.kind==="record"||e.kind==="dictionary"||e.kind==="set"||e.kind==="broadcastable"||e.kind==="symbol"||e.kind==="expression"||e.kind==="numeric"||e.kind==="collection"||e.kind==="indexed_collection"||e.kind==="reference"}var Hi=class{input;pos=0;line=1;column=1;tokens=[];tolerant;constructor(n,t){this.input=n,this.tolerant=t?.tolerant??!1}saveState(){return{pos:this.pos,line:this.line,column:this.column,tokens:[...this.tokens]}}restoreState(n){this.pos=n.pos,this.line=n.line,this.column=n.column,this.tokens=n.tokens}error(n){throw new Error(`Lexer error at line ${this.line}, column ${this.column}: ${n}`)}peek(n=0){let t=this.pos+n;return t<this.input.length?this.input[t]:""}advance(){let n=this.input[this.pos++];return n===`
|
|
3
3
|
`?(this.line++,this.column=1):this.column++,n}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){for(let t=0;t<n.length;t++)this.advance();return!0}return!1}isEOF(){return this.pos>=this.input.length}skipWhitespace(){for(;!this.isEOF()&&/\s/.test(this.peek());)this.advance()}readIdentifier(){let n="";for(;!this.isEOF()&&/[a-zA-Z0-9_]/.test(this.peek());)n+=this.advance();return n}readVerbatimString(){if(!this.match("`"))return"";let n="";for(;!this.isEOF()&&this.peek()!=="`";)this.match("\\`")?n+="`":this.match("\\\\")?n+="\\":n+=this.advance();return this.isEOF()&&this.error("Unterminated verbatim string"),this.advance(),n}readStringLiteral(){let n=this.advance(),t="";for(;!this.isEOF()&&this.peek()!==n;)this.match("\\"+n)?t+=n:this.match("\\\\")?t+="\\":t+=this.advance();return this.isEOF()&&this.error("Unterminated string literal"),this.advance(),t}readNumber(){let n="";if((this.peek()==="-"||this.peek()==="+")&&(n+=this.advance()),this.match("0x")||this.match("0X")){for(n+="x";!this.isEOF()&&/[0-9a-fA-F]/.test(this.peek());)n+=this.advance();return"0"+n}if(this.match("0b")||this.match("0B")){for(n+="b";!this.isEOF()&&/[01]/.test(this.peek());)n+=this.advance();return"0"+n}for(;!this.isEOF()&&/[0-9]/.test(this.peek());)n+=this.advance();if(this.peek()==="."&&/[0-9]/.test(this.peek(1)))for(n+=this.advance();!this.isEOF()&&/[0-9]/.test(this.peek());)n+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(n+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(n+=this.advance());!this.isEOF()&&/[0-9]/.test(this.peek());)n+=this.advance();return n}createToken(n,t){return{type:n,value:t,position:this.pos-t.length,line:this.line,column:this.column-t.length}}nextToken(){if(this.skipWhitespace(),this.isEOF())return this.createToken("EOF","");let n=this.pos,t=this.peek();if(this.match("->"))return this.createToken("->","->");if(this.match(".."))return this.createToken("..","..");if(this.match("+\u221E")||this.match("+oo"))return this.createToken("PLUS_INFINITY",this.input.slice(n,this.pos));if(this.match("-\u221E")||this.match("-oo"))return this.createToken("MINUS_INFINITY",this.input.slice(n,this.pos));if(this.match("+infinity"))return this.createToken("PLUS_INFINITY","+infinity");if(this.match("-infinity"))return this.createToken("MINUS_INFINITY","-infinity");if(/[a-zA-Z_]/.test(t)){let i=this.readIdentifier();switch(i){case"true":return this.createToken("TRUE",i);case"false":return this.createToken("FALSE",i);case"nan":return this.createToken("NAN",i);case"infinity":return this.createToken("INFINITY",i);case"oo":return this.createToken("INFINITY",i);default:return this.createToken("IDENTIFIER",i)}}switch(t){case"|":return this.advance(),this.createToken("|","|");case"&":return this.advance(),this.createToken("&","&");case"!":return this.advance(),this.createToken("!","!");case"^":return this.advance(),this.createToken("^","^");case"(":return this.advance(),this.createToken("(","(");case")":return this.advance(),this.createToken(")",")");case"<":return this.advance(),this.createToken("<","<");case">":return this.advance(),this.createToken(">",">");case"[":return this.advance(),this.createToken("[","[");case"]":return this.advance(),this.createToken("]","]");case",":return this.advance(),this.createToken(",",",");case":":return this.advance(),this.createToken(":",":");case"?":return this.advance(),this.createToken("?","?");case"*":return this.advance(),this.createToken("*","*");case"+":return/[0-9]/.test(this.peek(1))?this.createToken("NUMBER_LITERAL",this.readNumber()):(this.advance(),this.createToken("+","+"));case"x":return/[0-9]/.test(this.peek(1))?(this.advance(),this.createToken("x","x")):(this.advance(),this.createToken("x","x"))}if(t==='"'||t==="'")return this.createToken("STRING_LITERAL",this.readStringLiteral());if(t==="`")return this.createToken("VERBATIM_STRING",this.readVerbatimString());if(/[0-9]/.test(t)||t==="-"&&/[0-9]/.test(this.peek(1))){let i=this.readNumber();return this.peek()==="x"&&/[0-9]/.test(this.peek(1)),this.createToken("NUMBER_LITERAL",i)}if(t==="\u221E")return this.advance(),this.createToken("INFINITY","\u221E");if(this.tolerant)return this.createToken("EOF","");this.error(`Unexpected character: ${t}`)}tokenize(){let n=[];for(;!this.isEOF();){let t=this.nextToken();if(t&&(n.push(t),t.type==="EOF"))break}return n}peekToken(){if(this.tokens.length===0){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens[0]||this.createToken("EOF","")}consumeToken(){if(this.tokens.length===0){let n=this.nextToken();if(n)return n}return this.tokens.shift()||this.createToken("EOF","")}matchToken(n){return this.peekToken().type===n?(this.consumeToken(),!0):!1}expectToken(n){let t=this.consumeToken();return t.type!==n&&this.error(`Expected ${n}, got ${t.type}`),t}};var Gt=class{lexer;typeResolver;current;allowTrailing;_end=0;constructor(n,t){this.allowTrailing=t?.allowTrailing??!1,this.lexer=new Hi(n,{tolerant:this.allowTrailing}),this.typeResolver=t?.typeResolver??{forward:()=>{},resolve:()=>{},get names(){return[]}},this.current=this.lexer.consumeToken()}get endOffset(){return this._end}error(n,t){this.errorAtToken(this.current,n,t)}errorAtToken(n,t,i){let r=this.lexer.input;this.allowTrailing&&(r=r.slice(0,n.position+n.value.length));let o=r.split(`
|
|
4
4
|
`)[n.line-1]||r,a=n.column,u=" ".repeat(Math.max(0,a-1))+"^",l=["","Invalid type",`| ${o}`,`| ${u}`,"|",`| ${t}`];i&&l.push(`| ${i}`),l.push("");let c=new Error(l.join(`
|